-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlfg.py
31 lines (27 loc) · 1.22 KB
/
lfg.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
from printFunctions import printLarge
from discordIDs import *
def roleAliases(role):
role='grandmaster' if role=='gm' else role
role='master' if role=='masters' else role
role='diamond' if role=='dia' else role
role='platinum' if role=='plat' else role
role='unranked' if role in ['ur','none','qm'] else role
role='eu' if role=='europe' else role
role='na' if role in ['northamerica','us','america','americas','usa'] else role
role='latam' if role in ['br','brazil'] else role
return role
async def lfg(channel,text,client):
inputRoles=[roleAliases(j) for j in text.replace(' ','').split(',')]
roles=[i for i in channel.guild.roles if i.name.lower().replace(' ','') in inputRoles]
people=[i for i in channel.guild.members if len(roles)==sum(1 for j in roles if j in i.roles)]
lfgRole=client.get_guild(DiscordGuildIDs['WindStriders']).get_role(DiscordRoleIDs['LFG'])
if len(roles)!=len(inputRoles):
await channel.send('Invalid roles!')
elif people:
peopleNames=[]
for i in people:
name=i.nick if i.nick else i.name
peopleNames.append('**'+name+'**' if lfgRole in i.roles else name)
await printLarge(channel,', '.join(peopleNames),',')
else:
await channel.send('No people found!')