// =========================================================================== // Asshat Gaming Roleplay // https://github.com/VortrexFTW/agrp_main // (c) 2022 Asshat Gaming // =========================================================================== // FILE: command.js // DESC: Provides command data, functions and usage // TYPE: Server (JavaScript) // =========================================================================== /** * @class Representing a command's data. Loaded and saved in the database */ class CommandData { enable() { this.enabled = true; } disable() { this.enabled = false; } toggleEnabled() { this.enabled = !this.enabled; } constructor(command, handlerFunction, syntaxString, requiredStaffFlags, requireLogin, allowOnDiscord, helpDescription) { this.command = command; this.handlerFunction = handlerFunction; this.syntaxString = syntaxString; this.requiredStaffFlags = requiredStaffFlags; this.enabled = true; this.requireLogin = requireLogin; this.allowOnDiscord = allowOnDiscord; this.helpDescription = helpDescription; this.aliases = []; } }; // =========================================================================== let serverCommands = []; // =========================================================================== function initCommandScript() { logToConsole(LOG_INFO, "[AGRP.Command]: Initializing commands script ..."); logToConsole(LOG_INFO, "[AGRP.Command]: Initialized commands script!"); } // =========================================================================== function loadCommands() { let tempCommands = { accent: [ new CommandData("accent", setAccentCommand, "", getStaffFlagValue("None"), false, false, "Sets your character's accent"), new CommandData("accents", listAccentsCommand, "", getStaffFlagValue("None"), false, false, "Shows a list of all available accents"), new CommandData("accentlist", listAccentsCommand, "", getStaffFlagValue("None"), false, false, "Shows a list of all available accents"), ], account: [ new CommandData("login", loginCommand, "", getStaffFlagValue("None"), false, false, "Login to an account"), new CommandData("register", registerCommand, "", getStaffFlagValue("None"), false, false, "Creates an account"), new CommandData("changepass", changeAccountPasswordCommand, " ", getStaffFlagValue("None"), true, false, "Change an account password"), new CommandData("iplogin", toggleAutoLoginByIPCommand, "", getStaffFlagValue("None"), true, false, "Toggle whether to automatically login if you join with the same IP as your last join"), new CommandData("gui", toggleAccountGUICommand, "", getStaffFlagValue("None"), false, false, "Toggle whether to use GUI. If GUI is disabled on the server, it won't show even if you have GUI enabled."), new CommandData("2fa", toggleAccountTwoFactorAuthCommand, "", getStaffFlagValue("None"), true, false, "Set up and use two-factor authentication."), new CommandData("setemail", setAccountEmailCommand, "", getStaffFlagValue("None"), true, false, "Sets your email. To reset your password, you must have a valid email set and verified."), new CommandData("verifyemail", verifyAccountEmailCommand, "", getStaffFlagValue("None"), true, false, "Confirms/verifies your email."), //new CommandData("setdiscord", setAccountDiscordCommand, "", getStaffFlagValue("None"), true, false, "Set up the integration for discord. Allows you to see info and use in-game commands on discord."), new CommandData("notips", toggleNoRandomTipsCommand, "", getStaffFlagValue("None"), true, false, "Turn on and off random tips"), new CommandData("loginalert", toggleAccountLoginAttemptNotificationsCommand, "", getStaffFlagValue("None"), true, false, "Turn on and off email notifications for attempts to login to your account"), new CommandData("scrolllines", setAccountChatScrollLinesCommand, "", getStaffFlagValue("None"), true, false, "Sets how many chatbox lines to scroll at a time when using pageup/pagedown"), new CommandData("chatscrolllines", setAccountChatScrollLinesCommand, "", getStaffFlagValue("None"), true, false, "Sets how many chatbox lines to scroll at a time when using pageup/pagedown"), new CommandData("chatscroll", setAccountChatScrollLinesCommand, "", getStaffFlagValue("None"), true, false, "Sets how many chatbox lines to scroll at a time when using pageup/pagedown"), new CommandData("chatautohide", setAccountChatAutoHideDelayCommand, "