I am making a bot for discord and it requires Asyncio, but I am running into an error when I try to define my functions. This has never happened before, but I am now getting a “Callback must be a coroutine” error on all of my functions. Here is an example of one of those functions:
@bot.command(pass_context = True)
async def ping(ctx):
'''-> Pings Bot'''
channel = ctx.message.channel
t1 = time.perf_counter()
await bot.send_typing(channel)
t2 = time.perf_counter()
await bot.say(':ping_pong: Pong! - {}'.format(round((t2-t1)*1000)) + "ms")
This raises an error for no apparent reason because I am using async def to define the function. Any help would be appreciated!