From 03396642a459520735e905000157718c7df57812 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Sun, 3 Jul 2022 17:03:27 +0200 Subject: [PATCH] Added ban reason to .log userbanned (and if you used nadeko to ban someone, it will also show the mod who did the ban because nadeko adds it to the reason) --- .../ServerLog/ServerLogCommandService.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommandService.cs b/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommandService.cs index 832b96b4c..f60d10e42 100644 --- a/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommandService.cs +++ b/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommandService.cs @@ -945,11 +945,25 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor ITextChannel? logChannel; if ((logChannel = await TryGetLogChannel(guild, logSetting, LogType.UserBanned)) == null) return; + + + string? reason = null; + try + { + var ban = await guild.GetBanAsync(usr); + reason = ban?.Reason; + } + catch + { + + } + var embed = _eb.Create() .WithOkColor() .WithTitle("🚫 " + GetText(logChannel.Guild, strs.user_banned)) .WithDescription(usr.ToString()!) .AddField("Id", usr.Id.ToString()) + .AddField("Reason", string.IsNullOrWhiteSpace(reason) ? "-" : reason) .WithFooter(CurrentTime(guild)); var avatarUrl = usr.GetAvatarUrl();