From 9ecd97dff1863e011aa48854d34902e86702c16a Mon Sep 17 00:00:00 2001 From: Russell Date: Thu, 29 Jan 2015 21:05:37 +0000 Subject: [PATCH] Changed numberwang_bot changed the twee. backup the scores --- Code/irc/log | 8 -------- Code/irc/tildescores.txt | 25 ++++++++++++++----------- Code/irc/topicscores.txt | 4 ++-- Code/irc/wangbot.py | 40 +++++++++++++--------------------------- public_html/index.html | 1 + ttitt/krowbar.twee | 10 +++++----- 6 files changed, 35 insertions(+), 53 deletions(-) diff --git a/Code/irc/log b/Code/irc/log index 88d921c..e69de29 100644 --- a/Code/irc/log +++ b/Code/irc/log @@ -1,8 +0,0 @@ -Traceback (most recent call last): - File "./topicbot.py", line 187, in - listen() - File "./topicbot.py", line 161, in listen - get_topic(channel, user, time) - File "./topicbot.py", line 61, in get_topic - with open("topics_" + channel + ".txt", "r") as topics: -IOError: [Errno 2] No such file or directory: 'topics_topicbot.txt' diff --git a/Code/irc/tildescores.txt b/Code/irc/tildescores.txt index e80333a..dd301da 100644 --- a/Code/irc/tildescores.txt +++ b/Code/irc/tildescores.txt @@ -1,16 +1,19 @@ -krowbar&^%8&^%1422035087 -karlen&^%13&^%1422027689 -endorphant&^%26&^%1422033378 +krowbar&^%33&^%1422565422 +karlen&^%15&^%1422291058 +endorphant&^%62&^%1422561985 jumblesale&^%18&^%1422027769 marcus&^%12&^%1421960027 -papa&^%5&^%1422029014 +papa&^%41&^%1422542104 epicmorphism&^%3&^%1421937744 -audy&^%13&^%1422034301 -kc&^%5&^%1421975132 +audy&^%27&^%1422542589 +kc&^%16&^%1422326056 vilmibm&^%3&^%1421887627 -cmr&^%4&^%1421989946 -imt&^%12&^%1422014172 -cndorphant&^%22&^%1422033254 -rain&^%4&^%1422034265 -sl2c&^%6&^%1422036167 +cmr&^%6&^%1422388018 +imt&^%95&^%1422565426 +cndorphant&^%125&^%1422395920 +rain&^%15&^%1422310975 +sl2c&^%28&^%1422524176 leni&^%2&^%1421978450 +selfsame&^%1&^%1422230012 +bear&^%46&^%1422561755 +coaxial&^%4&^%1422325983 diff --git a/Code/irc/topicscores.txt b/Code/irc/topicscores.txt index 4738647..c2d947b 100644 --- a/Code/irc/topicscores.txt +++ b/Code/irc/topicscores.txt @@ -1,5 +1,5 @@ -krowbar&^%21&^%22 +krowbar&^%21&^%23 um&^%11&^%8 kc&^%0&^%22 marcus&^%3&^%1 -khoi&^%1&^%0karlen&^%0&^%1karlen&^%0&^%1jumblesale&^%1&^%0karlen&^%0&^%1karlen&^%0&^%1karlen&^%0&^%1dan&^%1&^%0datagrok&^%0&^%1vilmibm&^%0&^%1papa&^%1&^%0vilmibm&^%1&^%0vilmibm&^%0&^%1jumblesale&^%1&^%0selfsame&^%1&^%0karlen&^%0&^%1jumblesale&^%0&^%1karlen&^%0&^%1vilmibm&^%0&^%1vilmibm&^%0&^%1 \ No newline at end of file +khoi&^%1&^%0karlen&^%0&^%1karlen&^%0&^%1jumblesale&^%1&^%0karlen&^%0&^%1karlen&^%0&^%1karlen&^%0&^%1dan&^%1&^%0datagrok&^%0&^%1vilmibm&^%0&^%1papa&^%1&^%0vilmibm&^%1&^%0vilmibm&^%0&^%1jumblesale&^%1&^%0selfsame&^%1&^%0karlen&^%0&^%1jumblesale&^%0&^%1karlen&^%0&^%1vilmibm&^%0&^%1vilmibm&^%0&^%1vilmibm&^%0&^%1jumblesale&^%1&^%0 \ No newline at end of file diff --git a/Code/irc/wangbot.py b/Code/irc/wangbot.py index fdb378a..0b89bbb 100755 --- a/Code/irc/wangbot.py +++ b/Code/irc/wangbot.py @@ -35,6 +35,7 @@ MIN_ROUNDS = 5 MAX_ROUNDS = 12 SCORE_FILE = "numberwangscores.txt" SHOW_TOP_NUM = 5 +GOOD_CHAN = "#bots" roundsLeft = 0 bonusRound = 0 @@ -68,6 +69,10 @@ def hello(): ircsock.send("PRIVMSG "+ channel +" :Hello!\n") def start_numberwang(channel, user): + if(channel != "#bots"): + ircsock.send("PRIVMSG " + channel + " :Numberwang has been disabled for " + channel + " due to spamminess. Please join " + GOOD_CHAN + " to start a game.\n") + return + print user + " started a game" resetGlobals() ircsock.send("PRIVMSG " + channel + " :It's time for Numberwang!\n") @@ -190,29 +195,6 @@ def show_user_score(channel, user): #if we don't find a score line ircsock.send("PRIVMSG " + channel + " :" + user + ": You haven't scored any points yet!\n") -def give_tilde(channel, user, time): - found = False - with open("tildescores.txt", "r+") as scorefile: - scores = scorefile.readlines() - scorefile.seek(0) - scorefile.truncate() - for score in scores: - person = score.strip("\n").split("&^%") - if(person[0] == user): - found = True - if(too_recent(time, person[2])): - ircsock.send("PRIVMSG " + channel + " :You have asked for a tilde too recently. Try again later.\n") - else: - prize = get_prize(user) - 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) - 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 rollcall(channel): ircsock.send("PRIVMSG "+ channel +" :Is it time for Numberwang? It might be! Start a new game with !numberwang or stop a current game with !wangernumb Get your score with !myscore and the list of top wangers with !topwangers\n") @@ -222,6 +204,7 @@ def connect(server, channel, botnick): ircsock.send("NICK "+ botnick +"\n") joinchan(channel) + joinchan(GOOD_CHAN) def get_user_from_message(msg): try: @@ -256,10 +239,13 @@ def listen(): if ircmsg.find(":!numberwang") != -1 and roundsLeft == 0: start_numberwang(channel, user) - if ircmsg.find(":!wangernumb") != -1 and roundsLeft > 0: - stop_numberwang(channel, user) - if roundsLeft > 0: - guess_numberwang(channel, user, messageText) + + if channel == GOOD_CHAN: + if ircmsg.find(":!wangernumb") != -1 and roundsLeft > 0: + stop_numberwang(channel, user) + if roundsLeft > 0: + guess_numberwang(channel, user, messageText) + if ircmsg.find(":!topwangers") != -1: show_highscores(channel) if ircmsg.find(":!myscore") != -1: diff --git a/public_html/index.html b/public_html/index.html index a35d74f..8c09025 100644 --- a/public_html/index.html +++ b/public_html/index.html @@ -8,5 +8,6 @@ diff --git a/ttitt/krowbar.twee b/ttitt/krowbar.twee index 0f15923..7f8b7f1 100644 --- a/ttitt/krowbar.twee +++ b/ttitt/krowbar.twee @@ -55,7 +55,7 @@ There is a thick layer of dust on everything within the cottage. Very little lig <>The [[window frames|krowbar-CottageOpenWindows]] have been boarded up. <> If you had the right tool, you could probably remove them. <>[[Open windows with crowbar|krowbar-CottageOpenWindows]]<> -<>The windows are now letting in enough light to let you see [[some cubbards|krowbar-CottageSearchCubbards]].<> +<>The windows are now letting in enough light to let you see [[some cupboards|krowbar-CottageSearchcupboards]].<> [[Leave cottage|krowbar-FollowPath2]] :: krowbar-CottageOpenWindows @@ -63,13 +63,13 @@ After a few minutes of effort, you manage to use the crowbar to remove the board [[Return|previous()]] <> -:: krowbar-CottageSearchCubbards -<> -After rummaging around the cubbards, you find a rusty cleaver and <<$krowbar_temp1 to random(2,5)>> coins. +:: krowbar-CottageSearchCupboards +<> +After rummaging around the cupboards, you find a rusty cleaver and <<$krowbar_temp1 to random(2,5)>> coins. [[Return|previous()]] <> <> -<>You don't find anything else of value in the cubbards. +<>You don't find anything else of value in the cupboards. [[Return|previous()]] <>