change: .greet / .bye will get properly disabled if the bot can't write to the specified channel

This commit is contained in:
Kwoth
2024-05-11 08:08:48 +00:00
parent 23c8dc00e8
commit c7cec25a29
2 changed files with 8 additions and 0 deletions

View File

@@ -2,6 +2,12 @@
Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o
## [5.0.6]
### Changed
- `.greet` and `.bye` will now be automatically disabled if the bot losses permissions to post in the specified channel
## [5.0.5] - 11.05.2024 ## [5.0.5] - 11.05.2024
### Fixed ### Fixed

View File

@@ -222,6 +222,7 @@ public class GreetService : INService, IReadyExecutor
toDelete.DeleteAfter(conf.AutoDeleteByeMessagesTimer); toDelete.DeleteAfter(conf.AutoDeleteByeMessagesTimer);
} }
catch (HttpException ex) when (ex.DiscordCode == DiscordErrorCode.InsufficientPermissions catch (HttpException ex) when (ex.DiscordCode == DiscordErrorCode.InsufficientPermissions
|| ex.DiscordCode == DiscordErrorCode.MissingPermissions
|| ex.DiscordCode == DiscordErrorCode.UnknownChannel) || ex.DiscordCode == DiscordErrorCode.UnknownChannel)
{ {
Log.Warning(ex, Log.Warning(ex,
@@ -263,6 +264,7 @@ public class GreetService : INService, IReadyExecutor
toDelete.DeleteAfter(conf.AutoDeleteGreetMessagesTimer); toDelete.DeleteAfter(conf.AutoDeleteGreetMessagesTimer);
} }
catch (HttpException ex) when (ex.DiscordCode == DiscordErrorCode.InsufficientPermissions catch (HttpException ex) when (ex.DiscordCode == DiscordErrorCode.InsufficientPermissions
|| ex.DiscordCode == DiscordErrorCode.MissingPermissions
|| ex.DiscordCode == DiscordErrorCode.UnknownChannel) || ex.DiscordCode == DiscordErrorCode.UnknownChannel)
{ {
Log.Warning(ex, Log.Warning(ex,