You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the bot is implemented in a manner that depends on global state, which can cause confusion, unexpected behaviour, and inconsistency.
The solution:
Switching to a more functional approach where the same input to a function always produces the same output would bring many benefits to reliability and improve development conditions
how to implement it:
Everywhere that calls on the global variables users or games should instead take in all the state it needs as function parameters.
Everywhere that writes to the global variables users or games should instead return the value instead
when it comes to buttons and views, you can't really return since all the work is being done by a callback function being called within the discord api wrapper. Instead edit the object's attributes and access them when the view has stopped
The text was updated successfully, but these errors were encountered:
The problem:
Currently, the bot is implemented in a manner that depends on global state, which can cause confusion, unexpected behaviour, and inconsistency.
The solution:
Switching to a more functional approach where the same input to a function always produces the same output would bring many benefits to reliability and improve development conditions
how to implement it:
Everywhere that calls on the global variables
users
orgames
should instead take in all the state it needs as function parameters.Everywhere that writes to the global variables
users
orgames
should instead return the value insteadwhen it comes to buttons and views, you can't really return since all the work is being done by a callback function being called within the discord api wrapper. Instead edit the object's attributes and access them when the view has stopped
The text was updated successfully, but these errors were encountered: