From a38951b5ad5471184a8cf3cfbf9182665d545393 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Fri, 17 Dec 2021 16:26:06 +0100 Subject: [PATCH] atl will no longer post the translation if it's equivalent to the input message updated packages --- .../NadekoBot.Coordinator.csproj | 4 +-- src/NadekoBot.Tests/NadekoBot.Tests.csproj | 2 +- .../Searches/Services/TranslateService.cs | 6 +++- src/NadekoBot/NadekoBot.csproj | 34 +++++++++---------- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/NadekoBot.Coordinator/NadekoBot.Coordinator.csproj b/src/NadekoBot.Coordinator/NadekoBot.Coordinator.csproj index cd7078d7a..4bafbe55c 100644 --- a/src/NadekoBot.Coordinator/NadekoBot.Coordinator.csproj +++ b/src/NadekoBot.Coordinator/NadekoBot.Coordinator.csproj @@ -9,9 +9,9 @@ - + - + diff --git a/src/NadekoBot.Tests/NadekoBot.Tests.csproj b/src/NadekoBot.Tests/NadekoBot.Tests.csproj index 01a070066..a758e2934 100644 --- a/src/NadekoBot.Tests/NadekoBot.Tests.csproj +++ b/src/NadekoBot.Tests/NadekoBot.Tests.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/NadekoBot/Modules/Searches/Services/TranslateService.cs b/src/NadekoBot/Modules/Searches/Services/TranslateService.cs index 8a855071d..c725793cd 100644 --- a/src/NadekoBot/Modules/Searches/Services/TranslateService.cs +++ b/src/NadekoBot/Modules/Searches/Services/TranslateService.cs @@ -56,6 +56,9 @@ namespace NadekoBot.Modules.Searches public async Task LateExecute(IGuild guild, IUserMessage msg) { + if (string.IsNullOrWhiteSpace(msg.Content)) + return; + if (msg is IUserMessage { Channel: ITextChannel tch } um) { if (!_atcs.TryGetValue(tch.Id, out var autoDelete)) @@ -67,7 +70,8 @@ namespace NadekoBot.Modules.Searches var output = await _google.Translate(msg.Content, langs.From, langs.To); - if (string.IsNullOrWhiteSpace(output)) + if (string.IsNullOrWhiteSpace(output) + || msg.Content.Equals(output, StringComparison.InvariantCultureIgnoreCase)) return; var embed = _eb.Create() diff --git a/src/NadekoBot/NadekoBot.csproj b/src/NadekoBot/NadekoBot.csproj index e92ebbdcb..84e48d20e 100644 --- a/src/NadekoBot/NadekoBot.csproj +++ b/src/NadekoBot/NadekoBot.csproj @@ -9,29 +9,29 @@ - - + + - + - + - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + @@ -44,15 +44,13 @@ - - - + + + - - + - - +