Polar
Polar
DIAdiscord.js - Imagine an app
Created by Polar on 3/27/2024 in #djs-questions
Duplicate messageUpdate events in sharded bot
Thank you very much for narrowing down the issue, appreciate it
15 replies
DIAdiscord.js - Imagine an app
Created by Polar on 3/27/2024 in #djs-questions
Duplicate messageUpdate events in sharded bot
That indeed was the case, there's apparently a new field in embeds called content_scan_version, oldMessage and newMessage are same with content_scan_version being 0 for oldMessage and content_scan_version being 1 in newMessage
15 replies
DIAdiscord.js - Imagine an app
Created by Polar on 3/27/2024 in #djs-questions
Duplicate messageUpdate events in sharded bot
hmm that could be possible, let me check if that's the case
15 replies
DIAdiscord.js - Imagine an app
Created by Polar on 3/27/2024 in #djs-questions
Duplicate messageUpdate events in sharded bot
the addReminder function is called for the exact same messageId
15 replies
DIAdiscord.js - Imagine an app
Created by Polar on 3/27/2024 in #djs-questions
Duplicate messageUpdate events in sharded bot
and also console.log(client.listenerCount("messageUpdate"))
I get 1
15 replies
DIAdiscord.js - Imagine an app
Created by Polar on 3/27/2024 in #djs-questions
Duplicate messageUpdate events in sharded bot
No description
15 replies
DIAdiscord.js - Imagine an app
Created by Polar on 3/27/2024 in #djs-questions
Duplicate messageUpdate events in sharded bot
oh. I fixed it and just forgot to update in the other parts of the code. I've updated the message that should be more readable
15 replies
DIAdiscord.js - Imagine an app
Created by Polar on 3/27/2024 in #djs-questions
Duplicate messageUpdate events in sharded bot
I see
15 replies
DIAdiscord.js - Imagine an app
Created by Polar on 3/27/2024 in #djs-questions
Duplicate messageUpdate events in sharded bot
How can the code be better? I thought the standard factory design pattern was good enough
15 replies
DIAdiscord.js - Imagine an app
Created by Polar on 3/27/2024 in #djs-questions
Duplicate messageUpdate events in sharded bot
yea I'm sure I didn't add any duplicate listeners. Here's my event registeration code:
for await (const dir of botEventFiles) {
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
const dynamic = dynamicImport<new () => IEvent>(async () => import(pathToFileURL(dir.fullPath).href));
const resolved = container.resolve<IEvent>((await dynamic()).default);
events.set(resolved.eventName, resolved);
if (resolved.once) {
client.once(
resolved.eventName as keyof ClientEvents,
(...args: Parameters<IEvent["execute"]>): void =>
resolved.execute(...args),
);
} else if (resolved.rest) {
client.rest.on(
resolved.eventName as keyof RestEvents,
(...args: Parameters<IEvent["execute"]>): void =>
resolved.execute(...args),
);
} else {
client.on(
resolved.eventName as keyof ClientEvents,
(...args: Parameters<IEvent["execute"]>): void =>
resolved.execute(...args),
);
}
}
for await (const dir of botEventFiles) {
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
const dynamic = dynamicImport<new () => IEvent>(async () => import(pathToFileURL(dir.fullPath).href));
const resolved = container.resolve<IEvent>((await dynamic()).default);
events.set(resolved.eventName, resolved);
if (resolved.once) {
client.once(
resolved.eventName as keyof ClientEvents,
(...args: Parameters<IEvent["execute"]>): void =>
resolved.execute(...args),
);
} else if (resolved.rest) {
client.rest.on(
resolved.eventName as keyof RestEvents,
(...args: Parameters<IEvent["execute"]>): void =>
resolved.execute(...args),
);
} else {
client.on(
resolved.eventName as keyof ClientEvents,
(...args: Parameters<IEvent["execute"]>): void =>
resolved.execute(...args),
);
}
}
15 replies
DIAdiscord.js - Imagine an app
Created by Polar on 3/27/2024 in #djs-questions
Duplicate messageUpdate events in sharded bot
messageUpdate? When the other bot's embed title edits to "confirm", my bot maps the userId to that action
15 replies
DIAdiscord.js - Imagine an app
Created by Polar on 3/27/2024 in #djs-questions
Duplicate messageUpdate events in sharded bot
on adding some console.logs I found that it's the same shard running the same code twice
15 replies
DIAdiscord.js - Imagine an app
Created by Polar on 3/27/2024 in #djs-questions
Duplicate messageUpdate events in sharded bot
Discord.js: 14.13.0 Node.js: v20.10.0
15 replies
DIAdiscord.js - Imagine an app
Created by Polar on 11/14/2023 in #djs-questions
Scheduled message causes duplicate messages in sharded app
Aight, thank you for your time
7 replies
DIAdiscord.js - Imagine an app
Created by Polar on 11/14/2023 in #djs-questions
Scheduled message causes duplicate messages in sharded app
I'd also like to know how do I reload commands on all shards if commands is not attached to my client instance
7 replies
DIAdiscord.js - Imagine an app
Created by Polar on 11/14/2023 in #djs-questions
Scheduled message causes duplicate messages in sharded app
Ah okay. I'll try thank you
7 replies
DIAdiscord.js - Imagine an app
Created by Polar on 11/14/2023 in #djs-questions
Scheduled message causes duplicate messages in sharded app
If I decide to use ShardingManager process, ig I'll have to use @discordjs/core?
7 replies
DIAdiscord.js - Imagine an app
Created by Polar on 11/14/2023 in #djs-questions
Scheduled message causes duplicate messages in sharded app
wouldn't that cause duplicate reminders to be sent too? Cuz each shard will try to dm the user?
7 replies