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

plugin_example.py: use irc.reply()

This commit is contained in:
James Lu 2015-12-26 15:02:23 -08:00
parent 01a4da5d3a
commit 775df5a6c5

View File

@ -50,7 +50,12 @@ def randint(irc, source, args):
except IndexError:
rmin, rmax = 1, 10
n = random.randint(rmin, rmax)
irc.msg(source, str(n))
# irc.reply() is intelligent and will automatically reply to the caller in
# right context. If fantasy is loaded and you call the command via it,
# it will send replies into the channel instead of in your PM.
irc.reply(str(n))
# You can also bind a command function multiple times, and/or to different command names via a
# second argument.
# Note: no checking is done at the moment to prevent multiple plugins from binding to the same