Home python RuntimeWarning: Coroutine 'Messageable.send' Was Never Awaited (Discord.py)

RuntimeWarning: Coroutine ‘Messageable.send’ Was Never Awaited (Discord.py)

Author

Date

Category

(first I will say that most of the code is copied)

import discord
from discord.ext import commands
Token = 'long'
Bot = Commands.bot (Command_Prefix = '!')
@ Bot.Event
ASYNC DEF ON_REDY ():
  PRINT ('LOGGED IN AS')
  Print (Bot.user.name)
  Print (Bot.user.id)
  Print ('------')
@ Bot.comMand (Pass_Context = True)
ASYNC DEF Jacot (CTX):
  Print ('Received Jacot' command)
  Ctx.send ('OK')
@ Bot.comMand (pass_context = true) # Let me transmit the alarms
ASYNC DEF TEST (CTX, ARG): # Create an asynchronous poundation of the bot
  AWAIT CTX.SEND (ARG) # send back argument
Bot.Run (Token)

and error

RuntimeWarning: Coroutine 'Messageable.send' Was Never Awaited
On the ‘Yakot’ Team


Answer 1, Authority 100%

Any korutin must be “expectable”. This is done using the AWAIT instruction.
This code will be correct:

@ bot.command (Pass_Context = True)
ASYNC DEF Jacot (CTX):
  Print ('Received Jacot' command)
  AWAIT CTX.SEND ('OK')

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions