Google app script, cacheServices and cache.get need promises to work?

Here is the code that wrote but doesn't work

I am trying to make a telegram bot in google app script. When the user types /start. There will be a prompt to set start from null to true in the cacheServices(I was wondering is there a better way to store variables that don't change, because if i put a start variable as "False" and override in the code it will become a False again after running).

To further elaborate, i set a login variable to be true manually and it worked perfectly. So just need some direction to wait for the cache to load before executing code!

1 answer

  • answered 2018-07-11 03:13 GCDX

    Oh i realised if i change the from a boolean to a string for setting the values it will work. So for example instead of the key,value pair of ["start":true], ["start":"true"] and start=="true" will work. Still don't know why booleans dont work.