Added full reload functionality

This commit is contained in:
mrhanky 2017-05-16 14:42:21 +02:00
parent 38e571000e
commit a79a45f4ab
No known key found for this signature in database
GPG Key ID: 67D772C481CB41B8

View File

@ -12,12 +12,17 @@ from . import MODULE, Plugin
# noinspection PyUnusedLocal # noinspection PyUnusedLocal
@command(permission='admin', show_in_help_list=False) @command(permission='admin', show_in_help_list=False)
def reload(bot: IrcBot, mask: IrcString, channel: IrcString, args: DocoptDict): def reload(bot: IrcBot, mask: IrcString, channel: IrcString, args: DocoptDict):
"""Reload a plugin """Reloads a plugin or the whole bot
%%reload <plugin>
%%reload [<plugin>]
""" """
plugin = args['<plugin>'] plugin = args.get('<plugin>')
bot.reload('{module}.{plugin}'.format(plugin=plugin, module=MODULE)) if plugin:
bot.notice(mask.nick, 'Reloaded plugin "{plugin}"'.format(plugin=plugin)) bot.reload('{module}.{plugin}'.format(plugin=plugin, module=MODULE))
bot.privmsg(channel, 'Reloaded plugin "{}"'.format(plugin))
else:
bot.reload()
bot.privmsg(channel, 'Reloaded the bot')
@irc3.plugin @irc3.plugin