#How to make my radio bot run smoother?

20 messages · Page 1 of 1 (latest)

lunar pebbleBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

obsidian bloom
#

try sharding

obsidian bloom
#

@magic comet

winged zenith
#

If you're concerned about lagging and your current setup is already facing issues, then your logic may be horribly flawed.

What you need to ensure is that your host machine has a stable internet connection and has a reasonably good cpu capable of decoding and encoding audio in realtime. Bonus points if the cpu has multiple cores, because you can abuse worker_threads.

You can try to create a good working system yourself, or I'd probably recommend using or referencing from https://github.com/AmandaDiscord/Volcano

specifically: https://github.com/AmandaDiscord/Volcano/blob/main/src/worker.ts

GitHub

A light-weight LavaLink compatible replacement. Contribute to AmandaDiscord/Volcano development by creating an account on GitHub.

winged zenith
#

I think you really glossed over the actually important info. If you're having issues currently, then either your host machine is e-waste or your code is bad. In either case, I wouldn't recommend focusing your efforts towards music related stuff since to get good audio playback, it takes a lot of balancing, research, and science.

If you're a beginner at this kind of stuff, I would REALLY recommend taking a look at solutions similar to or literally just using LavaLink. The general take away concept is that you should be able to distribute your audio processing to multiple host machines and have it be de-coupled from your bot's logic especially with slash commands as the cpu time is better diverted to processing and routing interactions so they don't expire before you can even respond to them. Audio processing takes up way too much cpu time currently and the entire music space is just really high maintenance and requires a pretty good amount of knowledge.

Do with that info as you will and even ignore me if you think I'm wrong, but know that you are getting into a really deep and complicated rabbit hole.

magic comet
#

I use Azuri with sharding, so ehm i think this is it?

manager.on('shardCreate', shard => console.log(`Starting Shard: ${shard.id}`));
manager.spawn();

i see this in the app.js.

at the end.

#

but at app.js and index.js i didn't changed anything or at least not much.

#

@winged zenith

#

ok i see it's just working

#

but when counts it up?
i've seen much vids and it always said: started shard 0
not 1 or 5 or any other number, when does it do?

#

ping me.

winged zenith
#

You don't have to worry about sharding so early. Sharding is only beneficial at 1500+ guilds which you are a long ways away. The ShardingManager's default behavior is to tell Discord to spawn however many shards it thinks are appropriate for your bot

magic comet
#

ehm it "asks" the voice of the radio. and that can lagg a lot xd

winged zenith
#

What cpu does your host machine have

magic comet
#

arm64

#

it's an raspberrypi 4B wich runs the station also.
my second is an older one, an pentium 3, i've got it as gift from my grandma, because she didn't used it since it was used as office pc and home pc later.

#

my main pc has core i 5 6th gen

winged zenith