-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DiscordStartGameWebhook and DiscordPhaseUpdateWebhook to Game #194
Conversation
In fact, I might update it to take |
Do I understand it correctly, that this (and the previous PR) is to push events from the game service to Discord? Or is it from the game service to the bot service? |
@zond I briefly made a PR to have the Diplicity service integrate with the bot directly to update the server when the game is created or phase starts. But I decided it would be a bit of a headache to continue that way. Mainly because it's hard to test. In this approach, Diplicity service is set up to simply invoke a webhook when certain events happen. The Dipcord bot service will "hear" the webhook being invoked and will know that an update has happened, so it will then fetch the new state from Diplicity service again. It's a bit more roundabout, but it's much easier to test (can just invoke webhook to test, don't need to actually create a game and finish phase) and easier to maintain (all bot stuff in the one service and language) |
So the webhook is on the Discord servers, and will trigger an event that via WebSocket reaches the bot? Fair enough :D |
Here is the related code in the NodeJS server:
So basically it is just listening for any message with a Like I said, it's a bit roundabout, but I think ultimately easier. |
Cool, but it feels a bit Rube Goldberg-y :D |
Adds
DiscordWebhook
field toGame
:These webhooks will be invoked when the game is started, and when the phase is updated.
By using webhooks, the server doesn't need to know what needs to happen when certain updates happen. Instead, the Dipcord NodeJS server will listen for these webhook messages, and carry out any necessary actions.
@zond is this all I need to do to add optional fields to a data model? I want the fields to be either nil or an empty string if not specified. I don't want this to break existing create game endpoint.