-
Notifications
You must be signed in to change notification settings - Fork 0
/
role_checks.py
38 lines (32 loc) · 1.13 KB
/
role_checks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import env
import discord
import asyncio
async def stafforcomm(self, inp):
if '[no]' not in inp.author.display_name:
if ifcomm(self, inp):
return True
sst = await env.get('{}_stfrole'.format(str(inp.guild.id)))
try:
if sst == 'variable does not exist': # if var error from server
return False # since there is no mod role to compare against anyways
server_stfrole = int(sst)
except ValueError:
raise ValueError(f'server_stfrole can\'t be assigned to {sst}, probably not a real id. maybe define a staffrole with an id?')
if server_stfrole == discord.utils.get(inp.author.roles, id=server_stfrole).id: # check to make sure the ids are the same
return True
else:
return False
def ifcomm(self, inp):
if inp.author.id in self.client.commanderids:
return True
else:
return False
def ifvip(self, inp):
if inp.author.id in self.client.commanderids:
return True
if inp.guild.owner == inp.author:
return True
if inp.author.guild_permissions.administrator is True:
return True
else:
return False