1
我有這段代碼,我很好奇它爲什麼不工作。問題是在k = discord.Server.get_member(j)
它說Discord API,get_member(user_id)錯誤
"TypeError: get_member() missing 1 required positional argument: '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)