1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-05-03 04:29:54 +03:00

List supported languages if an invalid one is provided

This commit is contained in:
mctaylors 2022-12-08 22:42:17 +03:00
parent 8c90b8d9cc
commit 9df4f72f9d
6 changed files with 933 additions and 732 deletions

View file

@ -1,4 +1,6 @@
using Discord;
using System.Collections.Generic;
using System.Globalization;
namespace Boyfriend.Commands;
@ -111,7 +113,11 @@ public sealed class SettingsCommand : ICommand {
}
if (selectedSetting is "Lang" && !Utils.CultureInfoCache.ContainsKey(value)) {
cmd.Reply(Messages.LanguageNotSupported, ReplyEmojis.Error);
var langNotSupported = Boyfriend.StringBuilder.Append($"{Messages.LanguageNotSupported} ");
foreach (var lang in Utils.CultureInfoCache) langNotSupported.Append($"`{lang.Key}`, ");
langNotSupported.Remove(langNotSupported.Length-2, 2);
cmd.Reply(langNotSupported.ToString(), ReplyEmojis.Error);
langNotSupported.Clear();
return Task.CompletedTask;
}