Temporary group vcs and a bunch of fixes

This commit is contained in:
2021-03-12 19:09:59 +01:00
parent 4e605e548c
commit 8ffafcf51d
2 changed files with 93 additions and 13 deletions

View File

@@ -15,3 +15,10 @@ def find_category(guild: discord.Guild, group: str) -> Optional[discord.Category
if cat.name.lower() == group:
return cat
return None
async def find_role_case_insensitive(guild: discord.Guild, name: str, prefix: str = '') -> Optional[discord.Role]:
for role in await guild.fetch_roles():
if name.strip().lower() == role.name[len(prefix):].lower():
return role
return None