我需要獲取用戶的下午通道才能看到我的機器人以前發送給該用戶的消息。我已經從標準通道的命令消息中獲得了其用戶對象。如何在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。我現在應該怎麼做?