2022-01-13 00:56:24 +05:00
|
|
|
const Command = require("../../base/Command"),
|
2022-01-04 02:18:28 +05:00
|
|
|
Resolvers = require("../../helpers/resolvers");
|
|
|
|
|
|
|
|
class Setsuggests extends Command {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
|
|
name: "setsuggests",
|
|
|
|
dirname: __dirname,
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: true,
|
|
|
|
aliases: ["setsu"],
|
|
|
|
memberPermissions: ["MANAGE_GUILD"],
|
|
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
|
|
nsfw: false,
|
|
|
|
ownerOnly: false,
|
|
|
|
cooldown: 1000
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async run(message, args, data) {
|
|
|
|
const areSuggestsEnabled = Boolean(data.guild.plugins.suggestions);
|
|
|
|
const sentChannel = await Resolvers.resolveChannel({
|
|
|
|
message,
|
|
|
|
search: args.join(" "),
|
2022-03-27 22:32:18 +05:00
|
|
|
channelType: "GUILD_TEXT"
|
2022-01-04 02:18:28 +05:00
|
|
|
});
|
|
|
|
|
|
|
|
if (!sentChannel && areSuggestsEnabled) {
|
|
|
|
data.guild.plugins.suggestions = null;
|
|
|
|
data.guild.markModified("plugins.suggestions");
|
|
|
|
await data.guild.save();
|
|
|
|
return message.success("administration/setsuggests:DISABLED");
|
|
|
|
} else {
|
|
|
|
const channel = sentChannel || message.channel;
|
|
|
|
data.guild.plugins.suggestions = channel.id;
|
|
|
|
data.guild.markModified("plugins.suggestions");
|
|
|
|
await data.guild.save();
|
|
|
|
return message.success("administration/setsuggests:ENABLED", {
|
|
|
|
channel: channel.toString()
|
|
|
|
});
|
2022-01-13 00:26:23 +05:00
|
|
|
}
|
2022-01-04 02:18:28 +05:00
|
|
|
}
|
2022-01-13 00:26:23 +05:00
|
|
|
}
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
module.exports = Setsuggests;
|