Twitch.ChatMessage| Value | Name |
|---|---|
| 0 | Unknown |
| 1 | Viewer |
| 2 | Vip |
| 3 | Moderator |
| 4 | Broadcaster |
| Value | Name |
|---|---|
| 0 | Unknown |
| 1 | Viewer |
| 2 | Vip |
| 3 | Moderator |
| 4 | Broadcaster |
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "TwitchMessageEvent",
"type": "object",
"additionalProperties": false,
"properties": {
"message": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/definitions/ChatMessage"
}
]
},
"user": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/definitions/TwitchUser"
}
]
},
"messageId": {
"type": [
"null",
"string"
]
},
"meta": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/definitions/TwitchMessageMetaData"
}
]
},
"anonymous": {
"type": "boolean"
},
"text": {
"type": [
"null",
"string"
]
},
"emotes": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Emote"
}
},
"parts": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/TwitchMessagePartBase"
}
},
"isReply": {
"type": "boolean"
},
"reply": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/definitions/TwitchMessageReply"
}
]
},
"isTest": {
"type": "boolean"
},
"sharedChatSource": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/definitions/TwitchBaseUser"
}
]
},
"isInSharedChat": {
"type": "boolean"
},
"isSharedChatHost": {
"type": "boolean"
},
"isFromSharedChatGuest": {
"type": "boolean"
}
},
"definitions": {
"ChatMessage": {
"type": "object",
"additionalProperties": false,
"properties": {
"internal": {
"type": "boolean"
},
"msgId": {
"type": [
"null",
"string"
]
},
"clientNonce": {
"type": [
"null",
"string"
]
},
"userId": {
"type": [
"null",
"string"
]
},
"username": {
"type": [
"null",
"string"
]
},
"role": {
"$ref": "#/definitions/ViewerRole"
},
"subscriber": {
"type": "boolean"
},
"subscriptionTier": {
"type": [
"null",
"string"
]
},
"displayName": {
"type": [
"null",
"string"
]
},
"color": {
"type": [
"null",
"string"
]
},
"channel": {
"type": [
"null",
"string"
]
},
"message": {
"type": [
"null",
"string"
]
},
"isHighlighted": {
"type": "boolean"
},
"isMe": {
"type": "boolean"
},
"isCustomReward": {
"type": "boolean"
},
"isAnonymous": {
"type": "boolean"
},
"isReply": {
"type": "boolean"
},
"reply": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/definitions/ReplyData"
}
]
},
"bits": {
"type": "integer",
"format": "int32"
},
"firstMessage": {
"type": "boolean"
},
"returningChatter": {
"type": "boolean"
},
"hasBits": {
"type": "boolean"
},
"emotes": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Emote"
}
},
"cheerEmotes": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/CheerEmote"
}
},
"badges": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Badge"
}
},
"monthsSubscribed": {
"type": "integer",
"format": "int32"
},
"isTest": {
"type": "boolean"
},
"isInSharedChat": {
"type": "boolean"
},
"isFromSharedChatGuest": {
"type": "boolean"
},
"sourceRoomId": {
"type": [
"null",
"string"
]
},
"sourceMsgId": {
"type": [
"null",
"string"
]
},
"sourceBadges": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Badge"
}
}
}
},
"ViewerRole": {
"type": "integer",
"description": "",
"x-enum-names": [
"Unknown",
"Viewer",
"Vip",
"Moderator",
"Broadcaster"
],
"x-enum-varnames": [
"Unknown",
"Viewer",
"Vip",
"Moderator",
"Broadcaster"
],
"x-enumNames": [
"Unknown",
"Viewer",
"Vip",
"Moderator",
"Broadcaster"
],
"x-enum-descriptions": [
null,
null,
null,
null,
null
],
"x-enumDescriptions": [
null,
null,
null,
null,
null
],
"enum": [
0,
1,
2,
3,
4
]
},
"ReplyData": {
"type": "object",
"additionalProperties": false,
"properties": {
"userId": {
"type": [
"null",
"string"
]
},
"userLogin": {
"type": [
"null",
"string"
]
},
"userName": {
"type": [
"null",
"string"
]
},
"msgId": {
"type": [
"null",
"string"
]
},
"msgBody": {
"type": [
"null",
"string"
]
},
"threadMsgId": {
"type": [
"null",
"string"
]
},
"threadUserLogin": {
"type": [
"null",
"string"
]
}
}
},
"Emote": {
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"type": [
"null",
"string"
]
},
"name": {
"type": [
"null",
"string"
]
},
"startIndex": {
"type": "integer",
"format": "int32"
},
"endIndex": {
"type": "integer",
"format": "int32"
},
"imageUrl": {
"type": [
"null",
"string"
]
}
}
},
"CheerEmote": {
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"type": [
"null",
"string"
]
},
"name": {
"type": [
"null",
"string"
]
},
"startIndex": {
"type": "integer",
"format": "int32"
},
"endIndex": {
"type": "integer",
"format": "int32"
},
"imageUrl": {
"type": [
"null",
"string"
]
},
"bits": {
"type": "integer",
"format": "int32"
},
"color": {
"type": [
"null",
"string"
]
}
}
},
"Badge": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": [
"null",
"string"
]
},
"version": {
"type": [
"null",
"string"
]
},
"imageUrl": {
"type": [
"null",
"string"
]
},
"info": {
"type": [
"null",
"string"
]
}
}
},
"TwitchUser": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": [
"null",
"string"
]
},
"login": {
"type": [
"null",
"string"
]
},
"name": {
"type": [
"null",
"string"
]
},
"type": {
"type": [
"null",
"string"
]
},
"role": {
"$ref": "#/definitions/ViewerRole2"
},
"badges": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/TwitchBadge"
}
},
"color": {
"type": [
"null",
"string"
]
},
"subscribed": {
"type": "boolean"
},
"subscriptionTier": {
"type": [
"null",
"string"
]
},
"monthsSubscribed": {
"type": "integer",
"format": "int32"
}
}
},
"ViewerRole2": {
"type": "integer",
"description": "",
"x-enum-names": [
"Unknown",
"Viewer",
"Vip",
"Moderator",
"Broadcaster"
],
"x-enum-varnames": [
"Unknown",
"Viewer",
"Vip",
"Moderator",
"Broadcaster"
],
"x-enumNames": [
"Unknown",
"Viewer",
"Vip",
"Moderator",
"Broadcaster"
],
"x-enum-descriptions": [
null,
null,
null,
null,
null
],
"x-enumDescriptions": [
null,
null,
null,
null,
null
],
"enum": [
0,
1,
2,
3,
4
]
},
"TwitchBadge": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": [
"null",
"string"
]
},
"version": {
"type": [
"null",
"string"
]
},
"imageUrl": {
"type": [
"null",
"string"
]
},
"info": {
"type": [
"null",
"string"
]
}
}
},
"TwitchMessageMetaData": {
"type": "object",
"additionalProperties": false,
"properties": {
"internal": {
"type": "boolean"
},
"clientNonce": {
"type": [
"null",
"string"
]
},
"firstMessage": {
"type": "boolean"
},
"returningChatter": {
"type": "boolean"
},
"isHighlighted": {
"type": "boolean"
},
"isMe": {
"type": "boolean"
},
"isCustomReward": {
"type": "boolean"
},
"isTest": {
"type": "boolean"
}
}
},
"TwitchMessagePartBase": {
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"type": [
"null",
"string"
]
},
"text": {
"type": [
"null",
"string"
]
}
}
},
"TwitchMessageReply": {
"type": "object",
"additionalProperties": false,
"properties": {
"msgId": {
"type": [
"null",
"string"
]
},
"userId": {
"type": [
"null",
"string"
]
},
"userLogin": {
"type": [
"null",
"string"
]
},
"userName": {
"type": [
"null",
"string"
]
},
"msgBody": {
"type": [
"null",
"string"
]
},
"threadMsgId": {
"type": [
"null",
"string"
]
},
"threadUserLogin": {
"type": [
"null",
"string"
]
}
}
},
"TwitchBaseUser": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": [
"null",
"string"
]
},
"login": {
"type": [
"null",
"string"
]
},
"name": {
"type": [
"null",
"string"
]
},
"type": {
"type": [
"null",
"string"
]
}
}
}
}
}
{
"anonymous": true,
"emotes": [
{
"endIndex": 60706780,
"imageUrl": null,
"name": "tempor deserunt",
"startIndex": -26421668,
"type": null
},
{
"endIndex": -95640340,
"imageUrl": "ad anim elit occaecat",
"name": "ipsum est pariatur",
"startIndex": -17954121,
"type": null
},
{
"endIndex": -87219947,
"imageUrl": null,
"name": null,
"startIndex": -83669944,
"type": null
},
{
"endIndex": 66630204,
"imageUrl": "magna qui ipsum",
"name": "dolore minim ullamco",
"startIndex": 90388961,
"type": "fugiat laborum est id"
},
{
"endIndex": 84555019,
"imageUrl": "ex aute officia quis",
"name": null,
"startIndex": 87538587,
"type": null
}
],
"isFromSharedChatGuest": false,
"isInSharedChat": false,
"isReply": false,
"isSharedChatHost": true,
"isTest": false,
"message": {
"badges": [
{
"imageUrl": null,
"info": "elit pariatur ea enim",
"name": null,
"version": "Excepteur"
},
{
"imageUrl": "sint Duis cupidatat voluptate id",
"info": "nulla aute esse",
"name": "aliquip pariatur dolor sed",
"version": "cillum pariatur in"
},
{
"imageUrl": "nostrud amet",
"info": null,
"name": "officia tempor qui nulla",
"version": "consectetur ad in"
},
{
"imageUrl": "sed irure elit nulla Duis",
"info": "commodo culpa voluptate elit ut",
"name": "elit cillum",
"version": null
},
{
"imageUrl": "quis exercitation enim ullamco Duis",
"info": null,
"name": null,
"version": "occaecat Lorem ipsum Duis ad"
}
],
"bits": -20296240,
"channel": null,
"cheerEmotes": [
{
"bits": -80278204,
"color": null,
"endIndex": -67746205,
"imageUrl": null,
"name": null,
"startIndex": -19256060,
"type": "adipisicing"
},
{
"bits": 16230856,
"color": null,
"endIndex": -87955724,
"imageUrl": null,
"name": null,
"startIndex": -11086788,
"type": "laboris"
},
{
"bits": -82082871,
"color": "laborum exercitation in",
"endIndex": -65795015,
"imageUrl": null,
"name": "est pariatur consectetur nostrud",
"startIndex": 81425061,
"type": null
},
{
"bits": -34659217,
"color": "mollit officia do dolore nisi",
"endIndex": -81629374,
"imageUrl": "et",
"name": null,
"startIndex": 11363885,
"type": "in nisi"
},
{
"bits": 64977663,
"color": null,
"endIndex": -66397526,
"imageUrl": null,
"name": "velit aute in non sint",
"startIndex": 71549614,
"type": "Ut aliqua"
}
],
"clientNonce": null,
"color": "labore",
"displayName": "in",
"emotes": [
{
"endIndex": 37891719,
"imageUrl": null,
"name": null,
"startIndex": -46200254,
"type": null
},
{
"endIndex": -56781901,
"imageUrl": "Ut nisi ipsum non",
"name": null,
"startIndex": -84252807,
"type": null
},
{
"endIndex": 32766568,
"imageUrl": "eiusmod amet Duis Ut enim",
"name": "dolore enim ipsum",
"startIndex": -50618042,
"type": "commodo sit"
},
{
"endIndex": 44802086,
"imageUrl": "ea aute tempor fugiat laborum",
"name": "sunt Excepteur consectetur ut",
"startIndex": -66400337,
"type": null
},
{
"endIndex": 10052507,
"imageUrl": "sed laboris occaecat",
"name": null,
"startIndex": -391612,
"type": null
}
],
"firstMessage": true,
"hasBits": false,
"internal": false,
"isAnonymous": false,
"isCustomReward": true,
"isFromSharedChatGuest": false,
"isHighlighted": true,
"isInSharedChat": false,
"isMe": false,
"isReply": false,
"isTest": true,
"message": "laboris aute ex sint dolor",
"monthsSubscribed": 77601101,
"msgId": null,
"reply": {
"msgBody": null,
"msgId": null,
"threadMsgId": null,
"threadUserLogin": null,
"userId": null,
"userLogin": null,
"userName": null
},
"returningChatter": true,
"role": 0,
"sourceBadges": null,
"sourceMsgId": "proident cupidatat",
"sourceRoomId": null,
"subscriber": true,
"subscriptionTier": null,
"userId": null,
"username": null
},
"messageId": null,
"meta": null,
"parts": [
{
"text": null,
"type": "amet in aliqua pariatur"
},
{
"text": "amet Lorem ullamco sit",
"type": "ut commodo aliqua esse non"
},
{
"text": null,
"type": "Duis irure dolor"
},
{
"text": null,
"type": "et magna Ut elit"
},
{
"text": "enim irure deserunt sit",
"type": null
}
],
"reply": {
"msgBody": "nostrud eiusmod labore dolore occaecat",
"msgId": null,
"threadMsgId": "incididunt pariatur ad",
"threadUserLogin": null,
"userId": null,
"userLogin": null,
"userName": null
},
"sharedChatSource": {
"id": "ipsum",
"login": null,
"name": "adipisicing aliquip ex",
"type": null
},
"text": null,
"user": {
"badges": null,
"color": "minim dolor sed exercitation quis",
"id": null,
"login": "dolor adipisicing dolore minim exercitation",
"monthsSubscribed": 36463000,
"name": "ex in ut adipisicing",
"role": 2,
"subscribed": true,
"subscriptionTier": "irure exercitation ullamco dolor",
"type": null
}
}
// Initialize the Streamer.bot WebSocket Client
const client = new StreamerbotClient();
// Subscribe to "Twitch.ChatMessage" events and register a callback
client.on('Twitch.ChatMessage', ({ event, data }) => {
// Code here will run every time the event is received!
console.log('Received event:', event.source, event.type);
console.log('Event data:', data);
});