<div align="center">
<br />
<p>
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
</p>
<br />
<p>
<a href="https://discord.gg/bRCvFy9"><img src="https://img.shields.io/discord/222078108977594368?color=7289da&logo=discord&logoColor=white" alt="Discord server" /></a>
<a href="https://www.npmjs.com/package/discord.js"><img src="https://img.shields.io/npm/v/discord.js.svg?maxAge=3600" alt="NPM version" /></a>
<a href="https://www.npmjs.com/package/discord.js"><img src="https://img.shields.io/npm/dt/discord.js.svg?maxAge=3600" alt="NPM downloads" /></a>
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/workflows/Testing/badge.svg" alt="Build status" /></a>
<a href="https://david-dm.org/discordjs/discord.js"><img src="https://img.shields.io/david/discordjs/discord.js.svg?maxAge=3600" alt="Dependencies" /></a>
<a href="https://www.patreon.com/discordjs"><img src="https://img.shields.io/badge/donate-patreon-F96854.svg" alt="Patreon" /></a>
</p>
<p>
<a href="https://nodei.co/npm/discord.js/"><img src="https://nodei.co/npm/discord.js.png?downloads=true&stars=true" alt="npm installnfo" /></a>
</p>
</div>
## Table of contents
- [About](#about)
- [Installation](#installation)
- [Audio engines](#audio-engines)
- [Optional packages](#optional-packages)
- [Example Usage](#example-usage)
- [Links](#links)
- [Extensions](#extensions)
- [Contributing](#contributing)
- [Help](#help)
## About
discord.js is a powerful [Node.js](https://nodejs.org) module that allows you to easily interact with the
[Discord API](https://discord.com/developers/docs/intro).
- Object-oriented
- Predictable abstractions
- Performant
- 100% coverage of the Discord API
## Installation
**Node.js 14.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 ([@discordjs/opus](https://www.npmjs.com/package/@discordjs/opus)): `npm install discord.js @discordjs/opus`
With voice support ([opusscript](https://www.npmjs.com/package/opusscript)): `npm install discord.js opusscript`
### Audio engines
The preferred audio engine is @discordjs/opus, as it performs significantly better than opusscript. When both are available, discord.js will automatically choose @discordjs/opus.
Using opusscript is only recommended for development environments where @discordjs/opus is tough to get working.
For production bots, using @discordjs/opus should be considered a necessity, especially if they're going to be running on multiple servers.
### Optional packages
- [zlib-sync](https://www.npmjs.com/package/zlib-sync) for WebSocket data compression and inflation (`npm install zlib-sync`)
- [erlpack](https://github.com/discord/erlpack) for significantly faster WebSocket data (de)serialisation (`npm install discord/erlpack`)
- One of the following packages can be installed for faster voice packet encryption and decryption:
- [sodium](https://www.npmjs.com/package/sodium) (`npm install sodium`)
- [libsodium.js](https://www.npmjs.com/package/libsodium-wrappers) (`npm install libsodium-wrappers`)
- [bufferutil](https://www.npmjs.com/package/bufferutil) for a much faster WebSocket connection (`npm install bufferutil`)
- [utf-8-validate](https://www.npmjs.com/package/utf-8-validate) in combination with `bufferutil` for much faster WebSocket processing (`npm install utf-8-validate`)
## Example usage
```js
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', msg => {
if (msg.content === 'ping') {
msg.channel.send('pong');
}
});
client.login('token');
```
## Links
- [Website](https://discord.js.org/) ([source](https://github.com/discordjs/website))
- [Documentation](https://discord.js.org/#/docs/main/master/general/welcome)
- [Guide](https://discordjs.guide/) ([source](https://github.com/discordjs/guide)) - this is still for stable
See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v12.html), including updated and removed items in the library.
- [Discord.js Discord server](https://discord.gg/bRCvFy9)
- [Discord API Discord server](https://discord.gg/discord-api)
- [GitHub](https://github.com/discordjs/discord.js)
- [NPM](https://www.npmjs.com/package/discord.js)
- [Related libraries](https://discordapi.com/unofficial/libs.html)
### Extensions
- [RPC](https://www.npmjs.com/package/discord-rpc) ([source](https://github.com/discordjs/RPC))
## Contributing
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
[documentation](https://discord.js.org/#/docs).
See [the contribution guide](https://github.com/discordjs/discord.js/blob/master/.github/CONTRIBUTING.md) 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](https://discord.gg/bRCvFy9).
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
可与Discord API进行交互的JavaScript库.zip (238个子文件)
.gitattributes 19B
.gitignore 267B
Guild.js 46KB
WebSocketShard.js 22KB
GuildChannel.js 22KB
Constants.js 22KB
Message.js 20KB
Util.js 18KB
Client.js 17KB
VoiceConnection.js 14KB
GuildAuditLogs.js 14KB
TextBasedChannel.js 13KB
WebSocketManager.js 13KB
MessageEmbed.js 12KB
Role.js 12KB
Shard.js 12KB
GuildMemberManager.js 12KB
ShardingManager.js 11KB
GuildMember.js 11KB
APIMessage.js 11KB
StreamDispatcher.js 10KB
GuildManager.js 9KB
User.js 9KB
Presence.js 9KB
Collector.js 8KB
ShardClientUtil.js 8KB
Webhook.js 8KB
VoiceWebSocket.js 8KB
random.js 8KB
ReactionCollector.js 7KB
escapeMarkdown.test.js 7KB
MessageMentions.js 7KB
VoiceState.js 6KB
PermissionOverwrites.js 6KB
Messages.js 6KB
GuildMemberRoleManager.js 6KB
RequestHandler.js 6KB
ClientUser.js 5KB
RoleManager.js 5KB
webhooktest.js 5KB
GuildTemplate.js 5KB
sendtest.js 5KB
MessageManager.js 5KB
BitField.js 5KB
index.js 5KB
TextChannel.js 5KB
Invite.js 5KB
Integration.js 4KB
PacketHandler.js 4KB
GuildEmoji.js 4KB
Permissions.js 4KB
DataResolver.js 4KB
MessageCollector.js 4KB
Channel.js 4KB
PlayInterface.js 4KB
VoiceUDPClient.js 4KB
BaseClient.js 4KB
GuildChannelManager.js 4KB
Structures.js 4KB
VoiceChannel.js 4KB
MessageReaction.js 4KB
GuildEmojiManager.js 4KB
GuildPreview.js 4KB
GuildEmojiRoleManager.js 3KB
VoiceBroadcast.js 3KB
ClientVoiceManager.js 3KB
Snowflake.js 3KB
AsyncQueue.js 3KB
Application.js 3KB
BasePlayer.js 3KB
ChannelManager.js 3KB
DMChannel.js 3KB
VolumeInterface.js 2KB
Action.js 2KB
APIRequest.js 2KB
BaseGuildEmojiManager.js 2KB
Emoji.js 2KB
ReactionUserManager.js 2KB
BaseManager.js 2KB
Team.js 2KB
Receiver.js 2KB
MessageAttachment.js 2KB
Intents.js 2KB
UserManager.js 2KB
ClientPresence.js 2KB
voice.js 2KB
ActionsManager.js 2KB
GuildDelete.js 2KB
DiscordAPIError.js 2KB
ReactionManager.js 2KB
PresenceManager.js 2KB
MessageReactionAdd.js 2KB
TypingStart.js 2KB
APIRouter.js 2KB
DJSError.js 2KB
VoiceStateUpdate.js 2KB
GuildMemberUpdate.js 2KB
RESTManager.js 1KB
PresenceUpdate.js 1KB
tester1000.js 1KB
共 238 条
- 1
- 2
- 3
资源评论
小正太浩二
- 粉丝: 194
- 资源: 5904
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功