Skip to content

Commit

Permalink
change setp Radio channel button modal to menu
Browse files Browse the repository at this point in the history
  • Loading branch information
omar00050 committed Jul 26, 2024
1 parent da8a577 commit f57b267
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quran_radio",
"version": "1.2.0",
"version": "1.3.0",
"description": "Quran Radio for discord",
"main": "index.js",
"scripts": {
Expand Down
11 changes: 6 additions & 5 deletions src/Commands/Radio/setup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require('discord.js');
const { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder, ChannelSelectMenuBuilder, ChannelType } = require('discord.js');

/**
* @type {import("@utils/types/baseCommand")}
Expand Down Expand Up @@ -35,6 +35,7 @@ module.exports = {
let embed = new EmbedBuilder()
.setColor("White")
.setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL(), url: config.DevXorLink })
.setThumbnail(client.user.avatarURL({ size: 2048 }))
.setTitle("قائمه تسطيب القناه الصوتية ")
.setDescription("يمكنك تحديد القناه الصوتية او التسطيب التلقائي")
.setFooter({ text: config.Copyright.text, iconURL: config.Copyright.logo })
Expand All @@ -45,12 +46,12 @@ module.exports = {
.setLabel("Quick Setup")
.setStyle(ButtonStyle.Primary)

let btn_setChannel = new ButtonBuilder()
let Menu_setChannel = new ChannelSelectMenuBuilder()
.setCustomId("set_RadioChannel")
.setLabel("Setup set Channel")
.setStyle(ButtonStyle.Primary)
.setPlaceholder("Setup Radio Channel")
.setChannelTypes(ChannelType.GuildVoice)
let row = new ActionRowBuilder()
.addComponents(btn_setChannel)
.addComponents(Menu_setChannel)

interaction.reply({ embeds: [embed], components: [row], ephemeral: true })
} catch (err) {
Expand Down
3 changes: 2 additions & 1 deletion src/ComponentsAction/setup/set_RadioChannel.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const { ButtonStyle, ButtonBuilder, ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require("discord.js");

// ! this component is not in use yet and will be soon deleted
/**
* @type {import("@utils/types/baseComponent")}
*/
module.exports = {
name: "set_RadioChannel",
name: "Old_set_RadioChannel",
enabled: true,
async action(client, interaction, parts, lang) {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
const { ButtonStyle, ButtonBuilder, ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, ModalSubmitInteraction, ChannelType } = require("discord.js");
const { ButtonStyle, ButtonBuilder, ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, ChannelType } = require("discord.js");

/**
* @type {import("@utils/types/baseComponent")}
*/
module.exports = {
name: "Modal_set_RadioChannel",
name: "set_RadioChannel",
enabled: true,
/**
* @param {ModalSubmitInteraction} interaction
* @param {import("discord.js").ChannelSelectMenuInteraction} interaction
*/
async action(client, interaction, parts, lang) {
try {
let channelId = interaction.fields.getTextInputValue("RadioChannel").trim()

let channel = await interaction.guild.channels.fetch(channelId).catch(e => null) || interaction.guild.channels.cache.find(ch => ch.name === channelId)
// let channelId = interaction.fields.getTextInputValue("RadioChannel").trim()

let channel = interaction.channels.first() //await interaction.guild.channels.fetch(channelId).catch(e => null) || interaction.guild.channels.cache.find(ch => ch.name === channelId)
if (!channel) return interaction.reply({
content: "❌ | لم يتم العثور علي القناه الصوتيه",
ephemeral: true
Expand Down

0 comments on commit f57b267

Please sign in to comment.