discord.py重写删除作者消息

问题描述 投票:0回答:1

[我已经尝试过此discord.py delete author message after executing command,并且现在搜索了一个多小时,并且在运行后我找不到删除执行者消息的解决方案。

代码:

from discord.ext import commands

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

@bot.command(pass_context = True)
async def say(ctx, *args):
    mesg = ' '.join(args)
    await ctx.delete()
    return await ctx.send(mesg)

bot.run('xxxx')

感谢您的阅读:)

python discord.py discord.py-rewrite
1个回答
0
投票

您从上下文中获取了消息,然后将其删除。

await ctx.message.delete()
© www.soinside.com 2019 - 2024. All rights reserved.