Advertisements
With following code, I am able to retrieve messages from a given Discord channel, but only the 50 last messages get retrieved.
Please, how to increase this number (for instance 200 messages)?
Thanks for your help.
Have a good day,
Bests,
import requests
import json
def retrieve_messages(channelIdn author):
headers = {'authorization':author}
r = requests.get(f'https://discord.com/api/v9/channels/{channelId}/messages', headers=headers)
return json.loads(r.text)
>Solution :
So the limit is 100 messages according to the docs. You can set that amount up to 100 by adding the limit query string param.
ex: https://discord.com/api/v9/channels/{channelId}/messages?limit={limit}
Source: https://discord.com/developers/docs/resources/channel#get-channel-messages