Good evening,
I am currently trying to programm a discord music bot based on an 1-year-old tutorial. As seen below my code includes some coroutines that need to be awaited, however I get the error that my coroutines could not be awaited. Since I am not very familliar with coroutines I hope someone here knows more about them and can help me:
General informations:
IDE: Thonny
python-version: 3.11.5
os: Windows 10
Further information:
I set the token in terminal before running the file
In my main file I try to run the other files that include the coroutines like this:
The music_gog file looks like this:
and includes serveral coroutines like:
However I get that error message:
RuntimeWarning: coroutine 'BotBase.add_cog' was never awaited
bot.add_cog(music_cog(bot))
I will attach my files below, feel free to ask me for further information
Thanks in advance
I am currently trying to programm a discord music bot based on an 1-year-old tutorial. As seen below my code includes some coroutines that need to be awaited, however I get the error that my coroutines could not be awaited. Since I am not very familliar with coroutines I hope someone here knows more about them and can help me:
General informations:
IDE: Thonny
python-version: 3.11.5
os: Windows 10
Further information:
I set the token in terminal before running the file
In my main file I try to run the other files that include the coroutines like this:
1 2 |
bot = commands.Bot(command_prefix = "/" , intents = intents) bot.add_cog(music_cog(bot)) |
1 2 3 4 5 6 7 8 9 10 11 12 |
class music_cog(commands.Cog): def __init__( self , bot): self .bot = bot self .is_playing = False self .is_paused = False self .music_queue = [] self .YDL_OPTIONS = { "format" : "bestaudio" , "noplaylist" : "True" } self .FFMEPG_OPTIONS = { "before_options" : "-reconnect 1 -reconnected_streamed 1 -reconnect_delay_max 5" , "options" : "-vn" } self .vc = None |
1 2 3 4 5 6 7 8 9 10 11 |
@commands .command(name = "pause" , help = "Pause the current song" ) async def pause( self , ctx, * args): if self .is_playing: self .is_playing = False self .is_paused = True await self .vc.pause() elif self .is_paused: self .is_playing = True self .is_paused = False await self .vc.resume() |
However I get that error message:
RuntimeWarning: coroutine 'BotBase.add_cog' was never awaited
bot.add_cog(music_cog(bot))
I will attach my files below, feel free to ask me for further information
Thanks in advance
Attached Files
Thumbnail(s)