### Add Robo.js Plugins Source: https://robojs.dev/getting-started Installs and integrates specified Robo.js plugins into an existing project. This command allows for the seamless addition of new features, such as AI or server capabilities, by running the robo add command with the desired plugin package names. ```shell npx **robo add @robojs/ai @robojs/server** ``` -------------------------------- ### Plugin Installation Prompt Example Source: https://robojs.dev/plugins/seed An example of the interactive prompt when a plugin installation detects seed files. The user can choose to include them or not. ```bash 📦 Installing plugin ✔ @robojs/server 🌱 Seed files detected - @robojs/server: Example API route and index page Would you like to include these files? [Y/n]: n ✨ Plugin successfully installed and ready to use. ``` -------------------------------- ### Add Robo.js Plugins Source: https://robojs.dev/discord-bots/getting-started Installs additional plugins for Robo.js projects to extend functionality. Plugins integrate seamlessly into the Robo File Structure, allowing for easy feature additions. Example shows adding AI and moderation plugins. ```bash npx **robo add @robojs/ai @robojs/moderation** ``` -------------------------------- ### Install Dependencies and Start Dev Server (NPM) Source: https://robojs.dev/templates/web-apps/discord-auth-ts Commands to install project dependencies and start the local development server for a Robo.js application. This is typically run after scaffolding a new project. ```bash npm install npm run dev ``` -------------------------------- ### Create a New Robo.js Project Source: https://robojs.dev/discord-activities Use this command to quickly scaffold a new Robo.js project, which is designed to function as a Discord Activity. This command initializes a project structure suitable for building Discord Activities. ```bash npx create-robo **** ``` -------------------------------- ### Start Robo.js in Production Mode Source: https://robojs.dev/templates/discord-activities/react-multiplayer-video-ts Command to start the Robo.js application after building it for production. This is used for self-hosting your Robo. ```bash npm start ``` -------------------------------- ### Install Robo.js Package Source: https://robojs.dev/discord-bots/migrate Installs the Robo.js package using npm. This is the first step for any migration or new project setup. ```bash npm install **robo.js** ``` -------------------------------- ### Deploy Robo.js Project with RoboPlay Source: https://robojs.dev/hosting/roboplay This command optimizes and deploys your Robo.js project to RoboPlay. It also handles updates. First-time users will be guided through a setup process. ```bash npx robo deploy ``` -------------------------------- ### Backend API Route (JavaScript/TypeScript) Source: https://robojs.dev/discord-activities/beginner-guide A simple API route handler for the backend server. This example demonstrates a basic route that returns a 'Hello, World!' string. ```javascript export default () => { return 'Hello, World!' } ``` ```typescript export default () => { return 'Hello, World!' } ``` -------------------------------- ### Deploy and Run Robo.js Application Source: https://robojs.dev/templates/web-apps/react-ts Commands for deploying the Robo.js application. `npm run deploy` is used for deployment to RoboPlay. For self-hosting, build the application using `npm run build` and then start it with `npm start`. ```bash npm run deploy npm run build npm start ``` -------------------------------- ### REST API Forum Setup (Bash) Source: https://robojs.dev/plugins/roadmap An example `curl` command to initiate the forum setup process via the RoboJS Roadmap REST API. This command uses the `POST` method and targets the `/api/roadmap/forum/:guildId/setup` endpoint, requiring the `guildId` as a path parameter. ```bash # Create forum structure curl -X POST http://localhost:3000/api/roadmap/forum/:guildId/setup ``` -------------------------------- ### Import Robo.js Client Source: https://robojs.dev/discord-bots/getting-started Demonstrates how to import the Discord.js client managed by Robo.js. The client is configured in `/config/robo.mjs` and can be imported using ESM syntax. ```javascript import { client } from 'robo.js' ``` -------------------------------- ### Create Robo.js Project with Specified Plugins (NPM) Source: https://robojs.dev/cli/create-robo Initialize a new Robo.js project and automatically install specified plugins, such as '@robojs/ai', from the start. ```bash npx create-robo --plugins @robojs/ai ``` -------------------------------- ### Add Robo.js Plugins Source: https://robojs.dev/discord-activities Install additional features to your Robo.js project by adding plugins. This command demonstrates how to add the @robojs/ai and @robojs/sync plugins, extending your activity's capabilities. ```bash npx **robo add @robojs/ai @robojs/sync** ``` -------------------------------- ### Build and Start Robo.js Application Source: https://robojs.dev/templates/web-apps/discord-auth-ts Commands to build the Robo.js application for production and start the self-hosted server. These commands are used for deploying the application. ```bash npm run build npm start # self-hosting ``` -------------------------------- ### Build and Start Robo.js Project for Self-Hosting Source: https://robojs.dev/hosting/overview These commands are used when self-hosting a Robo.js project. `robo build` prepares your project for production, and `robo start` runs the optimized production build. It's crucial not to use `robo dev` in production. ```bash robo build robo start ``` -------------------------------- ### Add Robo.js Plugin Source: https://robojs.dev/templates/discord-activities/react-tailwind-ts Installs a new plugin for the Robo.js project. Replace '@robojs/ai' with the desired plugin package name. This command extends the functionality of your Robo by adding capabilities provided by the specified plugin. ```bash npx robo add @robojs/ai ``` -------------------------------- ### Install Robo.js Plugin (NPM) Source: https://robojs.dev/templates/discord-bots/economy-ts Demonstrates how to install a Robo.js plugin using NPM. Replace `@roboplay/plugin-gpt` with the actual package name of the plugin you wish to install. This command fetches the plugin from the NPM registry. ```bash npm install @roboplay/plugin-gpt ``` -------------------------------- ### Install Dependencies with NPM Source: https://robojs.dev/hosting/self-host Installs all necessary project dependencies using the Node Package Manager (NPM). Ensure Node.js v20 or newer is installed. ```bash npm install ``` -------------------------------- ### Build and Start Robo.js for Self-Hosting Source: https://robojs.dev/templates/discord-activities/react-music-proxy-ts These commands are used for self-hosting your Robo.js application. First, `npm run build` compiles your project, and then `npm start` runs the built application. This is suitable for deployment on any Node.js compatible environment. ```bash npm run build npm start ``` -------------------------------- ### Start RoboPlay Pod Source: https://robojs.dev/hosting/roboplay This command restarts a previously stopped RoboPlay pod, bringing your Robo back online. Deploying again also starts the Robo. ```bash npx robo cloud start ``` -------------------------------- ### Create Robo Project with React, Tailwind, TypeScript Template Source: https://robojs.dev/templates/discord-activities/react-tailwind-ts Initializes a new Robo.js project using the 'discord-activities/react-tailwind-ts' template. Replace '' with your desired project name. This command sets up the project structure and dependencies for a React, Tailwind CSS, and TypeScript-based Discord activity. ```bash npx create-robo --template discord-activities/react-tailwind-ts --name ``` -------------------------------- ### Robo.js CLI Help and Upgrade Commands Source: https://robojs.dev/cli/robo Provides information on how to get help for the Robo.js CLI or specific commands, and how to upgrade Robo.js and installed plugins to their latest versions. ```bash robo help ``` ```bash robo help build ``` ```bash robo upgrade ``` -------------------------------- ### Install Robo.js Plugin using Robo CLI Source: https://robojs.dev/plugins/install Installs a Robo.js plugin using the 'robo add' command. This command handles both the NPM package installation and registration within the Robo's configuration. It supports installing multiple plugins simultaneously. ```bash npx robo add ``` ```bash npx robo add @robojs/ai @robojs/server ``` ```bash npx create-robo --plugins @robojs/ai @robojs/server ``` -------------------------------- ### Log Environment Variable on Project Start Source: https://robojs.dev/robojs/environment-variables Logs the value of `EXAMPLE_VARIABLE` from the environment to the console when the Robo.js project starts. This showcases the automatic loading of environment variables. ```javascript export default () => { // This is EXAMPLE_VARIABLE in your .env file console.log(process.env.EXAMPLE_VARIABLE) } ``` -------------------------------- ### Create Robo.js Project Skipping Dependency Installation (NPM) Source: https://robojs.dev/cli/create-robo Initialize a new Robo.js project without automatically installing dependencies. This is useful if you want to manage installations manually. ```bash npx create-robo --no-install ``` -------------------------------- ### Run Robo.js Bot Source: https://robojs.dev/discord-bots/beginner-guide Command to run a Robo.js bot in development mode. Assumes Node.js and necessary credentials are set up. ```bash npm run dev ``` -------------------------------- ### Environment Variable Seeding Example Source: https://robojs.dev/plugins/seed This example shows how a plugin can detect and propose seeding environment variables. The user is prompted to confirm the addition of these variables to their .env file. ```bash 🔑 Environment additions detected - @robojs/auth: Adds secure defaults for authentication flows. AUTH_SECRET – Secret used to sign and verify authentication payloads. Target files: .env Add these variables to .env? [Y/n]: Y 🔑 Environment variables applied ✔ @robojs/auth added AUTH_SECRET ``` -------------------------------- ### Install TypeScript Dependencies for Existing Projects Source: https://robojs.dev/robojs/typescript Installs the necessary development dependencies, `@swc/core` and `typescript`, for an existing project to enable TypeScript support. It also assumes the creation of a `tsconfig.json` file. ```bash npm install **--save-dev @swc/core typescript** ``` -------------------------------- ### Install @robojs/dev Plugin Source: https://robojs.dev/plugins/dev Installs the @robojs/dev plugin into your Robo.js project using NPM. This command should be executed from your Robo directory. ```bash npx robo add @robojs/dev ``` -------------------------------- ### Build Robo.js for Production Source: https://robojs.dev/templates/discord-activities/react-multiplayer-video-ts Command to build the Robo.js project for production. This command compiles your code and prepares it for deployment. ```bash npm run build ``` -------------------------------- ### Install Multiple Robo Plugins using NPM Source: https://robojs.dev/plugins/overview Installs multiple Robo.js plugins simultaneously using NPM via the Robo CLI. This command adds all specified plugin NPM packages and registers them in the Robo's configuration. ```bash npx robo add @robojs/ai @robojs/moderation @robojs/server ``` -------------------------------- ### Jira Configuration with JQL Filtering Example Source: https://robojs.dev/plugins/roadmap Presents an example of Jira-specific configuration within the roadmap plugin, including a detailed JQL query to filter for unresolved public stories. ```javascript export default { provider: { type: 'jira', options: { url: 'https://company.atlassian.net', email: 'team@example.com', apiToken: process.env.JIRA_API_TOKEN, projectKey: 'PROJ', jql: 'project = PROJ AND labels = public AND resolution = Unresolved', maxResults: 50, defaultIssueType: 'Story' } } } ``` -------------------------------- ### Create Robo Project with Pre-installed Plugins Source: https://robojs.dev/plugins/overview Creates a new Robo.js project with specified plugins pre-installed using the Robo CLI and NPM. This command initializes a project and sets up the initial plugins. ```bash npx create-robo projectName --plugins @robojs/ai @robojs/server ``` -------------------------------- ### Setup Roadmap Forum Structure in Discord Source: https://robojs.dev/plugins/roadmap Initiates the setup process for the roadmap in Discord by creating a dedicated category and forum channels for each workflow column. This command is typically run by an administrator. ```discord_command /roadmap setup ``` -------------------------------- ### Robo.js Module File Structure Example Source: https://robojs.dev/robojs/modules This example illustrates a basic Robo.js project structure incorporating modules for organization. It shows separate 'commands' and 'events' folders within each module directory. ```tree src/ └── modules/ ├── moderation/ | ├── commands/ | └── events/ └── fun/ ├── commands/ └── events/ ``` -------------------------------- ### Create Robo.js Project with Starter Template Source: https://robojs.dev/templates/discord-bots/starter-js Use the 'create-robo' command with the 'discord-bots/starter-js' template to initialize a new Robo.js project. Replace '' with your desired project name. This command sets up the basic structure and configuration for a Discord bot using Robo.js. ```bash npx create-robo --template discord-bots/starter-js --name ``` -------------------------------- ### Create a Vanilla JS Robo.js Project Source: https://robojs.dev/templates/discord-activities/vanilla-js Initializes a new Robo.js project using the discord-activities/vanilla-js template. Replace `` with your desired project name. This command sets up the basic structure for building Discord activities. ```bash npx create-robo --template discord-activities/vanilla-js --name ``` -------------------------------- ### Handle GET request with parameters in JavaScript Source: https://robojs.dev/plugins/server This example shows how to handle a GET request, check the request method, and access URL parameters. It extracts a user ID from the request parameters and returns a message. ```javascript export default (request, reply) => { if (request.method !== 'GET') { throw new Error('Method not allowed') } const userId = request.params.id // ... perform some action with userId return { message: `User ID is ${userId}` } } ``` -------------------------------- ### Install @robojs/server and @robojs/trpc Source: https://robojs.dev/plugins/trpc Command to add the @robojs/server and @robojs/trpc plugins to an existing Robo.js project using NPM. ```bash npx robo add @robojs/server @robojs/trpc ``` -------------------------------- ### Create Robo.js SvelteKit Project Source: https://robojs.dev/templates/web-apps/svelte-js Initializes a new Robo.js project using the SvelteKit template. Replace `` with your desired project name. This command sets up the basic structure for a SvelteKit web application managed by Robo.js. ```bash npx create-robo **--template web-apps/svelte-js --name ** ``` -------------------------------- ### Create Robo.js Project with Starter Template (NPM) Source: https://robojs.dev/templates/plugins/starter-js Command to create a new Robo.js project using the starter-js template. Replace `` with your desired project name. This command utilizes npx to execute the create-robo command with the specified template. ```bash npx create-robo **--template plugins/starter-js --name ** ``` -------------------------------- ### TRPCProvider Integration in React App Source: https://robojs.dev/plugins/trpc Example of wrapping a React application with TRPCProvider to enable tRPC capabilities. It requires the trpc and trpcQueryClient objects, typically seeded during installation. ```jsx import { TRPCProvider } from '@robojs/trpc' import { trpc, trpcQueryClient } from '../trpc/client' function App() { return ( ) } ``` -------------------------------- ### React App Entry Point (tsx) Source: https://robojs.dev/playground This snippet demonstrates the basic setup for a React application using React DOM. It renders the main App component into a root element in the HTML. No external dependencies beyond React are explicitly shown. ```tsx import React from 'react' import ReactDOM from 'react-dom/client' import App from './App' ReactDOM.createRoot(document.getElementById('root')!).render( ) ``` -------------------------------- ### Create Robo.js Project from a Kit (NPM) Source: https://robojs.dev/cli/create-robo Initialize a new Robo.js project using a pre-defined kit, such as 'bot'. Kits provide a starting point with specific configurations. ```bash npx create-robo --kit bot ``` -------------------------------- ### Create API Route (JavaScript) Source: https://robojs.dev/templates/discord-activities/vanilla-ts Example of creating a new API route in Robo.js by defining a default export function in a JavaScript file within the /src/api directory. The filename dictates the route path. ```javascript export default () => { return { status: 'ok' } } ``` -------------------------------- ### Navigate and Run Robo.js Project Source: https://robojs.dev/templates/discord-activities/2d-game Commands to navigate into the created Robo.js project directory and start the development server. This enables hot module reloading and other development features. ```bash cd npm run dev ``` -------------------------------- ### ESLint Configuration for Robo.js Projects Source: https://robojs.dev/robojs/linting This JSON configuration sets up ESLint for JavaScript and TypeScript projects. It extends recommended rules, enables Node.js environment, and uses the TypeScript parser. Ensure ESLint and @typescript-eslint/parser are installed as dev dependencies. ```json { "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], "env": { "node": true }, "parser": "@typescript-eslint/parser", "plugins": ["@typescript-eslint"], "root": true, "rules": {} } ``` -------------------------------- ### Create a Backend API Route in Robo.js Source: https://robojs.dev/templates/web-apps/svelte-ts Defines a new API route in Robo.js by creating a JavaScript file in the `/src/api` directory. The file name determines the route path. This example creates a `/health` route returning a JSON status object. ```javascript export default () => { return { status: 'ok' }; }; ``` -------------------------------- ### Create Robo.js Project with TypeScript Template Source: https://robojs.dev/templates/discord-bots/starter-ts Use this command to create a new Robo.js project using the starter TypeScript template. Replace `` with your desired project name. This sets up a basic project structure with TypeScript support. ```bash npx create-robo **--template discord-bots/starter-ts --name ** ``` -------------------------------- ### Prettier Configuration for Robo.js Projects Source: https://robojs.dev/robojs/linting This JavaScript configuration file defines Prettier's code formatting rules. It specifies preferences like line width, semicolon usage, quote style, trailing commas, and tab indentation. Prettier must be installed as a dev dependency. ```javascript module.exports = { printWidth: 120, semi: false, singleQuote: true, trailingComma: 'none', tabWidth: 2, useTabs: true } ``` -------------------------------- ### Create Robo.js Project with Unity Template Source: https://robojs.dev/templates/discord-activities/unity This command initializes a new Robo.js project using the 'discord-activities/unity' template. Replace '' with your desired project name. This sets up the basic structure for a Discord activity project with Unity integration. ```bash npx create-robo --template discord-activities/unity --name ``` -------------------------------- ### Create a new Robo.js project with Colyseus template Source: https://robojs.dev/discord-activities/multiplayer This command uses the Robo.js CLI to create a new project with a pre-configured template for Discord Activities using React and Colyseus. This template simplifies the setup process for building complex multiplayer games, providing a starting point for server and client integration. ```bash npx create-robo --template discord-activities/react-colyseus-ts ``` -------------------------------- ### Robo.js Project Scripts Source: https://robojs.dev/playground Defines scripts for building, deploying, developing, and linting the Robo.js project. It leverages the `robo.js` CLI for various development and deployment tasks. ```json { "name": "starter-webapp-typescript", "description": "", "version": "1.0.0", "type": "module", "private": true, "keywords": [ "api", "http", "robo", "robo.js", "server", "typescript", "vite", "web" ], "scripts": { "build": "robo build", "deploy": "robo deploy", "dev": "robox dev", "doctor": "sage doctor", "invite": "robo invite", "lint:style": "prettier --write .", "start": "robo start", "upgrade": "sage upgrade" }, "dependencies": { "@robojs/server": "^0.5.7", "react": "^18.3.1", "react-dom": "^18.3.1", "robo.js": "^0.10.15" }, "devDependencies": { "@swc/core": "^1.7.26", "@types/node": "^22.7.4", "@types/react": "^18.3.10", "@types/react-dom": "^18.3.0", "@vitejs/plugin-react-swc": "^3.7.0", "eslint-plugin-react-hooks": "^4.6.2", "prettier": "^3.3.3", "typescript": "^5.6.2", "vite": "^5.4.8" } } ``` -------------------------------- ### Manually Install Robo.js Plugin using NPM Source: https://robojs.dev/plugins/install Installs a Robo.js plugin manually using a package manager like NPM. After installation, the plugin needs to be registered in the Robo's configuration. ```bash npm install ``` -------------------------------- ### Create Robo.js Vanilla TS Project (NPM) Source: https://robojs.dev/templates/discord-activities/vanilla-ts Command to create a new Robo.js project using the discord-activities/vanilla-ts template with a specified project name. This is the initial step for setting up a new Discord activity project. ```bash npx create-robo **--template discord-activities/vanilla-ts --name ** ``` -------------------------------- ### Install @robojs/patch with NPM Source: https://robojs.dev/plugins/patch Installs the @robojs/patch package using NPM. This command can be used both within a Robo.js project via 'robo add' or as a standalone package installation. ```bash npx **robo add @robojs/patch** npm install @robojs/patch ``` -------------------------------- ### Install @robojs/analytics Plugin Source: https://robojs.dev/plugins/analytics Installs the @robojs/analytics plugin into an existing Robo.js project using NPM. ```bash npx robo add @robojs/analytics ``` -------------------------------- ### Create Robo.js Discord Activities Project Source: https://robojs.dev/templates/discord-activities/2d-game Initializes a new Robo.js project using the 'discord-activities/2d-game' template. This command requires the 'create-robo' package and allows specifying a project name. ```bash npx create-robo **--template discord-activities/2d-game --name ** ``` -------------------------------- ### Configure Bot Integration Types (JavaScript) Source: https://robojs.dev/discord-bots/commands Configure the integration types for your bot commands. By default, commands are only available in guilds where the bot is installed. Setting integrationTypes to ['GuildInstall', 'UserInstall'] allows commands to be used in any server, even if the bot is not installed there. Remove 'GuildInstall' to restrict commands to installed users. ```javascript export const config = { // ... other config integrationTypes: ['GuildInstall', 'UserInstall'] } ``` -------------------------------- ### Create New Robo.js Project (NPM) Source: https://robojs.dev/cli/create-robo Initialize a new Robo.js project named 'my-awesome-robo' using npx. This is the primary command for starting a new Robo project. ```bash npx create-robo **my-awesome-robo** ``` -------------------------------- ### Install @robojs/better-stack Plugin Source: https://robojs.dev/plugins/better-stack This command installs the @robojs/better-stack plugin into your existing Robo.js project, adding Better Stack capabilities. ```bash npx **robo add @robojs/better-stack** ``` -------------------------------- ### Running Linting and Formatting with NPM Source: https://robojs.dev/robojs/linting This command executes linting and formatting tasks defined in your project's `package.json` scripts, typically combining ESLint and Prettier. It assumes you have a 'lint' script configured. Requires npm and a package.json with a lint script. ```bash npm run lint ``` -------------------------------- ### Vite Build Tool Configuration Source: https://robojs.dev/playground Configures the Vite build tool, integrating the React SWC plugin and enabling specific server options. It sets up the development server to allow all hosts. ```javascript import { defineConfig } from 'vite' import react from '@vitejs/plugin-react-swc' // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], server: { allowedHosts: true } }) ``` -------------------------------- ### Install @robojs/giveaways Plugin Source: https://robojs.dev/plugins/giveaways This command installs the @robojs/giveaways plugin using NPM. It is used to add the giveaway functionality to an existing Robo.js project. ```bash npx **robo add @robojs/giveaways** ``` -------------------------------- ### Create Robo.js Project with SvelteKit (TS) Template Source: https://robojs.dev/templates/web-apps/svelte-ts Initializes a new Robo.js project using the SvelteKit and TypeScript template. Replace `` with your desired project name. This command uses `create-robo` to scaffold the project. ```bash npx create-robo --template web-apps/svelte-ts --name ``` -------------------------------- ### Install @robojs/i18n with NPM Source: https://robojs.dev/plugins/i18n Installs the @robojs/i18n plugin into an existing Robo project using NPM. This is the standard way to add the i18n functionality. ```bash npx robo add @robojs/i18n ``` -------------------------------- ### Discord Authentication Provider Source: https://robojs.dev/discord-activities/beginner-guide Sets up the Discord context provider for the application, enabling authentication with Discord. It specifies the necessary scopes for user identification and guild information. ```javascript import { DiscordContextProvider } from '../hooks/useDiscordSdk' import { Activity } from './Activity' import './App.css' export default function App() { return ( ) } ``` -------------------------------- ### Create Robo.js Project with Specific Features (NPM) Source: https://robojs.dev/cli/create-robo Initialize a new Robo.js project and include specific features like ESLint and Prettier, separated by commas. ```bash npx create-robo --features eslint,prettier ``` -------------------------------- ### Install @robojs/xp using NPM Source: https://robojs.dev/plugins/xp This command installs the @robojs/xp package into your existing Robo.js project using npm. It's a straightforward command to add the XP system functionality. ```bash npx **robo add @robojs/xp** ``` -------------------------------- ### Create a new Robo.js project with @robojs/server using NPM Source: https://robojs.dev/plugins/server This command creates a new Robo.js project with the @robojs/server plugin pre-installed. It uses npx to execute the create-robo command, specifying the project name and plugin. ```bash npx create-robo ** -p @robojs/server** ``` -------------------------------- ### Install @robojs/auth Plugin Source: https://robojs.dev/plugins/auth Installs the @robojs/auth plugin using NPM and registers it in the Robo.js configuration. This command-line action ensures the necessary package is added to your project. ```bash npx **robo add @robojs/auth** ``` -------------------------------- ### Create Robo.js Project with React Multiplayer Video TS Template Source: https://robojs.dev/templates/discord-activities/react-multiplayer-video-ts Command to create a new Robo.js project using the discord-activities/react-multiplayer-video-ts template. Replace '' with your desired project name. This sets up a project with React, TypeScript, and multiplayer video features. ```bash npx create-robo **--template discord-activities/react-multiplayer-video-ts --name ** ``` -------------------------------- ### Install @robojs/maintenance using NPM Source: https://robojs.dev/plugins/maintenance This snippet shows the command to install the @robojs/maintenance plugin using NPM. It's a straightforward command executed in the Robo project's directory. ```bash npm install @robojs/maintenance ``` -------------------------------- ### Run Robo.js Development Server Source: https://robojs.dev/discord-bots/migrate Starts the Robo.js development server using npx. This command is used across different migration strategies to run the bot during development. ```bash npx **robo dev** ``` -------------------------------- ### Install @robojs/server Plugin Source: https://robojs.dev/plugins/giveaways Install the @robojs/server plugin to enable REST API endpoints for managing giveaways. This command uses npx to execute the robo add command. ```bash npx robo add @robojs/server ``` -------------------------------- ### CSS Styling for App Component Source: https://robojs.dev/playground Provides CSS styles for the main App component, defining the color scheme, typography, and layout for different screen sizes and color preferences. It includes styles for links, buttons, and a 'powered-by' section. ```css :root { font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; line-height: 1.5; font-weight: 400; color-scheme: light dark; color: rgba(255, 255, 255, 0.87); background-color: #242424; font-synthesis: none; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } a { font-weight: 500; color: #646cff; text-decoration: inherit; } a:hover { color: #535bf2; } body { margin: 0; display: flex; place-items: center; min-width: 320px; min-height: 100vh; } h1 { font-size: 3.2em; line-height: 1.1; } #root { max-width: 1280px; margin: 0 auto; padding: 2rem; text-align: center; } button { border-radius: 8px; border: 1px solid transparent; padding: 0.6em 1.2em; font-size: 1em; font-weight: 500; font-family: inherit; background-color: #1a1a1a; cursor: pointer; transition: border-color 0.25s; } button:hover { border-color: #646cff; } button:focus, button:focus-visible { outline: 4px auto -webkit-focus-ring-color; } .powered-by { display: inline-block; margin-top: 24px; } .powered-by a { color: #ffffff; font-weight: 700; } @media (prefers-color-scheme: light) { :root { color: #213547; background-color: #ffffff; } a:hover { color: #747bff; } button { background-color: #f9f9f9; } } ``` -------------------------------- ### Start Robo.js Server in Production Mode with NPM Source: https://robojs.dev/hosting/self-host Starts your Robo.js server in production mode after building. This command makes your Robo accessible to the world. Ensure NODE_ENV is set to 'production'. ```bash npx robo start ``` -------------------------------- ### Fetch Guild Giveaway Settings (GET API) Source: https://robojs.dev/plugins/giveaways This curl command reads the persisted GuildSettings for a specific guild. It makes a GET request to the /api/giveaways/:guildId/settings endpoint. ```bash curl http://localhost:3000/api/giveaways/123456789012345678/settings ``` -------------------------------- ### Create Robo.js Project using Template Source: https://robojs.dev/templates/discord-bots/mrjawesome-dev-toolkit-js This command initializes a new Robo.js project using a specified template. Replace `` with your desired project name. ```bash npx create-robo --template discord-bots/mrjawesome-dev-toolkit-js --name ``` -------------------------------- ### Configure RoboJS Server Plugin Source: https://robojs.dev/plugins/server Example configuration for the RoboJS server plugin. It shows how to set the hostname, port, URL prefix, and a custom server engine. This allows customization of the server's behavior and network settings. ```javascript // File: /config/plugins/robojs/server.mjs export default { hostname: '0.0.0.0', // Defaults to 'localhost' port: 5000, // Custom port prefix: false, // Disable the '/api' prefix engine: CustomServer // Custom server engine } ``` -------------------------------- ### Create Robo.js Economy Bot Project (NPM) Source: https://robojs.dev/templates/discord-bots/economy-ts Use this command to create a new Discord bot project with the Robo.js Economy template. Replace `` with your desired project name. This command utilizes NPM to fetch and set up the template. ```bash npx create-robo **--template discord-bots/economy-ts --name ** ``` -------------------------------- ### Install @robojs/cron Plugin Source: https://robojs.dev/plugins/giveaways Install the @robojs/cron plugin to enhance scheduling capabilities for giveaways. This plugin provides higher accuracy, longer time windows, job persistence, and better recovery. ```bash npx **robo add @robojs/cron** ``` -------------------------------- ### Create New Robo.js Project with @robojs/xp using NPM Source: https://robojs.dev/plugins/xp This command creates a new Robo.js project with the @robojs/xp plugin pre-installed. You need to provide a project name. This is useful for starting a new project that will utilize the XP system from the beginning. ```bash npx create-robo ** -p @robojs/xp** ``` -------------------------------- ### Robo.js Nested Module Structure Example Source: https://robojs.dev/robojs/modules This example showcases the capability of Robo.js modules to be nested infinitely, allowing for deep organizational hierarchies within the bot's codebase. ```tree src/ └── modules/ ├── moderation/ | ├── commands/ | ├── events/ | └── modules/ | ├── chat-monitor/ | └── ban-hammer/ └── fun/ ├── commands/ └── events/ ``` -------------------------------- ### Create Robo.js Project with Verbose Logging (NPM) Source: https://robojs.dev/cli/create-robo Initialize a new Robo.js project and enable verbose logging for debugging purposes. ```bash npx create-robo --verbose ``` -------------------------------- ### JQL Filtering Examples for Jira Issues Source: https://robojs.dev/plugins/roadmap Provides examples of Jira Query Language (JQL) statements to filter issues based on various criteria such as project, labels, and resolution status. ```javascript // Public cards only jql: 'project = PROJ AND labels = public' // Exclude private cards jql: 'project = PROJ AND labels != private' // Active cards only (not resolved) jql: 'project = PROJ AND resolution = Unresolved' // Cards updated in last 30 days jql: 'project = PROJ AND updated >= -30d' ``` -------------------------------- ### Jira Provider Configuration with Environment Variables Source: https://robojs.dev/plugins/roadmap Demonstrates how to configure the Jira provider using environment variables within a .env file. This is the simplest setup method for most use cases. ```env JIRA_URL="https://company.atlassian.net" JIRA_EMAIL="team@example.com" JIRA_API_TOKEN="ATATT3xFfGF0..." JIRA_PROJECT_KEY="PROJ" JIRA_JQL="labels = public" JIRA_MAX_RESULTS="50" JIRA_DEFAULT_ISSUE_TYPE="Story" ``` -------------------------------- ### Fetch Active and Recent Giveaways (GET API) Source: https://robojs.dev/plugins/giveaways This curl command fetches the active giveaway roster and recent history for a specific guild. It makes a GET request to the /api/giveaways/:guildId endpoint. ```bash curl http://localhost:3000/api/giveaways/123456789012345678 ``` -------------------------------- ### User Context Menu Command Example (JavaScript) Source: https://robojs.dev/discord-bots/context-menu A JavaScript example for a user context menu command. This command receives a UserContextMenuCommandInteraction and the target user, resolves the user to a GuildMember, and kicks them from the server. ```javascript export default async function (interaction, user) { const guildMember = interaction.guild.members.resolve(user) await guildMember.kick() return `Yeeted ${user.username} from the server. Bye! 👋` } ``` -------------------------------- ### Upgrade Robo.js and Plugins using Robo CLI Source: https://robojs.dev/plugins/install Updates Robo.js itself and all installed plugins to their latest versions using the 'robo upgrade' command. This command presents a list of available updates and changelogs for user selection. ```bash npx robo upgrade ```