This commit is contained in:
Flummi 2025-03-19 12:54:12 +01:00
parent 90f43a734e
commit 62f45722c4
17 changed files with 228 additions and 1 deletions

93
dist/clients/irc.d.ts vendored Normal file
View File

@ -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<K extends keyof IRCEvents>(event: K, ...args: IRCEvents[K]): boolean;
on<K extends keyof IRCEvents>(event: K, listener: (...args: IRCEvents[K]) => void): this;
constructor(options: IRCOptions);
initialize(): Promise<void>;
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<string, unknown>;
channel: Map<string, unknown>;
user: Map<string, {
account?: string;
cached: number;
}>;
};
_chan: unknown;
_user: Map<string, {
account?: string;
cached: number;
}>;
_cmd: Map<string, (cmd: ParsedCommand) => void>;
join: (chan: string) => void;
part: (chan: string, msg?: string) => void;
whois: (user: string) => void;
write: (msg: string) => void;
};
}
export {};

3
dist/clients/irc/cap.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { Bot } from "../../types";
declare const _default: (bot: Bot) => void;
export default _default;

3
dist/clients/irc/invite.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { Bot } from "../../types";
declare const _default: (bot: Bot) => void;
export default _default;

3
dist/clients/irc/join.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { Bot } from "../../types";
declare const _default: (bot: Bot) => void;
export default _default;

3
dist/clients/irc/motd.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { Bot } from "../../types";
declare const _default: (bot: Bot) => void;
export default _default;

3
dist/clients/irc/msg.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { Bot } from "../../types";
declare const _default: (bot: Bot) => void;
export default _default;

3
dist/clients/irc/nick.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { Bot } from "../../types";
declare const _default: (bot: Bot) => void;
export default _default;

3
dist/clients/irc/part.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { Bot } from "../../types";
declare const _default: (bot: Bot) => void;
export default _default;

3
dist/clients/irc/ping.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { Bot } from "../../types";
declare const _default: (bot: Bot) => void;
export default _default;

3
dist/clients/irc/pwdreq.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { Bot } from "../../types";
declare const _default: (bot: Bot) => void;
export default _default;

3
dist/clients/irc/welcome.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { Bot } from "../../types";
declare const _default: (bot: Bot) => void;
export default _default;

3
dist/clients/irc/who.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { Bot } from "../../types";
declare const _default: (bot: Bot) => void;
export default _default;

3
dist/clients/irc/whois.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { Bot } from "../../types";
declare const _default: (bot: Bot) => void;
export default _default;

44
dist/clients/slack.d.ts vendored Normal file
View File

@ -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<K extends keyof SlackEvents>(event: K, ...args: SlackEvents[K]): boolean;
on<K extends keyof SlackEvents>(event: K, listener: (...args: SlackEvents[K]) => void): this;
constructor(options: SlackOptions);
connect(): Promise<void>;
private initializeWebSocket;
private handleWebSocketEvents;
reconnect(): Promise<void>;
getChannel(channelId: string): Promise<string | undefined>;
getUser(userId: string): Promise<User | undefined>;
send(channel: string, text: string | string[]): Promise<void>;
ping(): Promise<void>;
write(json: object): Promise<void>;
reply(tmp: SlackMessage): any;
private parseData;
format(msg: string): string;
}
export {};

33
dist/clients/tg.d.ts vendored Normal file
View File

@ -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<K extends keyof TelegramEvents>(event: K, ...args: TelegramEvents[K]): boolean;
on<K extends keyof TelegramEvents>(event: K, listener: (...args: TelegramEvents[K]) => void): this;
constructor(options: TelegramOptions);
connect(): Promise<void>;
getFile(fileId: string): Promise<string | false>;
poll(): Promise<void>;
private fetchUpdates;
private processUpdate;
private handleMessage;
private handlePollError;
reply(tmp: any, opt?: {}): any;
send(chatId: number, msg: string, reply?: number | null, opt?: {}): Promise<any>;
format(msg: string): string;
}
export {};

20
dist/index.d.ts vendored Normal file
View File

@ -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<K extends keyof CuffeoEvents>(event: K, ...args: CuffeoEvents[K]): boolean;
on<K extends keyof CuffeoEvents>(event: K, listener: (...args: CuffeoEvents[K]) => void): this;
constructor(cfg: Config[]);
private loadLibs;
private registerClients;
}
export {};

View File

@ -7,7 +7,8 @@
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"removeComments": true
"removeComments": true,
"declaration": true
},
"include": ["src"],
"exclude": ["node_modules"]