Another request from shivaco
This commit is contained in:
parent
ea73008ff2
commit
9fc2fd38dc
@ -402,6 +402,19 @@ class Intents(BaseFlags):
|
|||||||
raise TypeError('%r is not a valid flag name.' % key)
|
raise TypeError('%r is not a valid flag name.' % key)
|
||||||
setattr(self, key, value)
|
setattr(self, key, value)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_list(cls, intents_list):
|
||||||
|
for item in intents_list:
|
||||||
|
if item not in cls.VALID_FLAGS.keys():
|
||||||
|
intents_list.remove(item)
|
||||||
|
|
||||||
|
self = cls.__new__(cls)
|
||||||
|
for item in cls.VALID_FLAGS.keys():
|
||||||
|
if item not in intents_list:
|
||||||
|
setattr(self, item, False)
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def all(cls):
|
def all(cls):
|
||||||
"""A factory method that creates a :class:`Intents` with everything enabled."""
|
"""A factory method that creates a :class:`Intents` with everything enabled."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user