Skip to content

Commit

Permalink
Remove unnecessary whitespaces at the end of reactions in PlainText (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
xs2237 committed Mar 21, 2024
1 parent 72f02cd commit 6d1e8c2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions DiscordChatExporter.Core/Exporting/PlainTextMessageWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Threading.Tasks;
using DiscordChatExporter.Core.Discord.Data;
using DiscordChatExporter.Core.Discord.Data.Embeds;
using DiscordChatExporter.Core.Utils.Extensions;

namespace DiscordChatExporter.Core.Exporting;

Expand Down Expand Up @@ -172,18 +173,21 @@ await Context.ResolveAssetUrlAsync(sticker.SourceUrl, cancellationToken)

await _writer.WriteLineAsync("{Reactions}");

foreach (var reaction in reactions)
foreach (var (reaction, i) in reactions.WithIndex())
{
cancellationToken.ThrowIfCancellationRequested();

if (i > 0)
{
await _writer.WriteAsync(' ');
}

await _writer.WriteAsync(reaction.Emoji.Name);

if (reaction.Count > 1)
{
await _writer.WriteAsync($" ({reaction.Count})");
}

await _writer.WriteAsync(' ');
}

await _writer.WriteLineAsync();
Expand Down

0 comments on commit 6d1e8c2

Please sign in to comment.