Upgrade DSharpPlus version to 4.0.0-nightly-00707

This fixes passing an empty mention array to SendMessageAsync, making our workaround obsolete
This commit is contained in:
Ske 2020-06-21 15:11:18 +02:00
parent a31782864d
commit 34f4ff4e1b
2 changed files with 4 additions and 7 deletions

View File

@ -10,8 +10,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DSharpPlus" Version="4.0.0-nightly-00697" /> <PackageReference Include="DSharpPlus" Version="4.0.0-nightly-00707" />
<PackageReference Include="DSharpPlus.Rest" Version="4.0.0-nightly-00697" /> <PackageReference Include="DSharpPlus.Rest" Version="4.0.0-nightly-00707" />
<PackageReference Include="Humanizer.Core" Version="2.7.9" /> <PackageReference Include="Humanizer.Core" Version="2.7.9" />
<PackageReference Include="Sentry" Version="2.0.0-beta7" /> <PackageReference Include="Sentry" Version="2.0.0-beta7" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0007" /> <PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0007" />

View File

@ -106,12 +106,9 @@ namespace PluralKit.Bot
return input?.Replace("%20", "+"); return input?.Replace("%20", "+");
} }
// Passing an empty list (counter-intuitively) *allows* all mentions through (even if non-null)
// So we add a single "bogus" user mention for ID=1 that'll never actually resolve, and thus block all (other) mentions
private static readonly IEnumerable<IMention> DenyAllMentions = new IMention[] {new UserMention(1)};
public static Task<DiscordMessage> SendMessageFixedAsync(this DiscordChannel channel, string content = null, DiscordEmbed embed = null, IEnumerable<IMention> mentions = null) => public static Task<DiscordMessage> SendMessageFixedAsync(this DiscordChannel channel, string content = null, DiscordEmbed embed = null, IEnumerable<IMention> mentions = null) =>
channel.SendMessageAsync(content, embed: embed, mentions: mentions ?? DenyAllMentions); // Passing an empty list blocks all mentions by default (null allows all through)
channel.SendMessageAsync(content, embed: embed, mentions: mentions ?? new IMention[0]);
// This doesn't do anything by itself (DiscordMember.SendMessageAsync doesn't take a mentions argument) // This doesn't do anything by itself (DiscordMember.SendMessageAsync doesn't take a mentions argument)
// It's just here for consistency so we don't use the standard SendMessageAsync method >.> // It's just here for consistency so we don't use the standard SendMessageAsync method >.>