From 5570ba3dbed26f229c55ae282bb7a0753a79b8bc Mon Sep 17 00:00:00 2001 From: James Vega Date: Mon, 13 Sep 2004 18:19:03 +0000 Subject: [PATCH] Fix bug #1027279, $randomnick should not return msg.nick --- plugins/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/__init__.py b/plugins/__init__.py index cf3236e18..6cb16dfb0 100644 --- a/plugins/__init__.py +++ b/plugins/__init__.py @@ -420,7 +420,14 @@ def standardSubstitute(irc, msg, text, env=None): return time.ctime(t) def randNick(): if channel != 'somewhere': - return random.choice(list(irc.state.channels[channel].users)) + L = list(irc.state.channels[channel].users) + if len(L) > 1: + n = msg.nick + while n != msg.nick: + n = random.choice(L) + return n + else: + return msg.nick else: return 'someone' ctime = time.ctime()