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

View File

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