Skip to content

Commit

Permalink
LanguageCodes command
Browse files Browse the repository at this point in the history
  • Loading branch information
Eptagone committed May 5, 2022
1 parent 5326558 commit 68b5a1f
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/SauceNao.Core/Bot/SauceNaoBot.CommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -730,5 +730,20 @@ private async Task StatisticsAsync(CancellationToken cancellationToken)
var stats = MSG.Statistics(Language, sucefullSearchCount, usersCount, groupCount);
await Api.SendMessageAsync(Message.Chat.Id, stats, ParseMode.HTML, replyToMessageId: Message.MessageId, allowSendingWithoutReply: true, cancellationToken: cancellationToken).ConfigureAwait(false);
}
private async Task LanguagesAsync(CancellationToken cancellationToken)
{
await Api.SendChatActionAsync(Message.Chat.Id, ChatAction.Typing, cancellationToken).ConfigureAwait(false);

var langs = _db.Users.GetAllUsers().GroupBy(u => u.LanguageCode).OrderByDescending(g => g.Count());

var values = string.Empty;
foreach (var l in langs)
{
values += string.Format("\n- <b>{0}</b> [{1}]", l.Key ?? "default", l.Count());
}

var text = string.Format(MSG.LanguageCodes(Language), values);
await Api.SendMessageAsync(Message.Chat.Id, text, ParseMode.HTML, replyToMessageId: Message.MessageId, allowSendingWithoutReply: true, cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
}
10 changes: 10 additions & 0 deletions src/SauceNao.Core/Resources/BotMessages.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/SauceNao.Core/Resources/BotMessages.ar.resx
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ Inline search results can take a few minutes to disappear because they are cache
<data name="InvalidPhoto" xml:space="preserve">
<value>That doesn't look like a photo file.</value>
</data>
<data name="LanguageCodes" xml:space="preserve">
<value>&lt;b&gt;Language Codes:&lt;/b&gt;
{0}</value>
</data>
<data name="LocalMode" xml:space="preserve">
<value>Bot is currently running in local mode, so this feature is disabled.</value>
</data>
Expand Down
4 changes: 4 additions & 0 deletions src/SauceNao.Core/Resources/BotMessages.es.resx
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ Los resultados de la búsqueda Inline pueden tardar unos minutos en desaparecer
<data name="InvalidPhoto" xml:space="preserve">
<value>Eso no parece un archivo de imagen.</value>
</data>
<data name="LanguageCodes" xml:space="preserve">
<value>&lt;b&gt;Códigos de languaje:&lt;/b&gt;
{0}</value>
</data>
<data name="LocalMode" xml:space="preserve">
<value>El bot se está ejecutando actualmente en modo local, por lo que esta función está deshabilitada.</value>
</data>
Expand Down
4 changes: 4 additions & 0 deletions src/SauceNao.Core/Resources/BotMessages.id.resx
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ Inline search results can take a few minutes to disappear because they are cache
<data name="InvalidPhoto" xml:space="preserve">
<value>That doesn't look like a photo file.</value>
</data>
<data name="LanguageCodes" xml:space="preserve">
<value>&lt;b&gt;Language Codes:&lt;/b&gt;
{0}</value>
</data>
<data name="LocalMode" xml:space="preserve">
<value>Bot sedang berjalan dalam mode lokal, jadi fitur ini dinonaktifkan.</value>
</data>
Expand Down
4 changes: 4 additions & 0 deletions src/SauceNao.Core/Resources/BotMessages.resx
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ Inline search results can take a few minutes to disappear because they are cache
<data name="InvalidPhoto" xml:space="preserve">
<value>That doesn't look like a photo file.</value>
</data>
<data name="LanguageCodes" xml:space="preserve">
<value>&lt;b&gt;Language Codes:&lt;/b&gt;
{0}</value>
</data>
<data name="LocalMode" xml:space="preserve">
<value>Bot is currently running in local mode, so this feature is disabled.</value>
</data>
Expand Down
4 changes: 4 additions & 0 deletions src/SauceNao.Core/Resources/BotMessages.zh-Hans.resx
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ The history will be erased periodically. If you want to delete your history righ
<data name="InvalidPhoto" xml:space="preserve">
<value>那看起来不像图像文件。</value>
</data>
<data name="LanguageCodes" xml:space="preserve">
<value>&lt;b&gt;Language Codes:&lt;/b&gt;
{0}</value>
</data>
<data name="LocalMode" xml:space="preserve">
<value>Bot is currently running in local mode, so this feature is disabled.</value>
</data>
Expand Down
5 changes: 5 additions & 0 deletions src/SauceNao.Core/Resources/MSG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ public static string InvalidPhoto(CultureInfo lang)
return Res.GetString(nameof(InvalidPhoto), lang);
}

public static string LanguageCodes(CultureInfo lang)
{
return Res.GetString(nameof(LanguageCodes), lang);
}

public static string LocalMode(CultureInfo lang)
{
return Res.GetString(nameof(LocalMode), lang);
Expand Down

0 comments on commit 68b5a1f

Please sign in to comment.