Nikki 🌺
Nikki 🌺
DIAdiscord.js - Imagine an app
Created by Nikki 🌺 on 7/25/2024 in #djs-questions
Random shard sessionInfo errors
Hello, I have recently started getting an error when trying to start my bot. The error seems to be coming from DiscordJS directly, I have not written this code.
C:\Users\nikki\Documents\Code\discord_bots\discord-bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:268
if (shard.sessionInfo) {
^

TypeError: Cannot read properties of undefined (reading 'sessionInfo')
at WebSocketManager.<anonymous> (C:\Users\nikki\Documents\Code\discord_bots\discord-bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:268:17)
at WebSocketManager.emit (C:\Users\nikki\Documents\Code\discord_bots\discord-bot\node_modules\@vladfrangu\async_event_emitter\src\index.ts:360:28)
at WebSocketShard.<anonymous> (C:\Users\nikki\Documents\Code\discord_bots\discord-bot\node_modules\@discordjs\ws\src\strategies\sharding\SimpleShardingStrategy.ts:32:47)
at WebSocketShard.emit (C:\Users\nikki\Documents\Code\discord_bots\discord-bot\node_modules\@vladfrangu\async_event_emitter\src\index.ts:371:33)
at WebSocketShard.onMessage (C:\Users\nikki\Documents\Code\discord_bots\discord-bot\node_modules\@discordjs\ws\src\ws\WebSocketShard.ts:755:10)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
C:\Users\nikki\Documents\Code\discord_bots\discord-bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:268
if (shard.sessionInfo) {
^

TypeError: Cannot read properties of undefined (reading 'sessionInfo')
at WebSocketManager.<anonymous> (C:\Users\nikki\Documents\Code\discord_bots\discord-bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:268:17)
at WebSocketManager.emit (C:\Users\nikki\Documents\Code\discord_bots\discord-bot\node_modules\@vladfrangu\async_event_emitter\src\index.ts:360:28)
at WebSocketShard.<anonymous> (C:\Users\nikki\Documents\Code\discord_bots\discord-bot\node_modules\@discordjs\ws\src\strategies\sharding\SimpleShardingStrategy.ts:32:47)
at WebSocketShard.emit (C:\Users\nikki\Documents\Code\discord_bots\discord-bot\node_modules\@vladfrangu\async_event_emitter\src\index.ts:371:33)
at WebSocketShard.onMessage (C:\Users\nikki\Documents\Code\discord_bots\discord-bot\node_modules\@discordjs\ws\src\ws\WebSocketShard.ts:755:10)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
It also happens on my bot host/vps and I changed no code, it just started happening. I have tried switching my DiscordJS version to the latest, the dev and others but the error persists. If you want to take a look at the source code, it is all here: https://github.com/CuteNikki/discord-bot/ (also ik discord-player is against tos, pls don't mention it)
37 replies
DIAdiscord.js - Imagine an app
Created by Nikki 🌺 on 7/1/2024 in #djs-questions
channelPinsUpdate get the pinned/unpinned message
I'm trying to get the most recently pinned or unpinned message from the channelPinsUpdate event. The event returns a channel and a date. You can get all pinned messages by using channel.messages.fetchPinned() It's not possible to know if a message was pinned or unpinned since the date is always provided. The message class has no property for when it was pinned, so you can't go through all pinned messages and then find the one that matches the date that's given to you... Is there any other way to actually get that one message that just got pinned or unpinned?
18 replies
DIAdiscord.js - Imagine an app
Created by Nikki 🌺 on 6/24/2024 in #djs-questions
Removing and adding roles at the same time
Hello, I am trying to remove certain roles and then add other roles to a member once a command is used. The issue is that if you remove some roles and then add different roles, no roles will be removed from a member. This is an issue with asynchronous code. I have tried putting addRole() into a chained then() but that does not solve the issue. The only workaround I could find was using setTimeout() which seems like a very wonky way to handle this. Is there any other workaround I could use?
19 replies