如何删除discord.py中的用户命令信息?



我有这个命令的代码。如何删除user命令提示信息?

@bot.command()
@commands.has_role("Referee")
async def game(ctx, winner, loser, score, MVP):
teams = winner + " vs " + loser
embed = discord.Embed(title = "Shell League Game | Season 1 ", color = 0xfca426)
embed.add_field(name = "Teams", value = teams, inline = False)
embed.add_field(name = "Score", value = score, inline = False)
embed.add_field(name = "MVP", value = MVP, inline = False)
await ctx.send(embed = embed)

您必须将await ctx.message.delete()放在函数定义的开头。给你:

@bot.command()
@commands.has_role("Referee")
async def game(ctx, winner, loser, score, MVP):
await ctx.message.delete() # deletes author's command message
# rest of your command's code

最新更新