简体   繁体   中英

How do I delete the command message?

Hello.

So, I'm currently trying to make a command that when you post the command, the command will get deleted and the content of the command will be posted.

Take this code for example:

@client.command()
async def hello(ctx):
    await ctx.send("Goodbye!")
    await ctx.author.message.delte()

So, what I want to happen is for the !hello command to be deleted, while the Goodbye. message is being sent.

I tried with the message parameter, but it didn't work.

How can I do this? Thank you beforehand.

As @moinierer3000 said, you should use await ctx.message.delete() . You made a typo and the author attribute of Context does not have a message attribute.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM