我有这段代码,我真的很好奇它为什么不起作用。问题在于k = discord.Server.get_member(j)
它说
“TypeError:get_member() 缺少 1 个必需的位置参数:'user_id'”。
此代码使用discord.py:
@client.event
async def on_message(message):
if message.content.startswith('/sendpm'):
print(message.author)
j = message.content.replace('/sendpm ', '')
print(j)
j = j.replace('@', '')
j = j.replace('<', '')
j = j.replace('>', '')
j = j.replace('!', '')
print(l)
k = discord.Server.get_member(j) #problem is here
await client.send_message(await client.start_private_message(k), spammsg)
await client.send_message(message.channel, 'sent' + message.author.mention)