disagreement/docs/message_history.md
Slipstream def2ff0183
Some checks failed
Deploy MkDocs / deploy (push) Has been cancelled
Add Message.jump_url helper (#68)
2025-06-11 18:24:20 -06:00

782 B

Message History

TextChannel.history provides an async iterator over a channel's past messages. The iterator is powered by utils.message_pager which handles pagination for you.

channel = await client.fetch_channel(123456789012345678)
async for message in channel.history(limit=200):
    print(message.content)

Each returned Message has a jump_url property that links directly to the message in the Discord client.

Pass before or after to control the range of messages returned. The paginator fetches messages in batches of up to 100 until the limit is reached or Discord returns no more messages.

Next Steps