Sim3Xx
Sim3Xx
DIAdiscord.js - Imagine an app
Created by Sim3Xx on 4/25/2024 in #djs-questions
How to query members of a voice channel
Hello, i would like to query all the members of a certain voice channel. But unfortunately i only get an empty list of members. I had the same thing with channels, before i added the "View Channel/Message" Permission on the Discord Developer Site". I query the channels by:
const channels = interaction.guild?.channels.fetch() // interaction: ButtonInteraction | CommandInteraction
const channels = interaction.guild?.channels.fetch() // interaction: ButtonInteraction | CommandInteraction
i filter the channel list for voiceChannels beforehand: const voiceChannels = channels.filter(channel => channel.type === ChannelType.GuildVoice) And i check for members by: voiceChannels.first()?.members.size or voiceChannels.first()?.members.has("someID") But i always get an empty collection. I have searched quite some time on google but were only able to find results like "You need Members Intent" Do i really? Its a complete overkill, cause i just wanna read the members and their id and nothing more. I hope you can help me with your expierince. Because this question is super explicit, i hope you can help me even though this might be discord api related :peepoLoveMonbrey: Thank you guys! Have a good day 🙂 Details: Node version: v20.6.1 discordjs: 14.14.1 (i cant change the label afterwards no?)
50 replies
DIAdiscord.js - Imagine an app
Created by Sim3Xx on 11/3/2023 in #djs-questions
Multi Select in command parameter
Hello, i have a general question. Is it possible to enable multi-selection, similar to stringSelectMenus, as a command parameter? Let me explain some more: Example items
new SlashCommandBuilder()
.setName("gifs")
.setDescription("Select your favourite gifs")
.addStringOption(option =>
option
.setName("gifs")
.setDescription("favorite gifs")
.setChoices(
...choices,
)
.setRequired(true),
)

const choices =
[
{ name: 'Funny', value: 'gif_funny' },
{ name: 'Meme', value: 'gif_meme' },
{ name: 'Movie', value: 'gif_movie' },
]
new SlashCommandBuilder()
.setName("gifs")
.setDescription("Select your favourite gifs")
.addStringOption(option =>
option
.setName("gifs")
.setDescription("favorite gifs")
.setChoices(
...choices,
)
.setRequired(true),
)

const choices =
[
{ name: 'Funny', value: 'gif_funny' },
{ name: 'Meme', value: 'gif_meme' },
{ name: 'Movie', value: 'gif_movie' },
]
I want to create a command that allows you to select multiple choices as parameters for /gifs. For example something like this /gifs Funny Meme Its not possible right? The only solution that comes to mind is to add as many 'not required' options as needed to allow the selection of a certain number of favorite gifs like this:
new SlashCommandBuilder()
.setName("gifs")
.setDescription("Select your favourite gifs")
.addStringOption(option =>
option
.setName("gif")
.setDescription("favorite gifs")
.setChoices(
...choices,
)
.setRequired(true),
)
.addStringOption(option =>
option
.setName("gif1")
.setDescription("another favorite gif")
.setChoices(
...choices,
)
.setRequired(false), //default to false, just wanted to make it explicit
)
new SlashCommandBuilder()
.setName("gifs")
.setDescription("Select your favourite gifs")
.addStringOption(option =>
option
.setName("gif")
.setDescription("favorite gifs")
.setChoices(
...choices,
)
.setRequired(true),
)
.addStringOption(option =>
option
.setName("gif1")
.setDescription("another favorite gif")
.setChoices(
...choices,
)
.setRequired(false), //default to false, just wanted to make it explicit
)
Is there any other way? Thanks in advance!
22 replies
DIAdiscord.js - Imagine an app
Created by Sim3Xx on 9/25/2023 in #djs-questions
edit ephemeral embeds
No description
30 replies