diff options
| author | Rapptz <[email protected]> | 2020-04-04 12:49:24 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2020-04-04 12:49:39 -0400 |
| commit | 730d79d60ad3b2ddb4b9005866621b784ee9c1fc (patch) | |
| tree | 8aee6b38288e8ae305960726e2584b4a4192bfb3 | |
| parent | Fix various implementation bugs with allowed mentions (diff) | |
| download | discord.py-730d79d60ad3b2ddb4b9005866621b784ee9c1fc.tar.xz discord.py-730d79d60ad3b2ddb4b9005866621b784ee9c1fc.zip | |
Allow introspection and setting of global allowed mention configuration
| -rw-r--r-- | discord/client.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/discord/client.py b/discord/client.py index 9a673f79..1b826b9b 100644 --- a/discord/client.py +++ b/discord/client.py @@ -42,6 +42,7 @@ from .guild import Guild from .channel import _channel_factory from .enums import ChannelType from .member import Member +from .mentions import AllowedMentions from .errors import * from .enums import Status, VoiceRegion from .gateway import * @@ -665,6 +666,23 @@ class Client: else: raise TypeError('activity must derive from BaseActivity.') + @property + def mentions(self): + """Optional[:class:`AllowedMentions`]: The allowed mention configuration. + + .. versionadded:: 1.4 + """ + return self._connection.mentions + + @mentions.setter + def mentions(self, value): + if value is None: + self._connection.mentions = value + elif isinstance(value, AllowedMentions): + self._connection.mentions = value + else: + raise TypeError('mentions must be AllowedMentions not {0.__class__!r}'.format(value)) + # helpers/getters @property |