Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Discord.py code doesn't work! How can i fix this?

Why does not this work? When I run the code and try the !test, it doesn’t even send an error to the terminal. How can i fix this?

import discord
from discord.ext import commands


bot = commands.Bot(command_prefix="!")




bot.command()
async def test(ctx):
    ctx.send("test")
    
    
    
    
bot.run(token)

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You’re missing the decorator symbol

@bot.command()

also, the send message instruction inside your test function needs to be awaited

@bot.command()
async def test(ctx):
    await ctx.send("test")
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading