feat(twilight): added bot avatar to log messages

This commit is contained in:
AlphaNecron 2021-10-08 19:54:39 +07:00
parent 833d231cbd
commit d4d69bf6ae
1 changed files with 8 additions and 1 deletions

View File

@ -4,14 +4,21 @@ import { name, version } from '../../package.json';
export class Logger {
channel: TextChannel;
client: Client;
constructor(client: Client) {
if (!config.bot.log_channel) return;
this.client = client;
this.channel = client.channels.cache.find(c => c.type === 'text' && c.id === config.bot.log_channel) as TextChannel;
}
log(msg: MessageEmbed | string) {
if (!this.channel) return;
this.channel.send(typeof msg === 'string' ? new MessageEmbed().setTitle(msg).setColor('#B794F4').setTimestamp().setFooter(`${name}@${version}`) : msg);
this.channel.send(typeof msg === 'string' ? new MessageEmbed()
.setTitle(msg)
.setColor('#B794F4')
.setTimestamp()
.setFooter(`${name}@${version}`, this.client.user.displayAvatarURL())
.setThumbnail(this.client.user.displayAvatarURL()) : msg);
}
}