24 lines
681 B
Python
24 lines
681 B
Python
# -*- coding: utf-8 -*-
|
|
import irc3
|
|
from docopt import Dict as DocoptDict
|
|
from irc3.plugins.command import command
|
|
from irc3.utils import IrcString
|
|
|
|
from . import MODULE
|
|
|
|
|
|
@command(permission='admin', show_in_help_list=False)
|
|
def reload(bot: irc3.IrcBot, mask: IrcString, target: IrcString,
|
|
args: DocoptDict):
|
|
"""Reloads a plugin or the whole bot.
|
|
|
|
%%reload [<plugin>]
|
|
"""
|
|
plugin = args.get('<plugin>')
|
|
if plugin:
|
|
bot.reload('{module}.{plugin}'.format(plugin=plugin, module=MODULE))
|
|
bot.privmsg(target, 'Reloaded plugin "{plugin}"'.format(plugin=plugin))
|
|
else:
|
|
bot.reload()
|
|
bot.privmsg(target, 'Reloaded the bot')
|