简体   繁体   English

Discord 机器人不踢人

[英]Discord bot not kicking people

This is my bot code to kick members:这是我踢成员的机器人代码:

from discord.ext import commands

# Enable all intents except for members and presences
intents = discord.Intents.default()
intents.members = True  # Subscribe to the privileged members intent.
client = commands.Bot(command_prefix='!', intents=intents)

commands = commands

@client.command()
@commands.has_permissions(ban_members=True)
async def kick(message, member: discord.Member, *, reason=None):
    print(f"{member} was kicked")
    await member.kick(reason=reason)
    await message.channel.send(f"{member} was kicked")

But the bot doesn't kick people from the server but the bot has administrator permissions.但是该机器人不会从服务器上踢人,但该机器人具有管理员权限。 Thanks谢谢

This is my bot code to kick members:这是我踢成员的机器人代码:

from discord.ext import commands

# Enable all intents except for members and presences
intents = discord.Intents.default()
intents.members = True  # Subscribe to the privileged members intent.
client = commands.Bot(command_prefix='!', intents=intents)

commands = commands

@client.command()
@commands.has_permissions(ban_members=True)
async def kick(message, member: discord.Member, *, reason=None):
    print(f"{member} was kicked")
    await member.kick(reason=reason)
    await message.channel.send(f"{member} was kicked")

But the bot doesn't kick people from the server but the bot has administrator permissions.但是该机器人不会从服务器上踢人,但该机器人具有管理员权限。 Thanks谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM