1
0
Fork 0

refactor: notify embed style

master
Hiroyuki 2021-09-12 21:40:02 -04:00
parent bef1f3e59f
commit 248bd88469
No known key found for this signature in database
GPG Key ID: AF65958B7B7362E6
1 changed files with 5 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import { Message, MessageEmbed, TextChannel } from 'discord.js'; import { Message, MessageEmbed, TextChannel } from 'discord.js';
import axios from 'axios';
import { Client, Command } from '../class'; import { Client, Command } from '../class';
export default class Notify extends Command { export default class Notify extends Command {
@ -20,13 +21,16 @@ export default class Notify extends Command {
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setTitle('Cloud Account | Notification') .setTitle('Cloud Account | Notification')
.setDescription(args.slice(1).join(' ')) .setDescription(args.slice(1).join(' '))
.addField('Technician', message.author.toString(), true)
.setFooter(this.client.user.username, this.client.user.avatarURL()) .setFooter(this.client.user.username, this.client.user.avatarURL())
.setTimestamp(); .setTimestamp();
this.client.users.fetch(account.userID).then((u) => { this.client.users.fetch(account.userID).then((u) => {
u.send({ embeds: [embed] }); u.send({ embeds: [embed] });
}); });
embed.addField('User', `${account.username} | <@${account.userID}>`, true); embed.addField('User', `${account.username} | <@${account.userID}>`, true);
const req = await axios.get('https://loc.sh/int/directory');
const technician = req.data.find((mem) => mem.userID === message.author.id);
const technicianAccount = await this.client.db.Account.findOne({ userID: message.author.id });
embed.addField('Technician', message.author.id === this.client.user.id ? 'SYSTEM' : `${technicianAccount.username}, ${technician.pn.join(', ')} (<@${message.author.id}>)`, true);
const ch = this.client.channels.cache.get('580950455581147146') as TextChannel; const ch = this.client.channels.cache.get('580950455581147146') as TextChannel;
ch.send({ embeds: [embed] }); ch.send({ embeds: [embed] });
this.client.util.transport.sendMail({ this.client.util.transport.sendMail({