aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Matteo Bertucci <[email protected]>2021-01-10 17:16:42 +0100
committerGravatar Matteo Bertucci <[email protected]>2021-01-10 17:16:42 +0100
commit26672e5524fb178f3e21f2c18818f3a20c213605 (patch)
tree255af7b51984754513e1099a5946fc04ea292c0a
parentUpped duckpond threshold to 5 (diff)
Make sure that users without the Developers role can use tag.
We have a check in place to restrict tag usage to a certain role, but our default is the Developers role, and some users now don't have this code. This commit fixes this by using None as a default and adding a truth test in the check_accessibility method.
-rw-r--r--bot/exts/info/tags.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/bot/exts/info/tags.py b/bot/exts/info/tags.py
index 8f15f932b..da4154316 100644
--- a/bot/exts/info/tags.py
+++ b/bot/exts/info/tags.py
@@ -46,7 +46,7 @@ class Tags(Cog):
"embed": {
"description": file.read_text(encoding="utf8"),
},
- "restricted_to": "developers",
+ "restricted_to": None,
"location": f"/bot/{file}"
}
@@ -63,7 +63,7 @@ class Tags(Cog):
@staticmethod
def check_accessibility(user: Member, tag: dict) -> bool:
"""Check if user can access a tag."""
- return tag["restricted_to"].lower() in [role.name.lower() for role in user.roles]
+ return not tag["restricted_to"] or tag["restricted_to"].lower() in [role.name.lower() for role in user.roles]
@staticmethod
def _fuzzy_search(search: str, target: str) -> float: