40 lines
928 B
Python
40 lines
928 B
Python
# -*- coding: utf-8 -*-
|
|
import logging
|
|
|
|
import irc3
|
|
# noinspection PyPackageRequirements
|
|
from docopt import Dict as DocOptDict
|
|
from irc3.plugins.command import command
|
|
from irc3.utils import IrcString
|
|
|
|
from . import MODULE, Plugin
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
@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('{}.{}'.format(plugin, MODULE))
|
|
bot.privmsg(target, 'Reloaded plugin "{}"'.format(plugin))
|
|
else:
|
|
bot.reload()
|
|
bot.privmsg(target, 'Reloaded the bot')
|
|
|
|
|
|
@irc3.event(irc3.rfc.CONNECTED)
|
|
def connected(bot, srv, me, data):
|
|
bot.mode(me, '+R')
|
|
|
|
|
|
@irc3.plugin
|
|
class Admin(Plugin):
|
|
# TODO: add admin functions (join, part, etc)
|
|
pass
|