Skip to content

Commit

Permalink
Merge pull request #158 from onerandomusername/implement-allowed-ment…
Browse files Browse the repository at this point in the history
…ions

use allowed mentions to prevent mentioning everyone
  • Loading branch information
Akarys42 authored Dec 29, 2021
2 parents fe42628 + 13db234 commit 840e150
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import asyncpg
from aiohttp import ClientSession
from bot.postgres import create_tables
from discord import Embed, Intents
from discord import AllowedMentions, Embed, Intents, Object
from discord.ext import commands
from loguru import logger

Expand All @@ -22,8 +22,25 @@ def __init__(self) -> None:

self.http_session = ClientSession()
self.db_pool: asyncpg.Pool = asyncpg.create_pool(constants.DATABASE_URL)

super().__init__(command_prefix=constants.PREFIX, intents=intents)
allowed_mention_roles = [
Object(r)
for r in [
constants.Roles.steering_council,
constants.Roles.moderators,
constants.Roles.gurkult_lords,
]
]

super().__init__(
command_prefix=constants.PREFIX,
intents=intents,
allowed_mentions=AllowedMentions(
everyone=None,
users=True,
roles=allowed_mention_roles,
replied_user=True,
),
)

self.loop.create_task(self._db_setup())

Expand Down

0 comments on commit 840e150

Please sign in to comment.