Reputation: 1
I would like to know how to get the first message in a channel. But more preferably could you point me to the part of the documentation that explains this, please?
Upvotes: 0
Views: 2484
Reputation: 1
messages = [message async for message in channel1.history(limit=1, oldest_first=True)]
Upvotes: 0
Reputation: 1037
TextChannel
has a history
method.
If you type await channel.history()
you can get all messages in that text channel. But this starts from last message. To start from first message, use oldest_first=True
in method. Also you can limit the amount of message with a keyword argument limit
.
Upvotes: 2