Mario
Mario

Reputation: 1478

Fetch all the messages sent by the bot

I want to fetch all the messages sent by my bot in Discord.py .. I've tried a lot but I only found ways to do that for the last message.

Is it a function available in Discord.py?

Upvotes: 0

Views: 1586

Answers (1)

Seymour Guado
Seymour Guado

Reputation: 248

There is no internally-kept list with information about the messages sent by your bot -- as such, you have two methods to find all the messages sent by it:

  1. Create your own system to track and save messages or message IDs that are sent out, or
  2. Iterate through the history of the guilds' channels that your bot posts in. Note that if any of these channels have a long history, iterating through all of it could be extraordinarily slow, especially if you have a public bot in multiple servers. If you choose to do this way, you can use the TextChannel.history method.

Upvotes: 1

Related Questions