refactor: notify embed style
parent
bef1f3e59f
commit
248bd88469
|
@ -1,4 +1,5 @@
|
|||
import { Message, MessageEmbed, TextChannel } from 'discord.js';
|
||||
import axios from 'axios';
|
||||
import { Client, Command } from '../class';
|
||||
|
||||
export default class Notify extends Command {
|
||||
|
@ -20,13 +21,16 @@ export default class Notify extends Command {
|
|||
const embed = new MessageEmbed()
|
||||
.setTitle('Cloud Account | Notification')
|
||||
.setDescription(args.slice(1).join(' '))
|
||||
.addField('Technician', message.author.toString(), true)
|
||||
.setFooter(this.client.user.username, this.client.user.avatarURL())
|
||||
.setTimestamp();
|
||||
this.client.users.fetch(account.userID).then((u) => {
|
||||
u.send({ embeds: [embed] });
|
||||
});
|
||||
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;
|
||||
ch.send({ embeds: [embed] });
|
||||
this.client.util.transport.sendMail({
|
||||
|
|
Loading…
Reference in New Issue