I am trying to code a MusicBot for Discord in discord.js but when i try to execute the play command I always get interaction.options.getString is not a function. I searched in the Internet for this error couldn't find anything.
My Code:
const { QueryType, useMainPlayer, useQueue } = require("discord-player");
const { ApplicationCommandOptionType, EmbedBuilder } = require("discord.js");
module.exports = {
name: "play",
description: "play a song!",
voiceChannel: true,
options: [
{
name: "song",
description: "the song you want to play",
type: ApplicationCommandOptionType.String,
required: true,
},
],
callback: async (interaction, client) => {
const player = useMainPlayer();
const song = interaction.options.getString("play");
};
I also tried the interaction.options.get command but doesn't work either.