1
votes

I'm creating a discord bot that I would host with my PC so only some hours per day and I'm searching something that allows the bot to read all dms that he received while offline or similar.

I had two ideas to do this.

The first and simpler

  • call an iphotetic function that collect all the messages that the bot received when it was offline

The second

  • save the date when the bot goes offline
  • when it goes back online take all the 'open' private chats (so the ones that contains at least one message)
  • parse all the messages received from when it went offline to when it came back online

Right now I couldn't find anything on how to do this, any ideas?

1

1 Answers

0
votes

Discord seems to have some nice looking api docs that are 100% covered by the discord.py library. I'd dig around there for a bit and see if you can achieve what you are looking for with it. Something as simple as a text file would work to store persistent data, maybe a timestamp or the last message id before the user logged off.

Both your ideas seem decent to me, I'd say just try building them and see if you run into any road blocks. By the time you do you will have a better understanding of the capabilities and limitations of the api and will be able to create a better plan.