cabal-club / cabal-client

interface for writing peer-to-peer chat clients
GNU General Public License v3.0
95 stars 14 forks source link

Add additional event for data when processing commands #37

Closed nikolaiwarner closed 4 years ago

nikolaiwarner commented 4 years ago

Cabal Desktop needs to do some cleanup after a /command happens. This adds an extra "command" event that contains what command was typed, the args that were typed, and any relevant data that was generated from it.

ghost commented 4 years ago

Do we need a new res.data() method for this? I made res.info() so that you can pass supplementary information along with the text message:

res.info({
  text: 'this message gets displayed by clients',
  someExtra: ['data'],
  whatever: 'you want goes here'
})

Would that work? It also looks like it would be better if there is always a "command" event that happens when a command gets interpreted, instead of each command individually needing to emit a "command" event.