Skip to content

Commit

Permalink
docs: Update example usage (#9461)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiralite authored Apr 27, 2023
1 parent b2e1bb9 commit 6212bff
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ import { GatewayDispatchEvents, GatewayIntentBits, InteractionType, MessageFlags

// Create REST and WebSocket managers directly
const rest = new REST({ version: '10' }).setToken(token);
const ws = new WebSocketManager({

const gateway = new WebSocketManager({
token,
intents: GatewayIntentBits.GuildMessages | GatewayIntentBits.MessageContent,
rest,
});

// Create a client to emit relevant events.
const client = new Client({ rest, ws });
const client = new Client({ rest, gateway });

// Listen for interactions
// Each event contains an `api` prop along with the event data that allows you to interface with the Discord REST API
Expand All @@ -62,7 +63,7 @@ client.on(GatewayDispatchEvents.InteractionCreate, async ({ data: interaction, a
client.once(GatewayDispatchEvents.Ready, () => console.log('Ready!'));

// Start the WebSocket connection.
ws.connect();
gateway.connect();
```

## Independent REST API Usage
Expand Down

0 comments on commit 6212bff

Please sign in to comment.