fix(antipolls): prevent cog loading if the Message Content intent is disabled

This commit is contained in:
Seaswimmer 2024-04-16 12:13:15 -04:00
parent dbe6fc2390
commit aaf9ac1b4e
Signed by untrusted user: cswimr
GPG key ID: 5D671B5D03D65A7F

View file

@ -29,6 +29,9 @@ class AntiPolls(commands.Cog):
channel_whitelist=[], channel_whitelist=[],
manage_messages=True, manage_messages=True,
) )
if not self.bot.intents.message_content:
self.logger.error("Message Content intent is not enabled, cog will not load.")
raise RuntimeError("This cog requires the Message Content intent to function. To prevent potentially destructive behavior, the cog will not load without the intent enabled.")
def format_help_for_context(self, ctx: commands.Context) -> str: def format_help_for_context(self, ctx: commands.Context) -> str:
pre_processed = super().format_help_for_context(ctx) or "" pre_processed = super().format_help_for_context(ctx) or ""