irclib/src/bot.ts

23 lines
669 B
TypeScript

import { IRCSocketConnector } from './connector/net.connector';
import { IRCConnectionWrapper } from './irc';
import { IIRCOptions } from './types/irc.interfaces';
import { formatstr } from './utility/formatstr';
export class IRCBot extends IRCConnectionWrapper {
constructor(options: IIRCOptions) {
super(options, IRCSocketConnector);
}
send(to: string, message: string, ...args: any[]) {
this.write('PRIVMSG %s :%s', to, formatstr(message, ...args));
}
notice(to: string, message: string, ...args: any[]) {
this.write('NOTICE %s :%s', to, formatstr(message, ...args));
}
nick(newNick: string) {
this.write('NICK %s', newNick);
}
}