Exemple #1
0
def run_bot(config_path, plugin_dir):
    bot = Bot(config_path)
    bot.loader.load_plugins()

    try:
        bot.run()
    except KeyboardInterrupt:
        sys.exit(0)
Exemple #2
0
 def test_name(self):
     bot = Bot(self.config_file)
     plugin = TestPlugin(bot)
     plugin.load()
     self.assertEqual(plugin.name, "TestPlugin")
     self.assertEqual(plugin.logger.name, "plugins.TestPlugin")
     self.assertEqual(repr(plugin), "Plugin(TestPlugin)")
Exemple #3
0
    def test_cron_will_run(self):
        bot = Bot(self.config_file)
        plugin = TestCronPlugin(bot)
        plugin.load()

        next_cron = plugin.crons[0].cron.get_current(datetime)
        now = datetime.now()

        self.assertEqual(next_cron.minute, now.minute + 1)
Exemple #4
0
    def test_cron_decos(self):
        bot = Bot(self.config_file)
        plugin = TestCronPlugin(bot)
        plugin.load()

        self.assertTrue(len(plugin.crons) > 0)
Exemple #5
0
    def test_interval_will_run(self):
        bot = Bot(self.config_file)
        plugin = TestIntervalPlugin(bot)
        plugin.load()

        self.assertTrue(plugin.intervals[0].ready())
Exemple #6
0
    def test_interval_decos(self):
        bot = Bot(self.config_file)
        plugin = TestIntervalPlugin(bot)
        plugin.load()

        self.assertTrue(len(plugin.intervals) > 0)
Exemple #7
0
 def test_webhook_decos(self):
     bot = Bot(self.config_file)
     plugin = TestPlugin(bot)
     plugin.load()
     self.assertTrue(len(plugin.webhooks) > 0)
Exemple #8
0
 def test_command_decos(self):
     bot = Bot(self.config_file)
     plugin = TestPlugin(bot)
     plugin.load()
     self.assertTrue(len(plugin.commands) > 0)
Exemple #9
0
 def test_plugin_deactivate(self):
     bot = Bot(self.config_file)
     plugin = TestPlugin(bot)
     plugin.load()
     plugin.unload()
     self.assertFalse(plugin.activated)
Exemple #10
0
 def test_plugin_activate(self):
     bot = Bot(self.config_file)
     plugin = TestPlugin(bot)
     plugin.load()
     self.assertTrue(plugin.activated)
Exemple #11
0
def run_bot(config_path, plugin_dir):
    bot = Bot(config_path)
    bot.load_plugin("./plugins/Access.py")
    bot.load_plugin("./plugins/Manage.py")
    bot.load_plugin("./plugins/Chance.py")
    bot.load_plugin("./plugins/DemosTF.py")
    bot.load_plugin("./plugins/LogsTF.py")
    bot.load_plugin("./plugins/Steam.py")
    bot.load_plugin("./plugins/UrbanDictionary.py")
    bot.load_plugin("./plugins/ServeMe.py")

    try:
        bot.run()
    except KeyboardInterrupt:
        sys.exit(0)