modernirc
Version:
IRC library for creating modern IRC bots
170 lines (169 loc) • 4.52 kB
TypeScript
declare module 'modernirc' {
export interface BotUplinkOptions {
host: string,
port: number,
password: string|null,
tls: boolean,
rejectUnauthorized: boolean,
autoPong: boolean,
}
export interface BotIdentityOptions {
nickname: string,
username: string,
realname: string,
password: string,
}
export interface BotAutoJoinOptions {
name: string,
key?: string,
}
export interface BotApiOptions {
enabled: boolean,
listen: {
port: number,
host: string|null,
},
auth: {
key: string|null,
},
}
export interface BotOptions {
uplink: BotUplinkOptions,
identity: BotIdentityOptions,
autoJoin: BotAutoJoinOptions[],
modules: object,
logger: object,
api: BotApiOptions,
context: object,
autostart: boolean,
}
export interface Bot {
_socket: import('node:net').Socket,
loadedModules: object,
serverConfig: object,
joinedChannels: object,
identity: BotIdentityOptions,
context: object,
init(): void,
send(command: string, params: string[], message?: string): void,
changeNickname(nickname: string): void,
join(channel: string, key?: string): void,
part(channel: string): void,
message(channel: string, text: string): void,
notice(target: string, text: string): void,
kick(channel: string, target: string, reason?: string): void,
storage: object|null,
on(eventName: string, cb: Function): Bot,
off(eventName: string): Bot,
emit(eventName: string, ...args: any[]): void,
}
export function createBot(options: BotOptions): Promise<Bot>
export const Colors: {
White: '00',
Black: '01',
Blue: '02',
Green: '03',
Red: '04',
Brown: '05',
Magenta: '06',
Orange: '07',
Yellow: '08',
LightGreen: '09',
Cyan: '10',
LightCyan: '11',
LightBlue: '12',
Pink: '13',
Grey: '14',
LightGrey: '15',
Ansi52: '16',
Ansi94: '17',
Ansi100: '18',
Ansi58: '19',
Ansi22: '20',
Ansi29: '21',
Ansi23: '22',
Ansi24: '23',
Ansi17: '24',
Ansi54: '25',
Ansi53: '26',
Ansi89: '27',
Ansi88: '28',
Ansi130: '29',
Ansi142: '30',
Ansi64: '31',
Ansi28: '32',
Ansi35: '33',
Ansi30: '34',
Ansi25: '35',
Ansi18: '36',
Ansi91: '37',
Ansi90: '38',
Ansi125: '39',
Ansi124: '40',
Ansi166: '41',
Ansi184: '42',
Ansi106: '43',
Ansi34: '44',
Ansi49: '45',
Ansi37: '46',
Ansi33: '47',
Ansi19: '48',
Ansi129: '49',
Ansi127: '50',
Ansi161: '51',
Ansi196: '52',
Ansi208: '53',
Ansi226: '54',
Ansi154: '55',
Ansi46: '56',
Ansi86: '57',
Ansi51: '58',
Ansi75: '59',
Ansi21: '60',
Ansi171: '61',
Ansi201: '62',
Ansi198: '63',
Ansi203: '64',
Ansi215: '65',
Ansi227: '66',
Ansi191: '67',
Ansi83: '68',
Ansi122: '69',
Ansi87: '70',
Ansi111: '71',
Ansi63: '72',
Ansi177: '73',
Ansi207: '74',
Ansi205: '75',
Ansi217: '76',
Ansi223: '77',
Ansi229: '78',
Ansi193: '79',
Ansi157: '80',
Ansi158: '81',
Ansi159: '82',
Ansi153: '83',
Ansi147: '84',
Ansi183: '85',
Ansi219: '86',
Ansi212: '87',
Ansi16: '88',
Ansi233: '89',
Ansi235: '90',
Ansi237: '91',
Ansi239: '92',
Ansi241: '93',
Ansi244: '94',
Ansi247: '95',
Ansi250: '96',
Ansi254: '97',
Ansi231: '98'
}
export function bold(text: string): string
export function italic(text: string): string
export function underline(text: string): string
export function strikethrough(text: string): string
export function monospace(text: string): string
export function color(text: string, foreground: string, background?: string): string
export function hexColor(text: string, rgb: string): string
}