chiark / gitweb /
remove the losing-the-game code
authorMatthew Vernon <matthewv@chiark.greenend.org.uk>
Wed, 20 Apr 2011 10:32:31 +0000 (11:32 +0100)
committerMatthew Vernon <matthewv@chiark.greenend.org.uk>
Wed, 20 Apr 2011 10:32:31 +0000 (11:32 +0100)
Servus-chiark.py
commands.py

index c1157f6..81f8076 100644 (file)
@@ -134,14 +134,6 @@ def quit(bot,cmd,nick,conn,public):
 def reload(bot,cmd,nick,conn,public):
     c.reloadq(bot,cmd,nick,conn,public)
 
-#The game...
-class game:
-       trigger="Servus"
-       grace=time.time()
-       minlose=24*60*60 #1 day
-       maxlose=14*minlose #2 weeks
-       losetime=time.time()+300000
-
 # initialise the urldb on startup
 urldb={}
 lastexp=time.time()
@@ -178,7 +170,6 @@ commands = {"karma": (c.karmaq,karmadb),
            "nws": (c.nsfwq,urldb),
            "units": c.unitq,
            "help": c.helpq,
-#          "game": (c.gameq,game),
             "say": c.sayq,
             "do": c.doq, 
             "twit": (c.twitterq,twitapi) }
@@ -225,11 +216,3 @@ def command(bot, cmd, nick, conn, public):
            e(bot,cmd,nick,conn,public)
        else:
            e[0](bot,cmd,nick,conn,public,*e[1:])
-#    elif public:
-#        if cmd.find("GAME")!=-1: #someone else lost
-#          grace.grace=time.time()+60*20
-#      elif cmd.find(game.trigger)!=-1 and len(game.trigger)>2: #we lost!
-#          c.gameq(bot,"pad "+game.trigger,bot.owner,conn,False,game)
-#      elif time.time()>game.losetime: #we randomly lost, take new trigger
-#          c.gameq(bot,cmd,bot.owner,conn,False,game)
-#          
index b63836a..e7a0de3 100644 (file)
@@ -187,24 +187,6 @@ def reloadq(bot, cmd, nick, conn, public):
         bot.automsg(public,nick,
                "Configuration can only be reloaded by my owner, by /msg.")
 
-# lose the game and/or install a new trigger word
-def gameq(bot, cmd, nick, conn, public, game):
-    #only install a new trigger if it's not too short.
-    if len(' '.join(cmd.split()[1:]))>2:
-        game.trigger=' '.join(cmd.split()[1:])
-    if (time.time()> game.grace):
-        if not public:
-            if irc_lower(nick) == irc_lower(bot.owner):
-                conn.action(bot.channel,"loses the game!")
-            else:
-                conn.privmsg(bot.channel,nick+" just lost the game!")
-    else:
-        if not public:
-            conn.notice(nick, "It's a grace period!")
-    game.grace=time.time()+60*20 #20 minutes' grace
-    game.losetime=time.time()+random.randrange(game.minlose,game.maxlose)
-    conn.notice(bot.owner, str(game.losetime-time.time())+" "+game.trigger)
-
 # quit irc
 def quitq(bot, cmd, nick, conn, public):
     if irc_lower(nick) == irc_lower(bot.owner):