52 lines
1.2 KiB
JavaScript
52 lines
1.2 KiB
JavaScript
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; |