@@ -36,8 +36,37 @@ impl ComponentHandler for VerifyDevForumRank<'_> {
3636 async fn exec ( & self , ctx : crate :: Context ) -> anyhow:: Result < ( ) > {
3737 let guild_id = self . cmd . guild_id . context ( "get guild id" ) ?;
3838 let author_id = self . cmd . author_id ( ) . context ( "get interaction author id" ) ?;
39+ let member_roles = ctx
40+ . http
41+ . guild_member ( guild_id, author_id)
42+ . await
43+ . context ( "get guild member" ) ?
44+ . model ( )
45+ . await ?
46+ . roles ;
47+
48+ // Respond early if the user doesn't have the verified role
49+ // this is a quick check to avoid unnecessary API calls
50+ if let Some ( r_id) = ctx. cfg . roles . roblox_verified {
51+ if !member_roles. contains ( & r_id) {
52+ ctx. http
53+ . interaction ( self . cmd . application_id )
54+ . create_response ( self . cmd . id , & self . cmd . token , & InteractionResponse {
55+ kind : InteractionResponseType :: ChannelMessageWithSource ,
56+ data : Some (
57+ InteractionResponseDataBuilder :: new ( )
58+ . flags ( MessageFlags :: EPHEMERAL )
59+ . content ( "You must be Roblox verified to use this command." )
60+ . build ( ) ,
61+ ) ,
62+ } )
63+ . await
64+ . context ( "respond to interaction" ) ?;
65+ return Ok ( ( ) ) ;
66+ }
67+ }
3968
40- // Defer the interaction response
69+ // Defer the interaction response since the API calls may take some time
4170 ctx. http
4271 . interaction ( self . cmd . application_id )
4372 . create_response ( self . cmd . id , & self . cmd . token , & InteractionResponse {
0 commit comments