我有这个命令的代码。如何删除用户命令消息?
@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)
答案 0 :(得分:0)
您必须将 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