$cmd->option("c")->aka("config")->title("Path to configuration file")->describedAs("Defines the configuration file that the bot will use to run")->file(true)->require(); $cmd->option("ccp")->title("Install the ccp database")->describedAs("Installs the CCP database. Required before the bot can start properly")->boolean(); $cmd->option("conv")->aka("convert")->title("Converts a username/password login to token login")->describedAs("Converts the username/password login for Discord, to the new bot API token login"); $args = $cmd->getFlagValues(); // Define the path for the logfile $configPath = $args["c"] ? $args["c"] : \Exception("Error, config file not loaded"); // Bot start time $startTime = time(); // Load in the config require_once $configPath; // define the bots name define("BOTNAME", strtolower($config["bot"]["botName"])); // Conversion path triggered if ($args["conv"]) { $discord = new \Discord\Discord($config["discord"]["email"], $config["discord"]["password"]); $bot = Discord::createOauthApp($args["conv"], $config["bot"]["botName"]); $discord->convertToBot($args["conv"], $bot->id, $bot->secret); echo "Bot has been converted to the new Token API.."; exit; } // Start the bot, and load up all the Libraries and Models include BASEDIR . "/src/init.php"; // Check if the CCP Database exists if (!file_exists(BASEDIR . "/config/database/ccpData.sqlite") || filesize(BASEDIR . "/config/database/ccpData.sqlite") == 0) { throw new \Exception("Error, ccpData.sqlite does not exist. Please start the bot with --ccp, to update it"); } // --ccp was passed, lets update the database! if ($args["ccp"]) { $app->ccpdatabaseupdater->createCCPDB(); echo "Updated the CCP Database, now exiting, please start the bot without --ccp"; exit;