Compare commits

...

1 Commits

Author SHA1 Message Date
Kwoth
3f5443dd54 - Fixed .logevents and .log bugs related to thread logging
- Upped version to 4.3.16
- closes #418
2023-05-24 10:31:05 +02:00
4 changed files with 31 additions and 7 deletions

View File

@@ -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 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 ## [4.3.15] - 21.05.2023
### Fixed ### Fixed

View File

@@ -150,9 +150,11 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
{ {
try try
{ {
if (sch.HasValue || sch.Value is not IGuildChannel ch) if (!sch.HasValue)
return; return;
var ch = sch.Value;
if (!GuildLogSettings.TryGetValue(ch.Guild.Id, out var logSetting) if (!GuildLogSettings.TryGetValue(ch.Guild.Id, out var logSetting)
|| logSetting.ThreadDeletedId is null) || logSetting.ThreadDeletedId is null)
return; return;
@@ -165,7 +167,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
await logChannel.EmbedAsync(_eb.Create() await logChannel.EmbedAsync(_eb.Create()
.WithOkColor() .WithOkColor()
.WithTitle("🆕 " + title) .WithTitle("🗑 " + title)
.WithDescription($"{ch.Name} | {ch.Id}") .WithDescription($"{ch.Name} | {ch.Id}")
.WithFooter(CurrentTime(ch.Guild))); .WithFooter(CurrentTime(ch.Guild)));
} }
@@ -177,15 +179,12 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
return Task.CompletedTask; return Task.CompletedTask;
} }
private Task _client_ThreadCreated(SocketThreadChannel sch) private Task _client_ThreadCreated(SocketThreadChannel ch)
{ {
_ = Task.Run(async () => _ = Task.Run(async () =>
{ {
try try
{ {
if (sch.Guild is not IGuildChannel ch)
return;
if (!GuildLogSettings.TryGetValue(ch.Guild.Id, out var logSetting) if (!GuildLogSettings.TryGetValue(ch.Guild.Id, out var logSetting)
|| logSetting.ThreadCreatedId is null) || logSetting.ThreadCreatedId is null)
return; return;
@@ -456,6 +455,12 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
case LogType.UserWarned: case LogType.UserWarned:
channelId = logSetting.LogWarnsId = logSetting.LogWarnsId is null ? cid : default; channelId = logSetting.LogWarnsId = logSetting.LogWarnsId is null ? cid : default;
break; 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(); uow.SaveChanges();
@@ -1267,6 +1272,12 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
case LogType.UserWarned: case LogType.UserWarned:
id = logSetting.LogWarnsId; id = logSetting.LogWarnsId;
break; break;
case LogType.ThreadCreated:
id = logSetting.ThreadCreatedId;
break;
case LogType.ThreadDeleted:
id = logSetting.ThreadDeletedId;
break;
} }
if (id is null or 0) if (id is null or 0)

View File

@@ -143,6 +143,12 @@ public partial class Administration
return l.LogVoicePresenceTTSId; return l.LogVoicePresenceTTSId;
case LogType.UserMuted: case LogType.UserMuted:
return l.UserMutedId; return l.UserMutedId;
case LogType.UserWarned:
return l.LogWarnsId;
case LogType.ThreadDeleted:
return l.ThreadDeletedId;
case LogType.ThreadCreated:
return l.ThreadCreatedId;
default: default:
return null; return null;
} }

View File

@@ -7,7 +7,7 @@ namespace NadekoBot.Services;
public sealed class StatsService : IStatsService, IReadyExecutor, INService 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 public string Author
=> "Kwoth#2452"; => "Kwoth#2452";