Support new username format

This commit is contained in:
Noi 2023-09-09 10:42:08 -07:00
parent 2861b579b4
commit aa3907466c
3 changed files with 14 additions and 6 deletions

View file

@ -66,12 +66,19 @@ public class CommandsBase : InteractionModuleBase<ShardedInteractionContext> {
return result.ToString(); return result.ToString();
} }
if (user.DiscriminatorValue == 0) {
if (user.Nickname != null) {
return $"**{escapeFormattingCharacters(user.Nickname)}** ({escapeFormattingCharacters(user.ToString())})";
}
return user.ToString();
} else {
var username = escapeFormattingCharacters(user.Username); var username = escapeFormattingCharacters(user.Username);
if (user.Nickname != null) { if (user.Nickname != null) {
return $"**{escapeFormattingCharacters(user.Nickname)}** ({username}#{user.Discriminator})"; return $"**{escapeFormattingCharacters(user.Nickname)}** ({username}#{user.Discriminator})";
} }
return $"**{username}**#{user.Discriminator}"; return $"**{username}**#{user.Discriminator}";
} }
}
/// <summary> /// <summary>
/// Checks if the member cache for the specified guild needs to be filled, and sends a request if needed. /// Checks if the member cache for the specified guild needs to be filled, and sends a request if needed.

View file

@ -41,7 +41,8 @@ internal class WorldTime : IDisposable {
MessageCacheSize = 0, // disable message cache MessageCacheSize = 0, // disable message cache
GatewayIntents = GatewayIntents.Guilds | GatewayIntents.GuildMembers, GatewayIntents = GatewayIntents.Guilds | GatewayIntents.GuildMembers,
SuppressUnknownDispatchWarnings = true, SuppressUnknownDispatchWarnings = true,
LogGatewayIntentWarnings = false LogGatewayIntentWarnings = false,
FormatUsersInBidirectionalUnicode = false
}; };
_services = new ServiceCollection() _services = new ServiceCollection()
.AddSingleton(new DiscordShardedClient(clientConf)) .AddSingleton(new DiscordShardedClient(clientConf))

View file

@ -11,7 +11,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" /> <PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Discord.Net" Version="3.9.0" /> <PackageReference Include="Discord.Net" Version="3.12.0" />
<PackageReference Include="EFCore.NamingConventions" Version="7.0.2" /> <PackageReference Include="EFCore.NamingConventions" Version="7.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.2"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.2">