Translate rank command
This commit is contained in:
parent
92c2d173eb
commit
5109cc03a4
3 changed files with 28 additions and 8 deletions
|
@ -74,7 +74,7 @@ namespace Geekbot.net.Commands.Rpg
|
|||
|
||||
[Command("give", RunMode = RunMode.Async)]
|
||||
[Summary("Give cookies to someone")]
|
||||
public async Task GiveACookie([Summary("User")] IUser user, [Summary("amount")] int amount)
|
||||
public async Task GiveACookie([Summary("User")] IUser user, [Summary("amount")] int amount = 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -10,6 +10,7 @@ using Geekbot.net.Lib.Converters;
|
|||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using Geekbot.net.Lib.Extensions;
|
||||
using Geekbot.net.Lib.Highscores;
|
||||
using Geekbot.net.Lib.Localization;
|
||||
using Geekbot.net.Lib.UserRepository;
|
||||
|
||||
namespace Geekbot.net.Commands.User.Ranking
|
||||
|
@ -18,18 +19,20 @@ namespace Geekbot.net.Commands.User.Ranking
|
|||
{
|
||||
private readonly IEmojiConverter _emojiConverter;
|
||||
private readonly IHighscoreManager _highscoreManager;
|
||||
private readonly ITranslationHandler _translationHandler;
|
||||
private readonly IErrorHandler _errorHandler;
|
||||
private readonly DatabaseContext _database;
|
||||
private readonly IUserRepository _userRepository;
|
||||
|
||||
public Rank(DatabaseContext database, IErrorHandler errorHandler, IUserRepository userRepository,
|
||||
IEmojiConverter emojiConverter, IHighscoreManager highscoreManager)
|
||||
IEmojiConverter emojiConverter, IHighscoreManager highscoreManager, ITranslationHandler translationHandler)
|
||||
{
|
||||
_database = database;
|
||||
_errorHandler = errorHandler;
|
||||
_userRepository = userRepository;
|
||||
_emojiConverter = emojiConverter;
|
||||
_highscoreManager = highscoreManager;
|
||||
_translationHandler = translationHandler;
|
||||
}
|
||||
|
||||
[Command("rank", RunMode = RunMode.Async)]
|
||||
|
@ -39,6 +42,7 @@ namespace Geekbot.net.Commands.User.Ranking
|
|||
{
|
||||
try
|
||||
{
|
||||
var transContext = await _translationHandler.GetGuildContext(Context);
|
||||
HighscoreTypes type;
|
||||
try
|
||||
{
|
||||
|
@ -46,14 +50,14 @@ namespace Geekbot.net.Commands.User.Ranking
|
|||
}
|
||||
catch
|
||||
{
|
||||
await ReplyAsync("Valid types are '`messages`' '`karma`', '`rolls`' and '`cookies`'");
|
||||
await ReplyAsync(transContext.GetString("InvalidType"));
|
||||
return;
|
||||
}
|
||||
|
||||
var replyBuilder = new StringBuilder();
|
||||
if (amount > 20)
|
||||
{
|
||||
replyBuilder.AppendLine(":warning: Limiting to 20\n");
|
||||
await ReplyAsync(transContext.GetString("LimitingTo20Warning"));
|
||||
amount = 20;
|
||||
}
|
||||
|
||||
|
@ -65,7 +69,7 @@ namespace Geekbot.net.Commands.User.Ranking
|
|||
}
|
||||
catch (HighscoreListEmptyException)
|
||||
{
|
||||
await ReplyAsync($"No {type} found on this server");
|
||||
await ReplyAsync(transContext.GetString("NoTypeFoundForServer", type));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -80,8 +84,8 @@ namespace Geekbot.net.Commands.User.Ranking
|
|||
|
||||
var failedToRetrieveUser = highscoreUsers.Any(e => string.IsNullOrEmpty(e.Key.Username));
|
||||
|
||||
if (failedToRetrieveUser) replyBuilder.AppendLine(":warning: I couldn't find all usernames. Maybe they left the server?\n");
|
||||
replyBuilder.AppendLine($":bar_chart: **{type.ToString().CapitalizeFirst()} Highscore for {Context.Guild.Name}**");
|
||||
if (failedToRetrieveUser) replyBuilder.AppendLine(transContext.GetString("FailedToResolveAllUsernames"));
|
||||
replyBuilder.AppendLine(transContext.GetString("HighscoresFor", type.ToString().CapitalizeFirst(), Context.Guild.Name));
|
||||
var highscorePlace = 1;
|
||||
foreach (var user in highscoreUsers)
|
||||
{
|
||||
|
|
|
@ -156,4 +156,20 @@ quote:
|
|||
CHDE: "**#{0} glöscht**"
|
||||
NotFoundWithId:
|
||||
EN: "I couldn't find a quote with that ID :disappointed:"
|
||||
CHDE: "Ich chan kei quote finde mit därri ID :disappointed:"
|
||||
CHDE: "Ich chan kei quote finde mit därri ID :disappointed:"
|
||||
rank:
|
||||
InvalidType:
|
||||
EN: "Valid types are '`messages`' '`karma`', '`rolls`' and '`cookies`'"
|
||||
CHDE: "Gültigi paramenter sind '`messages`' '`karma`', '`rolls`' und '`cookies`'"
|
||||
LimitingTo20Warning:
|
||||
EN: ":warning: Limiting to 20\n"
|
||||
CHDE: ":warning: Limitiert uf 20\n"
|
||||
NoTypeFoundForServer:
|
||||
EN: "No {0} found on this server"
|
||||
CHDE: "Kei {0} gfunde für dä server"
|
||||
FailedToResolveAllUsernames:
|
||||
EN: ":warning: I couldn't find all usernames. Maybe they left the server?\n"
|
||||
CHDE: ":warning: Ich han nid alli benutzername gfunde. villiicht hend sie de server verlah?\n"
|
||||
HighscoresFor:
|
||||
EN: ":bar_chart: **{0} Highscore for {1}**"
|
||||
CHDE: ":bar_chart: **{0} Highscore für {1}**"
|
Loading…
Reference in a new issue