When we import discord.ts and create new client, it initialize MetaStorage once, https://github.com/OwenCalvin/discord.ts/blob/slash/src/logic/metadatas/MetadataStorage.ts.
so when a event or command triggered from bot a it will also execute bot b events. Cause of this issue, only one bot can be used under one deployment.
Steps to reproduce
create a bot with a event like onready.
create another bot with a event like onready but different output.
turn on both bots, and when your bots ready, you will see 4 outputs, but you were expecting only two outputs.
Reason of problem
Metadata does not differentiate between multiple Client objects, because it's scope is globally initialized.
When we import discord.ts and create new client, it initialize MetaStorage once,
https://github.com/OwenCalvin/discord.ts/blob/slash/src/logic/metadatas/MetadataStorage.ts
.so when a event or command triggered from
bot a
it will also executebot b
events. Cause of this issue, only one bot can be used under one deployment.Steps to reproduce
Reason of problem
Metadata does not differentiate between multiple Client objects, because it's scope is globally initialized.