diff --git a/Commands/CommandsBase.cs b/Commands/CommandsBase.cs index 8c6e127..a80b3e9 100644 --- a/Commands/CommandsBase.cs +++ b/Commands/CommandsBase.cs @@ -29,9 +29,7 @@ public class CommandsBase : InteractionModuleBase { /// protected static string TzPrint(string zone, bool use12hr) { var tzdb = DateTimeZoneProviders.Tzdb; - DateTimeZone tz = tzdb.GetZoneOrNull(zone)!; - if (tz == null) throw new Exception("Encountered unknown time zone: " + zone); - + DateTimeZone tz = tzdb.GetZoneOrNull(zone) ?? throw new Exception("Encountered unknown time zone: " + zone); var now = SystemClock.Instance.GetCurrentInstant().InZone(tz); var sortpfx = now.ToString("MMddHH", DateTimeFormatInfo.InvariantInfo); string fullstr; diff --git a/Commands/UserCommands.cs b/Commands/UserCommands.cs index d7c26ea..d967000 100644 --- a/Commands/UserCommands.cs +++ b/Commands/UserCommands.cs @@ -73,11 +73,10 @@ public class UserCommands : CommandsBase { return; } - // Order times by popularity to limit how many are shown, group by printed name + // Generate time and zone names to be displayed, group with associated user IDs var sortedlist = new SortedDictionary>(); var ampm = db.GuildSettings.Where(s => s.GuildId == Context.Guild.Id).SingleOrDefault()?.Use12HourTime ?? false; - foreach ((string area, List users) in userlist.OrderByDescending(o => o.Value.Count).Take(20)) { - // Filter further to top 20 distinct timezones, even if they are not displayed in the final result + foreach ((string area, List users) in userlist.OrderByDescending(o => o.Value.Count)) { var areaprint = TzPrint(area, ampm); if (!sortedlist.ContainsKey(areaprint)) sortedlist.Add(areaprint, new List()); sortedlist[areaprint].AddRange(users);