dzlandis
dzlandis
DIAdiscord.js - Imagine an app
Created by dzlandis on 7/1/2024 in #djs-questions
How do I enable zlib compression with normal Discord.js?
I've installed zlib-sync but I'm getting the following error in my Websocket logging:
WebSocketShard: Compression is enabled but zlib-sync is not installed, falling back to identify compress
WebSocketShard: Compression is enabled but zlib-sync is not installed, falling back to identify compress
What am I doing wrong?
2 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 11/11/2023 in #djs-voice
ETIMEDOUT Exception Error (voice server connection issue)
No description
2 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 9/4/2023 in #djs-voice
Shard Reconnection and Voice Connection
Will the voice connection automatically restart if a shard is asked to restart? I've been running into some problems where a shard has to restart and then the audio connection disconnects. Is there a way I can listen for this type of problem and have my bot reconnect when it happens? Or is it already supposed to be reconnecting and this is a bug?
2 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 8/25/2023 in #djs-questions
Editing Message Rate Limits
Hey there, I noticed some interesting behavior when it comes to editing messages that I had some questions about. I noticed that when editing a webhook message (may also apply to non-webhook messages) quickly, discord.js handles the rate limits and the edits slowly catch up with time. However, I noticed that if one message is currently catching up with edits, and I send another webhook message and start editing that one, once the first message finishes being completely edited, the other one starts getting edited. However, the difference is, in the second message, the edits immediately catch up to the most recent edit. Is there a way to achieve this type of behavior (where it catches up immediately) for the first message in this scenario? When I edit a message quickly, I'm looking for it to try and update to the most recent version of the message (if it is unable to do so immediately due to rate limits) instead of trying to catch up the edits. Let me know if anyone knows about this (or if you have any questions) 🤔
5 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 7/1/2023 in #djs-questions
Reliably Fetching Roles from Member in Guild
How can I reliably fetch a member from a guild (without guild members intent) and ensure that the role information is always accurate when I fetch? I've been running into a problem where when I fetch it, it sometimes gives inaccurate role information. I'm using broadcastEval to perform this action as I'm looking at the role from a specific guild.
2 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 5/21/2023 in #djs-questions
Help with Understanding Cache Sweepers
So if I set the interval for a sweeper to every hour, after an hour of my bot being online, if I'm using the users sweeper, it just nukes all the users in cache? Or does it only nuke users that are an hour old in cache? Or something else? 🤔
4 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 5/2/2023 in #djs-questions
Bot Shards Keep Reconnecting After Reboot
26 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 5/1/2023 in #djs-questions
Checking to make sure a message still exist (Unknown Message Errors)
How can I check if a message still exists after I've gotten the message? I keep getting Unknown Message errors because I'm trying to react to a message that no longer exists. The problem is that my bot thinks it does exist cause it has the message stored in its cache as a variable. What should I do? Is there a way to verify that the message still exists before I try to react 🤷‍♂️
7 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 4/13/2023 in #djs-questions
Max Memory Restarting on Traditionally Sharded Bot
What do people here use for facilitating automatic max memory restarts with a traditionally sharded bot?
13 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 4/12/2023 in #djs-questions
Traditional Sharding w/PM2
Does anyone have experience using PM2 to manage different shards? I'm curious to know if this is even possible or if anyone has experience doing this type of thing.
2 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 4/9/2023 in #djs-questions
Sharding RAM (switching from internal to traditional sharding)
How much RAM typically does a bot with around 40 shards use? I'm switching my bot from internal sharding to traditional sharding and I'm concerned about how much of a RAM increase I'm going to get by doing that and if my server will have enough RAM for what is needed 😅
8 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 3/2/2023 in #djs-voice
70/74-byte UDP packets
Hey there, I was wondering if the voice package is sending 74 byte UDP packets or 70 byte UDP packets? Discord says that they are deprecating sending 70-byte voice packet in replacement for 74 byte UDP packets and so I was wondering which type the package sends currently.
9 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 2/21/2023 in #djs-voice
Voice Audio Detection Problems...
Hey, I run a bot which uses the voice packages audio receiving system. I've noticed a problem that appear to occur randomly where the built in VAD (voice audio detection) system appears to stop working at times. The only way to bypass the issue is to have the user manually mute and unmute to trigger the starting and ending of the stream. Anyone else experiencing something like this and is this a known problem? I'll open a Github issue if I don't receive a response soon.
3 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 1/14/2023 in #djs-questions
Do shards stay consistent?
Like if one server is on a certain shard and I'm using the automatic settings for totalShards, will that server always be on that same shard even after the bot restarts 🤔
5 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 1/3/2023 in #djs-questions
How to wait for all shards to startup using traditional sharding?
So, originally, I thought I would just be able to do this with the ready event, but then I figured out that the ready event is sent when each shard becomes ready. So how can I check when all of my shards are ready?
4 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 12/23/2022 in #djs-voice
How to handle Audio Receive Stream Pipeline on Connection Destroy (bot disconnected)
This is my code inside my receiver speaking on start event:
const opusStream = receiver.subscribe(userId, {
end: {
behavior: EndBehaviorType.AfterSilence,
duration: 800
}
});

const decoder = new opus.Decoder({ frameSize: 960, channels: 1, rate: 8000 });
const rawAudio = pipeline(opusStream, decoder, () => null);
const opusStream = receiver.subscribe(userId, {
end: {
behavior: EndBehaviorType.AfterSilence,
duration: 800
}
});

const decoder = new opus.Decoder({ frameSize: 960, channels: 1, rate: 8000 });
const rawAudio = pipeline(opusStream, decoder, () => null);
The problem is, I believe that 'rawAudio' is causing the following error when the connection is destroyed (bot is disconnected) and a user is speaking at the same time because the stream is not dealt with properly:
Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
How can I resolve this and handle the rawAudio pipeline correctly?
7 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 12/19/2022 in #djs-questions
Seeing if my bot disconnected with voiceStateUpdate
How through this listener can I check to see if my bot was in the voice channel prior to disconnecting (so I can do things after I know my bot was disconnected from a channel) 🤔
client.on("voiceStateUpdate", async (oldState, newState) => {
}
client.on("voiceStateUpdate", async (oldState, newState) => {
}
I've tried checking the oldState channelId but it always appears to be null. Am I doing something wrong? I'm wondering if my understanding of oldState vs newState is incorrect. Any help is greatly appreciated.
4 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 12/17/2022 in #djs-questions
How can I get the text channel a thread is in?
So, when I do interaction.channel I get the thread channel. I was wondering if it is possible to somehow find out what text channel the thread channel is in from just the thread channel. Any help is greatly appreciated.
12 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 12/3/2022 in #djs-voice
Bot does not play audio when audio source is changed from stream to string URL
For some strange reason, when I have my bot change from playing a ReadableStream to playing from a URL in a string, the bot does not play anything. I will note, that when I start the bot playing from a URL string, it works just fine, and when I change the source to a ReadableStream, it works just fine. This issue only occurs when switching from a ReadableStream into a URL string. I've analyzed my code to make sure that there is actual playable audio and I've also checked that the audio resources are identical. I can't find the issue. What am I doing wrong, or is this some strange bug?
3 replies
DIAdiscord.js - Imagine an app
Created by dzlandis on 11/26/2022 in #djs-voice
How to properly restart a voice connection after bot restart?
So lets say I restart my bot but I want all voice connections that my bot was in before the restart to be reconnected. What is the best way to do this? Does it involve using the voice sessionId?
12 replies