Reputation: 1
I was creating bot using Discord.js v13, but it keeps occurring this error:
TypeError: (intermediate value).setName(...).setDescription(...).addSubCommand is not a function
at Object.<anonymous> (C:\Users\SAMSUNG\Desktop\ReedM\commands\play.js:10:10)
at Module._compile (node:internal/modules/cjs/loader:1205:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1259:10)
at Module.load (node:internal/modules/cjs/loader:1068:32)
at Module._load (node:internal/modules/cjs/loader:909:12)
at Module.require (node:internal/modules/cjs/loader:1092:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (C:\Users\SAMSUNG\Desktop\ReedM\index.js:31:22)
at Module._compile (node:internal/modules/cjs/loader:1205:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1259:10)
This is my code:
const { SlashCommandBuilder } = require("@discordjs/builders")
const { MessageEmbed } = require("discord.js")
const { QueryType } = require("discord-player")
module.exports = {
data: new SlashCommandBuilder()
.setName("play")
.setDescription("Playing Music")
.addSubCommand((subcommand) =>
subcommand.setName("song").setDescription("Search by Url")
.addStringOption(option => {option.setName("URL").setDescription("Music URL").setRequired(true)}))
I tried deleting addStringOption construction, and I also referenced Discord.js v13 Guide
Upvotes: 0
Views: 440
Reputation: 614
You made a typo. It should be .addSubcommand()
, not .addSubCommand()
.
Upvotes: 1