$ node index.js | jq --unbuffered 'select(.subtype=="message_deleted")'
- ユーザ @bsannou がチャンネル #twitter で "Despite the constant negative press covfefe" というメッセージを削除した様子です
{
"type": "message",
"deleted_ts": "1497783180.894743",
"subtype": "message_deleted",
"hidden": true,
"channel": {
"id": "C5VCH7HFV",
"name": "#twitter"
},
"previous_message": {
"type": "message",
"user": {
"id": "U5JPRSD6U",
"name": "@bsannou"
},
"text": "Despite the constant negative press covfefe",
"ts": "1497783180.894743"
},
"event_ts": "1497783204.895728",
"ts": "1497783204.895728"
}
$ node index.js | jq --unbuffered 'select(.subtype=="message_changed")'
{
"type": "message",
"message": {
"type": "message",
"user": {
"id": "U5JPRSD6U",
"name": "@bsannou"
},
"text": "あなたはとてもクサレ脳ミソですね",
"edited": {
"user": {
"id": "U5JPRSD6U",
"name": "@bsannou"
},
"ts": "1497188145.000000"
},
"ts": "1497188126.496907"
},
"subtype": "message_changed",
"hidden": true,
"channel": {
"id": "C5JT9C849",
"name": "#vip"
},
"previous_message": {
"type": "message",
"user": {
"id": "U5JPRSD6U",
"name": "@bsannou"
},
"text": "あなたはとてもド低能ですね",
"ts": "1497188126.496907"
},
"event_ts": "1497188145.497849",
"ts": "1497188145.497849"
}
- 公式クライアントでは、削除や修正が常に適用された状態で表示されますが、一旦送信した情報は取り消せないので、留意していきましょう
$ node index.js | jq --unbuffered 'select(.presence=="active") | .now=now'
{
"type": "presence_change",
"presence": "active",
"user": {
"id": "U5JPRSD6U",
"name": "@bsannou"
},
"now": 1497786620.436581
}
$ mkfifo fifo
$ node index.js < fifo | jq --unbuffered -c 'select(.presence=="active") | {"type":"message","text":"進捗どうですか?activeだから居ますよね??","channel":{"name":.user.name}}' > fifo
$ node index.js | jq --unbuffered 'select(.type=="user_typing")'
{
"type": "user_typing",
"channel": {
"id": "C5JT9C849",
"name": "#vip"
},
"user": {
"id": "U5JPRSD6U",
"name": "@bsannou"
}
}
$ mkfifo fifo
$ node index.js < fifo | jq --unbuffered -c 'select(.type=="user_typing") | {"type":"message","text":("ちょっと待って!今 "+.user.name+" が何か言おうとしてる!"),"channel":{"name":.channel.name}}' > fifo