mirror of
https://github.com/RPCS3/discord-bot.git
synced 2025-03-04 15:57:43 +00:00
fix potential exception
This commit is contained in:
parent
7f704bbf10
commit
3d93339698
@ -10,18 +10,30 @@ namespace CompatBot.Utils
|
||||
{
|
||||
public static bool IsWhitelisted(this DiscordUser user, DiscordClient client, DiscordGuild guild = null)
|
||||
{
|
||||
if (user == null)
|
||||
return false;
|
||||
|
||||
if (ModProvider.IsMod(user.Id))
|
||||
return true;
|
||||
|
||||
if (client == null)
|
||||
return false;
|
||||
|
||||
var member = guild == null ? client.GetMember(user) : client.GetMember(guild, user);
|
||||
return member?.Roles.IsWhitelisted() ?? false;
|
||||
}
|
||||
|
||||
public static bool IsSmartlisted(this DiscordUser user, DiscordClient client, DiscordGuild guild = null)
|
||||
{
|
||||
if (user == null)
|
||||
return false;
|
||||
|
||||
if (ModProvider.IsMod(user.Id))
|
||||
return true;
|
||||
|
||||
if (client == null)
|
||||
return false;
|
||||
|
||||
var member = guild == null ? client.GetMember(user) : client.GetMember(guild, user);
|
||||
return member?.Roles.IsSmartlisted() ?? false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user