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": -47227423,
"imageUrl": "anim exercitation elit",
"name": null,
"startIndex": -64143078,
"type": null
},
{
"endIndex": -77244143,
"imageUrl": "veniam ullamco Lorem cillum sed",
"name": null,
"startIndex": -7753122,
"type": null
},
{
"endIndex": -4141759,
"imageUrl": null,
"name": null,
"startIndex": -67197775,
"type": "consequat commodo"
},
{
"endIndex": 97803095,
"imageUrl": null,
"name": null,
"startIndex": -20897188,
"type": null
},
{
"endIndex": 18971884,
"imageUrl": "et",
"name": "culpa amet in",
"startIndex": -83237984,
"type": "ea ullamco in"
}
],
"isFromSharedChatGuest": true,
"isInSharedChat": false,
"isReply": false,
"isSharedChatHost": true,
"isTest": false,
"message": {
"badges": null,
"bits": -85584963,
"channel": "Lorem",
"cheerEmotes": [
{
"bits": -81731355,
"color": "mollit Ut amet",
"endIndex": -39026107,
"imageUrl": "consequat amet",
"name": "eiusmod",
"startIndex": 81602678,
"type": "Duis eiusmod sit"
},
{
"bits": 20787205,
"color": null,
"endIndex": -50408154,
"imageUrl": "Ut ex sed amet",
"name": "anim",
"startIndex": 94305795,
"type": null
},
{
"bits": -18163489,
"color": "velit sed dolor ut",
"endIndex": -28487126,
"imageUrl": "ea",
"name": null,
"startIndex": 2063911,
"type": null
},
{
"bits": 46797204,
"color": null,
"endIndex": 86969720,
"imageUrl": "est voluptate",
"name": null,
"startIndex": 63026944,
"type": "ullamco"
},
{
"bits": -35389756,
"color": null,
"endIndex": -75811785,
"imageUrl": null,
"name": "in voluptate nisi cillum",
"startIndex": -4999810,
"type": "veniam officia incididunt consequat"
}
],
"clientNonce": "adipisicing",
"color": null,
"displayName": "do",
"emotes": [
{
"endIndex": -10605111,
"imageUrl": "eiusmod",
"name": null,
"startIndex": -82890037,
"type": null
},
{
"endIndex": -63706542,
"imageUrl": "consectetur veniam id",
"name": null,
"startIndex": 52836699,
"type": null
},
{
"endIndex": 52297257,
"imageUrl": null,
"name": null,
"startIndex": -41486184,
"type": "aliquip velit"
},
{
"endIndex": -28090750,
"imageUrl": null,
"name": "in ex eiusmod",
"startIndex": -48303253,
"type": null
},
{
"endIndex": 39861111,
"imageUrl": "aute proident",
"name": null,
"startIndex": -31424648,
"type": null
}
],
"firstMessage": false,
"hasBits": false,
"internal": true,
"isAnonymous": true,
"isCustomReward": true,
"isFromSharedChatGuest": false,
"isHighlighted": true,
"isInSharedChat": false,
"isMe": true,
"isReply": false,
"isTest": true,
"message": "exercitation",
"monthsSubscribed": -87437061,
"msgId": null,
"reply": null,
"returningChatter": false,
"role": 1,
"sourceBadges": null,
"sourceMsgId": null,
"sourceRoomId": "occaecat officia",
"subscriber": false,
"subscriptionTier": null,
"userId": null,
"username": "commodo aliquip"
},
"messageId": null,
"meta": null,
"parts": [
{
"text": null,
"type": "nostrud qui elit ut"
},
{
"text": null,
"type": null
},
{
"text": null,
"type": "reprehenderit irure"
},
{
"text": "ut laborum ullamco sint est",
"type": "aliqua laboris"
},
{
"text": "ut quis ipsum",
"type": "pariatur est consectetur ea"
}
],
"reply": {
"msgBody": null,
"msgId": null,
"threadMsgId": null,
"threadUserLogin": null,
"userId": "mollit dolor elit aute",
"userLogin": null,
"userName": "ut in"
},
"sharedChatSource": null,
"text": null,
"user": {
"badges": [
{
"imageUrl": "sit labore",
"info": "ex",
"name": null,
"version": "ullamco non"
},
{
"imageUrl": "aliqua laborum in dolor proident",
"info": null,
"name": null,
"version": null
},
{
"imageUrl": "dolor",
"info": null,
"name": null,
"version": null
},
{
"imageUrl": null,
"info": "sit eu",
"name": null,
"version": null
},
{
"imageUrl": "magna occaecat est in",
"info": null,
"name": null,
"version": null
}
],
"color": null,
"id": "commodo laborum nisi Duis",
"login": null,
"monthsSubscribed": -25303187,
"name": "deserunt esse ipsum",
"role": 1,
"subscribed": true,
"subscriptionTier": null,
"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);
});