禁止/踢命令后发送消息

时间:2019-05-31 21:14:37

标签: discord discord.py-rewrite

我正在设置一个不和谐的bot,但是我希望该bot在命令“ ban”和“ kick”之后发送确认或错误消息,有人可以帮忙吗?

[这里是新编码器]

我尝试用另一个参数创建另一个单独的命令,只是让它发送期望的消息。

@client.command()
async def purge(ctx, amount):
    await ctx.channel.purge(limit=amount)

@client.command()
async def kick(ctx, member : discord.Member, *, reason=None):
    await member.kick(reason=reason)

@client.command()
async def ban(ctx, member : discord.Member, *, reason=None):
    await member.ban(reason=reason)

@client.command()
async def purge(ctx, amount):
    await ctx.send(f'Okay, I will clear {amount} messages for you.')

@client.command()
async def kick(ctx, member : discord.Member, *, reason=None):
    await ctx.send(f'I have kicked {discord.Member}. Reason: {reason}.')

@client.command()
async def ban(ctx, member : discord.Member, *, reason=None):
    await ctx.send(f'The Ban Hammer has spoken! {discord.Member} has been banned!')```

In actuality, I think it would be great, because they clash with each other and probably will send a message, but it went wrong.

1 个答案:

答案 0 :(得分:0)

在 kick 命令的末尾删除最后一个 '.也做{member.name}{member}