community-relations/src/events/CallBackHandler.ts

24 lines
770 B
TypeScript
Raw Normal View History

2020-11-23 14:52:55 -05:00
import { Emoji, Message, TextChannel } from 'eris';
import { Client, Event } from '../class';
export default class CallBackHandler extends Event {
public client: Client;
constructor(client: Client) {
super(client);
this.event = 'messageReactionAdd';
}
public async run(message: Message, emoji: Emoji, member: string) {
try {
if (emoji.id !== '578750988907970567' || message.channel.id !== '780513128240382002') return;
if (member === this.client.user.id) return;
const chan = <TextChannel> this.client.guilds.get(this.client.config.guildID).channels.get('780513128240382002');
const msg = await chan.getMessage(message.id);
await msg.delete();
} catch (err) {
this.client.util.handleError(err);
}
}
}