galactic-bot/structure/client/components/settings/utility/ImageOnly.js

52 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-06-18 00:16:28 +02:00
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;