Set mode +R on connect

This commit is contained in:
mrhanky 2017-07-31 16:10:24 +02:00
parent 564c41aba0
commit 73bebd503e
No known key found for this signature in database
GPG Key ID: 67D772C481CB41B8
2 changed files with 12 additions and 3 deletions

View File

@ -3,6 +3,7 @@ import os
import sys
import json
# noinspection PyPackageRequirements
from dotenv import load_dotenv
from irc3 import IrcBot
@ -23,7 +24,6 @@ CFG_DEV = {
}
# TODO: regex
# TODO: ddg
def main(cfg_file):
# Load dotenv from file
@ -42,7 +42,9 @@ def main(cfg_file):
# Start the bot with constructed config
bot = IrcBot.from_config(cfg)
bot.run()
bot.mode(bot.nick, '+R')
if __name__ == '__main__':

View File

@ -2,6 +2,7 @@
import logging
import irc3
# noinspection PyPackageRequirements
from docopt import Dict as DocOptDict
from irc3.plugins.command import command
from irc3.utils import IrcString
@ -20,13 +21,19 @@ def reload(bot: irc3.IrcBot, mask: IrcString, target: IrcString,
"""
plugin = args.get('<plugin>')
if plugin:
bot.reload('{module}.{plugin}'.format(plugin=plugin, module=MODULE))
bot.privmsg(target, 'Reloaded plugin "{plugin}"'.format(plugin=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