internal static InlineKeyboardMarkup ChangeDebugChat() { InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup(); keyboard.addCallbackButton("Reset Debug Chat to Private", "dreadbot resetdebug", 0); keyboard.addCallbackButton("🔙", "dreadbot debugchatcfg", 1); return(keyboard); }
internal static InlineKeyboardMarkup DebugChatCfg() { InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup(); keyboard.addCallbackButton("🧾 Change Debug Chat", "dreadbot changedebugchat", 0); keyboard.addCallbackButton("🔕 Set Debug Chat Log Level", "dreadbot debugchatlevel", 1); keyboard.addCallbackButton("🔙", "dreadbot botadm", 2); return(keyboard); }
internal static InlineKeyboardMarkup AdminMenu() { InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup(); keyboard.addCallbackButton("🎛 DreadBot Management", "dreadbot botadm", 0); keyboard.addCallbackButton("🗄 DataBase Management", "dreadbot dbadm", 1); keyboard.addCallbackButton("⚡️ Plugin Manager", "dreadbot plugadm", 2); return(keyboard); }
internal static InlineKeyboardMarkup ManagementMenu() { InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup(); keyboard.addCallbackButton("🔥 Sensitive Options", "dreadbot tuneables", 0); keyboard.addCallbackButton("👮♂️ Add/Remove Bot Admins", "dreadbot botadmins", 1); keyboard.addCallbackButton("🗒 Debug Chat Settings", "dreadbot debugchatcfg", 2); keyboard.addCallbackButton("🔉 System Sounds", "dreadbot sounds", 3); keyboard.addCallbackButton("🔙", "dreadbot adm", 4); return(keyboard); }
internal static InlineKeyboardMarkup BackOnly(string CallBack) { InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup(); keyboard.addCallbackButton("🔙", "dreadbot " + CallBack, 0); return(keyboard); }
internal static InlineKeyboardMarkup TuneablesMenu() { InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup(); keyboard.addCallbackButton("🔑 Show Access Token", "dreadbot showtoken", 0); keyboard.addCallbackButton("🔑 Change Access Token", "dreadbot changetoken", 1); keyboard.addCallbackButton("👮️ Change Owner", "dreadbot changeowner", 2); keyboard.addCallbackButton("+1", "dreadbot gula1", 3); keyboard.addCallbackButton("+10", "dreadbot gula10", 3); keyboard.addCallbackButton(Configs.RunningConfig.GULimit.ToString(), "dreadbot gulhelp", 3); keyboard.addCallbackButton("-10", "dreadbot gulm10", 3); keyboard.addCallbackButton("-1", "dreadbot gulm1", 3); keyboard.addCallbackButton("⚙️ Bot Operation Mode", "dreadbot operationmode", 4); keyboard.addCallbackButton("🔙", "dreadbot botadm", 5); return(keyboard); }
//private static void OnDatabaseExport(string[] args) { DatabaseExport?.Invoke(new DatabaseExportEventArgs() { Args = args }); } internal static void OnPluginConfigKeyboardRequest(ref InlineKeyboardMarkup keyboard, long chatID) { int row = 0; foreach (Func <long, CallbackButtonRequestArgs> item in PluginConfigKeyboardRequest.GetInvocationList()) { CallbackButtonRequestArgs args = item(chatID); keyboard.addCallbackButton(args.text, args.callback, row++); } }
private static InlineKeyboardMarkup OperationMenu() { InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup(); string gumode = ""; string whmode = ""; if (Configs.RunningConfig.GetupdatesMode) { gumode = " ⬅️"; } else { whmode = " ⬅️"; } keyboard.addCallbackButton("GetUpdates" + gumode, "dreadbot disablewebhook", 0); keyboard.addCallbackButton("WebHook" + whmode, "dreadbot webhookcfg", 1); keyboard.addCallbackButton("🔙", "dreadbot tuneables", 2); return(keyboard); }
private static InlineKeyboardMarkup WebhookMenu() { InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup(); keyboard.addCallbackButton("Test & Go Live!", "dreadbot disablewebhook", 0); keyboard.addCallbackButton("Set URL", "dreadbot webhookcfg", 1); keyboard.addCallbackButton("Set Certificate", "dreadbot webhookcfg", 2); keyboard.addCallbackButton("Port Cfg", "dreadbot webhookcfg", 3); keyboard.addCallbackButton("443", "dreadbot webhookcfg", 3); keyboard.addCallbackButton("+", "dreadbot webhookcfg", 3); keyboard.addCallbackButton("🔙", "dreadbot operationmode", 4); return(keyboard); }
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); } }
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); } }
internal static InlineKeyboardMarkup LogLevelMenu() { InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup(); keyboard.addCallbackButton("File LogLevel - Debug " + GetLogLevel(LogLevel.Debug, false), "dreadbot fll 6", 0); keyboard.addCallbackButton("Console LogLevel - Debug " + GetLogLevel(LogLevel.Debug), "dreadbot cll 6", 0); keyboard.addCallbackButton("File LogLevel - Admin " + GetLogLevel(LogLevel.Admin, false), "dreadbot fll 5", 1); keyboard.addCallbackButton("Console LogLevel - Admin " + GetLogLevel(LogLevel.Admin), "dreadbot cll 5", 1); keyboard.addCallbackButton("File LogLevel - Info " + GetLogLevel(LogLevel.Info, false), "dreadbot fll 4", 2); keyboard.addCallbackButton("Console LogLevel - Info " + GetLogLevel(LogLevel.Info), "dreadbot cll 4", 2); keyboard.addCallbackButton("File LogLevel - Warn " + GetLogLevel(LogLevel.Warn, false), "dreadbot fll 3", 3); keyboard.addCallbackButton("Console LogLevel - Warn " + GetLogLevel(LogLevel.Warn), "dreadbot cll 3", 3); keyboard.addCallbackButton("File LogLevel - Error " + GetLogLevel(LogLevel.Error, false), "dreadbot fll 2", 4); keyboard.addCallbackButton("Console LogLevel - Error " + GetLogLevel(LogLevel.Error), "dreadbot cll 2", 4); keyboard.addCallbackButton("File LogLevel - Fatal " + GetLogLevel(LogLevel.Fatal, false), "dreadbot fll 1", 5); keyboard.addCallbackButton("Console LogLevel - Fatal " + GetLogLevel(LogLevel.Fatal), "dreadbot cll 1", 5); keyboard.addCallbackButton("File LogLevel - Off " + GetLogLevel(LogLevel.Off, false), "dreadbot fll 0", 6); keyboard.addCallbackButton("Console LogLevel - Off " + GetLogLevel(LogLevel.Off), "dreadbot cll 0", 6); keyboard.addCallbackButton("🔙", "dreadbot debugchatcfg", 7); return(keyboard); }