From 68fef1d74c3027e769e8faed7d4a1b41d80226de Mon Sep 17 00:00:00 2001 From: ITOH Date: Thu, 13 May 2021 19:30:26 +0200 Subject: [PATCH] remove: startBigBrainBot --- src/bot.ts | 67 ------------------------------------------------------ 1 file changed, 67 deletions(-) diff --git a/src/bot.ts b/src/bot.ts index f6afd27dc..2a8a4dfdf 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -61,76 +61,9 @@ export function setApplicationId(id: string) { applicationId = snowflakeToBigint(id); } -// BIG BRAIN BOT STUFF ONLY BELOW THIS - -/** - * This function should be used only by bot developers whose bots are in over 25,000 servers. - * Please be aware if you are a beginner developer using this, things will not work as per the guides. This is for advanced developers only! - * - * Advanced Devs: This function will allow you to have an insane amount of customization potential as when you get to large bots you need to be able to optimize every tiny detail to make you bot work the way you need. - */ -export async function startBigBrainBot(options: BigBrainBotConfig) { - rest.token = `Bot ${options.token}`; - - if (options.secretKey) secretKey = options.secretKey; - if (options.restURL) baseEndpoints.BASE_URL = options.restURL; - if (options.cdnURL) baseEndpoints.CDN_URL = options.cdnURL; - if (options.eventHandlers) eventHandlers = options.eventHandlers; - - // PROXY DOESNT NEED US SPAWNING SHARDS - if (!options.wsPort) { - ws.identifyPayload.token = `Bot ${options.token}`; - - if (options.compress) { - ws.identifyPayload.compress = options.compress; - } - - ws.identifyPayload.intents = options.intents.reduce( - ( - bits, - next, - ) => (bits |= typeof next === "string" - ? DiscordGatewayIntents[next] - : next), - 0, - ); - - // Initial API connection to get info about bots connection - ws.botGatewayData = await getGatewayBot(); - ws.maxShards = ws.maxShards || - ws.botGatewayData.shards; - ws.lastShardId = options.lastShardId || (ws.lastShardId === 1 - ? 0 - : ws.lastShardId) || - ws.botGatewayData.shards - 1; - // Explicitly append gateway version and encoding - ws.botGatewayData.url += `?v=${GATEWAY_VERSION}&encoding=json`; - proxyWSURL = ws.botGatewayData.url; - - ws.spawnShards(options.firstShardId); - } -} - export interface BotConfig { token: string; compress?: boolean; intents: (DiscordGatewayIntents | keyof typeof DiscordGatewayIntents)[]; eventHandlers?: EventHandlers; } - -export interface BigBrainBotConfig extends BotConfig { - /** The first shard to start at for this worker. Use this to control which shards to run in each worker. */ - firstShardId: number; - /** The last shard to start for this worker. By default it will be 25 + the firstShardId. */ - lastShardId?: number; - /** The maximum shard Id number. Useful for zero-downtime updates or resharding. */ - maxShards?: number; - /** This can be used to forward the ws handling to a proxy. It will disable the sharding done by the bot side. */ - wsPort?: number; - /** This can be used to forward the REST handling to a proxy. */ - restURL?: string; - /** This can be used to forward the CDN handling to a proxy. */ - cdnURL?: string; - /** This is the authorization header that your servers will send. Helpful to prevent DDOS attacks and such. */ - secretKey?: string; -}