Classmethods all and none for AllowedMentions

This commit is contained in:
Saphielle Akiyama 2020-09-04 14:43:44 +02:00 committed by GitHub
parent 5e4f3780ed
commit 33fb13043c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,6 +68,22 @@ class AllowedMentions:
self.users = users
self.roles = roles
@classmethod
def all(cls):
"""A factory method that returns a :class:`AllowedMentions` with all fields explicitly set to ``True``
.. versionadded:: 1.5
"""
return cls(everyone=True, users=True, roles=True)
@classmethod
def none(cls):
"""A factory method that returns a :class:`AllowedMentions` with all fields set to ``False``
.. versionadded:: 1.5
"""
return cls(everyone=False, users=False, roles=False)
def to_dict(self):
parse = []
data = {}