mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
Properly handle unauthorized log channel access
This commit is contained in:
parent
50b5a8fbee
commit
bb75519f6b
1 changed files with 3 additions and 2 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dapper;
|
||||
|
|
@ -53,9 +54,9 @@ namespace PluralKit.Bot {
|
|||
{
|
||||
return await _rest.GetChannelAsync(channel);
|
||||
}
|
||||
catch (NotFoundException)
|
||||
catch (Exception e) when (e is NotFoundException || e is UnauthorizedException)
|
||||
{
|
||||
// Channel doesn't exist, let's remove it from the database too
|
||||
// Channel doesn't exist or we don't have permission to access it, let's remove it from the database too
|
||||
_logger.Warning("Attempted to fetch missing log channel {LogChannel}, removing from database", channel);
|
||||
await using var conn = await _db.Obtain();
|
||||
await conn.ExecuteAsync("update servers set log_channel = null where server = @Guild",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue