【问题标题】:How to make a kick command in python for a discord bot如何在 python 中为不和谐的机器人制作踢命令
【发布时间】:2021-01-24 14:09:35
【问题描述】:

我正在为 discord 制作一个审核机器人,并想添加一个 kick 命令。 我对踢命令进行了一些研究,但它们都不起作用。 错误是:

discord.ext.commands.errors.CommandNotFound: Command "kick" is not found

这是我的代码:

@commands.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=None):
    await client.kick(member)
    await ctx.send(f'User {member} has been kick')

【问题讨论】:

    标签: python discord.py


    【解决方案1】:

    没有像client.kick(member) 这样的东西。我认为您正在尝试做member.kick()。下面是一个踢命令的例子:

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

    【讨论】:

    • 我收到一个错误:忽略命令中的异常无:discord.ext.commands.errors.CommandNotFound:找不到命令“踢”
    • 你在重启你的机器人吗?
    猜你喜欢
    • 2020-04-29
    • 2020-09-23
    • 2020-09-09
    • 2017-04-29
    • 2021-11-21
    • 2021-10-05
    • 2021-04-19
    • 2021-08-08
    • 2021-06-30
    相关资源
    最近更新 更多