From 33478a8080b18e471768db8a2793ec6c9113603f Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Sat, 8 Apr 2023 18:17:28 -0700 Subject: [PATCH] Discord replies no longer mention the user. I don't want this clogging up my mentions inbox (which i check for things i forgot to do) every time i do !tgs. and it will once there are 7 bots on tgs 5 and all 7 of them mention me every time I use a command. There is no need to mention or ping the user for a response to a message they sent less than a second ago. The goal of a mention is to alert the user there is a message they might want to see, but in this case, they kinda know, given they just sent the command. --- .../Components/Chat/Providers/DiscordProvider.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs b/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs index 084a349152..d5d2c91786 100644 --- a/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs +++ b/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs @@ -224,9 +224,20 @@ namespace Tgstation.Server.Host.Components.Chat.Providers public override async Task SendMessage(Message replyTo, MessageContent message, ulong channelId, CancellationToken cancellationToken) { Optional replyToReference = default; + Optional allowedMentions = default; if (replyTo != null && replyTo is DiscordMessage discordMessage) { replyToReference = discordMessage.MessageReference; + allowedMentions = new AllowedMentions( + //reset settings back to how discord acts if this is not passed (which is different than the default if empty) + Parse: [ + MentionType.Everyone, + MentionType.Roles, + MentionType.Users + ], + //disable reply mentions + MentionRepliedUser = false + ); } var embeds = ConvertEmbed(message.Embed); @@ -239,6 +250,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers message.Text, embeds: embeds, messageReference: replyToReference, + allowedMentions: allowedMentions, ct: cancellationToken); if (!result.IsSuccess)