示例#1
0
        private static void ExitCleanUp(object o, EventArgs e)
        {
            Logger.LogAdmin("Exiting DreadBot. Cleaning up...");

            Database.DisposeDB();

            Cron.CronThread.Abort();

            if (Configs.RunningConfig.AdminChat != 0)
            {
                Methods.sendMessage(Configs.RunningConfig.AdminChat, "DreadBot is termining Cleaningly.");
            }
        }
示例#2
0
        internal static bool Commands(Message msg)
        {
            string[] cmd = msg.text.Split(' ');
            switch (isCommand(cmd[0]))
            {
            case "version":
            {
                TimeSpan t = TimeSpan.FromSeconds(Utilities.EpochTime() - MainClass.LauchTime);

                string answer = string.Format("{0:D3} Days, {1:D2} Hours, {2:D2} Minutes, {3:D2} Seconds", t.Days, t.Hours, t.Minutes, t.Seconds);
                Methods.sendReply(msg.chat.id, (int)msg.message_id, "Dread Bot " + Configs.Version + "\n\nUptime: " + answer);
                return(true);
            }

            case "updatecache":
            {
                if (Utilities.isChatAdmin(msg.from.id, msg.chat.id))
                {
                    ChatCache chat = ChatCaching.GetCache(msg.chat.id);
                    if ((Utilities.EpochTime() - Utilities.ToEpoch(chat.LastUpdate)) >= 3600)
                    {
                        ChatCaching.UpdateCache(chat);
                        chat.LastForcedUpdate = DateTime.Now;
                        ChatCaching.Save(chat);
                        Methods.sendReply(msg.chat.id, msg.message_id, "The Cache for the group has been updated. You will be unable to use this command again for atleast 1 hour.");
                    }
                    else
                    {
                        Methods.sendReply(msg.chat.id, msg.message_id, "You can use this command only once per hour.");
                    }
                }
                return(true);
            }

            case "adminlist":
            {
                if (msg.chat.type == "group" || msg.chat.type == "supergroup")
                {
                    ChatCache chat = ChatCaching.GetCache(msg.chat.id);
                    if ((Utilities.EpochTime() - Utilities.ToEpoch(chat.LastUpdate)) >= Configs.RunningConfig.ChatCacheTimer)
                    {
                        ChatCaching.UpdateCache(chat);
                    }

                    StringBuilder sb = new StringBuilder();
                    sb.Append("👑 Creator\n");
                    List <string> Admins = new List <string>();
                    int           i      = 0;
                    foreach (ChatMember admin in chat.Admins.Values)
                    {
                        if (admin.status == "creator")
                        {
                            sb.Append("└" + admin.user.first_name + "\n\n");
                        }
                        else
                        {
                            i++;
                            Admins.Add(admin.user.first_name);
                        }
                    }

                    sb.Append("👮‍♂️ Admins (" + i + ")\n");
                    int j = 0;
                    foreach (string name in Admins)
                    {
                        if (i == j)
                        {
                            sb.Append("└ " + name);
                        }
                        else
                        {
                            sb.Append("├" + name + "\n");
                        }
                        j++;
                    }
                    Methods.sendReply(msg.chat.id, msg.message_id, sb.ToString());
                }
                return(true);
            }

            case "token":
            {
                if (msg.chat.type != "private")
                {
                    return(false);
                }
                if (cmd.Length == 2)
                {
                    if (Utilities.OwnerToken == cmd[1])
                    {
                        StringBuilder sb = new StringBuilder();

                        Utilities.OwnerToken        = "";
                        Configs.RunningConfig.Owner = msg.from.id;

                        sb.Append("Ownership of this bot has been claimed by " + msg.from.id + "\n");

                        if (!String.IsNullOrEmpty(msg.from.username))         //username can be null
                        {
                            sb.Append("Username: @" + msg.from.username + "\n");
                        }
                        else
                        {
                            sb.Append("Username: -none-\n");
                        }

                        Methods.sendReply(msg.from.id, msg.message_id, "You have claimed ownership over this bot.\nPlease check out the [Wiki](http://dreadbot.net/wiki/) on getting me setup.\n\nFrom this point on, please use the admin command $adminmenu for DreadBot specific configuration.");

                        Configs.RunningConfig.GULimit   = 100;
                        Configs.RunningConfig.AdminChat = msg.from.id;

                        Logger.LogAdmin(sb.ToString());

                        Database.SaveConfig();
                    }

                    else if (Utilities.AdminTokens.Contains(cmd[1]))
                    {
                        StringBuilder sb = new StringBuilder();

                        if (Configs.RunningConfig.Admins.Contains(msg.from.id))
                        {
                            sb.Append("You are already an admin of this bot. No need to use a token.");
                            Methods.sendReply(msg.from.id, msg.message_id, sb.ToString());
                            Logger.LogAdmin("User tried to validate a token, despite already being an admin: " + msg.from.id);
                            return(true);
                        }
                        Utilities.AdminTokens.Remove(cmd[1]);
                        Configs.RunningConfig.Admins.Add(msg.from.id);
                        sb.Append(msg.from.first_name + " is now an admin of @" + Configs.Me.username);
                        Methods.sendReply(msg.from.id, msg.message_id, "You are now an admin. Welcome. :)");
                        Logger.LogAdmin(sb.ToString());
                        Methods.sendMessage(Configs.RunningConfig.AdminChat, sb.ToString());
                        return(true);
                    }

                    else
                    {
                        Methods.sendReply(msg.from.id, (int)msg.message_id, "The token you have specified does not exist. This error has been logged.");
                        Result <Message> res = Methods.sendMessage(Configs.RunningConfig.AdminChat, "The token command was attempted by ([" + msg.from.id + "](tg://user?id=" + msg.from.id + ")) using the token " + cmd[1]);
                        if (res == null || !res.ok)
                        {
                            Logger.LogError("Error contacting the admin Chat: " + res.description);
                        }
                        return(true);
                    }
                }
                return(true);
            }

            default: return(false);
            }
        }
示例#3
0
        public static bool AdminCommand(Message msg)
        {
            if (!Configs.RunningConfig.Admins.Contains(msg.from.id) && (Configs.RunningConfig.Owner != msg.from.id))
            {
                return(false);
            }

            string[] cmd = msg.text.Split(' ');
            switch (Utilities.isAdminCommand(cmd[0]))
            {
            case "makemenu":
            {
                // /makemenu Yes,noop,0|No,noop,1|Back,noop,2|forward,noop,2
                InlineKeyboardMarkup kb = new InlineKeyboardMarkup();
                msg.text = msg.text.Replace("$makemenu ", "");
                string[] buttons = msg.text.Split('|');
                foreach (string button in buttons)
                {
                    string[] bargs = button.Split(',');
                    try
                    {
                        kb.addCallbackButton(bargs[0], bargs[1], Convert.ToInt32(bargs[2]));
                    }
                    catch
                    {
                        Methods.sendReply(msg.chat.id, msg.message_id, "Missing button argument.");
                        return(true);
                    }
                }
                Methods.sendMessage(msg.chat.id, "Demo Keyboard", "markdown", kb);
                return(true);
            }

            case "save":
            {
                Database.SaveConfig();
                Methods.sendReply(msg.chat.id, msg.message_id, "Flushed Database To Disk.");
                return(true);
            }

            case "adminmenu":
            {
                if (msg.from.id != Configs.RunningConfig.Owner)
                {
                    Logger.LogWarn("User attempted to use /adminmenu command: " + msg.from.id);
                    return(true);
                }
                Logger.LogAdmin("Admin Menu Called: " + msg.from.id);
                Result <Message> res = Methods.sendMessage(msg.from.id, "*DreadBot Administration Menu*\n\n`DreadBot Managment`\nUsed to fine tune the bot, plus other senstive, and powerful options.\n\n`DataBase Management`\nConfigure Specific Database options, and backup as needed.\n\n`Plugin Manager`\nAdd, Remove and Configure plugins to give DreadBot its purpose.", "Markdown", Menus.AdminMenu());
                if (!res.ok)
                {
                    Logger.LogError("Error contacting the admin Chat: " + res.description);
                }
                return(true);
            }

            case "admin":
            {
                return(true);
            }

            case "setdebug":
            {
                if (msg.from.id != Configs.RunningConfig.Owner)
                {
                    Logger.LogWarn("User attempted to use /setdebug command: " + msg.from.id);
                    return(true);
                }
                if (msg.chat.type == "private" || msg.chat.type == "channel")
                {
                    Result <Message> res = Methods.sendReply(msg.chat.id, msg.message_id, "You can only assign a Group or Supergroup to be the Debug Chat.\nIf you want to reset it back to PM, please use the admin menu.");
                    if (!res.ok)
                    {
                        Logger.LogError("Error contacting the admin Chat: " + res.description);
                    }
                    return(true);
                }
                else
                {
                    if (msg.chat.id == Configs.RunningConfig.AdminChat)
                    {
                        Result <Message> res = Methods.sendReply(msg.chat.id, msg.message_id, "Debug Chat is already set to this group.");
                        if (!res.ok)
                        {
                            Logger.LogError("Error contacting the admin Chat: " + res.description);
                        }
                        return(true);
                    }
                    else
                    {
                        Configs.RunningConfig.AdminChat = msg.chat.id;
                        Database.SaveConfig();
                        Result <Message> res = Methods.sendReply(msg.chat.id, msg.message_id, "Debug Chat is now set to this group.");
                        if (!res.ok)
                        {
                            Logger.LogError("Error contacting the admin Chat: " + res.description);
                        }
                        Logger.LogAdmin("Debug Chat has been set to: " + msg.chat.id);
                        return(true);
                    }
                }
            }


            default: return(false);
            }
        }
示例#4
0
        public static bool AdminCommand(Message msg)
        {
            if (!Configs.RunningConfig.Admins.Contains(msg.from.id) && (Configs.RunningConfig.Owner != msg.from.id))
            {
                return(false);
            }

            string[] cmd = msg.text.Trim().Split(' ');
            switch (Utilities.isAdminCommand(cmd[0]))
            {
            case "makemenu":
            {
                // /makemenu Yes,noop,0|No,noop,1|Back,noop,2|forward,noop,2
                InlineKeyboardMarkup kb = new InlineKeyboardMarkup();
                msg.text = msg.text.Replace("$makemenu ", "");
                string[] buttons = msg.text.Split('|');
                foreach (string button in buttons)
                {
                    string[] bargs = button.Split(',');
                    try
                    {
                        kb.addCallbackButton(bargs[0], bargs[1], Convert.ToInt32(bargs[2]));
                    }
                    catch
                    {
                        Methods.sendReply(msg.chat.id, msg.message_id, "Missing button argument.");
                        return(true);
                    }
                }
                Methods.sendMessage(msg.chat.id, "Demo Keyboard", "markdown", kb);
                return(true);
            }

            case "save":
            {
                Database.SaveConfig();
                Methods.sendReply(msg.chat.id, msg.message_id, "Flushed Database To Disk.");
                return(true);
            }

            case "adminmenu":
            {
                if (msg.from.id != Configs.RunningConfig.Owner)
                {
                    Logger.LogWarn("User attempted to use /adminmenu command: " + msg.from.id);
                    return(true);
                }
                Logger.LogAdmin("Admin Menu Called: " + msg.from.id);
                Menus.PostAdminMenu(msg.from.id);
                return(true);
            }

            case "admintoken":
            {
                string token = Utilities.CreateAdminToken(false);
                Methods.sendMessage(msg.from.id, "Have an admin send this to me to add them to the admin list.\n`/token " + token + "`");

                return(true);
            }

            case "setdebug":
            {
                if (msg.from.id != Configs.RunningConfig.Owner)
                {
                    Logger.LogWarn("User attempted to use /setdebug command: " + msg.from.id);
                    return(true);
                }
                if (msg.chat.type == "private" || msg.chat.type == "channel")
                {
                    Result <Message> res = Methods.sendReply(msg.chat.id, msg.message_id, "You can only assign a Group or Supergroup to be the Debug Chat.\nIf you want to reset it back to PM, please use the admin menu.");
                    if (!res.ok)
                    {
                        Logger.LogError("Error contacting the admin Chat: " + res.description);
                    }
                    return(true);
                }
                else
                {
                    if (msg.chat.id == Configs.RunningConfig.AdminChat)
                    {
                        Result <Message> res = Methods.sendReply(msg.chat.id, msg.message_id, "Debug Chat is already set to this group.");
                        if (!res.ok)
                        {
                            Logger.LogError("Error contacting the admin Chat: " + res.description);
                        }
                        return(true);
                    }
                    else
                    {
                        Configs.RunningConfig.AdminChat = msg.chat.id;
                        Database.SaveConfig();
                        Result <Message> res = Methods.sendReply(msg.chat.id, msg.message_id, "Debug Chat is now set to this group.");
                        if (!res.ok)
                        {
                            Logger.LogError("Error contacting the admin Chat: " + res.description);
                        }
                        Logger.LogAdmin("Debug Chat has been set to: " + msg.chat.id);
                        return(true);
                    }
                }
            }


            default: return(false);
            }
        }
示例#5
0
        internal static void ButtonPush(CallbackQuery callback)
        {
            string arg = callback.data.Split(' ')[1];

            switch (arg)
            {
            case "botadm": {
                Methods.answerCallbackQuery(callback.id);
                string text = "*DreadBot Management Options*\n\nThese options are for the bot owner only (you) and are critical settings for the operation of your bot. Use these settings with care. All of these settings take immediate effect.\n\n`Sensitive Options`\nThese settings control very low level settings. Such as how often the bot will request new messages, setting up webhook, and more!\n\n`Add/Remove Bot Admins`\nIn the event you want to grant others control over the bot, manage who can use it, and what control they have over it, you can use this menu.\n\n`Debug Chat Settings`\nBy Default, the \"Debug Chat\" is PM between you and the bot. These settings let you use a group instead, as well as control what options can be set from this group. This can really help if you are tired of getting Debug messages in PM.\n\n`System Sounds`\nThis allows DreadBot to play custom sounds per events. You send DreadBot WAV/ MP3 Files to play to correlate to specific events.";
                Methods.editMessageText(callback.from.id, callback.message.message_id, text, "markdown", ManagementMenu());
                return;
            }

            case "tuneables": {
                if (callback.from.id != Configs.RunningConfig.Owner)
                {
                    Methods.answerCallbackQuery(callback.id, "You are not allowed to view these options.", true);
                    Logger.LogAdmin("User Attempted to access the Sensitive Options Menu.(" + callback.from.id + ") " + callback.from.first_name);
                    return;
                }
                else
                {
                    Methods.answerCallbackQuery(callback.id);
                    string text = "*Sensitive Tunables*\n\nThese settings are VERY sensitive and alter how the bot will communicate with Telegram.\nDo not change these settings unless you are familiar with them!\n\n" +
                                  "`Show Access Token`\nThis will display the access token that the bot is using.\n\n" +
                                  "`Change Access Token`\nThis will allow you to change the access token and use a different bot account.\n*WARNING!* This can cause harmful side-effects to any database entries which plugins you have added are using.\nUSE WITH CAUTION!\n\n" +
                                  "`Change Owner`\nThis allows you to pass ownership of the bot to another Telegram user. Only the owner can use this button.\n\n" +
                                  "`Get Updates Limit`\nUsing the + - buttons, you can change the number of updates the bot will ask for when it gets messages from Telegram.\n(Min 1 - Max 100 - Default 20)\n\n" +
                                  "`Bot Operation Mode`\nThis allows you set change the bot's method of getting updates between getUpdates and WebHook. This can heavily impact the functionality of the bot and you shouldn't use it unless you know what you're doing.\n\n";

                    Methods.editMessageText(callback.from.id, callback.message.message_id, text, "markdown", TuneablesMenu());
                }
                return;
            }

            case "botadmins": { return; }

            case "debugchatcfg": {
                Methods.answerCallbackQuery(callback.id);
                string text = "*Debug Chat Settings*\n\nHere you can configure the Debug Chat. This is used by the bot as a good testing grounds, somewhere to dump errors for all Bot Admins to see, admin commands and more.\n\n`Toggle Debug Chat Commands`\nEnable Bot Admin commands for use within the Debug Chat. Its very useful for troubleshooting, and testing.\n\n`Change Debug Chat`\nThis is what you use to change the Debug Chat to a Group, Supergroup, or back to Private (Bot Owner only).\n\n`Set the Debug Chat Log Level`\nHere you can set how verbose the bot is with its error reporting in the Debug Chat. We recommend at least [Warn] Level.";
                Methods.editMessageText(callback.from.id, callback.message.message_id, text, "markdown", DebugChatCfg());
                return;
            }

            case "debugchatlevel":
            {
                Methods.answerCallbackQuery(callback.id);
                string text = "*Log Level Configuration*\n\nHere you can set the desired log level of the Console and the Log File.\n\nThe right column is for the Console.\nThe left side is for the Log File. (it is log.txt and is off by default.)\n\nWe strongly recommend the console log level be no lower than *WARN* as some of this information can be important when resolving problems.";
                Methods.editMessageText(callback.from.id, callback.message.message_id, text, "markdown", LogLevelMenu());
                return;
            }

            case "resetdebug": {
                string text = "";
                if (Configs.RunningConfig.Owner != Configs.RunningConfig.AdminChat)
                {
                    text = "Debug chat has been reset to PM.";
                    Configs.RunningConfig.AdminChat = callback.from.id;
                }
                else
                {
                    text = "Debug chat is already set to PM.";
                }
                Methods.answerCallbackQuery(callback.id, text, true);
                return;
            }

            case "changedebugchat":
            {
                Methods.answerCallbackQuery(callback.id);
                string text = "*Debug Chat Location Setting*\n\nHere you can restore the settings for where the bot sends Debug messages. To set a Debug Group, add the bot to a group, and perform /setdebug and the bot will use that group for debug output.\n\n`Reset Debug Chat to Private`\nAs the buttons states, this will reset the location of debug messages to PM with you.";
                Methods.editMessageText(callback.from.id, callback.message.message_id, text, "markdown", ChangeDebugChat());
                return;
            }

            case "operationmode":
            {
                Methods.answerCallbackQuery(callback.id);
                string text = "*Operation Mode Settings*\n\n*WebHook*\nClicking this will bring you to the menu to enable, configure and test your webhook.\nPlease Read [this](http://dreadbot.net/wiki/index.php/WebHook_Explained) page to fully understand what the differences are between Webhook and getUpdates.\n\n`getUpdates`\nThis is a Toggle button specifically for Disabling webhook easily. Clicking it while getUpdates is enabled will do nothing.";
                Methods.editMessageText(callback.from.id, callback.message.message_id, text, "markdown", OperationMenu());
                return;
            }

            case "webhookcfg":
            {
                Methods.answerCallbackQuery(callback.id);
                string text = "*WebHook Config*\n\n`Test & Go Live!`\nClicking this will reach out to the DreadBot site to help you test the accessibility of your bot to make sure webhook was setup correctly.\nOnce verified, the bot will then offer you the chance to make the switch.\n\n`Set URL`\nUse this to set the Full URL you want telegram to use; Example http://dreadbot.net/bot/ \n\n`Set Certificate`\nHere you can configure the SSL/TLS Certificate the bot will use to encrypt communication between your bot and Telegram.\n\n`Port Cfg`\nYou must select a port that the bot will use to listen on for the HTTPS traffic that will be sent by Telegram.";
                Methods.editMessageText(callback.from.id, callback.message.message_id, text, "markdown", WebhookMenu());
                return;
            }

            case "showtoken":
            {
                if (callback.from.id == Configs.RunningConfig.Owner)
                {
                    Methods.answerCallbackQuery(callback.id);
                    Methods.editMessageText(callback.from.id, callback.message.message_id, "`" + Configs.RunningConfig.token + "`", "markdown", BackOnly("tuneables"));
                    return;
                }
                else
                {
                    Methods.answerCallbackQuery(callback.id, "You are no longer allowed to view these options.", true);
                    Methods.deleteMessage(callback.from.id, callback.message.message_id);
                    Logger.LogAdmin("User attempted to use a sensitive menu option. (" + callback.from.id + ") " + callback.from.first_name);
                }
                return;
            }

            case "changetoken":
            {
                if (callback.from.id == Configs.RunningConfig.Owner)
                {
                    Methods.answerCallbackQuery(callback.id);
                    Methods.editMessageText(callback.from.id, callback.message.message_id, "This is a major change to make. Please read [this](http://dreadbot.net/wiki/index.php/Change_Token) page before proceeding.", "markdown", BackOnly("tuneables"));
                    return;
                }
                else
                {
                    Methods.answerCallbackQuery(callback.id, "You are no longer allowed to view these options.", true);
                    Methods.deleteMessage(callback.from.id, callback.message.message_id);
                    Logger.LogAdmin("User attempted to use a sensitive menu Option. (" + callback.from.id + ") " + callback.from.first_name);
                }
                return;
            }

            case "changeowner":
            {
                if (callback.from.id == Configs.RunningConfig.Owner)
                {
                    Methods.answerCallbackQuery(callback.id);
                    Methods.editMessageText(callback.from.id, callback.message.message_id, "If you do this, you will no longer have ANY ACCESS to this bot's options or administrative tools unless given to you by the new owner after the change has been made.\nPlease read [this](http://dreadbot.net/wiki/index.php/Change_Owner) page before proceeding.", "markdown", BackOnly("tuneables"));
                    return;
                }
                else
                {
                    Methods.answerCallbackQuery(callback.id, "You are no longer allowed to view these options.", true);
                    Methods.deleteMessage(callback.from.id, callback.message.message_id);
                    Logger.LogAdmin("User attempted to use a sensitive menu Option. (" + callback.from.id + ") " + callback.from.first_name);
                }
                return;
            }

            case "gulhelp":
            {
                Methods.answerCallbackQuery(callback.id, "Changes the Get Updates limit", true);
                return;
            }

            case "gula1": {
                if (callback.from.id == Configs.RunningConfig.Owner)
                {
                    if (Configs.RunningConfig.GULimit > 100)
                    {
                        Configs.RunningConfig.GULimit++;
                        Methods.answerCallbackQuery(callback.id);
                    }
                    else if (Configs.RunningConfig.GULimit == 100)
                    {
                        Methods.answerCallbackQuery(callback.id, "Maxed out.", true);
                    }
                    else
                    {
                        Configs.RunningConfig.GULimit = 100;
                        Methods.answerCallbackQuery(callback.id, "Maxed out.", true);
                    }
                    Database.SaveConfig();
                    return;
                }
                else
                {
                    Methods.answerCallbackQuery(callback.id, "You are no longer allowed to view these options.", true);
                    Methods.deleteMessage(callback.from.id, callback.message.message_id);
                    Logger.LogAdmin("User Attempted to use a sensitive menu option. (" + callback.from.id + ") " + callback.from.first_name);
                }
                return;
            }

            case "gula10":
            {
                if (callback.from.id == Configs.RunningConfig.Owner)
                {
                    if (Configs.RunningConfig.GULimit >= 90)
                    {
                        Configs.RunningConfig.GULimit = Configs.RunningConfig.GULimit + 10;
                        Methods.answerCallbackQuery(callback.id);
                    }
                    else if (Configs.RunningConfig.GULimit == 100)
                    {
                        Methods.answerCallbackQuery(callback.id, "Maxed out.", true);
                    }
                    else if (Configs.RunningConfig.GULimit < 90 && Configs.RunningConfig.GULimit > 100)
                    {
                        Configs.RunningConfig.GULimit = Configs.RunningConfig.GULimit + (100 - Configs.RunningConfig.GULimit);
                        Methods.answerCallbackQuery(callback.id, "Maxed out.", true);
                    }
                    else if (Configs.RunningConfig.GULimit < 100)
                    {
                        Configs.RunningConfig.GULimit = 100;
                        Methods.answerCallbackQuery(callback.id, "Maxed out.", true);
                    }
                    Database.SaveConfig();
                    return;
                }
                else
                {
                    Methods.answerCallbackQuery(callback.id, "You are no longer allowed to view these options.", true);
                    Methods.deleteMessage(callback.from.id, callback.message.message_id);
                    Logger.LogAdmin("User attempted to use a sensitive menu option. (" + callback.from.id + ") " + callback.from.first_name);
                }
                return;
            }

            case "gulm10":
            {
                if (callback.from.id == Configs.RunningConfig.Owner)
                {
                    if (Configs.RunningConfig.GULimit >= 11)
                    {
                        Configs.RunningConfig.GULimit = Configs.RunningConfig.GULimit - 10;
                        Methods.answerCallbackQuery(callback.id);
                    }
                    else if (Configs.RunningConfig.GULimit == 1)
                    {
                        Methods.answerCallbackQuery(callback.id, "Maxed out.", true);
                    }
                    else if (Configs.RunningConfig.GULimit < 11 && Configs.RunningConfig.GULimit > 1)
                    {
                        Configs.RunningConfig.GULimit = Configs.RunningConfig.GULimit - Configs.RunningConfig.GULimit + 1;
                        Methods.answerCallbackQuery(callback.id, "Bottomed out.", true);
                    }
                    else if (Configs.RunningConfig.GULimit <= 0)
                    {
                        Configs.RunningConfig.GULimit = 1;
                        Methods.answerCallbackQuery(callback.id, "Bottomed out.", true);
                    }
                    Database.SaveConfig();
                    return;
                }
                else
                {
                    Methods.answerCallbackQuery(callback.id, "You are no longer allowed to view these options.", true);
                    Methods.deleteMessage(callback.from.id, callback.message.message_id);
                    Logger.LogAdmin("User attempted to use a sensitive menu option. (" + callback.from.id + ") " + callback.from.first_name);
                }
                return;
            }

            case "gulm1":
            {
                if (callback.from.id == Configs.RunningConfig.Owner)
                {
                    if (Configs.RunningConfig.GULimit > 1)
                    {
                        Configs.RunningConfig.GULimit--;
                        Methods.answerCallbackQuery(callback.id);
                    }
                    else if (Configs.RunningConfig.GULimit == 1)
                    {
                        Methods.answerCallbackQuery(callback.id, "Bottomed out.", true);
                    }
                    else
                    {
                        Configs.RunningConfig.GULimit = 1;
                        Methods.answerCallbackQuery(callback.id, "Bottomed out.", true);
                    }
                    Database.SaveConfig();
                    return;
                }
                else
                {
                    Methods.answerCallbackQuery(callback.id, "You are no longer allowed to view these options.", true);
                    Methods.deleteMessage(callback.from.id, callback.message.message_id);
                    Logger.LogAdmin("User attempted to use a sensitive menu option. (" + callback.from.id + ") " + callback.from.first_name);
                }
                return;
            }
            }
        }