Add "you have nothing yet" feature to /status

This commit is contained in:
Basique Evangelist 2019-01-11 22:10:28 +03:00
parent 4c77b075c9
commit 2944ea150c
3 changed files with 14 additions and 7 deletions

View File

@ -30,6 +30,10 @@ namespace JetKarmaBot.Commands
// var awards = db.Awards.Where(x => x.ToId == asker.Id)
// .GroupBy(x => x.AwardTypeId)
// .Select(x => new { AwardTypeId = x.Key, Amount = x.Sum(y => y.Amount) });
if (!db.Awards.Any(x => x.ToId == asker.Id))
response = currentLocale["jetkarmabot.status.havenothing"];
else
{
var awardsQuery = from award in db.Awards
where award.ToId == asker.Id
group award by award.AwardTypeId into g
@ -39,6 +43,7 @@ namespace JetKarmaBot.Commands
+ string.Join("\n", awardsByType.Select(a => $" - {db.AwardTypes.Find(a.AwardTypeId).Symbol} {a.Amount}"));
}
}
else
{
var awardTypeIdQuery = from awt in db.AwardTypes

View File

@ -12,6 +12,7 @@
"jetkarmabot.award.statustext": "{0} is at {1}{2} now.",
"jetkarmabot.status.listalltext": "Your badges report:",
"jetkarmabot.status.listspecifictext": "You are at {0}{1} now.",
"jetkarmabot.status.havenothing": "You don't have anything yet.",
"jetkarmabot.changelocale.justchanged": "Roger that.",
"jetkarmabot.changelocale.getlocale": "I'm currently speaking English."
}

View File

@ -13,6 +13,7 @@
"jetkarmabot.award.statustext": "У {0} теперь {1}{2}.",
"jetkarmabot.status.listalltext": "У вас :",
"jetkarmabot.status.listspecifictext": "У вас сейчас {0}{1}.",
"jetkarmabot.status.havenothing": "У вас пока ничего нет.",
"jetkarmabot.changelocale.justchanged": "Так точно.",
"jetkarmabot.changelocale.getlocale": "Я сейчас говорю по-русски."
}