mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-13 01:00:12 +00:00
Create GetXXX utils wrapping try blocks
This commit is contained in:
parent
7fef8c1dde
commit
c87e67245d
8 changed files with 95 additions and 49 deletions
|
|
@ -106,13 +106,13 @@ namespace PluralKit.Bot {
|
|||
throw new PKSyntaxError($"Could not parse `{guildIdStr}` as an ID.");
|
||||
|
||||
// TODO: will this call break for sharding if you try to request a guild on a different bot instance?
|
||||
guild = await ctx.Rest.GetGuildAsync(guildId);
|
||||
guild = await ctx.Rest.GetGuild(guildId);
|
||||
if (guild == null)
|
||||
throw Errors.GuildNotFound(guildId);
|
||||
}
|
||||
|
||||
// Ensure people can't query guilds they're not in + get their own permissions (for view access checking)
|
||||
var senderGuildUser = await guild.GetMemberAsync(ctx.Author.Id);
|
||||
var senderGuildUser = await guild.GetMember(ctx.Author.Id);
|
||||
if (senderGuildUser == null)
|
||||
throw new PKError("You must be a member of the guild you are querying.");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue