Pokemontrader : Twitch Bot but every time the Bot goes to sleep, Arrays lose their data

I have a bot.js that whenever someone does !want Pokemonname it will add them to an Array held inside an Object. There is a command !whowants Pokemonname that prints the contents of an Array. However, whenever the Bot goes to sleep, the program loses all data inside the Arrays. Also if the code is altered in any way, even without changing the Arrays, the data is lost.

Hi zabarn!

It sounds to me like you want to implement persistence! ~hello-sqlite is an example of using Sqlite for persistence on Glitch itself, but people also use services like Google Firebase or Airtable or lots of other things: @storage is a collection of possibilities.

What you do with Sqlite is, instead of storing the data in an Array, you store it in a .db file, on the file system. The file system persists across starts of the bot, and so you can store things durably.

Hope this helps,

Johnicholas

1 Like