irclib/src/bot.ts

23 lines
645 B
TypeScript

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);
}
}