From 9fc2fd38dc097e489e1b3979a9b461c566d1ac48 Mon Sep 17 00:00:00 2001 From: iDutchy Date: Sun, 4 Oct 2020 00:39:03 +0000 Subject: [PATCH] Another request from shivaco --- discord/flags.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/discord/flags.py b/discord/flags.py index 0c81b103..6919f92a 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -402,6 +402,19 @@ class Intents(BaseFlags): raise TypeError('%r is not a valid flag name.' % key) 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 def all(cls): """A factory method that creates a :class:`Intents` with everything enabled."""