warnet-gi / WarnetBot

A bot for Warga Nusantara Teyvat (WARNET) discord server
https://discord.gg/warnet-gi
MIT License
7 stars 4 forks source link

Implement caching on `/warnet-color list` command #93

Closed Iqrar99 closed 1 year ago

Iqrar99 commented 1 year ago

Whenever the color addition, editing, or delete command is triggered, empty the cache. Cache only be built when the /warnet-color list command is triggered. If the cache still exists, use the cache instead of generating a new image. For now, save the cache in memory.

  1. On connect -> trigger the list command -> generate new image -> Cache the image -> trigger the list command again -> Use cache
  2. On connect -> trigger the list command -> generate new image -> Cache the image -> trigger add/edit/delete command -> Remove cache -> trigger the list command -> Cache the image (since the cache was empty)