38 lines
860 B
Python
38 lines
860 B
Python
# -*- coding: utf-8 -*-
|
|
import logging
|
|
|
|
import irc3
|
|
from docopt import Dict
|
|
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: Dict):
|
|
"""Reloads a plugin or the whole bot.
|
|
|
|
%%reload [<plugin>]
|
|
"""
|
|
plugin = args.get('<plugin>')
|
|
if plugin:
|
|
bot.reload('{}.{}'.format(MODULE, plugin))
|
|
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
|