From 01821579f47b901295c609067a7754416224b90e Mon Sep 17 00:00:00 2001 From: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> Date: Thu, 9 Mar 2023 09:32:45 -0600 Subject: [PATCH] Bb guide gw start (#2831) * fix: more docs for big bot * fix: more docs --- website/docs/bigbot/step-3-gateway.md | 12 +++++++++--- website/docs/migrating/eris.md | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/website/docs/bigbot/step-3-gateway.md b/website/docs/bigbot/step-3-gateway.md index acf047f6d..478a3b4ca 100644 --- a/website/docs/bigbot/step-3-gateway.md +++ b/website/docs/bigbot/step-3-gateway.md @@ -5,7 +5,7 @@ sidebar_label: Step 3 - Gateway # Standalone Gateway -Sweet, it is time to start our gateway code. By now, you should have already built your rest process, as we will need it shortly. +Sweet, it is time to start our gateway code. By now, you should have already built your rest process, as we will need it shortly. The gateway portion is the hardest and most complex part of making a bot. This is where most of your time will be spent to optimize your setup. ## Understanding The Concepts @@ -116,6 +116,8 @@ Just like before, we are going to make another http listener to listen for incom ```ts import { DiscordenoShard } from '@discordeno/gateway'; +import { logger } from '@discordeno/utils'; +import { Intents } from '@discordeno/types'; import events from './events.js'; import dotenv from 'dotenv'; import express from 'express'; @@ -147,8 +149,8 @@ app.all('/*', async (req, res) => { const shard = SHARDS.get(req.body.shardId) ?? new DiscordenoShard({ id: shardId, connection: { - compress: this.compress, - intents: this.intents, + compress: false, + intents: Intents.Guilds | Intents.GuildMessages, properties: this.properties, token: this.token, totalShards: this.totalShards, @@ -181,3 +183,7 @@ app.listen(process.env.SHARD_SERVER_PORT, () => { console.log(`Listening at ${process.env.SERVER_URL}`) }) ``` + +This gives us a http listener, that processes incoming requests and verifies that these requests are authorized. Any authorized request then gets put in a switch case which will handle the request as needed. In this case, we were building support for, **identifying** our shards. + +In the code above, we left a *// TODO:*. This was to keep the code above minimal not to cause confusion for understanding it. Now let's start, making shard event handlers so we can forward the events discord sends to our event listener process(bot). Start by making a file like ` diff --git a/website/docs/migrating/eris.md b/website/docs/migrating/eris.md index caac3dcde..d0eaecd4c 100644 --- a/website/docs/migrating/eris.md +++ b/website/docs/migrating/eris.md @@ -75,3 +75,5 @@ Currently, there are a few issues with the migration. - `voice` - Currently **@discordeno/client** does not support voice features. Until we have a large music bot with the desire to migrate to discordeno we don't plan to support this as it is a massive endeavor. It will require a willing developer with good ability to test our implementation and make sure it scales well, like the rest of discordeno. If you are a music bot developer looking to migrate, and are willing to work with us to support this, please do contact me on Discord. - `selfbots/userbots` - Eris supported a lot of selfbot features that Discordeno does not. All of these features were removed. If you are trying to migrate a self bot, you will not be able to access a lot of features. This will never be supported. Please don't ask. - `command frameworks` - If you made your bot with a command framework package such as Yuuko, you may have some issues. This is because that package itself depends on Eris. It would need updating to support **@discordeno/client** instead of Eris. In a near future, when both typescript and node.js, you will be able to use *import maps* to replace all instance of eris with discordeno in all your packages. +- `deprecations` - If your bot was written using old code that Eris had marked as deprecated, we removed that behavior. Take this time, to fix those few errors in the new cleaner fashion. The following is a list of reported methods that were effected: + - getMessages