【发布时间】:2021-07-28 03:45:23
【问题描述】:
我一直在为我和我的朋友制作不和谐机器人。 我想让我们服务器上的每个人(无论他们的等级)都能踢特定的人。 让他叫乔治
那是乔治:
George = {
'id' : '123456789',
'username' : 'george12'
}
我试图以这种方式做到这一点:
if message.content.startswith("Goodbay George"):
await george['id'].kick
还有这个:
@bot.command()
@commands.has_permissions(kick_members = True)
@commands.bot_has_permissions(kick_members = True)
async def kick(ctx, member : discord.Member, *, reason = None):
await member.kick(reason = reason)
@bot.event
async def on_message(message):
if message.content.startswith("Goodbay George"):
await kick(george['id']) ### im not sure how provide member as argument, I got kick function from this forum
但是这些选项都不起作用。 我怎样才能做到我所期望的? (开头说的)
【问题讨论】:
-
您是否尝试过从 discord api 中获取 George 对象?看起来您的乔治是
dict不能使用discord.Member方法。
标签: python discord.py