diff options
author | 2020-07-14 11:58:30 -0700 | |
---|---|---|
committer | 2020-07-14 12:01:40 -0700 | |
commit | 746e4dbe67499c55e9e60dd9c5ad58ae378b1c9a (patch) | |
tree | 571651506b31f7afff60b979dc889160fffd1712 /bot/bot.py | |
parent | Outdated badge in README.md was upsetting me (diff) |
Prevent bot from mentioning non-mod roles
This was open to abuse when the bot relayed user input. The fix relies
on a discord.py alpha feature.
Diffstat (limited to 'bot/bot.py')
-rw-r--r-- | bot/bot.py | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -10,7 +10,7 @@ from aiohttp import AsyncResolver, ClientSession, TCPConnector from discord import DiscordException, Embed, Guild, User from discord.ext import commands -from bot.constants import Channels, Client +from bot.constants import Channels, Client, MODERATION_ROLES from bot.utils.decorators import mock_in_debug log = logging.getLogger(__name__) @@ -103,7 +103,7 @@ class SeasonalBot(commands.Bot): return False else: - log.info(f"Asset successfully applied") + log.info("Asset successfully applied") return True @mock_in_debug(return_value=True) @@ -203,7 +203,9 @@ class SeasonalBot(commands.Bot): await self._guild_available.wait() +_allowed_roles = [discord.Object(id_) for id_ in MODERATION_ROLES] bot = SeasonalBot( command_prefix=Client.prefix, activity=discord.Game(name=f"Commands: {Client.prefix}help"), + allowed_mentions=discord.AllowedMentions(everyone=False, roles=_allowed_roles), ) |