This repository has been archived on 2024-03-06. You can view files and clone it, but cannot push or open issues or pull requests.
discord.js-rr-bot/Src/Structures/CommandOptions/OnlyChannels.js
2022-06-18 23:28:38 -04:00

25 lines
No EOL
1 KiB
JavaScript

module.exports = async function (message, command, Discord) {
if (!command.onlyChannels) return false;
if (command.onlyChannels.some(id => id == message.channel.id)) return false;
else {
let onlyChannels = []
command.onlyChannels.forEach(id => {
onlyChannels.push(`<#${id}>`)
})
if (command.returnOnlyChannels == false || command.returnNoErrors) return true;
else message.reply({
embeds: [new Discord.MessageEmbed()
.setAuthor({
name: message.member.user.tag,
iconURL: message.member.user.displayAvatarURL({ dynamic: true })
})
.setColor("RANDOM")
.setTimestamp()
.setDescription(`This command can only be ran in these channels.\n${onlyChannels.join("\n•")}`)],
allowedMentions: {
repliedUser: false
}
})
return true;
}
}