Skip to main content


Discord is the easiest way to talk over voice, video, and text. With this integration, you can easily use Discord API.


Credential configuration

The token field corresponds to the token of the bot you want to use. If you don't have a bot, you can create one and get the token following these steps.

For more information about Discord intents, visit this page.

In the extra options field, you can include most of the parameters found here.

Here is an example of a filled credential configuration form in YepCode:

Discord Snippets available in editor


The title is the triggering text for YepCode to autocomplete the script.


New integration from credential
const discordClient = yepcode.integration.discord("credential-slug");
New integration from plain authentication data
const { Client, Intents } = require("discord.js");

// You can use the intents you want, or an empty list
const discordClient = new Client({ intents: [Intents.FLAGS.GUILDS] });


Close Connection

Close connection

Get Servers which Bot is in

Get servers which bot is in
discordClient.guilds.fetch({ limit: 10 }).then(servers => {
servers.forEach(server => console.log(`Found server with id: ${}`))

Get Server

Get server
const server = await discordClient.guilds.fetch("guildId");


Get Server Channels

Get server channels
const server = await discordClient.guilds.fetch("guildId");

const channels = await server.channels.fetch();

channels.forEach((channel) => {
console.log(`Found channel: id: ${} - name: ${} - type: ${channel.type}`);

Get Channel Messages

Get channel messages
const channel = await discordClient.channels.fetch("channelId");

channel.messages.fetch({ limit: 10 }).then((messages) => {
messages.forEach((message) => {
console.log(`Found message with content: ${message.content}`);

Create a Command

Create a command
const command = await discordClient.application.commands
name: "command name",
description: "command description",

console.log(`Created command with id ${}`)

Delete a Command

Delete a command
.then(() => console.log("Deleted command"))