diff options
| author | Rapptz <[email protected]> | 2020-04-04 07:40:51 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2020-04-04 07:40:51 -0400 |
| commit | 041785937e091b7e282403d45dd0c68da340a8d4 (patch) | |
| tree | 1ea7a6bb47292e2a6978db690b98982338b4edba /discord/state.py | |
| parent | Fix regression with Member.activities not clearing (diff) | |
| download | discord.py-041785937e091b7e282403d45dd0c68da340a8d4.tar.xz discord.py-041785937e091b7e282403d45dd0c68da340a8d4.zip | |
Add support for configuring allowed mentions per message or bot wide.
Diffstat (limited to 'discord/state.py')
| -rw-r--r-- | discord/state.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/discord/state.py b/discord/state.py index e4ecdc45..e3ba299c 100644 --- a/discord/state.py +++ b/discord/state.py @@ -39,6 +39,7 @@ from .guild import Guild from .activity import BaseActivity from .user import User, ClientUser from .emoji import Emoji +from .mentions import AllowedMentions from .partial_emoji import PartialEmoji from .message import Message from .relationship import Relationship @@ -78,6 +79,12 @@ class ConnectionState: self._fetch_offline = options.get('fetch_offline_members', True) self.heartbeat_timeout = options.get('heartbeat_timeout', 60.0) self.guild_subscriptions = options.get('guild_subscriptions', True) + mentions = options.get('mentions') + + if mentions is not None and not isinstance(mentions, AllowedMentions): + raise TypeError('mentions parameter must be AllowedMentions') + + self.mentions = mentions # Only disable cache if both fetch_offline and guild_subscriptions are off. self._cache_members = (self._fetch_offline or self.guild_subscriptions) self._listeners = [] |