diff --git a/locale/Messages.resx b/locale/Messages.resx index 3e72a93..91e594f 100644 --- a/locale/Messages.resx +++ b/locale/Messages.resx @@ -600,4 +600,7 @@ All settings have been reset + + Jump to message: {0} + diff --git a/locale/Messages.ru.resx b/locale/Messages.ru.resx index 1682028..b7812a7 100644 --- a/locale/Messages.ru.resx +++ b/locale/Messages.ru.resx @@ -600,4 +600,7 @@ Все настройки были сброшены + + Открыть сообщение: {0} + diff --git a/locale/Messages.tt-ru.resx b/locale/Messages.tt-ru.resx index a13deb1..1847dad 100644 --- a/locale/Messages.tt-ru.resx +++ b/locale/Messages.tt-ru.resx @@ -600,4 +600,7 @@ откатываемся к заводским... + + чекнуть: {0} + diff --git a/src/Commands/BanCommandGroup.cs b/src/Commands/BanCommandGroup.cs index 25cd7e8..0ac5a36 100644 --- a/src/Commands/BanCommandGroup.cs +++ b/src/Commands/BanCommandGroup.cs @@ -133,10 +133,11 @@ public class BanCommandGroup : CommandGroup return await _feedback.SendContextualEmbedResultAsync(errorEmbed, ct); } - var builder = new StringBuilder().AppendLine(string.Format(Messages.DescriptionActionReason, reason)); + var builder = new StringBuilder().Append("- ") + .AppendLine(string.Format(Messages.DescriptionActionReason, reason)); if (duration is not null) { - builder.Append( + builder.Append("- ").Append( string.Format( Messages.DescriptionActionExpiresAt, Markdown.Timestamp(DateTimeOffset.UtcNow.Add(duration.Value)))); @@ -271,9 +272,10 @@ public class BanCommandGroup : CommandGroup .WithColour(ColorsList.Green).Build(); var title = string.Format(Messages.UserUnbanned, target.GetTag()); - var description = string.Format(Messages.DescriptionActionReason, reason); + var description = new StringBuilder().Append("- ") + .Append(string.Format(Messages.DescriptionActionReason, reason)); var logResult = _utility.LogActionAsync( - data.Settings, channelId, user, title, description, target, ColorsList.Green, ct: ct); + data.Settings, channelId, user, title, description.ToString(), target, ColorsList.Green, ct: ct); if (!logResult.IsSuccess) { return Result.FromError(logResult.Error); diff --git a/src/Messages.Designer.cs b/src/Messages.Designer.cs index 88da6c9..723c77c 100644 --- a/src/Messages.Designer.cs +++ b/src/Messages.Designer.cs @@ -1013,5 +1013,11 @@ namespace Boyfriend { return ResourceManager.GetString("AllSettingsReset", resourceCulture); } } + + internal static string DescriptionActionJumpToMessage { + get { + return ResourceManager.GetString("DescriptionActionJumpToMessage", resourceCulture); + } + } } } diff --git a/src/Responders/MessageEditedResponder.cs b/src/Responders/MessageEditedResponder.cs index 7e02f9f..d7e2347 100644 --- a/src/Responders/MessageEditedResponder.cs +++ b/src/Responders/MessageEditedResponder.cs @@ -1,3 +1,4 @@ +using System.Text; using Boyfriend.Data; using Boyfriend.Services; using DiffPlex.DiffBuilder; @@ -23,16 +24,13 @@ public class MessageEditedResponder : IResponder private readonly CacheService _cacheService; private readonly IDiscordRestChannelAPI _channelApi; private readonly GuildDataService _guildData; - private readonly IDiscordRestUserAPI _userApi; public MessageEditedResponder( - CacheService cacheService, IDiscordRestChannelAPI channelApi, GuildDataService guildData, - IDiscordRestUserAPI userApi) + CacheService cacheService, IDiscordRestChannelAPI channelApi, GuildDataService guildData) { _cacheService = cacheService; _channelApi = channelApi; _guildData = guildData; - _userApi = userApi; } public async Task RespondAsync(IMessageUpdate gatewayEvent, CancellationToken ct = default) @@ -92,20 +90,18 @@ public class MessageEditedResponder : IResponder // NOTE: Awaiting this might not even solve this if the same responder is called asynchronously _ = _channelApi.GetChannelMessageAsync(channelId, messageId, ct); - var currentUserResult = await _userApi.GetCurrentUserAsync(ct); - if (!currentUserResult.IsDefined(out var currentUser)) - { - return Result.FromError(currentUserResult); - } - var diff = InlineDiffBuilder.Diff(message.Content, newContent); Messages.Culture = GuildSettings.Language.Get(cfg); + var builder = new StringBuilder().AppendLine( + string.Format(Messages.DescriptionActionJumpToMessage, + $"https://discord.com/channels/{guildId}/{channelId}/{messageId}")) + .AppendLine(diff.AsMarkdown()); + var embed = new EmbedBuilder() .WithSmallTitle(string.Format(Messages.CachedMessageEdited, message.Author.GetTag()), message.Author) - .WithDescription($"https://discord.com/channels/{guildId}/{channelId}/{messageId}\n{diff.AsMarkdown()}") - .WithUserFooter(currentUser) + .WithDescription(builder.ToString()) .WithTimestamp(timestamp.Value) .WithColour(ColorsList.Yellow) .Build();