def test_twitter_startup(self): def Tmp(a): pass # Monkey-patch the fn so that it does not launch web requests # ... otherwise deferreds leave the reactor in unclean state after the test self.patch(ChannelBot, "getTwitMsgs", Tmp) c_bot = ChannelBot(self.irc, self.bot_fact, "chan3") c_bot.onJoined("#test-bot3") self.assertTrue(c_bot.t_srch is not None) c_bot.cleanUp()
def test_identica_startup(self): # verify that identica search starts if id_url is defined def Tmp(a): pass # Monkey-patch the fn so that it does not launch web requests # ... otherwise deferreds leave the reactor in unclean state after the test self.patch(ChannelBot, "getIdentMsgs", Tmp) self.patch(ChannelBot, "getTwitMsgs", Tmp) c_bot = ChannelBot(self.irc, self.bot_fact, "chan2") c_bot.onJoined("#test-bot2") self.assertTrue(c_bot.i_srch is not None) c_bot.cleanUp()
async def on_ready(): print(f'We have logged in as {DISCORD_CLIENT.user}') for channel_id in config["channels"].keys(): bot = ChannelBot(channel_id) CHANNEL_BOT[channel_id] = bot SCHEDULER.add_job(bot.send_item_store, "cron", second="0", hour="6-21", timezone=timezone('Europe/Paris')) SCHEDULER.start()