@@ -136,7 +136,7 @@ async def on_submit(self, ia: Interaction):
136136 other = await Profile .find_by_email (email )
137137 if other is not None :
138138 self .bot .discord_logger .warning (
139- f"user { ia .user .mention } attempted to verify with duplicate email '{ email } '" ,
139+ f"user { ia .user .mention } attempted to verify with duplicate email '{ email } '\n their other account is <@ { other . discord_id } > " ,
140140 guild = self .guild ,
141141 log_type = "verification" ,
142142 )
@@ -419,6 +419,41 @@ async def verify(self, ia: Interaction):
419419
420420 return await ia .followup .send (content = msg , ephemeral = True )
421421
422+ @app_commands .command (
423+ name = "unverify" , description = "Remove somebody from the verified users database"
424+ )
425+ @app_commands .describe (user = "The user to unverify" )
426+ @app_commands .guild_only ()
427+ async def unverify (self , ia : Interaction , user : Member ):
428+ guild_config = await Config .get (ia .guild .id )
429+ if guild_config is None :
430+ raise MissingConfig (ia .guild )
431+
432+ await ia .response .defer (ephemeral = True , thinking = True )
433+
434+ profile_statistics = await ProfileStatistics .get_all_for_user (user .id )
435+ stat_futures = [stat .delete () for stat in profile_statistics ]
436+ await asyncio .gather (* stat_futures )
437+
438+ profile = await Profile .find_by_discord_id (user .id )
439+ if profile :
440+ await profile .delete ()
441+
442+ if guild_config .verified_role :
443+ verified_role = discord .utils .get (
444+ ia .guild .roles , id = guild_config .verified_role
445+ )
446+ if verified_role :
447+ await user .remove_roles (verified_role )
448+
449+ self .bot .discord_logger .info (
450+ f"{ user .mention } was unverified manually" ,
451+ guild = self .guild ,
452+ log_type = "verification" ,
453+ )
454+
455+ return await ia .followup .send ("done" )
456+
422457 @ErrorHandledCog .listener ("on_member_join" )
423458 async def handle_member_join (self , member : Member ):
424459 if member .bot :
0 commit comments