I’m working on a Python Discord music bot using the wavelink library. Everything functioned perfectly during my initial local tests. However, after I tried deploying it on Heroku (which didn’t succeed), my local setup has also stopped working.
The Error
I’m facing this connection error:
WEBSOCKET | Connection Failure:: Cannot connect to host 127.0.0.1:2333
ConnectionRefusedError: [WinError 1225] Remote computer rejected network connection
My Code Setup
Here’s the function for initializing nodes:
async def initialize_audio_nodes(self):
await self.client.wait_until_ready()
# Setting up the audio node connection
await self.client.wavelink.initiate_node(host='127.0.0.1',
port=2333,
rest_uri='http://127.0.0.1:2333',
password='mysecretpass',
identifier='MAIN_NODE',
region='us_west')
My config.yml looks like this:
server:
port: 2333
address: 0.0.0.0
lavalink:
server:
password: "mysecretpass"
sources:
youtube: true
soundcloud: true
bandcamp: true
bufferDurationMs: 400
playerUpdateInterval: 5
logging:
level:
root: INFO
I’m puzzled because the code hasn’t changed at all. Has anyone else experienced a similar issue?
UPDATE: Resolved it! Make sure to start the Lavalink server by running java -jar Lavalink.jar in your terminal before starting the bot.