3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

fantasy: only work when the main PyLink client is in the channel

This commit is contained in:
James Lu 2015-09-26 10:19:47 -07:00
parent 7470efc461
commit a37d4b6f3c

View File

@ -16,7 +16,13 @@ def handle_fantasy(irc, source, command, args):
return return
channel = args['target'] channel = args['target']
text = args['text'] text = args['text']
if utils.isChannel(channel) and text.startswith(prefix) and not \ # Conditions:
# 1) Message target is a channel,
# 2) Message starts with our fantasy prefix,
# 3) The main PyLink client is in the channel.
# 4) The sender is NOT a PyLink client (prevents message loops).
if utils.isChannel(channel) and text.startswith(prefix) and \
irc.pseudoclient.uid in irc.channels[channel].users and not \
utils.isInternalClient(irc, source): utils.isInternalClient(irc, source):
# Cut off the length of the prefix from the text. # Cut off the length of the prefix from the text.
text = text[len(prefix):] text = text[len(prefix):]