Skip to content

BLAPI Not Posting w/Traditional Sharding #182

@dzlandis

Description

@dzlandis

Describe the bug
BLAPI does not post through the handle function on start when using traditional sharding. It is unclear how one is meant to use BLAPI with traditional sharding. Am I meant to use manualPost, and if so, can an example be provided?

To Reproduce
Steps to reproduce the behavior:

  1. Create a bot which uses traditional sharding (using Discord.js ShardingManager in index.ts file)
// index.ts
const manager = new ShardingManager('./dist/bot.js', { token: process.env.DISCORD_TOKEN, totalShards: 3 });
  1. Put BLAPI in the bot.ts file (not the main index.ts file)
// bot.ts
import { Client } from 'discord.js';
import { handle, setLogging } from 'blapi';
const client = new Client();

await client.login(process.env.DISCORD_TOKEN);

const botListAPIKeys = {
  'voidbots.net': process.env.VOIDBOTS_KEY
};

setLogging({
  extended: true,
  logger: logger
});
await handle(client, botListAPIKeys);
  1. Run code
  2. Observe an error is outputted.
BLAPI: Error [ShardingInProcess]: Shards are still being spawned.

Expected behavior
BLAPI posts to bot lists without any issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions