3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-23 18:54:05 +01:00

add alias argument where appropriate in plugins

This commit is contained in:
Mitchell Cooper 2017-07-09 21:19:08 -04:00
parent 2299204efa
commit 100089f6b8
5 changed files with 17 additions and 16 deletions

View File

@ -208,8 +208,8 @@ def setacc(irc, source, args):
# Join the Automode bot to the channel if not explicitly told to.
modebot.join(ircobj, channel)
modebot.add_cmd(setacc, 'setaccess')
modebot.add_cmd(setacc, 'set')
modebot.add_cmd(setacc, 'setaccess', alias='setacc')
modebot.add_cmd(setacc, 'set', alias='setacc')
modebot.add_cmd(setacc, featured=True)
def delacc(irc, source, args):
@ -243,8 +243,8 @@ def delacc(irc, source, args):
log.debug("Automode: purging empty channel pair %s/%s", ircobj.name, channel)
del db[ircobj.name+channel]
modebot.add_cmd(delacc, 'delaccess')
modebot.add_cmd(delacc, 'del')
modebot.add_cmd(delacc, 'delaccess', alias='delacc')
modebot.add_cmd(delacc, 'del', alias='delacc')
modebot.add_cmd(delacc, featured=True)
def listacc(irc, source, args):
@ -274,7 +274,7 @@ def listacc(irc, source, args):
reply(irc, "End of Automode entries list.", private=True)
modebot.add_cmd(listacc, featured=True)
modebot.add_cmd(listacc, 'listaccess')
modebot.add_cmd(listacc, 'listaccess', alias='listacc')
def save(irc, source, args):
"""takes no arguments.
@ -305,8 +305,8 @@ def syncacc(irc, source, args):
reply(irc, 'Done.')
modebot.add_cmd(syncacc, featured=True)
modebot.add_cmd(syncacc, 'sync')
modebot.add_cmd(syncacc, 'syncaccess')
modebot.add_cmd(syncacc, 'sync', alias='syncacc')
modebot.add_cmd(syncacc, 'syncaccess', alias='syncacc')
def clearacc(irc, source, args):
"""<channel>
@ -329,6 +329,6 @@ def clearacc(irc, source, args):
else:
error(irc, "No Automode access entries exist for \x02%s\x02." % channel)
modebot.add_cmd(clearacc, 'clearaccess')
modebot.add_cmd(clearacc, 'clear')
modebot.add_cmd(clearacc, 'clearaccess', alias='clearacc')
modebot.add_cmd(clearacc, 'clear', alias='clearacc')
modebot.add_cmd(clearacc, featured=True)

View File

@ -239,4 +239,4 @@ def msg(irc, source, args):
irc.message(sourceuid, real_target, text)
irc.reply("Done.")
irc.call_hooks([sourceuid, 'PYLINK_BOTSPLUGIN_MSG', {'target': real_target, 'text': text, 'parse_as': 'PRIVMSG'}])
utils.add_cmd(msg, 'say')
utils.add_cmd(msg, 'say', alias='msg')

View File

@ -65,5 +65,5 @@ def randint(irc, source, args):
irc.reply(str(n))
# You can also bind a command function multiple times, and/or to different command names via a
# second argument.
utils.add_cmd(randint, "random")
# second argument. The alias= argument marks it as an alias for the specified primary command.
utils.add_cmd(randint, "random", alias="randint")

View File

@ -58,5 +58,6 @@ def greet(irc, source, args):
# 2) Instead of using utils.add_cmd(function, 'name'), bind functions to your ServiceBot instance.
# You can also use the featured=True argument to display the command's syntax directly in 'list'.
# The alias= argument marks the command as an alias for another specified command.
servicebot.add_cmd(greet, featured=True)
servicebot.add_cmd(greet, 'g')
servicebot.add_cmd(greet, 'g', alias='greet')

View File

@ -40,7 +40,7 @@ def dice(irc, source, args):
s = 'You rolled %s: %s (total: %s)' % (args[0], ' '.join([str(x) for x in results]), sum(results))
reply(irc, s)
gameclient.add_cmd(dice, 'd')
gameclient.add_cmd(dice, 'd', alias='dice')
gameclient.add_cmd(dice, featured=True)
eightball_responses = ["It is certain.",
@ -70,8 +70,8 @@ def eightball(irc, source, args):
"""
reply(irc, random.choice(eightball_responses))
gameclient.add_cmd(eightball, featured=True)
gameclient.add_cmd(eightball, '8ball')
gameclient.add_cmd(eightball, '8b')
gameclient.add_cmd(eightball, '8ball', alias='eightball')
gameclient.add_cmd(eightball, '8b', alias='eightball')
def die(irc=None):
utils.unregisterService('games')