mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-19 16:33:36 +03:00
Do not clear BannedUntil if automatic unbanning wasn't successful
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
9c080d9691
commit
f4738e5dd4
2 changed files with 4 additions and 2 deletions
|
@ -163,6 +163,7 @@ public class BanCommandGroup : CommandGroup {
|
|||
/// was unbanned and vice-versa.
|
||||
/// </returns>
|
||||
/// <seealso cref="BanUserAsync" />
|
||||
/// <seealso cref="GuildUpdateService.TickGuildAsync"/>
|
||||
[Command("unban")]
|
||||
[RequireContext(ChannelContext.Guild)]
|
||||
[RequireDiscordPermission(DiscordPermission.BanMembers)]
|
||||
|
|
|
@ -33,9 +33,10 @@ public class GuildUpdateService : BackgroundService {
|
|||
|
||||
foreach (var memberData in data.MemberData.Values)
|
||||
if (DateTimeOffset.UtcNow > memberData.BannedUntil) {
|
||||
_ = _guildApi.RemoveGuildBanAsync(
|
||||
var unbanResult = await _guildApi.RemoveGuildBanAsync(
|
||||
guildId, memberData.Id.ToDiscordSnowflake(), Messages.PunishmentExpired.EncodeHeader(), ct);
|
||||
memberData.BannedUntil = null;
|
||||
if (unbanResult.IsSuccess)
|
||||
memberData.BannedUntil = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue