Slash Command : How to set the type channel option to voice only

public override registerApplicationCommands(registry: Command.Registry) {

registry.registerChatInputCommand((builder) =>
builder
.setName(this.name)
.setDescription(this.description)
.addStringOption(option =>
option.setName('music')
.setDescription(`The music name to play`)
.setRequired(true)
)
.addChannelOption(option =>
option.setName('channel')
.setDescription(`The voice channel where to play the music`)
.setRequired(true)

)
);
}
public override registerApplicationCommands(registry: Command.Registry) {

registry.registerChatInputCommand((builder) =>
builder
.setName(this.name)
.setDescription(this.description)
.addStringOption(option =>
option.setName('music')
.setDescription(`The music name to play`)
.setRequired(true)
)
.addChannelOption(option =>
option.setName('channel')
.setDescription(`The voice channel where to play the music`)
.setRequired(true)

)
);
}
Solution:
.addChannelTypes() as an example addChannelTypes(ChannelType.GuildText)...
Jump to solution
5 Replies
Solution
KaydaFox
KaydaFox9mo ago
.addChannelTypes() as an example addChannelTypes(ChannelType.GuildText)
-_-العربي الفصيح-_-
i can't auto-import ChannelType , where i can find it ?
KaydaFox
KaydaFox9mo ago
you can import it from discord.js or discord-api-types import { ChannelType } from "discord.js" or the require equivalent
-_-العربي الفصيح-_-
Thanks a lot !! it worked
KaydaFox
KaydaFox9mo ago
no worries ^^
Want results from more Discord servers?
Add your server