Remove all in-command usages of GetDict for translations

This commit is contained in:
runebaas 2019-05-12 00:44:25 +02:00
parent 0f0c0684c6
commit 67add36e51
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6
3 changed files with 9 additions and 9 deletions

View file

@ -134,8 +134,8 @@ namespace Geekbot.net.Commands.Admin
_database.GuildSettings.Update(guild); _database.GuildSettings.Update(guild);
await _database.SaveChangesAsync(); await _database.SaveChangesAsync();
var trans = await _translation.GetDict(Context); var transContext = await _translation.GetGuildContext(Context);
await ReplyAsync(trans["NewLanguageSet"]); await ReplyAsync(transContext.GetString("NewLanguageSet"));
return; return;
} }

View file

@ -39,7 +39,7 @@ namespace Geekbot.net.Commands.Games
var number = _randomNumberGenerator.Next(1, 100); var number = _randomNumberGenerator.Next(1, 100);
var guess = 1000; var guess = 1000;
int.TryParse(stuff, out guess); int.TryParse(stuff, out guess);
var transDict = await _translation.GetDict(Context); var transContext = await _translation.GetGuildContext(Context);
if (guess <= 100 && guess > 0) if (guess <= 100 && guess > 0)
{ {
var prevRoll = _redis.Db.HashGet($"{Context.Guild.Id}:RollsPrevious2", Context.Message.Author.Id).ToString()?.Split('|'); var prevRoll = _redis.Db.HashGet($"{Context.Guild.Id}:RollsPrevious2", Context.Message.Author.Id).ToString()?.Split('|');
@ -47,17 +47,17 @@ namespace Geekbot.net.Commands.Games
{ {
if (prevRoll[0] == guess.ToString() && DateTime.Parse(prevRoll[1]) > DateTime.Now.AddDays(-1)) if (prevRoll[0] == guess.ToString() && DateTime.Parse(prevRoll[1]) > DateTime.Now.AddDays(-1))
{ {
await ReplyAsync(string.Format(transDict["NoPrevGuess"], Context.Message.Author.Mention)); await ReplyAsync(transContext.GetString("NoPrevGuess", Context.Message.Author.Mention));
return; return;
} }
} }
_redis.Db.HashSet($"{Context.Guild.Id}:RollsPrevious2", new[] {new HashEntry(Context.Message.Author.Id, $"{guess}|{DateTime.Now}")}); _redis.Db.HashSet($"{Context.Guild.Id}:RollsPrevious2", new[] {new HashEntry(Context.Message.Author.Id, $"{guess}|{DateTime.Now}")});
await ReplyAsync(string.Format(transDict["Rolled"], Context.Message.Author.Mention, number, guess)); await ReplyAsync(transContext.GetString("Rolled", Context.Message.Author.Mention, number, guess));
if (guess == number) if (guess == number)
{ {
await ReplyAsync(string.Format(transDict["Gratz"], Context.Message.Author)); await ReplyAsync(transContext.GetString("Gratz", Context.Message.Author));
_redis.Db.HashIncrement($"{Context.Guild.Id}:Rolls", Context.User.Id.ToString()); _redis.Db.HashIncrement($"{Context.Guild.Id}:Rolls", Context.User.Id.ToString());
var user = await GetUser(Context.User.Id); var user = await GetUser(Context.User.Id);
user.Rolls += 1; user.Rolls += 1;
@ -67,7 +67,7 @@ namespace Geekbot.net.Commands.Games
} }
else else
{ {
await ReplyAsync(string.Format(transDict["RolledNoGuess"], Context.Message.Author.Mention, number)); await ReplyAsync(transContext.GetString("RolledNoGuess", Context.Message.Author.Mention, number));
} }
} }
catch (Exception e) catch (Exception e)

View file

@ -24,10 +24,10 @@ namespace Geekbot.net.Commands.Utils
{ {
try try
{ {
var transDict = await _translation.GetDict(Context); var transContext = await _translation.GetGuildContext(Context);
var choicesArray = choices.Split(';'); var choicesArray = choices.Split(';');
var choice = new Random().Next(choicesArray.Length); var choice = new Random().Next(choicesArray.Length);
await ReplyAsync(string.Format(transDict["Choice"], choicesArray[choice])); await ReplyAsync(transContext.GetString("Choice", choicesArray[choice]));
} }
catch (Exception e) catch (Exception e)
{ {