I'm having trouble getting the play command to work on my Discord bot using Wavelink. Does anyone know how to troubleshoot and fix this

This is the play command for my bot:

@client.tree.command(name="play", description="Play some music")
@app_commands.describe(musicname="The name of the music you want to play")
async def play(interaction:Interaction, musicname:str):
    '''Playing music'''
    search = await wavelink.YouTubeTrack.search(query=musicname, return_first=True)
    if not getattr(interaction.user.voice, "channel", None):
        return await interaction.response.send_message("You are not in a voice channel", ephemeral=True)
    elif not interaction.guild.voice_client:
        voiceclient: wavelink.Player = await interaction.user.voice.channel.connect(cls=wavelink.Player, self_deaf=True)
    else:
        voiceclient: wavelink.Player = interaction.guild.voice_client

    if not voiceclient.is_playing():
        await voiceclient.play(search)
        await interaction.response.send_message(f"Now playing `{search.title}`")
    else:
        await voiceclient.queue.put_wait(search)
        await interaction.response.send_message(f"Added `{search.title}` to the queue")

For on_wavelink_track_end event:

@client.event
async def on_wavelink_track_end(player:Player, track:YouTubeTrack, reason:str):
    '''When the track ends'''
    voiceclient: Player = player.guild.voice_client

    if voiceclient.loop:
        return await voiceclient.play(track)
    elif not voiceclient.queue.is_empty:
        next_song = voiceclient.queue.get()
        await voiceclient.play(next_song)
        await player.interaction.response.send_message(f"Now playing `{next_song.title}`")
    else:
        print("finished playing")

After I type /play something on Discord, the bot writes "finished playing" in the console, indicating that it doesn't start playing the song. Instead, it finishes immediately after the command execution. I need assistance with this issue!

Expected: Play music Reality: The bot outputs "Playing something" in chat and "finished playing" in the console.

Answer №1

Solution found effortlessly:
By switching the node from lavalinkinc.ml to lavalink.botsuniversity.ml, the issue was resolved and everything started functioning properly.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Extracting information from an API

Hey there, good morning! I'm currently working on gathering car data from this website: My process involves sending a request through the search bar on the homepage for a specific location and date. This generates a page like this: From there, I us ...

Why is it that when performing a slice operation, a list is returned, but when using

Indexing results in a string being returned Input: l1 = ['bbq', 'rr'] [l1[0] + l1[0], l1[1]+l1[1]] Output: ['bbqbbq', 'rrrr'] Slicing returns lists as the output Input: [l1[:1] + l1[:1], l1[1:2]+l1[1:2]]<br> ...

Is there a way to move all the elements in a nested python list in a downward direction?

In our scenario, we have a 4x4 grid with empty spaces and 1s grid = [ [" "," ","1"," "], [" "," ","1"," "], ["1","1"," "," "], ["1& ...

The tab functionality in Python Selenium is effective when using Firefox, however, when using Chrome, it

I have been working on a script that is designed to open multiple websites in new tabs. Initially, everything seemed to work perfectly in Firefox. However, when testing the script on Chrome, I encountered an issue. It opens a new tab as expected but the l ...

Finding the maximum element in two separate lists and determining its index

Suppose I have two separate lists and I want to determine the maximum element between those two lists. To accomplish this task, I am leveraging the numpy module in Python. Assuming that n and c are the names of the lists where: n = [7, 1, 54, 812, 124, 6 ...

Using Python 2.4 to deliver a notification to Pidgin

I am looking to send notifications to users via their pidgin internet messenger using python 2.4 in my application. Could someone provide guidance on how this task can be accomplished? ...

What is the best way to manage my Python IRC bot using Twisted in an interactive manner?

Currently, I am working on a simple IRC bot using Twisted's IRC client. The code can be found at the following link: http://pastebin.com/jjMSM64n I am wondering how I could integrate the bot with the command line interface so that I can control it th ...

What is the best way to handle a text file when using Python in the command line?

For running the program, follow these steps: Python LinkState < test1.txt The file name is called Linkstate.py. The text file to be used as input is named test1.txt. My question is how should I handle the txt file in my code for this setup? It seems l ...

Creating a stockpile, not simply filling up the storage vessel with Python

Currently, I am working on a project to simulate an inventory system. The debugger is not indicating any issues with the code, but when I run the file for testing purposes, it returns false for an item being added when it should return true. Unfortunatel ...

Installing R packages to a docker container from Ubuntu is a straightforward process and can be achieved

I am completely new to working with Docker. My goal is to create a container that can execute a Snakemake pipeline containing R and Python scripts. Eventually, I will need to incorporate a conda environment and clone/build from a GitHub repository. But for ...

Unlock the power of multiprocessing with decorators

I am looking to design a decorator that allows a function to accept a single argument for handling iterable arguments in parallel. Here is the sample code: import functools import time from multiprocessing import Pool def parallel(func): def wrappe ...

matching parentheses in python with stack algorithm

I'm working on implementing a stack to validate parenthesis, but I'm having trouble getting the correct output with the code below. Despite reviewing it multiple times, I can't seem to identify the mistakes. Any suggestions or assistance wou ...

The resize() function in Scikit image raised an error due to an unexpected argument 'anti_aliasing' being passed

I attempted to utilize the resize function with aliasing as outlined in the documentation at from skimage.transform import resize im_test = resize(im_test, (im_test.shape[0] / 3, im_test.shape[1] / 3),anti_aliasing=True) However, this resulted in the fo ...

Distinctive Tags Nodes within a Huffman Hierarchy

I'm currently developing a Python application that can compress and decompress text files using a Huffman tree structure. In the past, I saved the frequency table in a .json file alongside the compressed data. When reconstructing the decompression tre ...

StaleElementReferenceException: Error: The element's reference has become outdated

Currently, I am using Selenium to scrape links. While I am able to print out the links in my loop, I am encountering an issue when trying to navigate to them and retrieve all the information. The error message I receive is: "Message: The element reference ...

Bring in macros from a Jinja template without running the template's code

Seeking a method to include a Jinja template with top-level content without running the content itself. Here's an example: template_with_macros.html: {% macro link(text, url) %} <a href='{{ url }}'>{{ text }}</a> {% endmacro ...

Discovering the process of choosing a city name during web scraping in Python for Justdial

As a newcomer to web scraping, I am attempting to extract information from the Just Dial website. My goal is to allow users to enter any city name of their choice directly into the program. When using the code snippet below: driver.find_element(By.XPATH,&q ...

Sorting through a Json file with an unconventional structure

I'm currently working on filtering the number of website accesses per city, and I've encountered an issue with the API response. The data seems different from other JSON files I have previously worked with. My goal is to filter the Dimension kno ...

What are the steps to set up OpenCV on Python 3.4?

Currently, I am utilizing Python 3.4 via the Anaconda distribution. Unfortunately, I have encountered difficulty in finding Python 3.4 bindings for OpenCV within this setup. Despite attempting to install OpenCV through Cmake from the source files, no suc ...

Removing identical sections that have the same starting and ending points using Python or Shell

I'm just starting out with Python and I have a text file that contains some definitions like the following: .subckt inv a z mp z a vdd vdd pch mn z a gnd gnd nch .ends .subckt pg in out clk clkb mp in clkb out vdd pch mn in clk out gnd nch .ends .s ...