mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-12 16:50:10 +00:00
Consolidate conditionals
This commit is contained in:
parent
1138c1a2a9
commit
47fcfeca0f
1 changed files with 3 additions and 4 deletions
|
|
@ -94,7 +94,7 @@ namespace PluralKit.Bot {
|
||||||
public async Task PermCheckGuild(Context ctx)
|
public async Task PermCheckGuild(Context ctx)
|
||||||
{
|
{
|
||||||
DiscordGuild guild;
|
DiscordGuild guild;
|
||||||
DiscordMember senderGuildUser;
|
DiscordMember senderGuildUser = null;
|
||||||
|
|
||||||
if (ctx.Guild != null && !ctx.HasNext())
|
if (ctx.Guild != null && !ctx.HasNext())
|
||||||
{
|
{
|
||||||
|
|
@ -108,9 +108,8 @@ namespace PluralKit.Bot {
|
||||||
throw new PKSyntaxError($"Could not parse `{guildIdStr}` as an ID.");
|
throw new PKSyntaxError($"Could not parse `{guildIdStr}` as an ID.");
|
||||||
|
|
||||||
guild = ctx.Client.GetGuild(guildId);
|
guild = ctx.Client.GetGuild(guildId);
|
||||||
if (guild == null) throw Errors.GuildNotFound(guildId);
|
if (guild != null) senderGuildUser = await guild.GetMember(ctx.Author.Id);
|
||||||
senderGuildUser = await guild.GetMember(ctx.Author.Id);
|
if (guild == null || senderGuildUser == null) throw Errors.GuildNotFound(guildId);
|
||||||
if (senderGuildUser == null) throw Errors.GuildNotFound(guildId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var requiredPermissions = new []
|
var requiredPermissions = new []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue