multichat-ts 0.0.1 → 0.0.2

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/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # multichat-ts
2
+
3
+ Receive type-safe realtime events for chat-related messages on multiple platforms (Twitch, Kick)
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ pnpm install multichat-ts # or (npm, bun, deno, etc) install
9
+ ```
10
+
11
+ ```ts
12
+ import { TwitchIRC, KickPusher } from 'multichat-ts';
13
+
14
+ const twitch_chat = new TwitchIRC();
15
+ const kick_chat = new KickPusher();
16
+
17
+ twitch_chat.connect({
18
+ channelName: 'piratesoftware',
19
+ });
20
+
21
+ kick_chat.connect({
22
+ channelName: 'xqc',
23
+ });
24
+
25
+ // set custom badge assets or external emotes (ffz, bttv, 7tv, etc)
26
+ twitch_chat.assets.external_emotes = {
27
+ OMEGALUL: 'https://cdn.frankerfacez.com/emoticon/128054/1',
28
+ };
29
+
30
+ twitch_chat.on('message', (message) => {
31
+ console.log('new twitch message', message.raw_text, message);
32
+ });
33
+
34
+ kick_chat.on('message', (message) => {
35
+ console.log('new twitch message', message.raw_text, message);
36
+ });
37
+ ```
38
+
39
+ ### Example usage with Svelte 5
40
+
41
+ ```svelte
42
+ <script lang="ts">
43
+ import { TwitchIRC, type Message, KickPusher } from 'multichat-ts';
44
+
45
+ let messages: Message[] = $state([]);
46
+
47
+ const twitch_chat = new TwitchIRC();
48
+
49
+ twitch_chat.connect({
50
+ channelName: 'piratesoftware'
51
+ });
52
+
53
+ twitch_chat.on('message', (message) => {
54
+ messages.push(message);
55
+ });
56
+
57
+ twitch_chat.on('clear_messages', (data) => {
58
+ if (data.user !== undefined) {
59
+ messages.filter((message) => message.user.id !== data.user!.id);
60
+ } else {
61
+ messages.filter((message) => message.channel.room_id !== data.channel.room_id);
62
+ }
63
+ });
64
+
65
+ twitch_chat.on('delete_message', (message_data) => {
66
+ messages.filter((message) => message.id !== message_data.id);
67
+ });
68
+ </script>
69
+
70
+ <ul>
71
+ {#each messages as message}
72
+ <li>{message.user.display_name}: {message.raw_text}</li>
73
+ {/each}
74
+ </ul>
75
+ ```
76
+
77
+ MIT
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export * from './kick';
2
- export * from './twitch';
1
+ export * from './kick.js';
2
+ export * from './twitch.js';
3
3
  export type Message = {
4
4
  body: BodyComponent[];
5
5
  channel: {
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export * from './kick';
2
- export * from './twitch';
1
+ export * from './kick.js';
2
+ export * from './twitch.js';
package/dist/kick.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Pusher from 'pusher-js';
2
- import { type BadgeURLsByNameOrCount, type EmoteURLsByName, type Message } from './index';
2
+ import { type BadgeURLsByNameOrCount, type EmoteURLsByName, type Message } from './index.js';
3
3
  type EventCallbackFunctions = {
4
4
  message: (data: Message) => unknown;
5
5
  };
package/dist/kick.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import Pusher from 'pusher-js';
2
- import {} from './index';
3
2
  const DEFAULT_KICK_PUSHER_KEY = '32cbd69e4b950bf97679';
4
3
  export class KickPusher {
5
4
  kick_pusher_key = DEFAULT_KICK_PUSHER_KEY;
package/dist/twitch.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { WebSocket } from 'partysocket';
2
- import { type ClearMessages, type DeleteMessage, type Message, type Event, type EmoteURLsByName, type BadgeURLsBySetIDAndVersionID } from './index';
2
+ import { type ClearMessages, type DeleteMessage, type Message, type Event, type EmoteURLsByName, type BadgeURLsBySetIDAndVersionID } from './index.js';
3
3
  type EventCallbackFunctions = {
4
4
  message: (data: Message) => unknown;
5
5
  clear_messages: (data: ClearMessages) => unknown;
package/dist/twitch.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { WebSocket } from 'partysocket';
2
- import {} from './index';
3
2
  const ANONYMOUS_IRC_PASS = 'SCHMOOPIIE';
4
3
  const ANONYMOUS_IRC_LOGIN = 'justinfan1234';
5
4
  const PING_INTERVAL_MS = 30_000;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "multichat-ts",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
- "description": "Receive real-time events for chat-related messages and events on multiple platforms (Twitch, Kick)",
5
+ "description": "Receive type-safe realtime events for chat-related messages on multiple platforms (Twitch, Kick)",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/0Abdullah/multichat-ts.git"
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
- export * from './kick';
2
- export * from './twitch';
1
+ export * from './kick.js';
2
+ export * from './twitch.js';
3
3
 
4
4
  export type Message = {
5
5
  body: BodyComponent[];
package/src/kick.ts CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  type BodyComponent,
6
6
  type EmoteURLsByName,
7
7
  type Message,
8
- } from './index';
8
+ } from './index.js';
9
9
 
10
10
  type EventCallbackFunctions = {
11
11
  message: (data: Message) => unknown;
package/src/twitch.ts CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  type Event,
9
9
  type EmoteURLsByName,
10
10
  type BadgeURLsBySetIDAndVersionID,
11
- } from './index';
11
+ } from './index.js';
12
12
 
13
13
  const ANONYMOUS_IRC_PASS = 'SCHMOOPIIE';
14
14
  const ANONYMOUS_IRC_LOGIN = 'justinfan1234';
package/tsconfig.json CHANGED
@@ -1,45 +1,45 @@
1
1
  {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig to read more about this file */
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
4
 
5
- /* Language and Environment */
6
- "target": "ESNext",
5
+ /* Language and Environment */
6
+ "target": "ESNext",
7
7
 
8
- /* Modules */
9
- "module": "ESNext",
10
- "moduleResolution": "Bundler",
8
+ /* Modules */
9
+ "module": "ESNext",
10
+ "moduleResolution": "Bundler",
11
11
 
12
- /* JavaScript Support */
13
- "checkJs": true,
12
+ /* JavaScript Support */
13
+ "checkJs": true,
14
14
 
15
- /* Emit */
16
- "declaration": true,
17
- "outDir": "dist",
18
- "removeComments": true,
15
+ /* Emit */
16
+ "declaration": true,
17
+ "outDir": "dist",
18
+ "removeComments": true,
19
19
 
20
- /* Interop Constraints */
21
- "isolatedModules": true,
22
- "verbatimModuleSyntax": true,
23
- "allowSyntheticDefaultImports": true,
24
- "esModuleInterop": true,
25
- "forceConsistentCasingInFileNames": true,
20
+ /* Interop Constraints */
21
+ "isolatedModules": true,
22
+ "verbatimModuleSyntax": false,
23
+ "allowSyntheticDefaultImports": true,
24
+ "esModuleInterop": true,
25
+ "forceConsistentCasingInFileNames": true,
26
26
 
27
- /* Type Checking */
28
- "strict": true,
29
- "strictNullChecks": true,
30
- "noUnusedLocals": true,
31
- "noUnusedParameters": true,
32
- "exactOptionalPropertyTypes": true,
33
- "noImplicitReturns": true,
34
- "noFallthroughCasesInSwitch": true,
35
- "noUncheckedIndexedAccess": true,
36
- "noImplicitOverride": true,
37
- "noPropertyAccessFromIndexSignature": true,
38
- "allowUnusedLabels": false,
39
- "allowUnreachableCode": false,
27
+ /* Type Checking */
28
+ "strict": true,
29
+ "strictNullChecks": true,
30
+ "noUnusedLocals": true,
31
+ "noUnusedParameters": true,
32
+ "exactOptionalPropertyTypes": true,
33
+ "noImplicitReturns": true,
34
+ "noFallthroughCasesInSwitch": true,
35
+ "noUncheckedIndexedAccess": true,
36
+ "noImplicitOverride": true,
37
+ "noPropertyAccessFromIndexSignature": true,
38
+ "allowUnusedLabels": false,
39
+ "allowUnreachableCode": false,
40
40
 
41
- /* Completeness */
42
- "skipLibCheck": true
43
- },
44
- "include": ["src"]
41
+ /* Completeness */
42
+ "skipLibCheck": true
43
+ },
44
+ "include": ["src"]
45
45
  }