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()
"nws": (c.nsfwq,urldb),
"units": c.unitq,
"help": c.helpq,
-# "game": (c.gameq,game),
"say": c.sayq,
"do": c.doq,
"twit": (c.twitterq,twitapi) }
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)
-#
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):