@sockethub/irc2as 4.0.0-alpha.9 → 4.0.0-beta.1

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 CHANGED
@@ -11,8 +11,15 @@ of them, and as time goes on hopefully become more compliant (PRs & feedback wel
11
11
  ## Usage
12
12
 
13
13
  ```javascript
14
- var IRC2AS = require('irc2as');
15
- var irc2as = new IRC2AS({server: 'irc.freenode.net'});
14
+ import { IrcToActivityStreams } from '@sockethub/irc2as';
15
+ const irc2as = new IrcToActivityStreams({
16
+ server: 'irc.freenode.net',
17
+ contexts: [
18
+ 'https://www.w3.org/ns/activitystreams',
19
+ 'https://sockethub.org/ns/context/v1.jsonld',
20
+ 'https://sockethub.org/ns/context/platform/irc/v1.jsonld'
21
+ ]
22
+ });
16
23
 
17
24
  irc2as.events.on('incoming', function (asObject) {
18
25
  console.log('activity stream: ', asObject);
@@ -22,6 +29,12 @@ of them, and as time goes on hopefully become more compliant (PRs & feedback wel
22
29
  console.log('error response to something we sent: ', asObject);
23
30
  });
24
31
 
32
+ irc2as.events.on('ctcp', function (ctcp) {
33
+ // non-ACTION CTCP traffic: { kind: 'request' | 'reply', command, args, from, target }
34
+ // ACTION (/me) is delivered on 'incoming' as a "me" object instead
35
+ console.log('ctcp request or reply: ', ctcp);
36
+ });
37
+
25
38
  irc2as.events.on('unprocessed', function (line) {
26
39
  console.log(`irc line we don't know what to do with (yet), PRs welcome`, line);
27
40
  });
@@ -0,0 +1,43 @@
1
+ export class ASEmitter {
2
+ constructor(events: any, server: any, contexts: any);
3
+ server: any;
4
+ events: any;
5
+ contexts: any[];
6
+ emitEvent(code: any, asObject: any): void;
7
+ __generalError(nick: any, content: any): {
8
+ "@context": any[];
9
+ type: string;
10
+ actor: {
11
+ type: string;
12
+ id: string;
13
+ name: any;
14
+ };
15
+ target: {
16
+ type: string;
17
+ id: any;
18
+ };
19
+ error: any;
20
+ };
21
+ presence(nick: any, role: any, channel: any): void;
22
+ attendance(channel: any, nick: any, members: any, roles: any): void;
23
+ channelError(channel: any, nick: any, content: any): void;
24
+ nickError(nick: any, content: any): void;
25
+ notice(nick: any, content: any, from: any): void;
26
+ serviceError(nick: any, content: any): void;
27
+ joinError(nick: any): void;
28
+ topicChange(channel: any, nick: any, content: any): void;
29
+ joinRoom(channel: any, nick: any): void;
30
+ userQuit(nick: any): void;
31
+ userPart(channel: any, nick: any): void;
32
+ privMsg(nick: any, target: any, content: any): void;
33
+ /**
34
+ * Emits a non-ACTION CTCP frame on the `ctcp` event. `kind` is "request"
35
+ * for a PRIVMSG and "reply" for a NOTICE.
36
+ */
37
+ ctcp(kind: any, from: any, target: any, { command, args }: {
38
+ command: any;
39
+ args: any;
40
+ }): void;
41
+ role(type: any, nick: any, target: any, role: any, channel: any): void;
42
+ nickChange(nick: any, content: any): void;
43
+ }
@@ -0,0 +1,14 @@
1
+ /** Cap LIST rows buffered and delivered in one channels response. */
2
+ export const LIST_MAX_ITEMS: 5000;
3
+ export class IrcToActivityStreams {
4
+ constructor(cfg: any);
5
+ server: any;
6
+ contexts: any[];
7
+ events: events<[never]>;
8
+ chantypes: string;
9
+ __buffer: {};
10
+ __listTruncated: boolean;
11
+ input(payload: any): boolean;
12
+ __processIRCCodes(code: any, server: any, channel: any, pos1: any, pos2: any, pos3: any, content: any, msg: any, incoming: any): void;
13
+ }
14
+ import events from "node:events";