The name of the game. This is used to create the menu item to create a post.
This is a helper method to get the current post id.
This is a helper method to get the Reddit API client. You can use this to interact with Reddit.
This is a helper method to get the Redis client. All of your game state should be stored in Redis.
This is a helper method to get the current user id. This will be null if the user is not logged in, or if this is a TimerEvent handler.
Cancels a scheduled timer event
The timer event to cancel
This method is called when a new post is created. You can use this to initialize the game state.
The post that was created.
This method is called when a message is received from the broadcast channel. By default, this will send the message to the webview. You can override this method to customize the behavior.
The message that was received from the broadcast channel.
This gets called whenever a timer event is triggered. You can use this to update the game state, broadcast changes, etc. By default, this method broadcasts the timer event to the postId channel.
This method is called when a message is received from the webview. You can use this to update the game state. By default, this method will broadcast the message to the postId channel. You can override this method to customize the behavior.
The message that was sent from the webview.
Assuming you're in an individual user's context, you can use this method to send a message to the webview. If you're in a more global context, like a timer event, there won't be a webview to send a message to, so this will do nothing.
The message to send to the webview. This should be a JSONable object.
Schedules a recurring timer event on the server. You should prefer this to naive setInterval, if you want a long-running interval. This method will handle server restarts and other issues that could cause a naive setInterval to drift or stop.
Unique identifier for the timer, used for cancellation
Interval in milliseconds between timer events
Optional
data: JSONValueOptional data to pass to the timer event
A TimerEvent object representing the scheduled timer
Schedules a one-time timer event. You should prefer this to naive setTimeout, if you want a long-running timer. This method will handle server restarts and other issues that could cause a naive setTimeout to drift or stop.
Unique identifier for the timer, used for cancellation
Delay in milliseconds before the timer fires
Optional
data: JSONValueOptional data to pass to the timer event
A TimerEvent object representing the scheduled timer
This is a basic game server that can be used to create a simple game. Many of the methods are overridable so you can customize the behavior of the game server. Look at the specific method documentation for more information.