2021-12-10 21:39:54 +05:00
|
|
|
const Command = require("../../base/Command.js"),
|
|
|
|
Resolvers = require("../../helpers/resolvers");
|
|
|
|
|
|
|
|
class Setsuggests extends Command {
|
2021-12-26 19:29:37 +05:00
|
|
|
constructor(client) {
|
2021-12-10 21:39:54 +05:00
|
|
|
super(client, {
|
|
|
|
name: "setsuggests",
|
|
|
|
dirname: __dirname,
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: true,
|
2022-01-01 00:50:09 +05:00
|
|
|
aliases: ["setsu"],
|
2021-12-26 19:29:37 +05:00
|
|
|
memberPermissions: ["MANAGE_GUILD"],
|
|
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
2021-12-10 21:39:54 +05:00
|
|
|
nsfw: false,
|
|
|
|
ownerOnly: false,
|
2022-01-01 00:50:09 +05:00
|
|
|
cooldown: 1000
|
2021-12-10 21:39:54 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-12-26 19:29:37 +05:00
|
|
|
async run(message, args, data) {
|
2021-12-10 21:39:54 +05:00
|
|
|
const areSuggestsEnabled = Boolean(data.guild.plugins.suggestions);
|
2021-12-26 19:29:37 +05:00
|
|
|
const sentChannel = await Resolvers.resolveChannel({
|
|
|
|
message,
|
|
|
|
search: args.join(" "),
|
|
|
|
channelType: "text"
|
|
|
|
});
|
2021-12-10 21:39:54 +05:00
|
|
|
|
|
|
|
if (!sentChannel && areSuggestsEnabled) {
|
|
|
|
data.guild.plugins.suggestions = null;
|
|
|
|
data.guild.markModified("plugins.suggestions");
|
|
|
|
await data.guild.save();
|
2021-12-30 20:03:36 +05:00
|
|
|
return message.success("administration/setsuggests:DISABLED");
|
2021-12-10 21:39:54 +05:00
|
|
|
} else {
|
|
|
|
const channel = sentChannel || message.channel;
|
|
|
|
data.guild.plugins.suggestions = channel.id;
|
|
|
|
data.guild.markModified("plugins.suggestions");
|
|
|
|
await data.guild.save();
|
2021-12-30 20:03:36 +05:00
|
|
|
return message.success("administration/setsuggests:ENABLED", {
|
2021-12-26 19:29:37 +05:00
|
|
|
channel: channel.toString()
|
|
|
|
});
|
2021-12-10 21:39:54 +05:00
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Setsuggests;
|