diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fcfc9ac2..4bf72b020 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o +## [4.3.16] - 24.05.2023 + +### Fixed + +- Fixed missing events from `.logevents` +- Fixed `.log` thread deleted and thread created events not working properly + ## [4.3.15] - 21.05.2023 ### Fixed diff --git a/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommandService.cs b/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommandService.cs index 447bf2b1e..eb56ce2bb 100644 --- a/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommandService.cs +++ b/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommandService.cs @@ -150,9 +150,11 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor { try { - if (sch.HasValue || sch.Value is not IGuildChannel ch) + if (!sch.HasValue) return; + var ch = sch.Value; + if (!GuildLogSettings.TryGetValue(ch.Guild.Id, out var logSetting) || logSetting.ThreadDeletedId is null) return; @@ -165,7 +167,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor await logChannel.EmbedAsync(_eb.Create() .WithOkColor() - .WithTitle("🆕 " + title) + .WithTitle("🗑 " + title) .WithDescription($"{ch.Name} | {ch.Id}") .WithFooter(CurrentTime(ch.Guild))); } @@ -177,15 +179,12 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor return Task.CompletedTask; } - private Task _client_ThreadCreated(SocketThreadChannel sch) + private Task _client_ThreadCreated(SocketThreadChannel ch) { _ = Task.Run(async () => { try { - if (sch.Guild is not IGuildChannel ch) - return; - if (!GuildLogSettings.TryGetValue(ch.Guild.Id, out var logSetting) || logSetting.ThreadCreatedId is null) return; @@ -456,6 +455,12 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor case LogType.UserWarned: channelId = logSetting.LogWarnsId = logSetting.LogWarnsId is null ? cid : default; break; + case LogType.ThreadDeleted: + channelId = logSetting.ThreadDeletedId = logSetting.ThreadDeletedId is null ? cid : default; + break; + case LogType.ThreadCreated: + channelId = logSetting.ThreadCreatedId = logSetting.ThreadCreatedId is null ? cid : default; + break; } uow.SaveChanges(); @@ -1267,6 +1272,12 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor case LogType.UserWarned: id = logSetting.LogWarnsId; break; + case LogType.ThreadCreated: + id = logSetting.ThreadCreatedId; + break; + case LogType.ThreadDeleted: + id = logSetting.ThreadDeletedId; + break; } if (id is null or 0) diff --git a/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommands.cs b/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommands.cs index 1ddba679c..a4bf6eee5 100644 --- a/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommands.cs +++ b/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommands.cs @@ -143,6 +143,12 @@ public partial class Administration return l.LogVoicePresenceTTSId; case LogType.UserMuted: return l.UserMutedId; + case LogType.UserWarned: + return l.LogWarnsId; + case LogType.ThreadDeleted: + return l.ThreadDeletedId; + case LogType.ThreadCreated: + return l.ThreadCreatedId; default: return null; } diff --git a/src/NadekoBot/Services/Impl/StatsService.cs b/src/NadekoBot/Services/Impl/StatsService.cs index 60889186a..e85fb0a6f 100644 --- a/src/NadekoBot/Services/Impl/StatsService.cs +++ b/src/NadekoBot/Services/Impl/StatsService.cs @@ -7,7 +7,7 @@ namespace NadekoBot.Services; public sealed class StatsService : IStatsService, IReadyExecutor, INService { - public const string BOT_VERSION = "4.3.15"; + public const string BOT_VERSION = "4.3.16"; public string Author => "Kwoth#2452";