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

View File

@ -2,6 +2,7 @@
import logging import logging
import irc3 import irc3
# noinspection PyPackageRequirements
from docopt import Dict as DocOptDict from docopt import Dict as DocOptDict
from irc3.plugins.command import command from irc3.plugins.command import command
from irc3.utils import IrcString from irc3.utils import IrcString
@ -20,13 +21,19 @@ def reload(bot: irc3.IrcBot, mask: IrcString, target: IrcString,
""" """
plugin = args.get('<plugin>') plugin = args.get('<plugin>')
if plugin: if plugin:
bot.reload('{module}.{plugin}'.format(plugin=plugin, module=MODULE)) bot.reload('{}.{}'.format(plugin, MODULE))
bot.privmsg(target, 'Reloaded plugin "{plugin}"'.format(plugin=plugin)) bot.privmsg(target, 'Reloaded plugin "{}"'.format(plugin))
else: else:
bot.reload() bot.reload()
bot.privmsg(target, 'Reloaded the bot') bot.privmsg(target, 'Reloaded the bot')
@irc3.event(irc3.rfc.CONNECTED)
def connected(bot, srv, me, data):
bot.mode(me, '+R')
@irc3.plugin @irc3.plugin
class Admin(Plugin): class Admin(Plugin):
# TODO: add admin functions (join, part, etc)
pass pass