mirror of
https://github.com/RPCS3/discord-bot.git
synced 2026-01-31 01:25:22 +01:00
extend mention policy usage a bit
This commit is contained in:
@@ -84,7 +84,11 @@ namespace CompatBot
|
||||
public static double GameTitleMatchThreshold => config.GetValue(nameof(GameTitleMatchThreshold), 0.57);
|
||||
public static byte[] CryptoSalt => Convert.FromBase64String(config.GetValue(nameof(CryptoSalt), ""));
|
||||
|
||||
internal static readonly IMention[] AllowedMentions = { UserMention.All };
|
||||
internal static class AllowedMentions
|
||||
{
|
||||
internal static readonly IMention[] UsersOnly = { UserMention.All };
|
||||
internal static readonly IMention[] Nothing = { };
|
||||
}
|
||||
|
||||
internal static string CurrentLogPath => Path.GetFullPath(Path.Combine(LogPath, "bot.log"));
|
||||
|
||||
|
||||
@@ -58,11 +58,11 @@ namespace CompatBot.EventHandlers
|
||||
await postLock.WaitAsync().ConfigureAwait(false);
|
||||
try
|
||||
{
|
||||
await logChannel.SendMessageAsync(embed: embed, mentions: Config.AllowedMentions).ConfigureAwait(false);
|
||||
await logChannel.SendMessageAsync(embed: embed, mentions: Config.AllowedMentions.Nothing).ConfigureAwait(false);
|
||||
if (attachmentContent?.Count > 0)
|
||||
await logChannel.SendMultipleFilesAsync(attachmentContent, msg.Content, mentions: Config.AllowedMentions).ConfigureAwait(false);
|
||||
await logChannel.SendMultipleFilesAsync(attachmentContent, msg.Content, mentions: Config.AllowedMentions.Nothing).ConfigureAwait(false);
|
||||
else if (!string.IsNullOrEmpty(msg.Content))
|
||||
await logChannel.SendMessageAsync(msg.Content, mentions: Config.AllowedMentions).ConfigureAwait(false);
|
||||
await logChannel.SendMessageAsync(msg.Content, mentions: Config.AllowedMentions.Nothing).ConfigureAwait(false);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace CompatBot.EventHandlers
|
||||
{
|
||||
Throttling.Set(args.Channel.Id, similarList, ThrottleDuration);
|
||||
var msgContent = GetAvgContent(similarList.Select(m => m.Content).ToList());
|
||||
var botMsg = await args.Channel.SendMessageAsync(msgContent, mentions: Config.AllowedMentions).ConfigureAwait(false);
|
||||
var botMsg = await args.Channel.SendMessageAsync(msgContent, mentions: Config.AllowedMentions.UsersOnly).ConfigureAwait(false);
|
||||
similarList.Add(botMsg);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -125,9 +125,9 @@ namespace CompatBot.Utils
|
||||
try
|
||||
{
|
||||
if (conents?.Count > 0)
|
||||
return await logChannel.SendMultipleFilesAsync(conents, embed: embedBuilder.Build()).ConfigureAwait(false);
|
||||
return await logChannel.SendMultipleFilesAsync(conents, embed: embedBuilder.Build(), mentions: Config.AllowedMentions.Nothing).ConfigureAwait(false);
|
||||
else
|
||||
return await logChannel.SendMessageAsync(embed: embedBuilder.Build()).ConfigureAwait(false);
|
||||
return await logChannel.SendMessageAsync(embed: embedBuilder.Build(), mentions: Config.AllowedMentions.Nothing).ConfigureAwait(false);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -146,7 +146,7 @@ namespace CompatBot.Utils
|
||||
var mentions = reporters.Select(GetMentionWithNickname);
|
||||
embedBuilder.AddField("Reporters", string.Join(Environment.NewLine, mentions));
|
||||
var logChannel = await getLogChannelTask.ConfigureAwait(false);
|
||||
return await logChannel.SendMessageAsync(embed: embedBuilder.Build()).ConfigureAwait(false);
|
||||
return await logChannel.SendMessageAsync(embed: embedBuilder.Build(), mentions: Config.AllowedMentions.Nothing).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public static async Task<DiscordMessage> ReportAsync(this DiscordClient client, string infraction, string description, ICollection<DiscordMember> potentialVictims, ReportSeverity severity)
|
||||
@@ -160,7 +160,7 @@ namespace CompatBot.Utils
|
||||
if (potentialVictims?.Count > 0)
|
||||
result.AddField("Potential Targets", string.Join(Environment.NewLine, potentialVictims.Select(GetMentionWithNickname)).Trim(EmbedPager.MaxFieldLength));
|
||||
var logChannel = await client.GetChannelAsync(Config.BotLogId).ConfigureAwait(false);
|
||||
return await logChannel.SendMessageAsync(embed: result.Build()).ConfigureAwait(false);
|
||||
return await logChannel.SendMessageAsync(embed: result.Build(), mentions: Config.AllowedMentions.Nothing).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public static string GetMentionWithNickname(this DiscordMember member)
|
||||
|
||||
@@ -550,7 +550,7 @@ namespace CompatBot.Utils.ResultFormatters
|
||||
{
|
||||
var patchNames = items["patch_desc"];
|
||||
if (patchNames.Any())
|
||||
builder.AddField("Applied Game Patches", string.Join(", ", patchNames));
|
||||
builder.AddField("Applied Game Patch" + (patchNames.Length == 1 ? "" : "es"), string.Join(", ", patchNames));
|
||||
}
|
||||
private static void BuildMissingLicensesSection(DiscordEmbedBuilder builder, string serial, NameUniqueObjectCollection<string> items, List<string> generalNotes)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user