93 lines
2.2 KiB
TypeScript
93 lines
2.2 KiB
TypeScript
import { IIRCLine } from './irc.interfaces';
|
|
|
|
export type ConnectorEvents = {
|
|
error: (error: any) => void;
|
|
data: (data: string) => void;
|
|
close: (reason: string) => void;
|
|
};
|
|
|
|
export type IRCCommunicatorEvents = {
|
|
/**
|
|
* Parsed line from the IRC server.
|
|
*/
|
|
line: (line: IIRCLine) => void;
|
|
/**
|
|
* Supported channel user modes from the server (e.g. `ohv: @%+`)
|
|
*/
|
|
'supported-modes': (modes: Record<string, unknown>) => void;
|
|
/**
|
|
* Everything this server supports. See IRC documentation for command `005` or `RPL_ISUPPORT` for more info.
|
|
*/
|
|
'server-supports': (supports: Record<string, unknown>) => void;
|
|
/**
|
|
* Nicks in a channel.
|
|
*/
|
|
names: (data: { channel: string; list: string[] }) => void;
|
|
/**
|
|
* Error event from the server.
|
|
*/
|
|
error: (data: { error: Error; fatal: boolean }) => void;
|
|
/**
|
|
* Message event from the server.
|
|
*/
|
|
message: (data: {
|
|
type: string;
|
|
message: string;
|
|
to: string;
|
|
nickname: string;
|
|
raw: IIRCLine;
|
|
}) => void;
|
|
/**
|
|
* Emitted when the login to the server was successful.
|
|
*
|
|
* **Note:** "login" in this case doesn't account for NickServ or SASL success.
|
|
*/
|
|
authenticated: (authed: boolean) => void;
|
|
'channel-list-item': (data: {
|
|
channel: string;
|
|
users: string;
|
|
topic: string;
|
|
}) => void;
|
|
/**
|
|
* User leaving event. Type can be `quit`, `kick` or `part`.
|
|
*/
|
|
leave: (data: {
|
|
type: string;
|
|
nickname: string;
|
|
channel?: string;
|
|
reason?: string;
|
|
}) => void;
|
|
/**
|
|
* User changed their nickname.
|
|
*/
|
|
nick: (data: { oldNick: string; newNick: string }) => void;
|
|
/**
|
|
* User joined a channel you are in.
|
|
*/
|
|
join: (data: { nickname: string; channel: string }) => void;
|
|
/**
|
|
* A mode was set on a user in a channel you're in.
|
|
*/
|
|
'channel-mode': (
|
|
data: {
|
|
type: string;
|
|
mode: string;
|
|
modeTarget: string;
|
|
} & IIRCLine,
|
|
) => void;
|
|
/**
|
|
* A mode was set on a user, usually you.
|
|
*/
|
|
'user-mode': (
|
|
data: {
|
|
type: string;
|
|
mode: string;
|
|
modeTarget: string;
|
|
} & IIRCLine,
|
|
) => void;
|
|
/**
|
|
* Disconnected from the server.
|
|
*/
|
|
disconnect: (data: { type: string; raw: any; message: string }) => void;
|
|
};
|