From 2e702097e842e674122ddf30524819cf4766c61f Mon Sep 17 00:00:00 2001 From: sgoudham Date: Sat, 12 Sep 2020 11:40:55 +0100 Subject: [PATCH] Moved permissions into functions.py --- cogs/libs/functions.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/cogs/libs/functions.py b/cogs/libs/functions.py index e3b50992..d0ef07c6 100644 --- a/cogs/libs/functions.py +++ b/cogs/libs/functions.py @@ -14,6 +14,29 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# Using frozenset +# Permissions to filter through +perms = frozenset( + { + "create instant invite", + "add reactions", + "view audit log", + "priority speaker", + "stream", + "read messages", + "send messages", + "send tts messages", + "embed links", + "attach links", + "read message history", + "external emojis", + "view guild insights", + "connect", + "speak", + "use voice activation", + "change nickname" + } +) # List of regions mapped to emojis region = { @@ -51,6 +74,17 @@ notifs = { } +def detect_perms(message, fset): + """Filter out permissions that are not important""" + + # Split the message individual permissions + message = message.split(",") + + # Filter the permission out if it's in the frozenset + filtered = filter(lambda perm: perm not in fset, message) + return ", ".join(filtered) + + def string_list(types, n, instance): """Return objects in nicely formatted strings"""