LogoRobo.js

Inviting Your Bot

Add your bot to Discord servers

Generate an invite link and add your bot to a server. The invite URL includes scopes (permission categories that define what the bot can do) and specific permissions.

Developer Portal

The simplest way to generate an invite link:

  1. Open discord.com/developers/applications.
  2. Select your application.
  3. Navigate to OAuth2 in the sidebar.
  4. Under URL Generator, select the bot scope (allows joining servers) and applications.commands scope (allows registering slash commands).
  5. Select the permissions your bot requires.
  6. Copy the generated URL at the bottom.

Discord Developer Portal OAuth2 URL Generator page showing the bot and applications.commands scopes checked, a permissions section with several permission checkboxes selected, and the generated URL at the bottom of the page

FocusThe scopes checkboxes with bot and applications.commands selected, and the generated URLZoom100%NotesNavigate to OAuth2 > URL Generator. Check 'bot' and 'applications.commands' scopes. Select common permissions like Send Messages. Show the generated URL at the bottom.

CLI Invite

Alternatively, run the invite command:

npx robo invite

This reads your project configuration, aggregates required permissions from command configs, and outputs a ready-to-use invite URL.

Terminal output from running npx robo invite, showing the generated invite URL with encoded permission bits and scopes, ready to be copied

FocusThe terminal output with the generated invite URLZoom100%NotesRun npx robo invite in a configured bot project. Capture the terminal output showing the generated URL. Use a dark terminal theme.

Permissions and Scopes

The npx robo invite command reads your project's build metadata to determine which permissions your bot needs. During builds, the plugin aggregates permission flags declared in your command configs and stores them in the manifest. The invite CLI then uses that metadata to construct the invite URL with the correct permission bits and scopes (bot and applications.commands by default).

To declare permissions for a command, use createCommandConfig:

src/commands/clean.ts
import { createCommandConfig } from '@robojs/discordjs'
import { PermissionFlagsBits } from 'discord.js'

export const config = createCommandConfig({
  defaultMemberPermissions: PermissionFlagsBits.ManageMessages
})
src/commands/clean.js
import { createCommandConfig } from '@robojs/discordjs'
import { PermissionFlagsBits } from 'discord.js'

export const config = createCommandConfig({
  defaultMemberPermissions: PermissionFlagsBits.ManageMessages
})

If you need to customize the invite URL beyond what the CLI generates, use the Developer Portal method described above.

Privileged Intents

Some events require privileged intents that must be enabled in the Discord Developer Portal before your bot can receive them:

  1. Open your application in the portal.
  2. Navigate to the Bot tab.
  3. Scroll to Privileged Gateway Intents.
  4. Enable the intents your bot needs (Guild Members, Message Content, Presence).

For more detail on how intents work and how the plugin infers them, see the Intents documentation.

Discord Developer Portal Bot tab scrolled to the Privileged Gateway Intents section, showing toggle switches for Presence Intent, Server Members Intent, and Message Content Intent

FocusThe three privileged intent toggle switches with their labelsZoom100%NotesShow the Privileged Gateway Intents section with all three toggles OFF. This represents the default state before any intents are enabled. Crop tightly to just the toggles and section heading.

Troubleshooting

Bot does not appear in the server after inviting

  1. Check that you selected both the bot and applications.commands scopes in the invite URL.
  2. Verify that you have Manage Server permission on the server you are inviting the bot to.
  3. If the invite link shows "Invalid OAuth2 redirect_uri", regenerate the invite using npx robo invite or through the Developer Portal.

Bot is offline after invite

The invite only adds the bot to the server. You still need to run npx robo dev (or npx robo start in production) to bring the bot online. If the bot process is running but appears offline, check that the DISCORD_TOKEN in your .env is correct.

Missing permissions after invite

If the bot cannot perform actions (sending messages, managing roles, etc.), the invite URL may not have included the required permissions. You can either:

  • Re-invite the bot with updated permissions using npx robo invite (the CLI aggregates permissions from your command configs).
  • Manually adjust the bot's role permissions in Server Settings > Roles.

Next Steps

On this page