@@ -17,7 +17,7 @@ def __init__(self, bot) -> None:
17
17
self .bot = bot
18
18
self .update_contributors .start ()
19
19
20
- @tasks .loop (minutes = 10 )
20
+ @tasks .loop (minutes = 60 )
21
21
async def update_contributors (self ):
22
22
print ("update_contributors running" )
23
23
contributors = SupabaseClient ().read_all ("contributors_registration" )
@@ -26,16 +26,19 @@ async def update_contributors(self):
26
26
contributor_role = guild .get_role (VERIFIED_CONTRIBUTOR_ROLE_ID )
27
27
for contributor in contributors :
28
28
discord_id = contributor ["discord_id" ]
29
- member = guild . get_member ( discord_id )
30
- if member :
29
+ try :
30
+ member = await guild . fetch_member ( discord_id )
31
31
if contributor_role not in member .roles :
32
- await member .add_roles (contributor_role )
33
- print (f"Given { contributor_role .name } Role to { member .name } " )
32
+ try :
33
+ await member .add_roles (contributor_role )
34
+ print (f"Gave { contributor_role .name } role to { member .name } " )
35
+ except Exception as e :
36
+ print (f"{ member .name } could not be given verified contributor role" )
34
37
else :
35
- print (f"{ member .name } is already { contributor_role .name } " )
36
- else :
37
- print (f"{ discord_id } is not a member on discord " )
38
- ## TODO delete from supabase as well?
38
+ print (f"{ member .name } is already a { contributor_role .name } " )
39
+ except :
40
+ print (f"User with discord_id: { discord_id } is not a member of our server anymore " )
41
+ # TODO delete from supabase as well?
39
42
return
40
43
41
44
@commands .command (aliases = ["badges" ])
0 commit comments