irclib/src/bot.ts

23 lines
669 B
TypeScript
Raw Normal View History

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