Discord.js: Bot duplicates over time

Created on 21 Jul 2016  路  3Comments  路  Source: discordjs/discord.js

Hello, i'm having the issue that my bot duplicates over time, as in loggs twice, responds twice etc

i dont know what the issue could be, i'm using an bot ready event and inside that even listen for commands, after some time the bot duplicates, i suspect every midnight but i'm not sure.

also ive tried a custom autoreconnect and discord.js' inbuild one, both had the same issue, so it cant be that

question (please use Discord instead)

Most helpful comment

Use bot.once("ready") (fire once) instead of bot.on("ready") (fire every time). The ready event fires every time the bot turns ready, which includes after reconnects.

All 3 comments

Use bot.once("ready") (fire once) instead of bot.on("ready") (fire every time). The ready event fires every time the bot turns ready, which includes after reconnects.

Thanks, will report back if it happens again

Hi abalabahaha, is it possible to re-open this ticket? I am experiencing the same thing with v8.1.0. After about 20 hours or so, my bot decides to open a second socket to discord and starts receiving the message events twice (not the ready event). I also see one of the sockets constantly bouncing. I am interested in helping fix this and hoped to get a little guidance of where to start looking for diagnostics.

Here is an example lsof showing the two sockets:

node    15240  lmg   10u  IPv4     533739      0t0    TCP max.home:38391->104.16.59.37:https (ESTABLISHED)
node    15240  lmg   12u  IPv4     533711      0t0    TCP max.home:38758->104.16.60.37:https (ESTABLISHED)

I also see one of the sockets bouncing like so:

2016-08-18T23:25:46.852Z - info: desdemona is ready!
2016-08-18T23:26:33.616Z - warn: WS close: 1000
2016-08-18T23:26:33.621Z - info: Disconnected from discord
2016-08-18T23:26:37.219Z - info: desdemona is ready!
2016-08-18T23:27:24.249Z - warn: WS close: 1000
2016-08-18T23:27:24.251Z - info: Disconnected from discord
2016-08-18T23:27:27.501Z - info: desdemona is ready!
2016-08-18T23:28:12.525Z - warn: WS close: 1000
2016-08-18T23:28:12.532Z - info: Disconnected from discord
2016-08-18T23:28:15.373Z - info: desdemona is ready!
2016-08-18T23:29:02.699Z - warn: WS close: 1000
2016-08-18T23:29:02.701Z - info: Disconnected from discord
2016-08-18T23:29:06.301Z - info: desdemona is ready!
2016-08-18T23:29:50.610Z - warn: WS close: 1000
2016-08-18T23:29:50.614Z - info: Disconnected from discord
2016-08-18T23:29:53.427Z - info: desdemona is ready!

I'm going to add additional logging to see if I can spot what occurs before this happens.

Cheers,
Scott

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tiritto picture tiritto  路  3Comments

Lombra picture Lombra  路  3Comments

peachyfawx picture peachyfawx  路  3Comments

smchase picture smchase  路  3Comments

Alipoodle picture Alipoodle  路  3Comments