【问题标题】:Get Channel Id discord with request (python)获取与请求不一致的频道 ID(python)
【发布时间】:2023-04-06 14:58:01
【问题描述】:

def send_dm():
     token = 'i know, just not putting my token here'
     message = 'yo, dont mind just testing smth'
     id = "681089525702721546"
     header = {
         'authorization' : token,
         'user-agent' : 'i know, just not putting my user_agent here',}
     payload = {'content' : message}
sd = requests.post(f"https://discord.com/api/v9/channels/{id}/messages", headers=header, data=payload)
print(sd.status_code)

所以我也想给我的朋友发送一条带有 python 请求的消息,但我只是发现你需要获取直接消息的频道 ID,但我不知道如何,有人可以帮我找出答案吗?

【问题讨论】:

    标签:
    python
    python-requests
    request
    discord