So, I have a code that on receiving a message it will print it to the python terminal, but I want to be able to see previous messages as this code will only show messages sent while the code is running. I was thinking of getting the history printed in the startup section (async def on_ready():) but wasn't sure how. Thanks for your help.
@client.event
async def on_message(message):
print(f"{message.guild.name}: {message.channel.name}\n{message.author.name}: {message.content}")