From 62f45722c4af06a05b1920b6b051e2e97576204b Mon Sep 17 00:00:00 2001 From: Flummi Date: Wed, 19 Mar 2025 12:54:12 +0100 Subject: [PATCH] -.- --- dist/clients/irc.d.ts | 93 +++++++++++++++++++++++++++++++++++ dist/clients/irc/cap.d.ts | 3 ++ dist/clients/irc/invite.d.ts | 3 ++ dist/clients/irc/join.d.ts | 3 ++ dist/clients/irc/motd.d.ts | 3 ++ dist/clients/irc/msg.d.ts | 3 ++ dist/clients/irc/nick.d.ts | 3 ++ dist/clients/irc/part.d.ts | 3 ++ dist/clients/irc/ping.d.ts | 3 ++ dist/clients/irc/pwdreq.d.ts | 3 ++ dist/clients/irc/welcome.d.ts | 3 ++ dist/clients/irc/who.d.ts | 3 ++ dist/clients/irc/whois.d.ts | 3 ++ dist/clients/slack.d.ts | 44 +++++++++++++++++ dist/clients/tg.d.ts | 33 +++++++++++++ dist/index.d.ts | 20 ++++++++ tsconfig.json | 3 +- 17 files changed, 228 insertions(+), 1 deletion(-) create mode 100644 dist/clients/irc.d.ts create mode 100644 dist/clients/irc/cap.d.ts create mode 100644 dist/clients/irc/invite.d.ts create mode 100644 dist/clients/irc/join.d.ts create mode 100644 dist/clients/irc/motd.d.ts create mode 100644 dist/clients/irc/msg.d.ts create mode 100644 dist/clients/irc/nick.d.ts create mode 100644 dist/clients/irc/part.d.ts create mode 100644 dist/clients/irc/ping.d.ts create mode 100644 dist/clients/irc/pwdreq.d.ts create mode 100644 dist/clients/irc/welcome.d.ts create mode 100644 dist/clients/irc/who.d.ts create mode 100644 dist/clients/irc/whois.d.ts create mode 100644 dist/clients/slack.d.ts create mode 100644 dist/clients/tg.d.ts create mode 100644 dist/index.d.ts diff --git a/dist/clients/irc.d.ts b/dist/clients/irc.d.ts new file mode 100644 index 0000000..32308b3 --- /dev/null +++ b/dist/clients/irc.d.ts @@ -0,0 +1,93 @@ +import EventEmitter from "events"; +type MessageModes = "normal" | "action" | "notice"; +interface IRCOptions { + channels?: string[]; + host?: string; + port?: number; + ssl?: boolean; + selfSigned?: boolean; + sasl?: boolean; + network?: string; + nickname?: string; + username?: string; + realname?: string; + set?: string; +} +interface ParsedCommand { + prefix: string | null; + command: string; + params: string[]; +} +interface IRCEvents { + data: [string | [string, any]]; + error: [string]; +} +export default class irc extends EventEmitter { + private options; + private socket?; + private _recachetime; + private _cmd; + private server; + emit(event: K, ...args: IRCEvents[K]): boolean; + on(event: K, listener: (...args: IRCEvents[K]) => void): this; + constructor(options: IRCOptions); + initialize(): Promise; + private createSocket; + connect(reconnect?: boolean): void; + private handleConnection; + private handleData; + private handleDisconnect; + private handleError; + private join; + private part; + private whois; + send(data: string): void; + sendmsg(mode: MessageModes, recipient: string, msg: string | string[]): void; + parse(data: string): ParsedCommand; + private format; + parsePrefix(prefix: string | null): { + nick: string; + username: string; + hostname: string; + } | false; + reply(tmp: ParsedCommand): { + type: string; + network: string; + channel: string; + channelid: string; + user: { + account: string | boolean; + prefix: string; + nick?: string | undefined; + username?: string | undefined; + hostname?: string | undefined; + }; + message: string; + time: number; + raw: ParsedCommand; + reply: (msg: string) => void; + replyAction: (msg: string) => void; + replyNotice: (msg: string) => void; + self: { + set: string; + motd: string; + me: Record; + channel: Map; + user: Map; + }; + _chan: unknown; + _user: Map; + _cmd: Map void>; + join: (chan: string) => void; + part: (chan: string, msg?: string) => void; + whois: (user: string) => void; + write: (msg: string) => void; + }; +} +export {}; diff --git a/dist/clients/irc/cap.d.ts b/dist/clients/irc/cap.d.ts new file mode 100644 index 0000000..c68af02 --- /dev/null +++ b/dist/clients/irc/cap.d.ts @@ -0,0 +1,3 @@ +import { Bot } from "../../types"; +declare const _default: (bot: Bot) => void; +export default _default; diff --git a/dist/clients/irc/invite.d.ts b/dist/clients/irc/invite.d.ts new file mode 100644 index 0000000..c68af02 --- /dev/null +++ b/dist/clients/irc/invite.d.ts @@ -0,0 +1,3 @@ +import { Bot } from "../../types"; +declare const _default: (bot: Bot) => void; +export default _default; diff --git a/dist/clients/irc/join.d.ts b/dist/clients/irc/join.d.ts new file mode 100644 index 0000000..c68af02 --- /dev/null +++ b/dist/clients/irc/join.d.ts @@ -0,0 +1,3 @@ +import { Bot } from "../../types"; +declare const _default: (bot: Bot) => void; +export default _default; diff --git a/dist/clients/irc/motd.d.ts b/dist/clients/irc/motd.d.ts new file mode 100644 index 0000000..c68af02 --- /dev/null +++ b/dist/clients/irc/motd.d.ts @@ -0,0 +1,3 @@ +import { Bot } from "../../types"; +declare const _default: (bot: Bot) => void; +export default _default; diff --git a/dist/clients/irc/msg.d.ts b/dist/clients/irc/msg.d.ts new file mode 100644 index 0000000..c68af02 --- /dev/null +++ b/dist/clients/irc/msg.d.ts @@ -0,0 +1,3 @@ +import { Bot } from "../../types"; +declare const _default: (bot: Bot) => void; +export default _default; diff --git a/dist/clients/irc/nick.d.ts b/dist/clients/irc/nick.d.ts new file mode 100644 index 0000000..c68af02 --- /dev/null +++ b/dist/clients/irc/nick.d.ts @@ -0,0 +1,3 @@ +import { Bot } from "../../types"; +declare const _default: (bot: Bot) => void; +export default _default; diff --git a/dist/clients/irc/part.d.ts b/dist/clients/irc/part.d.ts new file mode 100644 index 0000000..c68af02 --- /dev/null +++ b/dist/clients/irc/part.d.ts @@ -0,0 +1,3 @@ +import { Bot } from "../../types"; +declare const _default: (bot: Bot) => void; +export default _default; diff --git a/dist/clients/irc/ping.d.ts b/dist/clients/irc/ping.d.ts new file mode 100644 index 0000000..c68af02 --- /dev/null +++ b/dist/clients/irc/ping.d.ts @@ -0,0 +1,3 @@ +import { Bot } from "../../types"; +declare const _default: (bot: Bot) => void; +export default _default; diff --git a/dist/clients/irc/pwdreq.d.ts b/dist/clients/irc/pwdreq.d.ts new file mode 100644 index 0000000..c68af02 --- /dev/null +++ b/dist/clients/irc/pwdreq.d.ts @@ -0,0 +1,3 @@ +import { Bot } from "../../types"; +declare const _default: (bot: Bot) => void; +export default _default; diff --git a/dist/clients/irc/welcome.d.ts b/dist/clients/irc/welcome.d.ts new file mode 100644 index 0000000..c68af02 --- /dev/null +++ b/dist/clients/irc/welcome.d.ts @@ -0,0 +1,3 @@ +import { Bot } from "../../types"; +declare const _default: (bot: Bot) => void; +export default _default; diff --git a/dist/clients/irc/who.d.ts b/dist/clients/irc/who.d.ts new file mode 100644 index 0000000..c68af02 --- /dev/null +++ b/dist/clients/irc/who.d.ts @@ -0,0 +1,3 @@ +import { Bot } from "../../types"; +declare const _default: (bot: Bot) => void; +export default _default; diff --git a/dist/clients/irc/whois.d.ts b/dist/clients/irc/whois.d.ts new file mode 100644 index 0000000..c68af02 --- /dev/null +++ b/dist/clients/irc/whois.d.ts @@ -0,0 +1,3 @@ +import { Bot } from "../../types"; +declare const _default: (bot: Bot) => void; +export default _default; diff --git a/dist/clients/slack.d.ts b/dist/clients/slack.d.ts new file mode 100644 index 0000000..3db8faa --- /dev/null +++ b/dist/clients/slack.d.ts @@ -0,0 +1,44 @@ +import EventEmitter from "node:events"; +interface SlackOptions { + token: string; + set?: string; +} +interface User { + account: string; + nickname: string; +} +interface SlackMessage { + type: string; + channel: string; + user: string; + text: string; +} +interface SlackEvents { + data: [string | [string, any]]; + error: [string]; + message: [SlackMessage]; +} +export default class slack extends EventEmitter { + private options; + private token; + private api; + private interval; + private server; + private reconnectAttempts; + emit(event: K, ...args: SlackEvents[K]): boolean; + on(event: K, listener: (...args: SlackEvents[K]) => void): this; + constructor(options: SlackOptions); + connect(): Promise; + private initializeWebSocket; + private handleWebSocketEvents; + reconnect(): Promise; + getChannel(channelId: string): Promise; + getUser(userId: string): Promise; + send(channel: string, text: string | string[]): Promise; + ping(): Promise; + write(json: object): Promise; + reply(tmp: SlackMessage): any; + private parseData; + format(msg: string): string; +} +export {}; diff --git a/dist/clients/tg.d.ts b/dist/clients/tg.d.ts new file mode 100644 index 0000000..642c98a --- /dev/null +++ b/dist/clients/tg.d.ts @@ -0,0 +1,33 @@ +import EventEmitter from "events"; +interface TelegramOptions { + token: string; + pollrate?: number; + set?: string; +} +interface TelegramEvents { + data: [string | [string, any]]; + error: [string]; +} +export default class tg extends EventEmitter { + private options; + private token; + private api; + private lastUpdate; + private lastMessage; + private poller; + private server; + emit(event: K, ...args: TelegramEvents[K]): boolean; + on(event: K, listener: (...args: TelegramEvents[K]) => void): this; + constructor(options: TelegramOptions); + connect(): Promise; + getFile(fileId: string): Promise; + poll(): Promise; + private fetchUpdates; + private processUpdate; + private handleMessage; + private handlePollError; + reply(tmp: any, opt?: {}): any; + send(chatId: number, msg: string, reply?: number | null, opt?: {}): Promise; + format(msg: string): string; +} +export {}; diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..69afb30 --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,20 @@ +import EventEmitter from "node:events"; +interface Config { + enabled: boolean; + type: string; + network: string; +} +interface CuffeoEvents { + data: [string, any]; + error: [Error]; +} +export default class Cuffeo extends EventEmitter { + private clients; + private libs; + emit(event: K, ...args: CuffeoEvents[K]): boolean; + on(event: K, listener: (...args: CuffeoEvents[K]) => void): this; + constructor(cfg: Config[]); + private loadLibs; + private registerClients; +} +export {}; diff --git a/tsconfig.json b/tsconfig.json index 510781e..c17f91c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,8 @@ "rootDir": "./src", "strict": true, "esModuleInterop": true, - "removeComments": true + "removeComments": true, + "declaration": true }, "include": ["src"], "exclude": ["node_modules"]