Пример #1
0
        private static async Task checkBotAdmins()
        {
            if (!BotVarManager.GlobalBotVars.TryGetBotVar("botadmins", out botAdmins))
            {
                botAdmins = new ULongHashsetBotVar();
                Console.Write("BotCore could not find any bot admins. ");
                bool addedBotAdmin = false;
                while (!addedBotAdmin)
                {
                    Console.WriteLine("Enter a ulong Discord user Id:");
                    string botAdminId_str = Console.ReadLine();
                    if (ulong.TryParse(botAdminId_str, out ulong botAdminId))
                    {
                        botAdmins.Add(botAdminId);
                        BotVarManager.GlobalBotVars.SetBotVar("botadmins", botAdmins);
                        await BotVarManager.GlobalBotVars.CheckSaveBotVars();

                        addedBotAdmin = true;
                    }
                    else
                    {
                        Console.Write("Failed to parse entered value to a ulong user Id! ");
                    }
                }
            }
        }
Пример #2
0
        private static void OnBotVarUpdated(ulong guildId, BotVar var)
        {
            switch (var.Identifier)
            {
            case "botadmins":
                if (var.TryConvert(out ULongHashsetBotVar newBotAdmins))
                {
                    botAdmins = newBotAdmins;
                }
                break;

            case "embedcolor":
                if (var.TryConvert(out ColorBotVar color))
                {
                    EmbedColor = color.C;
                }
                break;
            }
        }