mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-20 00:43:36 +03:00
Fix UnknownMember warning flood
If a user was muted using the `MuteRole` method and then banned, the UnknownMember warning will flood your logs when `DateTimeOffset.UtcNow > data.MutedUntil` becomes true, because there is no user in the server to unmute. Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
This commit is contained in:
parent
3a3865ba3d
commit
cc0c7c31e8
1 changed files with 6 additions and 0 deletions
|
@ -134,6 +134,12 @@ public sealed partial class MemberUpdateService : BackgroundService
|
|||
|
||||
if (DateTimeOffset.UtcNow > data.MutedUntil)
|
||||
{
|
||||
var isOnServer = await _guildApi.GetGuildMemberAsync(guildId, id, ct);
|
||||
if (!isOnServer.IsSuccess)
|
||||
{
|
||||
return Result.FromSuccess();
|
||||
}
|
||||
|
||||
var unmuteResult = await _guildApi.ModifyGuildMemberAsync(
|
||||
guildId, id, roles: data.Roles.ConvertAll(r => r.ToSnowflake()),
|
||||
reason: Messages.PunishmentExpired.EncodeHeader(), ct: ct);
|
||||
|
|
Loading…
Add table
Reference in a new issue