Создание музыкального бота с помощью Discord.js

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

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

Node.js 6.0.0 or newer is required.
Ignore any warnings about unmet peer dependencies, as they’re all optional.

Without voice support: npm install discord.js
With voice support (node-opus): npm install discord.js node-opus
With voice support (opusscript): npm install discord.js opusscript

The preferred audio engine is node-opus, as it performs significantly better than opusscript. When both are available, discord.js will automatically choose node-opus. Using opusscript is only recommended for development environments where node-opus is tough to get working. For production bots, using node-opus should be considered a necessity, especially if they’re going to be running on multiple servers.

  • RPC (source)

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.

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.

If you’re reading this, it probably means you want to learn how to make a bot with discord.js. Awesome! You’ve come to the right place. This guide will teach you things such as:

  • How to get a bot up and running from scratch;
  • How to properly create, organize, and expand on your commands;
  • How to use the best practices for common situations;
  • and much more.

This guide will also cover subjects like common errors and how to solve them, keeping your code clean, setting up a proper development environment, etc. Sounds good? Great! Let’s get started, then.

# Before you begin…

Alright, making a bot is cool and all, but there are some prerequisites to it. To create a bot with discord.js, you should have a fairly decent grasp of JavaScript itself. While you can
make a bot with very little JS and programming knowledge, trying to do so without understanding the language first will only hinder you. You may get stuck on many uncomplicated issues, struggle with solutions to incredibly easy problems, and all-in-all end up frustrated. Sounds pretty annoying if you ask me.

If you don’t know JS but would like to learn about it, here are a few links to help get you started:

Take your pick, learn some JS, and once you feel like you’re confident enough to make a bot, come back and get started!

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

Node.js 10.0.0 or newer is required.
Ignore any warnings about unmet peer dependencies, as they’re all optional.

Without voice support: npm install discordjs/discord.js
With voice support (node-opus): npm install discordjs/discord.js node-opus
With voice support (opusscript): npm install discordjs/discord.js opusscript

The preferred audio engine is node-opus, as it performs significantly better than opusscript. When both are available, discord.js will automatically choose node-opus. Using opusscript is only recommended for development environments where node-opus is tough to get working. For production bots, using node-opus should be considered a necessity, especially if they’re going to be running on multiple servers.

  • RPC (source)

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.

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.

Рейтинг автора
5
Подборку подготовил
Андрей Ульянов
Наш эксперт
Написано статей
168
Ссылка на основную публикацию
Похожие публикации