""" Rocketbot Discord bot. Relies on a configured config.py (copy config.py.sample for a template) and the sqlite database rocketbot.db (copy rocketbot.db.sample for a blank database). Author: Ian Albert (@rocketsoup) Date: 2021-11-11 """ from discord import Intents from discord.ext import commands from config import CONFIG from cogs.configcog import ConfigCog from cogs.crosspostcog import CrossPostCog from cogs.generalcog import GeneralCog from cogs.joinraidcog import JoinRaidCog from cogs.patterncog import PatternCog from cogs.urlspamcog import URLSpamCog CURRENT_CONFIG_VERSION = 1 if (CONFIG.get('__config_version') or 0) < CURRENT_CONFIG_VERSION: raise RuntimeError('config.py format may be outdated. Review ' + 'config.py.sample, update the "__config_version" field to ' + f'{CURRENT_CONFIG_VERSION}, and try again.') class Rocketbot(commands.Bot): def __init__(self, command_prefix, **kwargs): super().__init__(command_prefix, **kwargs) intents = Intents.default() intents.messages = True intents.members = True # To get join/leave events bot = Rocketbot(command_prefix=CONFIG['command_prefix'], intents=intents) bot.add_cog(GeneralCog(bot)) bot.add_cog(ConfigCog(bot)) bot.add_cog(JoinRaidCog(bot)) bot.add_cog(CrossPostCog(bot)) bot.add_cog(PatternCog(bot)) bot.add_cog(URLSpamCog(bot)) bot.run(CONFIG['client_token'], bot=True, reconnect=True) print('\nBot aborted')