format fixes

This commit is contained in:
Evert Prants 2020-12-05 12:01:48 +02:00
parent c560aefe6a
commit 9358be43fc
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 14 additions and 1 deletions

View File

@ -4,11 +4,14 @@ import { approximateB16Color, Formatter } from '@squeebot/core/lib/types';
export class IRCFormatter extends Formatter { export class IRCFormatter extends Formatter {
public formatting = { public formatting = {
bold: {start: '\u0002', end: '\u000F'}, bold: {start: '\u0002', end: '\u000F'},
italic: {start: '\u0016', end: '\u000F'}, italics: {start: '\u0016', end: '\u000F'},
emphasis: {start: '\u0016', end: '\u000F'}, emphasis: {start: '\u0016', end: '\u000F'},
underline: {start: '\u001F', end: '\u000F'}, underline: {start: '\u001F', end: '\u000F'},
action: {start: '\x01ACTION ', end: '\x01'},
}; };
public colorEscape = '\u000F';
public colors: {[key: string]: string} = { public colors: {[key: string]: string} = {
black: '\u00031', black: '\u00031',
darkblue: '\u00032', darkblue: '\u00032',

View File

@ -40,10 +40,18 @@ class IRCMessage implements IMessage {
return this.source.fullName + '/' + this.target.id; return this.source.fullName + '/' + this.target.id;
} }
public get text(): string {
return this.data;
}
public resolve(...args: any[]): void { public resolve(...args: any[]): void {
this.resolved = true; this.resolved = true;
this.source.resolve(this, ...args); this.source.resolve(this, ...args);
} }
public mention(user: IMessageTarget): string {
return user.name;
}
} }
class IRCProtocol extends Protocol { class IRCProtocol extends Protocol {
@ -56,6 +64,7 @@ class IRCProtocol extends Protocol {
public start(...args: any[]): void { public start(...args: any[]): void {
this.runEvents(); this.runEvents();
this.me.id = this.me.name = this.irc.options.nick;
this.irc.connect(); this.irc.connect();
this.running = true; this.running = true;
@ -112,6 +121,7 @@ class IRCProtocol extends Protocol {
this.irc.on('authenticated', () => { this.irc.on('authenticated', () => {
logger.log('[%s] Instance started successfully.', this.fullName); logger.log('[%s] Instance started successfully.', this.fullName);
this.me.id = this.me.name = this.irc.options.nick;
}); });
this.irc.on('error', (errdat) => { this.irc.on('error', (errdat) => {