From 1a657867ce44a69babb413cd3ffece4db4342fdb Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sun, 7 Apr 2013 23:04:47 -0400 Subject: [PATCH 1/3] update default rules to be different --- settings/wolfgame.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settings/wolfgame.py b/settings/wolfgame.py index 3ffbbf2..02c936b 100644 --- a/settings/wolfgame.py +++ b/settings/wolfgame.py @@ -78,8 +78,8 @@ import botconfig RULES = (botconfig.CHANNEL + " channel rules: 1) Be nice to others. 2) Do not share information "+ "after death. 3) No bots allowed. 4) Do not play with clones.\n"+ - "5) Do not quit unless you need to leave. 6) No swearing and keep it "+ - "family-friendly. 7) Do not paste PM's from the bot during the game. "+ + "5) Do not quit unless you need to leave. 6) Keep it "+ + "safe for work. 7) Do not paste PM's from the bot during the game. "+ "8) Use common sense. 9) Waiting for timeouts is discouraged.") # Other settings: From c96c05ac6dd01c715678656ac311ab9a421de411 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sun, 7 Apr 2013 23:05:23 -0400 Subject: [PATCH 2/3] Fix leave-from-different channel issue --- modules/wolfgame.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/wolfgame.py b/modules/wolfgame.py index fb043ef..f8391dc 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -1148,6 +1148,8 @@ def on_nick(cli, prefix, nick): def leave(cli, what, nick, why=""): nick, _, _, cloak = parse_nick(nick) + + if what == "part" and why != botconfig.CHANNEL: return if why and why == botconfig.CHANGING_HOST_QUIT_MESSAGE: return @@ -1187,7 +1189,7 @@ def leave(cli, what, nick, why=""): var.DISCONNECTED[nick] = (cloak, datetime.now(), what) #Functions decorated with hook do not parse the nick by default -hook("part")(lambda cli, nick, *rest: leave(cli, "part", nick)) +hook("part")(lambda cli, nick, *rest: leave(cli, "part", nick, rest[0])) hook("quit")(lambda cli, nick, *rest: leave(cli, "quit", nick, rest[0])) hook("kick")(lambda cli, nick, *rest: leave(cli, "kick", rest[1])) From 8c2b56960e9c0b3e60539f8c6dc6ebce6dd8c2a8 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sun, 7 Apr 2013 23:06:13 -0400 Subject: [PATCH 3/3] Change coin to be more pythonic --- modules/wolfgame.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/wolfgame.py b/modules/wolfgame.py index f8391dc..8f57f7d 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -2618,7 +2618,8 @@ def coin(cli, nick, chan, rest): cli.msg(chan, "\2{0}\2 tosses a coin into the air...".format(nick)) var.LOGGER.logMessage("{0} tosses a coin into the air...".format(nick)) - cmsg = "The coin lands on \2{0}\2.".format("heads" if random.random() < 0.5 else "tails") + coin = random.choice(["heads", "tails"]) + cmsg = "The coin lands on \2{0}\2.".format(coin) cli.msg(chan, cmsg) var.LOGGER.logMessage(cmsg)