shitty image only testing for now

This commit is contained in:
nolan 2021-06-17 15:16:28 -07:00
parent b83ea79cf1
commit 0c7ae08315
2 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,34 @@
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;

View File

@ -0,0 +1,52 @@
const { Setting } = require('../../../../interfaces/');
class ImageOnlySetting extends Setting {
constructor(client) {
super(client, {
name: 'imageOnly',
index: 'imageOnly',
module: 'utility',
resolve: 'GUILD',
default: {
imageOnly: {
channels: []
}
}
});
}
async handle(message, params) {
const { imageOnly } = message.guild._settings;
const result = await this.client.resolver.list(
imageOnly.channels,
message.guild.channels.cache.filter((c) => c.type === 'text').map((c) => c.id),
params,
this.client.resolver.resolveChannels.bind(this.client.resolver),
true,
message.guild
);
await message.guild._updateSettings({
[this.index]: {
channels: result.list
}
});
}
fields(guild) {
return {
name: '》 Channels',
value: `\`${guild._settings.imageOnly.channels}\``
};
}
}
module.exports = ImageOnlySetting;