Did some work on some things

This commit is contained in:
Russell 2018-02-28 21:08:22 +00:00
parent 6838f0ce5f
commit 746f1091bb
8 changed files with 91 additions and 55 deletions

View File

@ -184,15 +184,16 @@ def figlet(channel, text):
if not text:
ircsock.send("PRIVMSG " + channel + " :No text given. :(\n")
else:
lines = subprocess.Popen(["figlet", "-w80"] + text.split(' '), shell=False, stdout=subprocess.PIPE).stdout.read()
lines = subprocess.Popen(["figlet", "-w140"] + text.split(' '), shell=False, stdout=subprocess.PIPE).stdout.read()
for line in lines.split('\n'):
ircsock.send("PRIVMSG " + channel + " :" + line + "\n")
time.sleep(0.3) #to avoid channel throttle due to spamming
def toilet(channel, text):
if not text:
ircsock.send("PRIVMSG " + channel + " :No text given. :(\n")
else:
lines = subprocess.Popen(["toilet", "--irc"] + text.split(' '), shell=False, stdout=subprocess.PIPE).stdout.read()
lines = subprocess.Popen(["toilet", "-w140", "--irc"] + text.split(' '), shell=False, stdout=subprocess.PIPE).stdout.read()
for line in lines.split('\n'):
ircsock.send("PRIVMSG " + channel + " :" + line + "\n")
time.sleep(0.3) #to avoid channel throttle due to spamming
@ -222,8 +223,16 @@ def get_whosaid(channel, text):
msg += ' and %s said it %d times' % (result['data'][1][0], result['data'][1][1])
ircsock.send("PRIVMSG " + channel + " :" + msg + ".\n")
def mug_off(channel):
ircsock.send("PRIVMSG " + channel + " :u want some of this, m8?\n")
def rollcall(channel):
ircsock.send("PRIVMSG "+ channel +" :U wot m8? I score all the top drawer #banter and #bantz on this channel! Find new top-shelf banter with !newbanter, !rhymes, and !define. Make your chatter #legend with !rainbow and get jokes with !welch and !evil\n")
ircsock.send("PRIVMSG "+ channel +" :U wot m8? I score all the top drawer #banter and #bantz on this channel! \
Find new top-shelf banter with !newbanter, !rhymes, and !define. \
Look up things with !acronym and !whosaid. \
Make your chatter #legend with !rainbow, !toilet, and !figlet. \
Find interesting things with !xkcd and !wiki-philosophy. \
Get jokes with !welch and !evil\n")
def connect(server, channel, botnick):
ircsock.connect((server, 6667))
@ -279,30 +288,30 @@ def listen():
if ircmsg.find(":!rainbow") != -1:
make_rainbow(channel, user, messageText)
if ircmsg.find("!welch") != -1:
if ircmsg.find(":!welch") != -1:
get_welch(channel)
if ircmsg.find("!evil") != -1:
if ircmsg.find(":!evil") != -1:
get_evil(channel)
if ircmsg.find("!kjp") != -1:
if ircmsg.find(":!kjp") != -1:
get_tumble('http://kingjamesprogramming.tumblr.com', channel)
if ircmsg.find("!help") != -1:
if ircmsg.find(":!help") != -1:
get_tumble('http://thedoomthatcametopuppet.tumblr.com', channel)
if ircmsg.find("!xkcd") != -1:
if ircmsg.find(":!xkcd") != -1:
get_xkcd(channel, messageText)
if ircmsg.find("!wiki-philosophy") != -1:
if ircmsg.find(":!wiki-philosophy") != -1:
get_wphilosophy(channel, messageText);
if ircmsg.find("!figlet") != -1:
if ircmsg.find(":!figlet") != -1:
figlet(channel, messageText[8:])
if ircmsg.find("!toilet") != -1:
if ircmsg.find(":!toilet") != -1:
toilet(channel, messageText[8:])
if ircmsg.find("!acronym") != -1:
if ircmsg.find(":!acronym") != -1:
get_acronym(channel, messageText[9:])
if ircmsg.find(":!whosaid") != -1:
@ -311,6 +320,9 @@ def listen():
if ircmsg.find(":!rollcall") != -1:
rollcall(channel)
if ircmsg.find(":" + botname + ":") != -1:
mug_off(channel)
if ircmsg.find("PING :") != -1:
ping()

View File

@ -2,6 +2,7 @@
import random
import inflect
import quote_puzzle
import dict_puzzle
p = inflect.engine()
primes = [11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]
@ -9,10 +10,10 @@ fuzz_amount = 3
def make_puzzle(obfuscate=True):
answer = 0
puzzle = random.choice(["Prove you're not a robot: ", "Are you a robot?: ", "Anti-bot check: ", "Counter-cndorphant measures: ", "Cosnok countermeasures: "])
puzzle = random.choice(["Prove you're not a robot: ", "Are you a robot?: ", "Anti-bot check: ", "Counter-cndorphant measures: ", "Cosnok countermeasures: ", "Anti-tildethief precautions: "])
puzzle += random.choice(["What is", "How many is", "What do you get from", "What do you get with", "What is the value of", "Can you answer", "Can you tell me"])
puzzle += " "
roll = random.randrange(0,12)
roll = random.randrange(0,15)
var1 = random.randrange(1,10)
var2 = random.randrange(1,10)
var3 = random.randrange(1,20)
@ -69,6 +70,9 @@ def make_puzzle(obfuscate=True):
elif roll == 11:
answer = str(max(var1, var2, var3, var4))
puzzle = "What is the " + random.choice(["biggest", "largest"]) + " of " + p.number_to_words(var1) + ", " + p.number_to_words(var2) + ", " + p.number_to_words(var3) + ", and " + p.number_to_words(var4)
elif roll <= 14: #12-14
answer, puzzle = dict_puzzle.get_puzzle()
obfuscate = False
puzzle += "?"
if obfuscate == True:

View File

@ -12,6 +12,7 @@ import random
import formatter
import get_users
import names
import mentions
import pretty_date
import inflect
@ -76,11 +77,11 @@ def get_bad_thing():
"smells of elderberries", "should reconsider their life choices", "did't believe in the heart of the tilde", "came to the wrong chat channel", "should have stopped while they were ahead",\
"requires annotations from an authoratative source", "could have been a contender", "spreads vicious rumors", "drank my milkshake", "is probably cheating", "is trying too hard"]);
def get_prize(user, isHuman, bonus=0):
def get_prize(name, isHuman, bonus=0):
prizes = [1] * 8 + [2] * 4 + [3] * 2 + [5] * isHuman #no 5pt prize for non-humans
prize = random.choice(prizes) + bonus
if(random.randint(1,10) > 6 - 4 * isHuman): #80% of the time it's a normal prize (40% for not humans)
return [prize, user + ": " + (get_positive() if isHuman else get_negative()) + "! You are " + get_superlative(prize) + " and get " + p.number_to_words(prize) + " tildes!"]
return [prize, name + ": " + (get_positive() if isHuman else get_negative()) + "! You are " + get_superlative(prize) + " and get " + p.number_to_words(prize) + " tildes!"]
else: #20% of the time its a jackpot situation
with open(JACKPOT_FILE, "r+") as jackpotfile:
jackpot = int(jackpotfile.readline().strip("\n"))
@ -89,17 +90,17 @@ def get_prize(user, isHuman, bonus=0):
if(random.randint(1,10) > 1 or not isHuman): #90% of the time it's a non-prize. non-humans never win jackpot
new_jackpot = jackpot+max(1,prize)
jackpotfile.write(str(new_jackpot)) #increase the jackpot by the prize size
return [0, user + " " + get_bad_thing() + " and gets no tildes! (Jackpot is now " + str(new_jackpot) + " tildes)"]
return [0, name + " " + get_bad_thing() + " and gets no tildes! (Jackpot is now " + str(new_jackpot) + " tildes)"]
else: #hit jackpot!
jackpotfile.write(str(JACKPOT_MIN))
return [jackpot, user + " hit the jackpot and won **" + p.number_to_words(jackpot) + " tildes!**"]
return [jackpot, name + " hit the jackpot and won **" + p.number_to_words(jackpot) + " tildes!**"]
def show_jackpot(channel):
with open(JACKPOT_FILE, "r") as jackpotfile:
jackpot = int(jackpotfile.readline().strip("\n"))
ircsock.send("PRiVMSG " + channel + " :The jackpot is currently " + p.number_to_words(jackpot) + " tildes!\n")
def give_tilde(channel, user, time, human, bonus=0):
def give_tilde(channel, user, name, time, human, bonus=0):
found = False
with open(SCORE_FILE, "r+") as scorefile:
scores = scorefile.readlines()
@ -110,45 +111,45 @@ def give_tilde(channel, user, time, human, bonus=0):
if(person[0] == user):
found = True
if(too_recent(time, person[2]) and not DEBUG):
ircsock.send("PRIVMSG " + channel + " :" + user + " have asked for a tilde too recently and " + get_bad_thing() + ". Try again later.\n")
ircsock.send("PRIVMSG " + channel + " :" + name + " asked for a tilde too recently and " + get_bad_thing() + ". Try again later.\n")
else:
prize = get_prize(user, human, bonus)
prize = get_prize(name, human, bonus)
score = person[0] + "&^%" + str(int(person[1]) + prize[0]) + "&^%" + time + "\n"
ircsock.send("PRIVMSG " + channel + " :" + prize[1] + "\n")
scorefile.write(score)
if(not found):
prize = get_prize(user, True, bonus)
prize = get_prize(name, True, bonus)
ircsock.send("PRIVMSG " + channel + " :Welcome to the tilde game! Here's " + p.number_to_words(prize[0]+1) + " free tilde(s) to start you off.\n")
scorefile.write(user + "&^%" + str(prize[0]+1) + "&^%" + time + "\n")
def show_tildescore(channel, user):
def show_tildescore(channel, user, name):
with open(SCORE_FILE, "r") as scorefile:
for idx,score in enumerate(scorefile):
person = score.strip("\n").split("&^%")
if(person[0] == user):
ircsock.send("PRIVMSG " + channel + " :" + user + " has " + p.number_to_words(person[1]) + " tildes!\n")
ircsock.send("PRIVMSG " + channel + " :" + name + " has " + p.number_to_words(person[1]) + " tildes!\n")
return
#person has not played yet
ircsock.send("PRIVMSG " + channel + " :" + user + " has no tildes yet!\n")
ircsock.send("PRIVMSG " + channel + " :" + name + " has no tildes yet!\n")
def challenge(channel, user, time):
def challenge(channel, user, name, time):
if(channel != "#bots" and not DEBUG):
ircsock.send("PRIVMSG " + channel + " :" + user + " is a meanie and gets no tildes. **Tildebot now only gives out tildes in the #bots channel.**\n")
ircsock.send("PRIVMSG " + channel + " :" + name + " is a meanie and gets no tildes. **Tildebot now only gives out tildes in the #bots channel.**\n")
return
global challenges;
challenge = puzzle.make_puzzle();
challenges[user] = challenge[0]; #challenges[USER] = ANSWER
ircsock.send("PRIVMSG " + channel + " :" + user + ": " + challenge[1] + "\n");
ircsock.send("PRIVMSG " + channel + " :" + name + ": " + challenge[1] + "\n");
def challenge_response(channel, user, time, msg):
def challenge_response(channel, user, name, time, msg):
global challenges
print(msg);
if(challenges.has_key(user)):
bonus = 1 if str(challenges[user]).find(',') != -1 else 0 #give a bonus for prime factoring
if(msg.lower() == str(challenges[user]).lower() or msg == p.number_to_words(challenges[user])):
give_tilde(channel, user, time, True, bonus);
give_tilde(channel, user, name, time, True, bonus);
else:
give_tilde(channel, user, time, False, 0);
give_tilde(channel, user, name, time, False, 0);
del challenges[user]; #delete the user from challenges either way
@ -193,17 +194,18 @@ def listen():
split = formatted.split("\t")
iTime = split[0]
user = split[1]
name = names.get_name(user)
command = split[2]
channel = split[3]
messageText = split[4]
if msg.find(":!tildescore") != -1:
show_tildescore(channel, user)
show_tildescore(channel, user, name)
elif msg.find(":!tilde") != -1 and not challenges.has_key(user):
challenge(channel, user, iTime)
challenge(channel, user, name, iTime)
elif challenges.has_key(user):
challenge_response(channel, user, iTime, messageText)
#give_tilde(channel, user, iTime)
challenge_response(channel, user, name, iTime, messageText)
#give_tilde(channel, user, name, iTime)
if msg.find(":!jackpot") != -1:
show_jackpot(channel)

View File

@ -1,8 +1,8 @@
krowbar&^%1980&^%1516734495
karlen&^%277&^%1472020404
krowbar&^%2023&^%1519851803
karlen&^%305&^%1519847264
endorphant&^%682&^%1444775660
jumblesale&^%24&^%1426171214
marcus&^%2500&^%1511361157
marcus&^%2516&^%1519843226
papa&^%181&^%1474509971
epicmorphism&^%5&^%1421937744
audy&^%83&^%1504564254
@ -12,7 +12,7 @@ cmr&^%2244&^%1485978592
imt&^%519&^%1424087616
cndorphant&^%788&^%1424094192
rain&^%17&^%1422310975
sl2c&^%607&^%1516805296
sl2c&^%709&^%1519840556
selfsame&^%1&^%1422230012
bear&^%424&^%1510759605
coaxial&^%8&^%1422325983
@ -28,7 +28,7 @@ reppard&^%11&^%1437512059
jesse&^%6&^%1437569027
khoi&^%3&^%1438044039
sanqui&^%22&^%1474904633
endorphan&^%113&^%1512851444
endorphan&^%119&^%1519838766
cndorphbo&^%9&^%1466591324
santi&^%3&^%1447873216
insom&^%1&^%1450346059
@ -39,27 +39,27 @@ synergian&^%22&^%1458152889
dheeraj&^%5&^%1456489270
demobot&^%6&^%1454439605
premysl&^%65&^%1461768606
minerobbe&^%179&^%1510228411
minerobbe&^%249&^%1519753693
xkeeper&^%14&^%1461967961
cosnok&^%807&^%1508878859
escobar&^%1&^%1475431401
amicabot&^%30&^%1481225205
caff&^%877&^%1516766053
caff&^%884&^%1519690884
kadin&^%5&^%1479870008
desvox&^%5&^%1481632697
mankins&^%3&^%1480211581
cinch&^%2&^%1480454755
caffbot&^%904&^%1516766061
caffbot&^%915&^%1519690905
evilbot&^%4&^%1480693919
tybaltcat&^%7&^%1481076625
minerbot&^%94&^%1510228403
minerbot&^%127&^%1519753731
mio&^%339&^%1506434277
archangel&^%414&^%1515441099
tehfraga&^%193&^%1516622757
archangel&^%425&^%1519758851
tehfraga&^%217&^%1519799607
sushi&^%10&^%1493253212
troido&^%109&^%1515268965
gamebot&^%49&^%1514748179
nilaky&^%864&^%1515807984
troido&^%133&^%1519838821
gamebot&^%64&^%1519838871
nilaky&^%949&^%1519801193
bucket&^%103&^%1507931139
lolbot&^%1&^%1502568407
m455&^%12&^%1512076715
@ -72,9 +72,18 @@ pinhook&^%8&^%1509744722
emfor&^%3&^%1509671353
k2l8m11n2&^%11&^%1510932395
sacredpix&^%2&^%1510943959
deltawitc&^%362&^%1516822359
login&^%14&^%1516827186
deltawitc&^%944&^%1519852080
login&^%285&^%1519851577
kelpiebot&^%3&^%1513101957
unreal&^%1&^%1514940020
tildethie&^%694&^%1516825682
tildethie&^%2123&^%1519851875
kinsey&^%23&^%1515732346
testgameb&^%2&^%1517405361
erin&^%2&^%1517681999
wuz&^%3&^%1518125300
hashdang&^%4&^%1518666906
ubergeek&^%19&^%1519650555
silver&^%9&^%1519333029
equa&^%14&^%1519838802
audiodude&^%2&^%1519453927
jumblesal&^%1&^%1519746512

View File

@ -35,3 +35,4 @@
1512345295&^%deltawitc&^%All hail DeltaWitch the Bot Queen
1515522818&^%deltawitc&^%All hail DeltaWitch the Bot Queen (and promising pupper)
1516797394&^%login&^%If you join the circus, what would you perform?
1517234330&^%krowbar&^%Bot channel. Please ignore.

View File

@ -223,3 +223,12 @@
1515124829&^%vilmibm&^%did you plant your water today?
1516211774&^%vilmibm&^%how are you?
1516797431&^%login&^%"have you planted your water?"
1517104588&^%vilmibm&^%some townies are streaming a lil D&D if you want to follow along <3 https://www.twitch.tv/tildeplays
1517267128&^%vilmibm&^%how are you? how is your plant?
1518068012&^%vilmibm&^%plz help out ~cel, a townie in need of some $ help: https://funds.gofundme.com/dashboard/pitch-in-for-a-townie/
1518068735&^%vilmibm&^%plz help out ~cel, a townie in need of some $ help: https://www.gofundme.com/pitch-in-for-a-townie
1518543086&^%vilmibm&^%HAPPY BIRTHDAY ~ARCHANGELIC | plz help out ~cel https://www.gofundme.com/pitch-in-for-a-townie
1518632417&^%vilmibm&^%happy vday <3 | plz help out ~cel https://www.gofundme.com/pitch-in-for-a-townie
1518719324&^%vilmibm&^%plz help ~cel out https://www.gofundme.com/pitch-in-for-a-townie
1519636303&^%karlen&^%The town is 1234 days old! happy T+1234! | plz help ~cel out https://www.gofundme.com/pitch-in-for-a-townie
1519715605&^%karlen&^%plz help ~cel out https://www.gofundme.com/pitch-in-for-a-townie

View File

@ -1,3 +1 @@
kinsey&^%2&^%0
vilmibm&^%0&^%1login&^%1&^%0
login&^%7&^%4
krowbar&^%0&^%1vilmibm&^%0&^%1vilmibm&^%0&^%1vilmibm&^%0&^%1vilmibm&^%0&^%1vilmibm&^%0&^%1vilmibm&^%0&^%1karlen&^%0&^%1karlen&^%0&^%1

View File

@ -4,6 +4,7 @@
<div>
<select id="series">
<option value="">Today</option>
<option value="_2018_01">Jan 2018</option>
<option value="_2017_12">Dec 2017</option>
<option value="_2017_11">Nov 2017</option>
<option value="_2017_10">Oct 2017</option>