Experimental Discord bot written in Python
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

rocketbot.py 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. """
  2. Rocketbot Discord bot. Relies on a configured config.py (copy config.py.sample for a template) and
  3. the sqlite database rocketbot.db (copy rocketbot.db.sample for a blank database).
  4. Author: Ian Albert (@rocketsoup)
  5. Date: 2021-11-11
  6. """
  7. from discord import Intents
  8. from discord.ext import commands
  9. from config import CONFIG
  10. from cogs.configcog import ConfigCog
  11. from cogs.crosspostcog import CrossPostCog
  12. from cogs.generalcog import GeneralCog
  13. from cogs.joinraidcog import JoinRaidCog
  14. # from cogs.urlspamcog import URLSpamCog
  15. CURRENT_CONFIG_VERSION = 1
  16. if (CONFIG.get('__config_version') or 0) < CURRENT_CONFIG_VERSION:
  17. raise RuntimeError('config.py format may be outdated. Review ' +
  18. 'config.py.sample, update the "__config_version" field to ' +
  19. f'{CURRENT_CONFIG_VERSION}, and try again.')
  20. class Rocketbot(commands.Bot):
  21. def __init__(self, command_prefix, **kwargs):
  22. super().__init__(command_prefix, **kwargs)
  23. intents = Intents.default()
  24. intents.messages = True
  25. intents.members = True # To get join/leave events
  26. bot = Rocketbot(command_prefix=CONFIG['command_prefix'], intents=intents)
  27. bot.add_cog(GeneralCog(bot))
  28. bot.add_cog(ConfigCog(bot))
  29. bot.add_cog(JoinRaidCog(bot))
  30. bot.add_cog(CrossPostCog(bot))
  31. # bot.add_cog(URLSpamCog(bot))
  32. bot.run(CONFIG['client_token'], bot=True, reconnect=True)
  33. print('\nBot aborted')