multichat-ts 0.0.91 → 0.0.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.prettierrc CHANGED
@@ -1,7 +1,7 @@
1
- {
2
- "useTabs": true,
3
- "singleQuote": true,
4
- "semi": true,
5
- "trailingComma": "all",
6
- "printWidth": 100
7
- }
1
+ {
2
+ "useTabs": true,
3
+ "singleQuote": true,
4
+ "semi": true,
5
+ "trailingComma": "all",
6
+ "printWidth": 100
7
+ }
package/dist/twitch.js CHANGED
@@ -120,7 +120,7 @@ export class TwitchIRC {
120
120
  break;
121
121
  }
122
122
  case 'PRIVMSG': {
123
- const { channel, params, tags } = message;
123
+ const { channel, params, tags, source } = message;
124
124
  if (!tags || !tags['user-id'] || !tags['id'] || !tags['room-id'])
125
125
  return;
126
126
  const text = params[0];
@@ -215,9 +215,16 @@ export class TwitchIRC {
215
215
  }) ?? [],
216
216
  color: tags.color ?? '#FFFFFF',
217
217
  id: tags['user-id'],
218
- username: (tags['display-name'] ?? 'Unknown').toLowerCase(),
218
+ username: source?.user ?? 'Unknown',
219
219
  display_name: tags['display-name'] ?? 'Unknown',
220
- roles: {},
220
+ roles: {
221
+ admin: tags['user-type'] === 'admin',
222
+ global_moderator: tags['user-type'] === 'global_mod',
223
+ staff: tags['user-type'] === 'staff',
224
+ turbo: tags.turbo === '1',
225
+ vip: tags.vip === '1',
226
+ moderator: tags.mod === '1',
227
+ },
221
228
  },
222
229
  });
223
230
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multichat-ts",
3
- "version": "0.0.91",
3
+ "version": "0.0.93",
4
4
  "type": "module",
5
5
  "description": "Receive type-safe realtime events for chat-related messages on multiple platforms (Twitch, Kick)",
6
6
  "repository": {
@@ -1,173 +1,173 @@
1
- export * from './kick.js';
2
- export * from './twitch.js';
3
-
4
- export type Message = {
5
- body: BodyComponent[];
6
- channel: {
7
- room_id: string;
8
- name: string;
9
- };
10
- id: string;
11
- raw_text: string;
12
- timestamp_sent: number;
13
- resubscription?: {
14
- id: string;
15
- months: number;
16
- subscribed_since_timestamp: string;
17
- };
18
- user: {
19
- badges: Badge[];
20
- color: string;
21
- id: string;
22
- username: string;
23
- display_name: string;
24
- roles: {
25
- [role in 'vip' | 'moderator' | 'turbo' | 'admin' | 'global_moderator' | 'staff']?: boolean;
26
- };
27
- };
28
- };
29
-
30
- export type ClearMessages = {
31
- channel: {
32
- room_id: string;
33
- name: string;
34
- };
35
- user?: {
36
- id: string;
37
- username: string;
38
- };
39
- timeout_duration_seconds?: number | undefined;
40
- timestamp_sent: number;
41
- };
42
-
43
- export type DeleteMessage = {
44
- channel: {
45
- room_id?: string;
46
- name: string;
47
- };
48
- user?: {
49
- username: string;
50
- };
51
- id: string;
52
- raw_text: string;
53
- timestamp_sent: number;
54
- };
55
-
56
- type EventData = {
57
- subscription: {
58
- months: number;
59
- streak?: number;
60
- subscription_plan: {
61
- type: 'prime' | 1000 | 2000 | 3000;
62
- name: string;
63
- };
64
- gift_upgrade?: {
65
- gift_total: number;
66
- promo_name: string;
67
- sender: {
68
- username: string;
69
- display_name: string;
70
- };
71
- };
72
- };
73
- gift: {
74
- months: number;
75
- recipient: {
76
- id: string;
77
- username: string;
78
- display_name: string;
79
- };
80
- subscription_plan: {
81
- type: 'prime' | 1000 | 2000 | 3000;
82
- name: string;
83
- };
84
- };
85
- raid: {
86
- sender: {
87
- username: string;
88
- display_name: string;
89
- viewer_count: number;
90
- };
91
- };
92
- };
93
-
94
- export type Event = {
95
- [E in keyof EventData]: {
96
- type: E;
97
- body: BodyComponent[];
98
- channel: {
99
- room_id: string;
100
- name: string;
101
- };
102
- id: string;
103
- raw_text: string;
104
- system_message: string;
105
- timestamp_sent: number;
106
- user: {
107
- badges: Badge[];
108
- color: string;
109
- id: string;
110
- username: string;
111
- display_name: string;
112
- roles: {
113
- [role in
114
- | 'moderator'
115
- | 'subscriber'
116
- | 'turbo'
117
- | 'admin'
118
- | 'global_moderator'
119
- | 'staff']?: boolean;
120
- };
121
- };
122
- data: EventData[E];
123
- };
124
- }[keyof EventData];
125
-
126
- export type BodyComponentEmote = {
127
- end_exclusive: number;
128
- start_inclusive: number;
129
- type: 'emote';
130
- url: string;
131
- };
132
-
133
- export type BodyComponent =
134
- | {
135
- end_exclusive: number;
136
- label: string;
137
- start_inclusive: number;
138
- type: 'link';
139
- url: string;
140
- }
141
- | {
142
- end_exclusive: number;
143
- start_inclusive: number;
144
- text: string;
145
- type: 'text';
146
- }
147
- | BodyComponentEmote;
148
-
149
- type Badge = {
150
- info?: string | undefined;
151
- set_id: string;
152
- url: string;
153
- };
154
-
155
- export type BadgeURLsByNameOrCount = {
156
- [badge_name: string]:
157
- | string
158
- | {
159
- [badge_count: number]: string;
160
- };
161
- };
162
-
163
- export type BadgeURLsBySetIDOrSetIDAndVersion = {
164
- [set_id: string]:
165
- | {
166
- [version: string]: string;
167
- }
168
- | string;
169
- };
170
-
171
- export type EmoteURLsByName = {
172
- [emote_name: string]: string;
173
- };
1
+ export * from './kick.js';
2
+ export * from './twitch.js';
3
+
4
+ export type Message = {
5
+ body: BodyComponent[];
6
+ channel: {
7
+ room_id: string;
8
+ name: string;
9
+ };
10
+ id: string;
11
+ raw_text: string;
12
+ timestamp_sent: number;
13
+ resubscription?: {
14
+ id: string;
15
+ months: number;
16
+ subscribed_since_timestamp: string;
17
+ };
18
+ user: {
19
+ badges: Badge[];
20
+ color: string;
21
+ id: string;
22
+ username: string;
23
+ display_name: string;
24
+ roles: {
25
+ [role in 'vip' | 'moderator' | 'turbo' | 'admin' | 'global_moderator' | 'staff']?: boolean;
26
+ };
27
+ };
28
+ };
29
+
30
+ export type ClearMessages = {
31
+ channel: {
32
+ room_id: string;
33
+ name: string;
34
+ };
35
+ user?: {
36
+ id: string;
37
+ username: string;
38
+ };
39
+ timeout_duration_seconds?: number | undefined;
40
+ timestamp_sent: number;
41
+ };
42
+
43
+ export type DeleteMessage = {
44
+ channel: {
45
+ room_id?: string;
46
+ name: string;
47
+ };
48
+ user?: {
49
+ username: string;
50
+ };
51
+ id: string;
52
+ raw_text: string;
53
+ timestamp_sent: number;
54
+ };
55
+
56
+ type EventData = {
57
+ subscription: {
58
+ months: number;
59
+ streak?: number;
60
+ subscription_plan: {
61
+ type: 'prime' | 1000 | 2000 | 3000;
62
+ name: string;
63
+ };
64
+ gift_upgrade?: {
65
+ gift_total: number;
66
+ promo_name: string;
67
+ sender: {
68
+ username: string;
69
+ display_name: string;
70
+ };
71
+ };
72
+ };
73
+ gift: {
74
+ months: number;
75
+ recipient: {
76
+ id: string;
77
+ username: string;
78
+ display_name: string;
79
+ };
80
+ subscription_plan: {
81
+ type: 'prime' | 1000 | 2000 | 3000;
82
+ name: string;
83
+ };
84
+ };
85
+ raid: {
86
+ sender: {
87
+ username: string;
88
+ display_name: string;
89
+ viewer_count: number;
90
+ };
91
+ };
92
+ };
93
+
94
+ export type Event = {
95
+ [E in keyof EventData]: {
96
+ type: E;
97
+ body: BodyComponent[];
98
+ channel: {
99
+ room_id: string;
100
+ name: string;
101
+ };
102
+ id: string;
103
+ raw_text: string;
104
+ system_message: string;
105
+ timestamp_sent: number;
106
+ user: {
107
+ badges: Badge[];
108
+ color: string;
109
+ id: string;
110
+ username: string;
111
+ display_name: string;
112
+ roles: {
113
+ [role in
114
+ | 'moderator'
115
+ | 'subscriber'
116
+ | 'turbo'
117
+ | 'admin'
118
+ | 'global_moderator'
119
+ | 'staff']?: boolean;
120
+ };
121
+ };
122
+ data: EventData[E];
123
+ };
124
+ }[keyof EventData];
125
+
126
+ export type BodyComponentEmote = {
127
+ end_exclusive: number;
128
+ start_inclusive: number;
129
+ type: 'emote';
130
+ url: string;
131
+ };
132
+
133
+ export type BodyComponent =
134
+ | {
135
+ end_exclusive: number;
136
+ label: string;
137
+ start_inclusive: number;
138
+ type: 'link';
139
+ url: string;
140
+ }
141
+ | {
142
+ end_exclusive: number;
143
+ start_inclusive: number;
144
+ text: string;
145
+ type: 'text';
146
+ }
147
+ | BodyComponentEmote;
148
+
149
+ type Badge = {
150
+ info?: string | undefined;
151
+ set_id: string;
152
+ url: string;
153
+ };
154
+
155
+ export type BadgeURLsByNameOrCount = {
156
+ [badge_name: string]:
157
+ | string
158
+ | {
159
+ [badge_count: number]: string;
160
+ };
161
+ };
162
+
163
+ export type BadgeURLsBySetIDOrSetIDAndVersion = {
164
+ [set_id: string]:
165
+ | {
166
+ [version: string]: string;
167
+ }
168
+ | string;
169
+ };
170
+
171
+ export type EmoteURLsByName = {
172
+ [emote_name: string]: string;
173
+ };