I don't but at the same time do need to. I have a last_media_group_id that tracks, well, the last media group id of the post that the user has sent. Since each request is separate in node, rightfully so, I can't just declare the variable inside the function. I need to define and mutate it globally so no matter how many requests the user makes, I'll still have access to the last media group id Things are good when there's only one user, but not so good when there are 2 or more people making requests
That last part is why you don't do globals
By global i mean using let in the main lines/global scope. I don't know how to have a global persistent variable without users overwriting each other. Btw my usecase is with grammy/telegraf 😅 I know there are sessions, conversations etc... But i thought they would be overkill
It's not overkill, this is what session is meant for
Обсуждают сегодня