def __init__(self): self.app: Client = Client("bot", app_version=self.app_version, device_model=self.device_model, api_id=os.getenv("API_ID"), api_hash=os.getenv("API_HASH"), bot_token=os.getenv("TOKEN"), plugins=None, system_version=self.system_version) self.irc: IrcBot = IrcBot.from_config( dict( nick=os.getenv("IRC_NICKNAME"), autojoins=[os.getenv("IRC_CHANNEL")], username=os.getenv("IRC_NICKNAME"), realname=os.getenv("IRC_INFO"), sasl_username=os.getenv("IRC_NICKNAME"), sasl_password=os.getenv("IRC_PASSWORD"), host='irc.libera.chat', port=6697, ssl=True, debug=True, includes=[ 'irc3.plugins.command', 'irc3.plugins.logger', 'bot.irc_plugins.irc2tg', ], )) self.start_time: datetime = datetime.utcnow()
def main(): """Initializes a new irc3 bot.""" bot = IrcBot.from_config(conf) bot.version = get_version_from_file('Makefile') observer = Observer() observer.schedule( ReloadEventHandler(bot, conf), path.dirname(path.abspath(__file__)), recursive=True ) observer.start() try: bot.run(forever=True) except KeyboardInterrupt: observer.stop()
def main(): from roboto import model, http, loop, disc, config, commands # Parse & load config file config.update(parse_config('bot', "config.ini")) # Connect & Init DB model.init_db(config) # Load IRC Bot irc_bot = IrcBot.from_config(config, loop=loop) irc_bot.run(forever=False) # HTTP Server for playlist http.setup() # Start background task queue processor asyncio.ensure_future(commands.dispatcher.task_consumer(), loop=loop) # Start discord client disc.dc.run(config.get("discord_token"))