fix error message on invalid guild ID

This commit is contained in:
spiral
2021-04-19 21:38:03 +01:00
parent a2d2036851
commit 85615b3f68
2 changed files with 7 additions and 2 deletions

View File

@@ -126,7 +126,12 @@ namespace PluralKit.Bot {
if (!ulong.TryParse(guildIdStr, out var guildId))
throw new PKSyntaxError($"Could not parse {guildIdStr.AsCode()} as an ID.");
guild = await _rest.GetGuild(guildId);
try {
guild = await _rest.GetGuild(guildId);
} catch (Myriad.Rest.Exceptions.ForbiddenException) {
throw Errors.GuildNotFound(guildId);
}
if (guild != null)
senderGuildUser = await _rest.GetGuildMember(guildId, ctx.Author.Id);
if (guild == null || senderGuildUser == null)