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": false,
"emotes": [
{
"endIndex": 30998970,
"imageUrl": "dolore magna Excepteur sint veniam",
"name": "quis",
"startIndex": -57327796,
"type": null
},
{
"endIndex": 94955488,
"imageUrl": "labore incididunt laboris culpa in",
"name": "Excepteur officia fugiat enim",
"startIndex": -21001861,
"type": null
},
{
"endIndex": 49429600,
"imageUrl": "Ut",
"name": null,
"startIndex": -570414,
"type": null
},
{
"endIndex": 8749049,
"imageUrl": null,
"name": null,
"startIndex": 27359522,
"type": null
},
{
"endIndex": -30364933,
"imageUrl": null,
"name": null,
"startIndex": -22208111,
"type": "officia ut mollit dolor esse"
}
],
"isFromSharedChatGuest": true,
"isInSharedChat": false,
"isReply": true,
"isSharedChatHost": true,
"isTest": true,
"message": {
"badges": [
{
"imageUrl": null,
"info": "in tempor adipisicing dolor",
"name": "ullamco elit",
"version": null
},
{
"imageUrl": "ea nulla ipsum",
"info": "quis nisi",
"name": "nostrud dolore",
"version": null
},
{
"imageUrl": "ad irure dolor",
"info": null,
"name": "elit",
"version": "Ut velit ad"
},
{
"imageUrl": "laborum aute voluptate et ullamco",
"info": null,
"name": null,
"version": null
},
{
"imageUrl": null,
"info": null,
"name": "aliquip nisi quis officia aute",
"version": null
}
],
"bits": 10319215,
"channel": null,
"cheerEmotes": [
{
"bits": 45684316,
"color": null,
"endIndex": -735404,
"imageUrl": null,
"name": null,
"startIndex": -7123725,
"type": null
},
{
"bits": -34076467,
"color": "et",
"endIndex": -31383146,
"imageUrl": null,
"name": "qui in",
"startIndex": 97174630,
"type": null
},
{
"bits": 37802661,
"color": null,
"endIndex": 34480968,
"imageUrl": "dolor officia consectetur",
"name": "veniam elit",
"startIndex": 34254691,
"type": "nostrud laborum eu exercitation mollit"
},
{
"bits": -60561826,
"color": null,
"endIndex": 40205977,
"imageUrl": null,
"name": null,
"startIndex": 52918787,
"type": "tempor ut"
},
{
"bits": 25332455,
"color": "adipisicing cillum",
"endIndex": 4068570,
"imageUrl": "laboris",
"name": null,
"startIndex": -56158519,
"type": null
}
],
"clientNonce": null,
"color": null,
"displayName": "sit",
"emotes": null,
"firstMessage": true,
"hasBits": false,
"internal": true,
"isAnonymous": false,
"isCustomReward": true,
"isFromSharedChatGuest": false,
"isHighlighted": true,
"isInSharedChat": false,
"isMe": false,
"isReply": true,
"isTest": true,
"message": "ut culpa ullamco fugiat",
"monthsSubscribed": -98339515,
"msgId": "magna culpa cillum non",
"reply": {
"msgBody": "incididunt ullamco",
"msgId": "non et esse dolore ullamco",
"threadMsgId": "consequat",
"threadUserLogin": "ullamco nulla commodo laborum",
"userId": "aliquip in",
"userLogin": null,
"userName": "Ut eiusmod fugiat"
},
"returningChatter": false,
"role": 4,
"sourceBadges": null,
"sourceMsgId": "magna",
"sourceRoomId": "velit enim ullamco id tempor",
"subscriber": false,
"subscriptionTier": null,
"userId": "in esse mollit eiusmod enim",
"username": null
},
"messageId": null,
"meta": {
"clientNonce": "cillum officia",
"firstMessage": true,
"internal": true,
"isCustomReward": false,
"isHighlighted": false,
"isMe": false,
"isTest": true,
"returningChatter": true
},
"parts": [
{
"text": "ea in pariatur",
"type": null
},
{
"text": "culpa dolore aliqua do",
"type": "labore non laboris sunt consectetur"
},
{
"text": "id aute",
"type": null
},
{
"text": null,
"type": "esse nulla"
},
{
"text": null,
"type": null
}
],
"reply": null,
"sharedChatSource": null,
"text": "magna",
"user": {
"badges": null,
"color": null,
"id": null,
"login": null,
"monthsSubscribed": -43573735,
"name": "laborum tempor minim anim mollit",
"role": 0,
"subscribed": true,
"subscriptionTier": "ex incididunt qui elit",
"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);
});