当成员以用户的形式出现时,不会发送消息
@bot.command(name='kick')
async def kick(ctx, message, member: discord.Member, *, reason=None):
if reason is None:
reason = " no reason provided"
await ctx.guild.kick(member)
await ctx.send(f'User {member.mention} has been kicked. \n Reason: {reason}')
if member is False:
await message.channel.send("User can't be found")
这是我的代码。我尝试了多种不同的方法来做到这一点,但是它们都没有起作用。踢命令是我想要的,但是当我尝试踢一个机器人不认识到它的人时,从未说过找不到用户。我为何如此感到困惑,我想要一些帮助。谢谢。 :)欢迎任何建议或解决方案。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是针对那些正在研究这个问题并需要帮助的人。请注意,我使用了这篇文章的答案以找到此问题的答案。这是代码:
感谢所有试图帮助我解决这个问题的人。抱歉,如果这个问题让那些遇到这个问题感到困惑。这是我第一次在Stackoverflow上问一个问题,因此目前我并不是最好的问题。
This is for those who are looking at this question and need help. Please note that I used part of this post's answer to find the answer to this question. Here's the code:
Thank you to everyone who tried to help me with this question. Sorry if this question was confusing for those who came across this. This is my first time asking a question on stackoverflow so I'm not really the best with asking questions on this platform at the moment.
尝试一下
try this