Discord Bot Railway to discord gateway
gjorgjiml
PROOP

3 months ago

I have issue with my discord bot it cant connect to VC and based on my analysis the problem is Railway due to network latency is there any help
3e6de7ce-253c-4831-9377-8873bbc36db5

$20 Bounty

33 Replies

gjorgjiml
PROOP

3 months ago

Is there any way to fix this


Have you tried deploying in a different region?


gjorgjiml
PROOP

3 months ago

ill try now


gjorgjiml
PROOP

3 months ago

Discord voice handshakes from Railway are still failing with ConnectionClosed … code 4006


gjorgjiml
PROOP

3 months ago

Still failing



gjorgjiml
PROOP

3 months ago

no i am using pycord


gjorgjiml
PROOP

3 months ago

do i need to use discord.py for railway?


No, was just curious.
https://github.com/Rapptz/discord.py/issues/10207
Other users faced similar issues as you reported.
Have you tried switching the region of the vc?


You can change voice chat region in channel settings > region override.


gjorgjiml
PROOP

3 months ago

i did that and still not working


gjorgjiml
PROOP

3 months ago

Ill try to switch to discord.py


gjorgjiml
PROOP

3 months ago

Nvm cant switch to discord.py


gjorgjiml
PROOP

3 months ago

bec i need pycord lib for my bot


gjorgjiml
PROOP

3 months ago

needs receiving audio


gjorgjiml
PROOP

3 months ago

still having the issue


gjorgjiml
PROOP

3 months ago

any help on this from railway is it a discord issue?


gjorgjiml
PROOP

3 months ago

bec on hetzner Vps i have no issues


gjorgjiml
PROOP

3 months ago

Only on railway


3 months ago

whats the issue/logs?


gjorgjiml
PROOP

3 months ago

.


3 months ago

are you using a self-bot?


3 months ago

or an actual discord bot?


3 months ago

whats the traceback? cause 4006 is discord invalidating the voice connection


3 months ago

not railway


3 months ago

has it been working for you locally?


gjorgjiml
PROOP

3 months ago


gjorgjiml
PROOP

3 months ago

Some tries it connected but 90% of time does not connect


gjorgjiml
PROOP

3 months ago

it worked locally


3 months ago

your bot doesn’t have a processcommands method, which means the bot was created as a regular discord client instead of a commands bot. Every time a message arrives and your code runs bot.processcommands(message), Discord raises an AttributeError. If you aren’t using slash commands or commands at all, you shouldn’t call it on the client event (the process commands)

your logic for the voice connection is unstable, you don’t seem to check whether or not you are connected by voiceclient.isconnected() before doing anything with the audio, you’re proceeding anyway despite the connection failing

is_connected() returned False, but connect() succeeded. This is common on Railway due to network latency. Proceeding anyway… (is what appears from your logs)


3 months ago

overall from what I can tell, your logic is incorrect or flaky that it sometimes works and sometimes doesn’t


3 months ago

if you have a public git repo I can help you fix it, but if it’s private then I can only guide you on it


gjorgjiml
PROOP

3 months ago

Thanks will try out to change the logic and see


Loading...