mirror of
https://github.com/RPCS3/discord-bot.git
synced 2025-04-17 04:12:24 +00:00
26 lines
584 B
C#
26 lines
584 B
C#
using PsnClient.Utils;
|
|
|
|
namespace CompatBot.Utils.Extensions;
|
|
|
|
public static class DiscordUserExtensions
|
|
{
|
|
public static bool IsBotSafeCheck(this DiscordUser? user)
|
|
{
|
|
try
|
|
{
|
|
return user?.IsBot ?? false;
|
|
}
|
|
catch (KeyNotFoundException)
|
|
{
|
|
return false;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Config.Log.Warn(e);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static string ToSaltedSha256(this DiscordUser user)
|
|
=> BitConverter.GetBytes(user.Id).GetSaltedHash().ToHexString();
|
|
} |