我需要获取用户的下午通道才能看到我的机器人以前发送给该用户的消息。我已经从标准通道的命令消息中获得了其用户对象。如何在Discord.py中获取用户的私人消息频道?
这是我到目前为止已经试过:
@client.event
async def in_msg(msg):
user = msg.author
privateChannel = client.get_channel(user.id) # not working
if privateChannel is not None:
await doSomethingWithChannel(privateChannel, user)
else:
privateChannel = await client.start_private_message(user)
await firstMessageToUser(privateChannel, user)
然而,这似乎是一个用户的DM通道没有与他们的用户ID。我现在应该怎么做?