All Projects → discordjs → Discord.js

discordjs / Discord.js

Licence: apache-2.0
discord.js is a powerful Node.js module that allows you to easily interact with the Discord API.

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Discord.js

Javacord
An easy to use multithreaded library for creating Discord bots in Java.
Stars: ✭ 368 (-97.76%)
Mutual labels:  discord-api, bot, discord-bot, hacktoberfest, discord
Bot
A Discord bot for all your needs. With memes, utilities, moderation & more, Fire is the only bot you'll need.
Stars: ✭ 79 (-99.52%)
Mutual labels:  discord-api, bot, discord-bot, hacktoberfest, discord
Dsharpplus
A .NET Standard library for making bots using the Discord API.
Stars: ✭ 635 (-96.14%)
Mutual labels:  discord-api, bot, discord-bot, discord
Deku
Multi-purpose discord bot built with discord.js
Stars: ✭ 13 (-99.92%)
Mutual labels:  discord-api, bot, discord-bot, discord
Discord4j
Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.
Stars: ✭ 973 (-94.08%)
Mutual labels:  discord-api, bot, discord-bot, discord
Nino
🔨 Advanced and cute moderation discord bot as an entry of Discord's Hack Week!
Stars: ✭ 78 (-99.53%)
Mutual labels:  discord-api, bot, discord-bot, discord
Bot
The community bot for the Python Discord community
Stars: ✭ 460 (-97.2%)
Mutual labels:  bot, discord-bot, hacktoberfest, discord
Discord.js Menu
💬 Easily create Discord.js v12 embed menus with reactions and unlimited customizable pages.
Stars: ✭ 89 (-99.46%)
Mutual labels:  discord-api, bot, discord-bot, discord
Smorebot
SmoreBot is a fun, lightweight, multipurpose bot packed with features.
Stars: ✭ 51 (-99.69%)
Mutual labels:  discord-api, bot, discord-bot, discord
Basicbot
A basic example of a Discord Bot written in Python. (discord.py)
Stars: ✭ 73 (-99.56%)
Mutual labels:  discord-api, bot, discord-bot, discord
Music Bot
Simple music bot with a full-blown queue system that is easy to understand
Stars: ✭ 102 (-99.38%)
Mutual labels:  discord-api, bot, discord-bot, discord
Discord Bot Client
A patched version of discord, with bot login support
Stars: ✭ 441 (-97.32%)
Mutual labels:  discord-api, bot, discord-bot, discord
Sir Lancebot
A Discord bot started as a community project for Hacktoberfest 2018, later evolved to an introductory project for aspiring new developers starting out with open source development.
Stars: ✭ 105 (-99.36%)
Mutual labels:  bot, discord-bot, hacktoberfest, discord
Dtel
Telephone roleplay bot on Discord
Stars: ✭ 108 (-99.34%)
Mutual labels:  bot, discord-bot, hacktoberfest, discord
Commando
Official command framework for discord.js
Stars: ✭ 434 (-97.36%)
Mutual labels:  discord-api, bot, discord-bot, discord
Modmail
A feature rich discord Modmail bot
Stars: ✭ 957 (-94.18%)
Mutual labels:  discord-api, bot, discord-bot, discord
Xiao
Xiao is a Discord bot coded in JavaScript with discord.js using the Commando command framework. With over 500 commands, she is one of the most feature-rich bots out there. Formerly XiaoBot.
Stars: ✭ 302 (-98.16%)
Mutual labels:  discord-api, bot, discord-bot, discord
Discord bot.py
🍺 A simple discord bot that helps you getting started within discord.py
Stars: ✭ 313 (-98.1%)
Mutual labels:  bot, discord-bot, hacktoberfest, discord
Community Bot
The bot used on the TypeScript Community discord server
Stars: ✭ 46 (-99.72%)
Mutual labels:  bot, discord-bot, hacktoberfest, discord
Pengubot
Official PenguBot GitHub Repository
Stars: ✭ 98 (-99.4%)
Mutual labels:  bot, discord-bot, hacktoberfest, discord

discord.js


Discord server npm version npm downloads Tests status

About

discord.js is a powerful Node.js module that allows you to easily interact with the Discord API.

  • Object-oriented
  • Predictable abstractions
  • Performant
  • 100% coverage of the Discord API

Installation

Node.js 16.6.0 or newer is required.

npm install discord.js
yarn add discord.js
pnpm add discord.js

Optional packages

  • zlib-sync for WebSocket data compression and inflation (npm install zlib-sync)
  • erlpack for significantly faster WebSocket data (de)serialisation (npm install discord/erlpack)
  • bufferutil for a much faster WebSocket connection (npm install bufferutil)
  • utf-8-validate in combination with bufferutil for much faster WebSocket processing (npm install utf-8-validate)
  • @discordjs/voice for interacting with the Discord Voice API (npm install @discordjs/voice)

Example usage

Install all required dependencies:

npm install discord.js @discordjs/rest discord-api-types
yarn add discord.js @discordjs/rest discord-api-types
pnpm add discord.js @discordjs/rest discord-api-types

Register a slash command against the Discord API:

const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');

const commands = [{
  name: 'ping',
  description: 'Replies with Pong!'
}]; 

const rest = new REST({ version: '9' }).setToken('token');

(async () => {
  try {
    console.log('Started refreshing application (/) commands.');

    await rest.put(
      Routes.applicationGuildCommands(CLIENT_ID, GUILD_ID),
      { body: commands },
    );

    console.log('Successfully reloaded application (/) commands.');
  } catch (error) {
    console.error(error);
  }
})();

Afterwards we can create a quite simple example bot:

const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
});

client.on('interactionCreate', async interaction => {
  if (!interaction.isCommand()) return;

  if (interaction.commandName === 'ping') {
    await interaction.reply('Pong!');
  }
});

client.login('token');

Links

Extensions

Contributing

Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the documentation.
See the contribution guide if you'd like to submit a PR.

Help

If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to join our official discord.js Server.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].