From 89b0c06cdf870b6ef7993c4eb1c8a5457fcf177b Mon Sep 17 00:00:00 2001 From: SowinskiBraeden Date: Tue, 6 Dec 2022 20:47:16 -0800 Subject: [PATCH] 13.2.3 add channels command --- commands/channels.js | 51 ++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 commands/channels.js diff --git a/commands/channels.js b/commands/channels.js new file mode 100644 index 0000000..817bc40 --- /dev/null +++ b/commands/channels.js @@ -0,0 +1,51 @@ +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.` }); + } + + 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: {} +} \ No newline at end of file diff --git a/package.json b/package.json index 8db8da7..3494cb1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "quarksbot", - "version": "13.2.3", + "version": "13.2.4", "description": "Grand Theft Auto V Roleplay Bot", "main": "index.js", "nodemonConfig": {