added a title on .whosplaying output

This commit is contained in:
Toastie 2025-03-15 11:23:15 +13:00
parent 73db4e59c2
commit 0a57edfcb3
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7
2 changed files with 9 additions and 5 deletions
src/EllieBot
Modules/Utility
strings/responses

View file

@ -112,12 +112,13 @@ public partial class Utility : EllieModule
return; return;
} }
var userNames = new List<IUser>(socketGuild.Users.Count / 100); var userNames = new List<IUser>(socketGuild.Users.Count / 100);
foreach (var user in socketGuild.Users) foreach (var user in socketGuild.Users)
{ {
if (user.Activities.Any(x => x.Name is not null && x.Name.ToUpperInvariant() == game)) var activity = user.Activities.FirstOrDefault(x => x.Name is not null && x.Name.ToUpperInvariant() == game);
if (activity is not null)
{ {
game = activity.Name;
userNames.Add(user); userNames.Add(user);
} }
} }
@ -129,6 +130,9 @@ public partial class Utility : EllieModule
.PageSize(20) .PageSize(20)
.Page((names, _) => .Page((names, _) =>
{ {
var eb = CreateEmbed()
.WithTitle(GetText(strs.whos_playing_game(userNames.Count, game)));
if (names.Count == 0) if (names.Count == 0)
{ {
return CreateEmbed() return CreateEmbed()
@ -136,8 +140,7 @@ public partial class Utility : EllieModule
.WithDescription(GetText(strs.nobody_playing_game)); .WithDescription(GetText(strs.nobody_playing_game));
} }
var eb = CreateEmbed() eb = eb.WithOkColor();
.WithOkColor();
var users = names.Join('\n'); var users = names.Join('\n');

View file

@ -1203,5 +1203,6 @@
"userrole_icon_fail": "Failed to set the role icon.", "userrole_icon_fail": "Failed to set the role icon.",
"userrole_icon_invalid": "The role icon cannot be empty.", "userrole_icon_invalid": "The role icon cannot be empty.",
"userrole_hierarchy_error": "You can't assign or modify roles that are higher than or equal to your, or bots highest role.", "userrole_hierarchy_error": "You can't assign or modify roles that are higher than or equal to your, or bots highest role.",
"userrole_role_not_exists": "That role doesn't exist." "userrole_role_not_exists": "That role doesn't exist.",
"whos_playing_game": "{0} users are playing {1}"
} }