From 4d2bb53361f5db9e8fdf19ef789ad85375a27168 Mon Sep 17 00:00:00 2001 From: Skillz Date: Thu, 14 Sep 2023 09:44:04 -0500 Subject: [PATCH] fix: tiny bug in guide --- website/docs/bigbot/step-3-gateway.md | 47 +++++++++++++-------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/website/docs/bigbot/step-3-gateway.md b/website/docs/bigbot/step-3-gateway.md index 687a3af44..94dc9dc3c 100644 --- a/website/docs/bigbot/step-3-gateway.md +++ b/website/docs/bigbot/step-3-gateway.md @@ -264,35 +264,34 @@ Most of this code is another http listener again. The part we are going to focus Next, we will focus on the `events` portion which we had commented out above. Each shard handles many events and this will be the portion where we tell the shard how to handle those events. For this guide, we will only cover the `message` event, but you can implement any other events you require as you need following the same method. -```ts +```diff const shard = SHARDS.get(req.body.shardId) ?? new DiscordenoShard({ - id: shardId, + id: req.body.shardId, connection: { - compress: this.compress, - intents: this.intents, - properties: this.properties, - token: this.token, - totalShards: this.totalShards, - url: this.url, - version: this.version, - }, - // This is the part we are adding - events: { - async message(shrd, payload) { - await fetch(getUrlFromShardId(req.body.totalShards, shrd.id), { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - authorization: AUTHORIZATION, - }, - body: JSON.stringify({ payload, shardId }), - }) - .then(res => res.text()) - .catch(logger.error) - }, + compress: req.body.compress, + intents: req.body.intents, + properties: req.body.properties, + token: req.body.token, + totalShards: req.body.totalShards, + url: req.body.url, + version: req.body.version, }, ++ events: { ++ async message(shrd, payload) { ++ await fetch(getUrlFromShardId(req.body.totalShards, shrd.id), { ++ method: 'POST', ++ headers: { ++ 'Content-Type': 'application/json', ++ authorization: AUTHORIZATION, ++ }, ++ body: JSON.stringify({ payload, shardId }), ++ }) ++ .then(res => res.text()) ++ .catch(logger.error) ++ }, ++ }, }) ```