chiark
/
gitweb
/
~matthewv
/
irc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c023434
)
add better self-trouting detection
author
Matthew Vernon
<matthewv@chiark.greenend.org.uk>
Fri, 5 Oct 2012 14:48:08 +0000
(15:48 +0100)
committer
Matthew Vernon
<matthewv@chiark.greenend.org.uk>
Fri, 5 Oct 2012 14:48:08 +0000
(15:48 +0100)
commands.py
patch
|
blob
|
history
diff --git
a/commands.py
b/commands.py
index e8293ef868e23f08b9b4b5cba21bcf0a491dd041..f015b89a59754789d7f586e918f5a37323c2d5c6 100755
(executable)
--- a/
commands.py
+++ b/
commands.py
@@
-61,6
+61,9
@@
def fish_quota(pond):
pond.cur_fish=pond.max_fish
pond.quotatime=time.time()
pond.cur_fish=pond.max_fish
pond.quotatime=time.time()
+# List of things the bot might be called to work round the self-trouting code
+synonyms=["itself","the bot"]
+
# trout someone, or flirt with them
def troutq(bot, cmd, nick, conn, public, cfg):
fishlist=cfg[0]
# trout someone, or flirt with them
def troutq(bot, cmd, nick, conn, public, cfg):
fishlist=cfg[0]
@@
-86,7
+89,7
@@
def troutq(bot, cmd, nick, conn, public, cfg):
trout_msg = random.choice(fishlist)
fishpond.last=trout_msg
# The bot won't trout or flirt with itself;
trout_msg = random.choice(fishlist)
fishpond.last=trout_msg
# The bot won't trout or flirt with itself;
- if irc_lower(me) == irc_lower(target):
+ if irc_lower(me) == irc_lower(target)
or irc_lower(target) in synonyms
:
target = nick
# There's a chance the game may be given away if the request was not
# public...
target = nick
# There's a chance the game may be given away if the request was not
# public...
@@
-132,7
+135,7
@@
def slashq(bot, cmd, nick, conn, public, cfg):
return
# The bot won't slash with itself, instead slashing the requester
for n in [0,1]:
return
# The bot won't slash with itself, instead slashing the requester
for n in [0,1]:
- if irc_lower(me) == irc_lower(who[n]):
+ if irc_lower(me) == irc_lower(who[n])
or irc_lower(who[n]) in synonyms
:
who[n] = nick
# Perhaps someone asked to slash themselves with the bot then we get
if irc_lower(who[0]) == irc_lower(who[1]):
who[n] = nick
# Perhaps someone asked to slash themselves with the bot then we get
if irc_lower(who[0]) == irc_lower(who[1]):