Files
quarksBot/commands/channels.js
T

51 lines
1.6 KiB
JavaScript

const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
module.exports = {
name: "channels",
debug: false,
global: false,
description: "view the list of allowed channels",
usage: "",
permissions: {
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
member: [],
},
options: [],
SlashCommand: {
/**
* @param {require("../structures/QuarksBot")} client
* @param {import("discord.js").Message} message
* @param {string[]} args
* @param {*} param3
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send({ content: `You are not allowed to use the bot in this channel.`, flags: (1 << 6) });
}
if (GuildDB.allowedChannels.length == 0) {
const embed = new EmbedBuilder()
.setColor(client.config.Colors.Default)
.setDescription('There are no configured channels for this bot, you can use it anywhere!');
return interaction.send({ embeds: [embed] });
}
let channels = new EmbedBuilder()
.setColor(client.config.Colors.Default)
.setTitle('Configured Channels')
let des = "";
for (let i = 0; i < GuildDB.allowedChannels.length; i++) {
if (i == 0) des += `> <#${GuildDB.allowedChannels[i]}>`;
else des += `\n> <#${GuildDB.allowedChannels[i]}>`
}
channels.setDescription(des);
return interaction.send({ embeds: [channels] });
},
},
Interactions: {}
}