Riscord Back to chat

Developer docs

Build a bot that belongs in your community.

API v1 SDK 0.5.0

Your first bot

Create an application, install the SDK and get a slash command working.

Create and install your bot

  1. Open Applications in the Developer Portal and create a bot.
  2. Request View Channel and Send Messages. Add other permissions only when your bot needs them.
  3. Generate a token and save it as RISCORD_BOT_TOKEN in your environment. It is shown once.
  4. Open the application’s install link and authorize it in a server where you have Manage Server.
Open Applications

Bot tokens belong on your computer or server. Never put one in a website, a URL, a screenshot or source control. Reset a leaked token in the Portal.

Install the SDK

Choose JavaScript / TypeScript or Python above. JavaScript needs Node.js 22 or newer; Python needs Python 3.11 or newer. Text commands do not need FFmpeg.

Rich embeds, reply editing, paginated history and the new role/member helpers require SDK 0.3.0 or newer and the updated API. Use the verified release shown above; the SDK release notes list what changed.

pnpm
pnpm add @riscord/bot

Add a hello command

Save this as bot.mjs for JavaScript or bot.py for Python. Registering commands replaces the bot’s command list, so send the full list you want to keep.

JavaScript
import { Client } from '@riscord/bot';

const bot = new Client({ token: process.env.RISCORD_BOT_TOKEN });
await bot.registerCommands([
  { name: 'hello', description: 'Say hello', contexts: ['server', 'dm'] },
]);
bot.command('hello', interaction =>
  interaction.reply('Hello!', { private: true })
);
bot.on('ready', () => console.log('Ready'));
process.once('SIGINT', () => bot.close());
process.once('SIGTERM', () => bot.close());
await bot.connect();

Run it

Set RISCORD_BOT_TOKEN in your shell or hosting provider’s environment settings, then run the file. A .env file is not loaded automatically. In your installed server, type /hello and choose the bot’s command.

The bot runs on your machine. Keep that process running for commands and events to work.

JavaScript
node bot.mjs