Is there a way to get the most recent message of a specific channel using discord.py? I looked at the official docs and didn't find a way to.
I've now figured it out by myself:
For a discord.Client
class you just need these lines of code for the last message:
(await self.get_channel(CHANNEL_ID).history(limit=1).flatten())[0]
If you use a discord.ext.commands.Bot
@thegamecracks' answer is correct.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With