shuppet / raku-api-discord

Raku module for interacting with the Discord API.
https://shuppet.com
BSD 3-Clause "New" or "Revised" License
30 stars 3 forks source link

Objects should update with update events #16

Open Altreus opened 5 years ago

Altreus commented 5 years ago

For example, a Channel object should update itself when we receive relevant messages from the Discord websocket.

Problem here is that if the user has intentionally changed a field, we will probably overwrite it with the data from Discord, even if that didn't change in the payload.

So the questions are:

I think the answers are something like:

method handle-event($json) {
   # some sort of despatch to the right type or whatever
   # look it up by ID or something
   $discovered-object.update-supply.emit($json);
}