Skip to content

Commit

Permalink
Merge pull request #57 from SahneeDEV/httprequestexception
Browse files Browse the repository at this point in the history
Fixed. Handle HttpRequestExceptions
  • Loading branch information
Patrick Sachs authored Oct 14, 2022
2 parents 691faf8 + 4243fd6 commit ccc4812
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions SahneeBot/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 1.0.2

Fixed an internal error that occurred when the bot does not have permission to post a changelog after a new release. Instead of throwing an error, admins will now be notified about the bot missing permissions.

## 1.0.1

The Sahnee-Bot is currently generating an increased amount of errors related to changelog permissions.
Expand Down
6 changes: 6 additions & 0 deletions SahneeBot/SahneeBotDiscordError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ public struct ErrorOptions
var prefix = await GetGuildPrefix(ctx, options.GuildId);
return GetMissingRolePermissionsError<T>(prefix, options.Hint);
}
// Missing permissions? Not sure how this one can be provoked, but it happens on some guilds
case HttpRequestException:
{
var prefix = await GetGuildPrefix(ctx, options.GuildId);
return GetMissingRolePermissionsError<T>(prefix, options.Hint);
}
default:
{
return null;
Expand Down
2 changes: 1 addition & 1 deletion SahneeBot/Tasks/SahneeBotPostChangelogsToGuildTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public override async Task<ISuccess<uint>> Execute(ITaskContext ctx, Args arg)
, new SahneeBotDiscordError.ErrorOptions {
Exception = exception
, GuildId = guildId
, Hint = $"Could not post a message in the channel {channel.Mention}."
, Hint = $"Could not post a changelog message in the channel {channel.Mention}."
});
if (error != null)
{
Expand Down

0 comments on commit ccc4812

Please sign in to comment.