multichat-ts 0.0.5 → 0.0.7
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/dist/twitch.js +3 -1
- package/index.js +9 -0
- package/package.json +54 -54
- package/src/twitch.ts +8 -1
package/dist/twitch.js
CHANGED
|
@@ -86,7 +86,7 @@ export class TwitchIRC {
|
|
|
86
86
|
onMessage(event) {
|
|
87
87
|
if (!event.data)
|
|
88
88
|
return;
|
|
89
|
-
const lines =
|
|
89
|
+
const lines = event.data.trim().split('\r\n');
|
|
90
90
|
const messages = lines.map(parseIRCLine);
|
|
91
91
|
messages.forEach((message) => {
|
|
92
92
|
this.public_listeners.raw_message?.(message);
|
|
@@ -257,6 +257,8 @@ function parseIRCLine(line) {
|
|
|
257
257
|
componentIndex++;
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
+
if (params[0])
|
|
261
|
+
params[0] = String.raw `${params[0]}`.replaceAll(/.+ACTION (.*).+/g, (_original, group) => group);
|
|
260
262
|
const tags = raw_tags_component ? parseTags(raw_tags_component, command) : undefined;
|
|
261
263
|
return {
|
|
262
264
|
channel,
|
package/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "multichat-ts",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "Receive type-safe realtime events for chat-related messages on multiple platforms (Twitch, Kick)",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "https://github.com/0Abdullah/multichat-ts.git"
|
|
9
|
-
},
|
|
10
|
-
"homepage": "https://github.com/0Abdullah/multichat-ts",
|
|
11
|
-
"main": "dist/index.js",
|
|
12
|
-
"types": "dist/index.d.ts",
|
|
13
|
-
"exports": {
|
|
14
|
-
".": "./dist/index.js"
|
|
15
|
-
},
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "tsc",
|
|
18
|
-
"prepublishOnly": "pnpm build",
|
|
19
|
-
"pub": "npm publish --access public",
|
|
20
|
-
"lint": "eslint .",
|
|
21
|
-
"lint:fix": "eslint . --fix",
|
|
22
|
-
"format": "prettier --check src",
|
|
23
|
-
"format:fix": "prettier --write src"
|
|
24
|
-
},
|
|
25
|
-
"keywords": [
|
|
26
|
-
"chat",
|
|
27
|
-
"multichat",
|
|
28
|
-
"twitch",
|
|
29
|
-
"kick",
|
|
30
|
-
"realtime",
|
|
31
|
-
"irc",
|
|
32
|
-
"pusher",
|
|
33
|
-
"typescript",
|
|
34
|
-
"ts"
|
|
35
|
-
],
|
|
36
|
-
"author": {
|
|
37
|
-
"name": "Abdullah",
|
|
38
|
-
"url": "https://github.com/0Abdullah"
|
|
39
|
-
},
|
|
40
|
-
"license": "MIT",
|
|
41
|
-
"devDependencies": {
|
|
42
|
-
"@eslint/js": "^9.10.0",
|
|
43
|
-
"@types/node": "^22.5.4",
|
|
44
|
-
"eslint": "^9.10.0",
|
|
45
|
-
"eslint-config-prettier": "^9.1.0",
|
|
46
|
-
"prettier": "^3.3.3",
|
|
47
|
-
"typescript": "^5.5.4",
|
|
48
|
-
"typescript-eslint": "^8.4.0"
|
|
49
|
-
},
|
|
50
|
-
"dependencies": {
|
|
51
|
-
"partysocket": "^1.0.2",
|
|
52
|
-
"pusher-js": "8.4.0-rc2"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "multichat-ts",
|
|
3
|
+
"version": "0.0.7",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Receive type-safe realtime events for chat-related messages on multiple platforms (Twitch, Kick)",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/0Abdullah/multichat-ts.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/0Abdullah/multichat-ts",
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"prepublishOnly": "pnpm build",
|
|
19
|
+
"pub": "npm publish --access public",
|
|
20
|
+
"lint": "eslint .",
|
|
21
|
+
"lint:fix": "eslint . --fix",
|
|
22
|
+
"format": "prettier --check src",
|
|
23
|
+
"format:fix": "prettier --write src"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"chat",
|
|
27
|
+
"multichat",
|
|
28
|
+
"twitch",
|
|
29
|
+
"kick",
|
|
30
|
+
"realtime",
|
|
31
|
+
"irc",
|
|
32
|
+
"pusher",
|
|
33
|
+
"typescript",
|
|
34
|
+
"ts"
|
|
35
|
+
],
|
|
36
|
+
"author": {
|
|
37
|
+
"name": "Abdullah",
|
|
38
|
+
"url": "https://github.com/0Abdullah"
|
|
39
|
+
},
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@eslint/js": "^9.10.0",
|
|
43
|
+
"@types/node": "^22.5.4",
|
|
44
|
+
"eslint": "^9.10.0",
|
|
45
|
+
"eslint-config-prettier": "^9.1.0",
|
|
46
|
+
"prettier": "^3.3.3",
|
|
47
|
+
"typescript": "^5.5.4",
|
|
48
|
+
"typescript-eslint": "^8.4.0"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"partysocket": "^1.0.2",
|
|
52
|
+
"pusher-js": "8.4.0-rc2"
|
|
53
|
+
}
|
|
54
|
+
}
|
package/src/twitch.ts
CHANGED
|
@@ -136,7 +136,7 @@ export class TwitchIRC {
|
|
|
136
136
|
|
|
137
137
|
private onMessage(event: MessageEvent) {
|
|
138
138
|
if (!event.data) return;
|
|
139
|
-
const lines =
|
|
139
|
+
const lines = (event.data as string).trim().split('\r\n');
|
|
140
140
|
const messages = lines.map(parseIRCLine);
|
|
141
141
|
messages.forEach((message) => {
|
|
142
142
|
this.public_listeners.raw_message?.(message);
|
|
@@ -324,6 +324,13 @@ function parseIRCLine(line: string): IRC_Message {
|
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
+
// TODO: handle message actions like "/me"
|
|
328
|
+
if (params[0])
|
|
329
|
+
params[0] = String.raw`${params[0]}`.replaceAll(
|
|
330
|
+
/.+ACTION (.*).+/g,
|
|
331
|
+
(_original, group) => group,
|
|
332
|
+
);
|
|
333
|
+
|
|
327
334
|
const tags = raw_tags_component ? parseTags(raw_tags_component, command) : undefined;
|
|
328
335
|
|
|
329
336
|
return {
|