irclib/src/bot.ts

23 lines
645 B
TypeScript
Raw Normal View History

2022-09-23 17:38:41 +00:00
import { format } from 'util';
import { IRCSocketConnector } from './connector/net.connector';
import { IRCConnectionWrapper } from './irc';
import { IIRCOptions } from './types/irc.interfaces';
export class IRCBot extends IRCConnectionWrapper {
constructor(options: IIRCOptions) {
super(options, IRCSocketConnector);
}
send(to: string, message: string, ...args: any[]) {
this.write('PRIVMSG %s :%s', to, format(message, ...args));
}
notice(to: string, message: string, ...args: any[]) {
this.write('NOTICE %s :%s', to, format(message, ...args));
}
nick(newNick: string) {
this.write('NICK %s', newNick);
}
}