-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from Code4GovTech/fix/bot
Fix/bot
- Loading branch information
Showing
2 changed files
with
60 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,61 @@ | ||
from discord import Role | ||
|
||
|
||
def lookForChapterRoles(roles: [Role]): | ||
def lookForRoles(roles: [Role]): | ||
predefined_roles = { | ||
"country": ["India", "Asia (Outside India)", "Europe", "Africa", "North America", "South America", "Australia"], | ||
"city": ["Delhi", "Bangalore", "Mumbai", "Pune", "Hyderabad", "Chennai", "Kochi"], | ||
"experience": [ | ||
"Tech Freshman", | ||
"Tech Sophomore", | ||
"Tech Junior", | ||
"Tech Senior", | ||
"Junior Developer", | ||
"Senior Developer", | ||
"Super Senior Developer", | ||
"Champion Developer" | ||
], | ||
"gender": ["M", "F", "NB"] | ||
} | ||
chapter_roles = [] | ||
gender = None | ||
country = None | ||
city = None | ||
experience = None | ||
for role in roles: | ||
if role.name.startswith("College:"): | ||
chapter_roles.append(role.name[len("College: ") :]) | ||
elif role.name.startswith("Corporate:"): | ||
chapter_roles.append(role).name[len("Corporate: ") :] | ||
return chapter_roles | ||
|
||
#gender | ||
for role in roles: | ||
if role.name in predefined_roles["gender"]: | ||
gender = role.name | ||
break | ||
|
||
#country | ||
for role in roles: | ||
if role.name in predefined_roles["country"]: | ||
country = role.name | ||
break | ||
|
||
#city | ||
for role in roles: | ||
if role.name in predefined_roles["city"]: | ||
city = role.name | ||
break | ||
|
||
def lookForGenderRoles(roles: [Role]): | ||
#experience | ||
for role in roles: | ||
if role.name in ["M", "F", "NB"]: | ||
return role.name | ||
return None | ||
if role.name in predefined_roles["experience"]: | ||
experience = role.name | ||
break | ||
|
||
user_roles = { | ||
"chapter_roles": chapter_roles, | ||
"gender": gender, | ||
"country": country, | ||
"city": city, | ||
"experience": experience | ||
} | ||
return user_roles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters