Hello, i was trying to create a slash command which selects a channel, on that channel i will post some data from the api every 24hrs by using cron-node.
here is my code
Client,
SlashCommandBuilder,
EmbedBuilder,
ChannelType,
GatewayIntentBits,
} = require("discord.js");
const { fetch } = require("undici");
const cron = require("cron");
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
});
module.exports = {
data: new SlashCommandBuilder()
.setName("stadium-attr")
.setDescription("Daily stadium attributes will be posted.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription(
"Select the channel you want the stadium attributes to be posted."
)
.addChannelTypes(ChannelType.GuildText)
.setRequired(true)
),
async execute(interaction) {
interaction.reply(`You've selected a channel`);
console.log(interaction.options.getString("channel"));
},
};
but im getting this error
TypeError [CommandInteractionOptionType]: Option "channel" is of type: 7; expected 3.
for now i want to console.log the selected channel.