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

bots, opercmds: add a "Done" reply to most commands as they finish

This commit is contained in:
James Lu 2017-03-09 20:49:38 -08:00
parent ebd5b77576
commit b09565a723
2 changed files with 9 additions and 0 deletions

View File

@ -19,6 +19,7 @@ def spawnclient(irc, source, args):
irc.error("Not enough arguments. Needs 3: nick, user, host.")
return
irc.proto.spawnClient(nick, ident, host, manipulatable=True)
irc.reply("Done.")
@utils.add_cmd
def quit(irc, source, args):
@ -45,6 +46,7 @@ def quit(irc, source, args):
return
irc.proto.quit(u, quitmsg)
irc.reply("Done.")
irc.callHooks([u, 'PYLINK_BOTSPLUGIN_QUIT', {'text': quitmsg, 'parse_as': 'QUIT'}])
def joinclient(irc, source, args):
@ -105,6 +107,7 @@ def joinclient(irc, source, args):
irc.callHooks([u, 'PYLINK_BOTSPLUGIN_JOIN', {'channel': real_channel, 'users': [u],
'modes': irc.channels[real_channel].modes,
'parse_as': 'JOIN'}])
irc.reply("Done.")
utils.add_cmd(joinclient, name='join')
@utils.add_cmd
@ -139,6 +142,7 @@ def nick(irc, source, args):
return
irc.proto.nick(u, newnick)
irc.reply("Done.")
# Ditto above: manually send a NICK change hook payload to other plugins.
irc.callHooks([u, 'PYLINK_BOTSPLUGIN_NICK', {'newnick': newnick, 'oldnick': nick, 'parse_as': 'NICK'}])
@ -186,6 +190,7 @@ def part(irc, source, args):
return
irc.proto.part(u, channel, reason)
irc.reply("Done.")
irc.callHooks([u, 'PYLINK_BOTSPLUGIN_PART', {'channels': clist, 'text': reason, 'parse_as': 'PART'}])
@utils.add_cmd
@ -232,5 +237,6 @@ def msg(irc, source, args):
real_target = target
irc.proto.message(sourceuid, real_target, text)
irc.reply("Done.")
irc.callHooks([sourceuid, 'PYLINK_BOTSPLUGIN_MSG', {'target': real_target, 'text': text, 'parse_as': 'PRIVMSG'}])
utils.add_cmd(msg, 'say')

View File

@ -105,6 +105,7 @@ def kick(irc, source, args):
sender = irc.pseudoclient.uid
irc.proto.kick(sender, channel, targetu, reason)
irc.reply("Done.")
irc.callHooks([sender, 'CHANCMDS_KICK', {'channel': channel, 'target': targetu,
'text': reason, 'parse_as': 'KICK'}])
@ -136,6 +137,7 @@ def kill(irc, source, args):
# Format the kill reason properly in hooks.
reason = "Killed (%s (%s))" % (irc.getFriendlyName(sender), reason)
irc.reply("Done.")
irc.callHooks([sender, 'CHANCMDS_KILL', {'target': targetu, 'text': reason,
'userdata': userdata, 'parse_as': 'KILL'}])
@ -198,6 +200,7 @@ def topic(irc, source, args):
irc.proto.topic(irc.pseudoclient.uid, channel, topic)
irc.reply("Done.")
irc.callHooks([irc.pseudoclient.uid, 'CHANCMDS_TOPIC',
{'channel': channel, 'text': topic, 'setter': source,
'parse_as': 'TOPIC'}])