mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
docs: fix /core README example (#9201)
This commit is contained in:
@@ -35,7 +35,7 @@ pnpm add @discordjs/core
|
|||||||
```ts
|
```ts
|
||||||
import { REST } from '@discordjs/rest';
|
import { REST } from '@discordjs/rest';
|
||||||
import { WebSocketManager } from '@discordjs/ws';
|
import { WebSocketManager } from '@discordjs/ws';
|
||||||
import { GatewayIntentBits, InteractionType, MessageFlags, Client } from '@discordjs/core';
|
import { GatewayDispatchEvents, GatewayIntentBits, InteractionType, MessageFlags, Client } from '@discordjs/core';
|
||||||
|
|
||||||
// Create REST and WebSocket managers directly
|
// Create REST and WebSocket managers directly
|
||||||
const rest = new REST({ version: '10' }).setToken(token);
|
const rest = new REST({ version: '10' }).setToken(token);
|
||||||
@@ -51,7 +51,7 @@ const client = new Client({ rest, ws });
|
|||||||
// Listen for interactions
|
// Listen for interactions
|
||||||
// Each event contains an `api` prop along with the event data that allows you to interface with the Discord REST API
|
// Each event contains an `api` prop along with the event data that allows you to interface with the Discord REST API
|
||||||
client.on(GatewayDispatchEvents.InteractionCreate, async ({ data: interaction, api }) => {
|
client.on(GatewayDispatchEvents.InteractionCreate, async ({ data: interaction, api }) => {
|
||||||
if (!(interaction.type === InteractionType.ApplicationCommand) || interaction.data.name !== 'ping') {
|
if (interaction.type !== InteractionType.ApplicationCommand || interaction.data.name !== 'ping') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user