core icon indicating copy to clipboard operation
core copied to clipboard

chat: "tagged" messages

Open goto-bus-stop opened this issue 9 years ago • 0 comments

Some messages might want special handling based on how they are sent. For example, a bot posting links from reddit into the chat so they can be styled differently, or a waitlist raffle message that should ping everybody in the waitlist, or an IRC /me style action message.

One way to solve this generically could be tags. Next to the message contents, a message can have one or more tags, similar to IRCv3 message tags. It could be a list of strings, probably:

{
  "command": "sendChat",
  "data": {
    "message": "[r/kpop] f(x) – FANCY NEW SONG",
    "tags": ["reddit"]
  } | {
    "message": "@Admin started a raffle!",
    "tags": ["raffleStart"]
  } | {
    "message": "waves",
    "tags": ["action"]
  }
}

But there might be uses for tags with more data attached as well, in which case it'd become something like

{
  "tags": {
    "action": true
  } | {
    "raffleEnd": { "winner": "<user id>" },
  }
}

Initially these tags would simply be passed through. Once role-based ACL is implemented there could be roles for sending tags at all: chat.tags, and for using specific tags chat.tags.action, chat.tags.closeEveryone'sBrowser, etc.

goto-bus-stop avatar Aug 31 '16 18:08 goto-bus-stop