-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshared.py
56 lines (53 loc) · 1.68 KB
/
shared.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from replit import db
adminRoles = ['helper', 'Moderators', 'Owner']
guildIds= [479493485037355022,472944754397806619]
class validation():
def validGoogleDoc(input):
link = "https://docs.google.com/"
if (input.startswith(link)):
return True
else:
return False
def validDiscordLink(input):
link = "https://discord.com/"
if (input.startswith(link)):
return True
else:
return False
def validHexColor(input):
hexdigits = '0123456789abcdef'
try:
type(input) == type('')
except:
return False
input = input.lstrip('#')
if (input.length == 6):
for letter in input.casefold():
if letter not in hexdigits:
return False
return True
else: return False
def doesKeyExist(key):
if db.prefix(key): return True
else: return False
def userHasRole(member, role):
membersRoles = member.roles
if isinstance(role, str):
if (membersRoles.count(role) > 0):
return True
else:
return False
elif isinstance(role, list):
for i in role:
if (membersRoles.count(i) > 0):
return True
return False
def addFieldsToEmbed(dict, embed):
for i in dict:
if list(dict.keys()).index(i) > 4:
embed.add_field(name=i, value=dict[i], inline=True)
return embed
class conversion():
def hexToRGB(hex):
hex = hex.lstrip('#')
return tuple(int(hex[i:i+2], 16) for i in (0, 2, 4))