@@ -9,9 +9,9 @@ use ffmonitor::{Monitor, NameRequestEvent};
99use poise:: {
1010 serenity_prelude:: {
1111 ActivityData , ChannelId , ClientBuilder , ComponentInteraction ,
12- ComponentInteractionCollector , Context , CreateActionRow , CreateButton ,
13- CreateInteractionResponse , CreateInteractionResponseMessage , CreateMessage , GatewayIntents ,
14- GuildId , RoleId , User ,
12+ ComponentInteractionCollector , Context , CreateActionRow , CreateAllowedMentions ,
13+ CreateButton , CreateInteractionResponse , CreateInteractionResponseMessage , CreateMessage ,
14+ GatewayIntents , GuildId , Mention , RoleId , User ,
1515 } ,
1616 CreateReply ,
1717} ;
@@ -184,11 +184,17 @@ async fn handle_namereq_approve(
184184 let Some ( channel) = globals. log_channel else {
185185 return Ok ( ( ) ) ;
186186 } ;
187- let msg = format ! (
187+
188+ let mention = Mention :: from ( user. id ) ;
189+ let content = format ! (
188190 "Name request from Player {} **approved** :white_check_mark: by {}: {}" ,
189- namereq. player_uid, user , namereq. requested_name
191+ namereq. player_uid, mention , namereq. requested_name
190192 ) ;
191- send_message ( channel, & msg) . await ?;
193+ let allowed_mentions = CreateAllowedMentions :: default ( ) . empty_users ( ) ; // avoids ping
194+ let msg = CreateMessage :: default ( )
195+ . content ( content)
196+ . allowed_mentions ( allowed_mentions) ;
197+ channel. send_message ( http, msg) . await ?;
192198 Ok ( ( ) )
193199}
194200
@@ -222,11 +228,17 @@ async fn handle_namereq_deny(globals: &Globals, interaction: &ComponentInteracti
222228 let Some ( channel) = globals. log_channel else {
223229 return Ok ( ( ) ) ;
224230 } ;
225- let msg = format ! (
231+
232+ let mention = Mention :: from ( user. id ) ;
233+ let content = format ! (
226234 "Name request from Player {} **denied** :no_entry: by {}: {}" ,
227- namereq. player_uid, user , namereq. requested_name
235+ namereq. player_uid, mention , namereq. requested_name
228236 ) ;
229- send_message ( channel, & msg) . await ?;
237+ let allowed_mentions = CreateAllowedMentions :: default ( ) . empty_users ( ) ; // avoids ping
238+ let msg = CreateMessage :: default ( )
239+ . content ( content)
240+ . allowed_mentions ( allowed_mentions) ;
241+ channel. send_message ( http, msg) . await ?;
230242 Ok ( ( ) )
231243}
232244
0 commit comments