protected override InlineKeyboardMarkup Keyboard()
        {
            var keyboard = new InlineKeyboardMarkup();

            if (_validOutputTypes.Count == 0)
            {
                keyboard.addCallbackButton("Go back to menu 🔙", RootMenu.CallbackName, 0);
                return(keyboard);
            }

            foreach (var outputType in _validOutputTypes)
            {
                switch (outputType)
                {
                case DataOutput.DataOutputTypes.SubDirectory:
                    keyboard.addCallbackButton("Move to subdirectories", CallbackSubDirectory, 0);
                    break;

                case DataOutput.DataOutputTypes.Json:
                    keyboard.addCallbackButton("Save to JSON file", CallbackJson, 1);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            return(keyboard);
        }
        protected override InlineKeyboardMarkup Keyboard()
        {
            var keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton("Original order", $"{CallbackName}:{false}", 0);
            keyboard.addCallbackButton("Random order", $"{CallbackName}:{true}", 1);
            return(keyboard);
        }
        protected override InlineKeyboardMarkup Keyboard()
        {
            var keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton("Allow adding new options", $"{CallbackName}:{true}", 0);
            keyboard.addCallbackButton("Just use hard-coded options", $"{CallbackName}:{false}", 1);
            return(keyboard);
        }
        protected override InlineKeyboardMarkup Keyboard()
        {
            var keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton("Automatically order options", $"{CallbackName}:{true}", 0);
            keyboard.addCallbackButton("Keep in the order they are added", $"{CallbackName}:{false}", 1);
            return(keyboard);
        }
Exemple #5
0
        protected override InlineKeyboardMarkup Keyboard()
        {
            var keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton("Keep active", $"{LiveSessionCallBackName}:{_session.Id}", 0);
            keyboard.addCallbackButton("End session", $"{StopSessionMenu.CallbackName}:{_session.Id}", 1);
            return(keyboard);
        }
Exemple #6
0
        private static InlineKeyboardMarkup ChangeDebugChat()
        {
            InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton("Reset Debug Chat to Private", $"dreadbot {Callback.ResetDebugChat}", 0);
            keyboard.addCallbackButton("🔙", $"dreadbot {Callback.DebugChat}", 1);
            return(keyboard);
        }
        protected override InlineKeyboardMarkup Keyboard()
        {
            var keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton("Allow multiple options", $"{CallbackName}:{true}", 0);
            keyboard.addCallbackButton("One option only", $"{CallbackName}:{false}", 1);
            return(keyboard);
        }
Exemple #8
0
        internal static InlineKeyboardMarkup AdminMenu()
        {
            InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton("🎛 DreadBot Management", $"dreadbot {Callback.BotManagement}", 0);
            keyboard.addCallbackButton("🗄 DataBase Management", $"dreadbot {Callback.DatabaseManagement}", 1);
            keyboard.addCallbackButton("⚡️ Plugin Manager", $"dreadbot {Callback.PluginManagement}", 2);
            return(keyboard);
        }
Exemple #9
0
        private static InlineKeyboardMarkup DebugChatCfg()
        {
            InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton("🧾 Change Debug Chat", $"dreadbot {Callback.ChangeDebugChat}", 0);
            keyboard.addCallbackButton("🔕 Set Debug Chat Log Level", $"dreadbot {Callback.LogLevel}", 1);
            keyboard.addCallbackButton("🔙", $"dreadbot {Callback.BotManagement}", 2);
            return(keyboard);
        }
        protected override InlineKeyboardMarkup Keyboard()
        {
            var keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton("1", $"{CallbackName}:1", 0);
            keyboard.addCallbackButton("3", $"{CallbackName}:3", 0);
            keyboard.addCallbackButton("5", $"{CallbackName}:5", 0);
            keyboard.addCallbackButton("10", $"{CallbackName}:10", 0);
            return(keyboard);
        }
Exemple #11
0
        protected override InlineKeyboardMarkup Keyboard()
        {
            var keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton("Create new session", CreateSessionMenu.CallbackName, 0);
            keyboard.addCallbackButton("Start session", StartSessionMenu.CallbackName, 1);
            keyboard.addCallbackButton("End session", StopSessionMenu.CallbackName, 2);
            keyboard.addCallbackButton("Delete session", DeleteSessionMenu.CallBackName, 3);
            return(keyboard);
        }
Exemple #12
0
        private static InlineKeyboardMarkup ManagementMenu()
        {
            InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton("🔥 Sensitive Options", $"dreadbot {Callback.SensitiveOptions}", 0);
            keyboard.addCallbackButton("👮‍♂️ Add/Remove Bot Admins", $"dreadbot {Callback.BotAdmins}", 1);
            keyboard.addCallbackButton("🗒 Debug Chat Settings", $"dreadbot {Callback.DebugChat}", 2);
            keyboard.addCallbackButton("🔉 System Sounds", $"dreadbot {Callback.Sounds}", 3);
            keyboard.addCallbackButton("🔙", $"dreadbot {Callback.Root}", 4);
            return(keyboard);
        }
Exemple #13
0
        protected override InlineKeyboardMarkup Keyboard()
        {
            var keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton(
                "Yes, delete the session.",
                $"{DeleteSessionConfirmedMenu.CallbackName}:{_session.Id}",
                0
                );
            keyboard.addCallbackButton("No, go back to menu 🔙", RootMenu.CallbackName, 1);
            return(keyboard);
        }
Exemple #14
0
        private static InlineKeyboardMarkup OperationMenu()
        {
            InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup();

            string getUpdatesSuffix = Configs.RunningConfig.GetupdatesMode ? " ⬅️" : "";
            string webHooksSuffix   = Configs.RunningConfig.GetupdatesMode ? "" : " ⬅️";

            keyboard.addCallbackButton("GetUpdates" + getUpdatesSuffix, $"dreadbot {Callback.WebhookDisable}", 0);
            keyboard.addCallbackButton("WebHook" + webHooksSuffix, $"dreadbot {Callback.WebhookConfig}", 1);
            keyboard.addCallbackButton("🔙", $"dreadbot {Callback.SensitiveOptions}", 2);
            return(keyboard);
        }
Exemple #15
0
        protected override InlineKeyboardMarkup Keyboard()
        {
            var keyboard = new InlineKeyboardMarkup();
            var row      = 0;

            foreach (var session in _sessions)
            {
                keyboard.addCallbackButton(session.Name, $"{CallBackName}:{session.Id}", row++);
            }

            keyboard.addCallbackButton("🔙 to menu", RootMenu.CallbackName, row);
            return(keyboard);
        }
Exemple #16
0
        protected override InlineKeyboardMarkup Keyboard()
        {
            var activeSessions = _sessions.FindAll(s => s.IsActive);
            var keyboard       = new InlineKeyboardMarkup();
            var row            = 0;

            foreach (var session in activeSessions)
            {
                keyboard.addCallbackButton(session.Name, $"{CallbackName}:{session.Id}", row++);
            }

            keyboard.addCallbackButton("🔙", RootMenu.CallbackName, row);
            return(keyboard);
        }
Exemple #17
0
        private static InlineKeyboardMarkup BackOnly(string callBack)
        {
            InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton("🔙", $"dreadbot {callBack}", 0);
            return(keyboard);
        }
        protected override InlineKeyboardMarkup Keyboard()
        {
            var keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton("🔙 to menu", RootMenu.CallbackName, 0);
            return(keyboard);
        }
        protected override InlineKeyboardMarkup Keyboard()
        {
            var keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton("Files in directory", CallbackDirectorySource, 0);
            return(keyboard);
        }
Exemple #20
0
        private static InlineKeyboardMarkup SensitiveOptionsMenu()
        {
            InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton("🔑 Show Access Token", $"dreadbot {Callback.ShowToken}", 0);
            keyboard.addCallbackButton("🔑 Change Access Token", $"dreadbot {Callback.ChangeToken}", 1);
            keyboard.addCallbackButton("👮‍️ Change Owner", $"dreadbot {Callback.ChangeOwner}", 2);

            keyboard.addCallbackButton("+1", $"dreadbot {Callback.GetUpdatesPlusSmall}", 3);
            keyboard.addCallbackButton("+10", $"dreadbot {Callback.GetUpdatesPlusLarge}", 3);
            keyboard.addCallbackButton(Configs.RunningConfig.GULimit.ToString(), $"dreadbot {Callback.GetUpdatesLimit}", 3);
            keyboard.addCallbackButton("-10", $"dreadbot {Callback.GetUpdatesMinusLarge}", 3);
            keyboard.addCallbackButton("-1", $"dreadbot {Callback.GetUpdatesMinusSmall}", 3);

            keyboard.addCallbackButton("⚙️ Bot Operation Mode", $"dreadbot {Callback.OperationMode}", 4);
            keyboard.addCallbackButton("🔙", $"dreadbot {Callback.BotManagement}", 5);
            return(keyboard);
        }
        protected override InlineKeyboardMarkup Keyboard()
        {
            var keyboard = new InlineKeyboardMarkup();

            if (_directories.Count == 0)
            {
                keyboard.addCallbackButton("Go back to menu 🔙", RootMenu.CallbackName, 0);
                return(keyboard);
            }

            var row = 0;

            foreach (var directory in _directories)
            {
                keyboard.addCallbackButton(directory, $"{CallbackName}:{row}", row++);
            }

            return(keyboard);
        }
Exemple #22
0
        protected override InlineKeyboardMarkup Keyboard()
        {
            if (!_withBackButton)
            {
                return(null);
            }
            var keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton("🔙 to root menu", RootMenu.CallbackName, 0);
            return(keyboard);
        }
        private InlineKeyboardMarkup Keyboard(int callbackId)
        {
            const int maxCols = 3;
            const int maxRows = 5;
            var       perPage = maxCols * maxRows;

            var keyboard         = new InlineKeyboardMarkup();
            var currentPage      = _idIndex.GetPageFromCallbackId(callbackId);
            var totalOptions     = _options.Count;
            var pages            = ((totalOptions - 1) / perPage) + 1;
            var orderedOptions   = _autoOrderOptions ? _options.OrderBy(e => e).ToList() : _options;
            var optionsOnPage    = orderedOptions.Skip(perPage * currentPage).Take(perPage).ToList();
            var numOptionsOnPage = optionsOnPage.Count;
            var columns          = ((numOptionsOnPage - 1) / maxRows) + 1;

            var datumId         = _idIndex.GetDatumIdFromCallbackId(callbackId);
            var selectedOptions = AllData().Where(d => d.DatumId.Equals(datumId)).SelectMany(d => _dataOutput.GetOptionsForData(d)).ToList();

            var buttonId = 0;
            var rowId    = 0;

            foreach (var option in optionsOnPage)
            {
                var optionId = _idIndex.GetOptionIdByOption(option);
                var selected = selectedOptions.Contains(option) ? "✔ " : "";
                var text     = $"{selected}{option}";
                keyboard.addCallbackButton(text, $"{CallbackName}:{Id}:{callbackId}:{optionId}", rowId);
                buttonId++;
                if (buttonId % columns == 0)
                {
                    rowId++;
                }
            }

            rowId++;

            if (pages > 1 && currentPage > 0)
            {
                keyboard.addCallbackButton("⬅️Prev page", $"{CallbackName}:{Id}:{callbackId}:{CallbackPrev}", rowId);
            }
            if (_canSelectMultipleOptions)
            {
                keyboard.addCallbackButton("🖊️️*Done*", $"{CallbackName}:{Id}:{callbackId}:{CallbackDone}", rowId);
            }

            if (_isRandomOrder)
            {
                keyboard.addCallbackButton("🎲Re-roll", $"{CallbackName}:{Id}:{callbackId}:{CallbackRand}", rowId);
            }
            if (pages > 1 && currentPage + 1 < pages)
            {
                keyboard.addCallbackButton("➡️Next page", $"{CallbackName}:{Id}:{callbackId}:{CallbackNext}", rowId);
            }

            rowId++;

            keyboard.addCallbackButton("End session", $"{StopSessionMenu.CallbackName}:{Id}", rowId);

            return(keyboard);
        }
Exemple #24
0
        private static InlineKeyboardMarkup WebhookMenu()
        {
            InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup();


            keyboard.addCallbackButton("Test & Go Live!", $"dreadbot {Callback.WebhookDisable}", 0);
            keyboard.addCallbackButton("Set URL", $"dreadbot {Callback.WebhookConfig}", 1);
            keyboard.addCallbackButton("Set Certificate", $"dreadbot {Callback.WebhookConfig}", 2);

            keyboard.addCallbackButton("Port Cfg", $"dreadbot {Callback.WebhookConfig}", 3);
            keyboard.addCallbackButton("443", $"dreadbot {Callback.WebhookConfig}", 3);
            keyboard.addCallbackButton("+", $"dreadbot {Callback.WebhookConfig}", 3);

            keyboard.addCallbackButton("🔙", $"dreadbot {Callback.OperationMode}", 4);
            return(keyboard);
        }
Exemple #25
0
        private static InlineKeyboardMarkup LogLevelMenu()
        {
            InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup();

            keyboard.addCallbackButton("File LogLevel - Debug " + GetLogLevel(LogLevel.Debug, false), $"dreadbot {Callback.LogLevelSetFile} 6", 0);
            keyboard.addCallbackButton("Console LogLevel - Debug " + GetLogLevel(LogLevel.Debug), $"dreadbot {Callback.LogLevelSetChat} 6", 0);

            keyboard.addCallbackButton("File LogLevel - Admin " + GetLogLevel(LogLevel.Admin, false), $"dreadbot {Callback.LogLevelSetFile} 5", 1);
            keyboard.addCallbackButton("Console LogLevel - Admin " + GetLogLevel(LogLevel.Admin), $"dreadbot {Callback.LogLevelSetChat} 5", 1);

            keyboard.addCallbackButton("File LogLevel - Info " + GetLogLevel(LogLevel.Info, false), $"dreadbot {Callback.LogLevelSetFile} 4", 2);
            keyboard.addCallbackButton("Console LogLevel - Info " + GetLogLevel(LogLevel.Info), $"dreadbot {Callback.LogLevelSetChat} 4", 2);

            keyboard.addCallbackButton("File LogLevel - Warn " + GetLogLevel(LogLevel.Warn, false), $"dreadbot {Callback.LogLevelSetFile} 3", 3);
            keyboard.addCallbackButton("Console LogLevel - Warn " + GetLogLevel(LogLevel.Warn), $"dreadbot {Callback.LogLevelSetChat} 3", 3);

            keyboard.addCallbackButton("File LogLevel - Error " + GetLogLevel(LogLevel.Error, false), $"dreadbot {Callback.LogLevelSetFile} 2", 4);
            keyboard.addCallbackButton("Console LogLevel - Error " + GetLogLevel(LogLevel.Error), $"dreadbot {Callback.LogLevelSetChat} 2", 4);

            keyboard.addCallbackButton("File LogLevel - Fatal " + GetLogLevel(LogLevel.Fatal, false), $"dreadbot {Callback.LogLevelSetFile} 1", 5);
            keyboard.addCallbackButton("Console LogLevel - Fatal " + GetLogLevel(LogLevel.Fatal), $"dreadbot {Callback.LogLevelSetChat} 1", 5);

            keyboard.addCallbackButton("File LogLevel - Off " + GetLogLevel(LogLevel.Off, false), $"dreadbot {Callback.LogLevelSetFile} 0", 6);
            keyboard.addCallbackButton("Console LogLevel - Off " + GetLogLevel(LogLevel.Off), $"dreadbot {Callback.LogLevelSetChat} 0", 6);

            keyboard.addCallbackButton("🔙", $"dreadbot {Callback.DebugChat}", 7);

            return(keyboard);
        }
Exemple #26
0
 public static void ConfigBackButton(ref InlineKeyboardMarkup keyboard, long chatID)
 {
     keyboard.addCallbackButton("🔙", $"config:{chatID}", keyboard.Keyboard.Count);
 }