fix for PR comments. also turns DEBUG off

This commit is contained in:
Ben Harris committed 2018-10-10 18:09:37 -04:00
1 parent 649a56f6c2
commit eeadac5aa0
8 files changed
+15 -23

No files matched your search

+6 -8
View File
@@ -9,10 +9,8 @@ dict = "/usr/share/dict/american-english"
def get_acros(word, silly, short): def get_acros(word, silly, short):
acros = [] acros = []
url = "http://www.stands4.com/services/v2/abbr.php?uid=%s&tokenid=%s&term=%s" % ( url = "http://www.stands4.com/services/v2/abbr.php?uid={}&tokenid={}&term={}".format(
userId, userId, token, word
token,
word,
) )
soup = BeautifulSoup(urllib.urlopen(url).read(), "html5lib") soup = BeautifulSoup(urllib.urlopen(url).read(), "html5lib")
results = soup.find_all("result") results = soup.find_all("result")
@@ -56,8 +54,7 @@ def get_acros(word, silly, short):
else: else:
acros.append( acros.append(
( (
'%s: "%s" (%s, score: %s)' '{}: "{}" ({}, score: {})'.format(
% (
d["term"], d["term"],
d["definition"], d["definition"],
", ".join(d["categories"]), ", ".join(d["categories"]),
@@ -85,8 +82,9 @@ def get_acros(word, silly, short):
else: else:
acros.append( acros.append(
( (
'%s: "%s" (%s, score: %s)' '{}: "{}" ({}, score: {})'.format(
% (word.upper(), newWord, "Tilde.town Original", "0") word.upper(), newWord, "Tilde.town Original", "0"
)
).encode("ascii", "ignore") ).encode("ascii", "ignore")
) )
except IndexError: except IndexError:
+1 -2
View File
@@ -50,5 +50,4 @@ def get_anagram(maxlen=6):
# Ok, gotta actually check if it's a word now # Ok, gotta actually check if it's a word now
return any(guess == item for item in gen_wordlist()) return any(guess == item for item in gen_wordlist())
challenge_text = "Unscramble the following word: '{}'".format(anagram) return [answer_checker, "Unscramble the following word: '{}'".format(anagram)]
return [answer_checker, challenge_text]
+4 -4
View File
@@ -48,7 +48,7 @@ challenges = {}
SCORE_FILE = "tildescores.txt" SCORE_FILE = "tildescores.txt"
JACKPOT_FILE = "tildejackpot.txt" JACKPOT_FILE = "tildejackpot.txt"
JACKPOT_MIN = 3 JACKPOT_MIN = 3
DEBUG = True DEBUG = False
def too_recent(time1, time2): def too_recent(time1, time2):
@@ -217,7 +217,7 @@ def get_prize(name, isHuman, bonus=0):
jackpotfile.write(str(JACKPOT_MIN)) jackpotfile.write(str(JACKPOT_MIN))
return [ return [
jackpot, jackpot,
"{} hit the jackpot and won **{}**".format( "{} hit the jackpot and won **{}** tildes!".format(
name, p.number_to_words(jackpot) name, p.number_to_words(jackpot)
), ),
] ]
@@ -272,7 +272,7 @@ def give_tilde(channel, user, name, time, human, bonus=0):
def show_tildescore(channel, user, name): def show_tildescore(channel, user, name):
with open(SCORE_FILE, "r") as scorefile: with open(SCORE_FILE, "r") as scorefile:
for idx, score in enumerate(scorefile): for _idx, score in enumerate(scorefile):
person = score.strip("\n").split("&^%") person = score.strip("\n").split("&^%")
if person[0] == user: if person[0] == user:
util.sendmsg( util.sendmsg(
@@ -339,7 +339,7 @@ def listen():
if "" == formatted: if "" == formatted:
continue continue
iTime, user, command, channel, messageText = formatted.split("\t") iTime, user, _command, channel, messageText = formatted.split("\t")
name = util.get_name(user) name = util.get_name(user)
if msg.find(":!tildescore") != -1: if msg.find(":!tildescore") != -1:
-1
View File
@@ -1 +0,0 @@
111
-1
View File
@@ -122,4 +122,3 @@ x4464&^%1&^%1532028546
pounce&^%19&^%1532133325 pounce&^%19&^%1532133325
von_&^%5&^%1532502104 von_&^%5&^%1532502104
livix&^%7&^%1533603142 livix&^%7&^%1533603142
ben&^%28&^%1539065026
-1
View File
@@ -1,2 +1 @@
vilmibm&^%0&^%2 vilmibm&^%0&^%2
ben&^%3&^%0
+2 -3
View File
@@ -16,9 +16,8 @@ outfile = "/home/krowbar/logs/chatBesties.json"
outCircle = "/home/krowbar/logs/chatcircle.json" outCircle = "/home/krowbar/logs/chatcircle.json"
timePeriod = calendar.timegm(time.gmtime()) - (2 * 7 * 24 * 60 * 60) # 2 weeks timePeriod = calendar.timegm(time.gmtime()) - (2 * 7 * 24 * 60 * 60) # 2 weeks
userData = ( # hash keyed by "user" that contains a hash of mentioned other users with count
{} userData = {}
) # hash keyed by "user" that contains a hash of mentioned other users with count
nameFix = { nameFix = {
"jumblesal": "jumblesale", "jumblesal": "jumblesale",
"hardmath1": "kc", "hardmath1": "kc",
+2 -3
View File
@@ -9,9 +9,8 @@ import re
logfile = "/home/archangelic/irc/log" logfile = "/home/archangelic/irc/log"
# logfile = "/home/jumblesale/Code/irc/log" # logfile = "/home/jumblesale/Code/irc/log"
outfile = "/home/krowbar/logs/chatStats.json" outfile = "/home/krowbar/logs/chatStats.json"
userData = ( # hash keyed by "user" that contains a start timestamp, last timestamp, last said string, chat count, letter count, and word count
{} userData = {}
) # hash keyed by "user" that contains a start timestamp, last timestamp, last said string, chat count, letter count, and word count
# also now happy emotes and sad emotes # also now happy emotes and sad emotes
rejectRegexp = "http[s]?://|[0-9]{2}[;:][0-9]{2}" rejectRegexp = "http[s]?://|[0-9]{2}[;:][0-9]{2}"
happyRegexp = ":[-]?[])}]" happyRegexp = ":[-]?[])}]"