mirror of
https://github.com/Jetsparrow/karmabot.git
synced 2026-01-21 09:06:09 +03:00
Add "you have nothing yet" feature to /status
This commit is contained in:
parent
4aee536c63
commit
3e7ace4a7e
@ -30,14 +30,19 @@ namespace JetKarmaBot.Commands
|
|||||||
// var awards = db.Awards.Where(x => x.ToId == asker.Id)
|
// var awards = db.Awards.Where(x => x.ToId == asker.Id)
|
||||||
// .GroupBy(x => x.AwardTypeId)
|
// .GroupBy(x => x.AwardTypeId)
|
||||||
// .Select(x => new { AwardTypeId = x.Key, Amount = x.Sum(y => y.Amount) });
|
// .Select(x => new { AwardTypeId = x.Key, Amount = x.Sum(y => y.Amount) });
|
||||||
var awardsQuery = from award in db.Awards
|
if (!db.Awards.Any(x => x.ToId == asker.Id))
|
||||||
where award.ToId == asker.Id
|
response = currentLocale["jetkarmabot.status.havenothing"];
|
||||||
group award by award.AwardTypeId into g
|
else
|
||||||
select new { AwardTypeId = g.Key, Amount = g.Sum(x => x.Amount) };
|
{
|
||||||
var awardsByType = awardsQuery.ToList();
|
var awardsQuery = from award in db.Awards
|
||||||
response = currentLocale["jetkarmabot.status.listalltext"] + "\n"
|
where award.ToId == asker.Id
|
||||||
+ string.Join("\n", awardsByType.Select(a => $" - {db.AwardTypes.Find(a.AwardTypeId).Symbol} {a.Amount}"));
|
group award by award.AwardTypeId into g
|
||||||
|
select new { AwardTypeId = g.Key, Amount = g.Sum(x => x.Amount) };
|
||||||
|
var awardsByType = awardsQuery.ToList();
|
||||||
|
response = currentLocale["jetkarmabot.status.listalltext"] + "\n"
|
||||||
|
+ string.Join("\n", awardsByType.Select(a => $" - {db.AwardTypes.Find(a.AwardTypeId).Symbol} {a.Amount}"));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
"jetkarmabot.award.statustext": "{0} is at {1}{2} now.",
|
"jetkarmabot.award.statustext": "{0} is at {1}{2} now.",
|
||||||
"jetkarmabot.status.listalltext": "Your badges report:",
|
"jetkarmabot.status.listalltext": "Your badges report:",
|
||||||
"jetkarmabot.status.listspecifictext": "You are at {0}{1} now.",
|
"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.justchanged": "Roger that.",
|
||||||
"jetkarmabot.changelocale.getlocale": "I'm currently speaking English."
|
"jetkarmabot.changelocale.getlocale": "I'm currently speaking English."
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
"jetkarmabot.award.statustext": "У {0} теперь {1}{2}.",
|
"jetkarmabot.award.statustext": "У {0} теперь {1}{2}.",
|
||||||
"jetkarmabot.status.listalltext": "У вас :",
|
"jetkarmabot.status.listalltext": "У вас :",
|
||||||
"jetkarmabot.status.listspecifictext": "У вас сейчас {0}{1}.",
|
"jetkarmabot.status.listspecifictext": "У вас сейчас {0}{1}.",
|
||||||
|
"jetkarmabot.status.havenothing": "У вас пока ничего нет.",
|
||||||
"jetkarmabot.changelocale.justchanged": "Так точно.",
|
"jetkarmabot.changelocale.justchanged": "Так точно.",
|
||||||
"jetkarmabot.changelocale.getlocale": "Я сейчас говорю по-русски."
|
"jetkarmabot.changelocale.getlocale": "Я сейчас говорю по-русски."
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user