我正试图使用Python从特定的服务器通道中获取不一致的消息
import requests
import json
def retrieve_messages(channelid):
headers = {
'authorization': 'enter the authorization code'
}
# need to make a request to the url
r = requests.get(
f'https://discord.com/api/v9/channels/{channelid}/messages', headers=headers)
# create JSON object
jsonn = json.loads(r.text)
# we can now use a for loop on this JSON object
for value in jsonn:
print(value, '\n') # new line as well to separate each message
retrieve_messages('channel server id')
我期望在终端中输出消息,但我一直在接收以下输出。 The output that I am getting instead of the messages
你可能正在使用机器人
试试这个
相关问题 更多 >
编程相关推荐