[英]Discord Bot Py Can't Kick Member
I was trying to make a kick command, and everything worked great, until I started adding some extra messages in case of a user error, and now I can only figure out how to kick member, but messages don't work and get messages to work, but the bot is not kicking members.我试图发出一个踢命令,一切都很好,直到我开始添加一些额外的消息以防用户错误,现在我只能弄清楚如何踢成员,但消息不起作用并得到消息工作,但机器人不会踢成员。
Basically, if I write members: discord.Member
, bot kicks users, but do not display the messages, and if I write commands.Greedy[discord.Member]
, it's the other way around.基本上,如果我写
members: discord.Member
,机器人踢用户,但不显示消息,如果我写commands.Greedy[discord.Member]
,则相反。
@bot.command()
@has_permissions(manage_roles=True, ban_members=True)
async def kick(ctx, members : commands.Greedy[discord.Member], *,reason=None):
if not members:
await ctx.send("** You need to name someone to kick **")
return
for member in members:
if bot.user == member:
embed = discord.Embed(title = "You can't kick me, I'm an almighty bot")
await ctx.send(embed=embed)
await members.kick(reason=reason)
Sorry if it was already asked, did not seem to find the solution for me.抱歉,如果已经问过,似乎没有为我找到解决方案。 Thank you for your answers.
谢谢您的回答。
The members
variable is a list, you need to kick them in the for loop members
变量是一个列表,您需要将它们踢到 for 循环中
for member in members:
if member == bot.user:
await ctx.send("You can't kick me")
else:
await member.kick(reason=reason)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.