galactic-bot/structure/client/components/observers/ImageRestriction.js
2021-06-17 15:16:28 -07:00

34 lines
819 B
JavaScript

const { Observer } = require("../../../interfaces");
class RestrictedChannels extends Observer {
constructor(client) {
super(client, {
name: 'restrictedChannels',
priority: 0,
disabled: false
});
this.client = client;
this.hooks = [
['message', this.message.bind(this)]
];
}
async message(message) {
const { imageOnly } = await message.guild.settings();
if(!imageOnly.channels) return undefined;
if(imageOnly.channels.includes(message.channel.id)) {
if(message.attachments.size === 0 && message.embeds.length === 0) {
this.client.rateLimiter.queueDelete(message.channel, message);
}
}
}
}
module.exports = RestrictedChannels;