i'm a fullstack dev, data engineer, and avid anime enjoyer.
i also make coding youtube videos sometimes.
i'm a fullstack dev, data engineer, and avid anime enjoyer.
i also make coding youtube videos sometimes.
client.on("interactionCreate", (interaction) => {
async function handleCommand() {
if (!interaction.isCommand()) return
const slashcmd = client.slashcommands.get(interaction.commandName)
if (!slashcmd) interaction.reply("Not a valid slash command")
await interaction.deferReply()
await slashcmd.run({ client, interaction })
}
handleCommand()
})
When I run the bot and use the /play command, it returns this error and the bot does not function.
Error when starting the Bot.
client.slashcommands.set(slashcmd.data.name, slashcmd)
^
TypeError: Cannot read properties of undefined (reading 'name')
Hi!
Just starting to use this code. I had some issues with play playlist. In play.js there is this line of code
embed
.setDescription(`**${result.tracks.length} songs from [${playlist.title}](${playlist.url})** have been added to the Queue`)
.setThumbnail(playlist.thumbnail)
The error occurs when .setThumbnail receives playlist.thumbnail. The whole error log is below:
return Result.err(new CombinedError(errors));
^
CombinedError: Received one or more errors
at UnionValidator.handle (C:\Users\focax\Documents\Repos\Practica\Proyecto_Fokabot\node_modules\@sapphire\shapeshift\dist\index.js:1088:23)
at UnionValidator.parse (C:\Users\focax\Documents\Repos\Practica\Proyecto_Fokabot\node_modules\@sapphire\shapeshift\dist\index.js:201:88)
at EmbedBuilder.setThumbnail (C:\Users\focax\Documents\Repos\Practica\Proyecto_Fokabot\node_modules\@discordjs\builders\dist\index.js:257:23)
at Object.run (C:\Users\focax\Documents\Repos\Practica\Proyecto_Fokabot\slash\play.js:67:18)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async handleCommand (C:\Users\focax\Documents\Repos\Practica\Proyecto_Fokabot\index.js:70:13) {
errors: [
ValidationError: Expected undefined or null
at NullishValidator.handle (C:\Users\focax\Documents\Repos\Practica\Proyecto_Fokabot\node_modules\@sapphire\shapeshift\dist\index.js:748:79)
at NullishValidator.run (C:\Users\focax\Documents\Repos\Practica\Proyecto_Fokabot\node_modules\@sapphire\shapeshift\dist\index.js:187:23)
at UnionValidator.handle (C:\Users\focax\Documents\Repos\Practica\Proyecto_Fokabot\node_modules\@sapphire\shapeshift\dist\index.js:1083:32)
at UnionValidator.parse (C:\Users\focax\Documents\Repos\Practica\Proyecto_Fokabot\node_modules\@sapphire\shapeshift\dist\index.js:201:88)
at EmbedBuilder.setThumbnail (C:\Users\focax\Documents\Repos\Practica\Proyecto_Fokabot\node_modules\@discordjs\builders\dist\index.js:257:23)
at Object.run (C:\Users\focax\Documents\Repos\Practica\Proyecto_Fokabot\slash\play.js:67:18)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async handleCommand (C:\Users\focax\Documents\Repos\Practica\Proyecto_Fokabot\index.js:70:13) {
validator: 's.nullish',
given: Thumbnail {
id: null,
width: 336,
height: 188,
url: 'https://i.ytimg.com/vi/Yd8kUoB72xU/hqdefault.jpg?sqp=-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLDqzu6hKMS8ScZnwypHbxwv6WF2Aw'
}
},
ValidationError: Expected a string primitive
at StringValidator.handle (C:\Users\focax\Documents\Repos\Practica\Proyecto_Fokabot\node_modules\@sapphire\shapeshift\dist\index.js:1705:70)
at StringValidator.run (C:\Users\focax\Documents\Repos\Practica\Proyecto_Fokabot\node_modules\@sapphire\shapeshift\dist\index.js:187:23)
at UnionValidator.parse (C:\Users\focax\Documents\Repos\Practica\Proyecto_Fokabot\node_modules\@sapphire\shapeshift\dist\index.js:201:88)
at Object.run (C:\Users\focax\Documents\Repos\Practica\Proyecto_Fokabot\slash\play.js:67:18)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async handleCommand (C:\Users\focax\Documents\Repos\Practica\Proyecto_Fokabot\index.js:70:13) {
validator: 's.string',
given: Thumbnail {
id: null,
width: 336,
height: 188,
url: 'https://i.ytimg.com/vi/Yd8kUoB72xU/hqdefault.jpg?sqp=-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLDqzu6hKMS8ScZnwypHbxwv6WF2Aw'
}
}
]
}
I avoided this issue by just deleting that line, but i need a solution of the setThumbnail part. What gives??
How do I make the bot stay in the voice channel after all the songs have been played? So far I've figured out how to do playlists and repeats but not that this one :(
this is the console output
`PS D:\el musica> node index.js load
D:\el musica\node_modules\discord-player\dist\Player.js:50
if (this.client?.options?.intents && !new discord_js_1.IntentsBitField(this.client?.options?.intents).has(discord_js_1.IntentsBitField.Flags.GuildVoiceStates)) {
^
TypeError: discord_js_1.IntentsBitField is not a constructor
at new Player (D:\el musica\node_modules\discord-player\dist\Player.js:50:47)
at Object. (D:\el musica\index.js:24:17)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
Node.js v18.12.1`
Hey i wanted to ask if you could make an video about the new discord-player version. Thanks in advanced.
Best regards
I cloned the master repo and ran npm install only to get an error. I tried installing the dependencies individually @latest but still got the same error.
`npm WARN deprecated [email protected]: No longer supported. Install the latest release!
npm ERR! code 1
npm ERR! path D:\WebProjects\discord-music-bot\node_modules@discordjs\opus
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build
npm ERR! Failed to execute 'D:\Node\node.exe D:\Node\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=D:\WebProjects\discord-music-bot\node_modules@discordjs\opus\prebuild\node-v108-napi-v3-win32-x64-unknown-unknown\opus.node --module_name=opus --module_path=D:\WebProjects\discord-music-bot\node_modules@discordjs\opus\prebuild\node-v108-napi-v3-win32-x64-unknown-unknown --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using [email protected]
npm ERR! node-pre-gyp info using [email protected] | win32 | x64
npm ERR! node-pre-gyp info check checked for "D:\WebProjects\discord-music-bot\node_modules@discordjs\opus\prebuild\node-v108-napi-v3-win32-x64-unknown-unknown\opus.node" (not found)
npm ERR! node-pre-gyp http GET https://github.com/discordjs/opus/releases/download/v0.5.3/opus-v0.5.3-node-v108-napi-v3-win32-x64-unknown-unknown.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/discordjs/opus/releases/download/v0.5.3/opus-v0.5.3-node-v108-napi-v3-win32-x64-unknown-unknown.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for @discordjs/[email protected] and [email protected] (node-v108 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/discordjs/opus/releases/download/v0.5.3/opus-v0.5.3-node-v108-napi-v3-win32-x64-unknown-unknown.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.4 found at "C:\Python310\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
dules@discordjs\opus\prebuild\node-v108-napi-v3-win32-x64-unknown-unknown\opus.node --module_name=opus --module_path=D:\WebProjects\discord-music-bot\node_modules@discordjs\opus\prebuild\node-v108-napi-v3-win32-x64-unknown-unknown --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp ERR! stack at ChildProcess. (D:\WebProjects\discord-music-bot\node_modules@discordjs\node-pre-gyp\lib\util\compile.js:85:20)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:527:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1090:16)
npm ERR! node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.22000
npm ERR! node-pre-gyp ERR! command "D:\Node\node.exe" "D:\WebProjects\discord-music-bot\node_modules\@discordjs\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd D:\WebProjects\discord-music-bot\node_modules@discordjs\opus
npm ERR! node-pre-gyp ERR! node -v v18.0.0npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.4.2npm ERR! node-pre-gyp ERR! not ok
I come from Youtube video, your video really awesome!
I found some parts can still be optimized, if i have only less than 10 songs, i still can search page2, I add +1 behind page in line19 of queue.js can solve this problem.
`npm WARN deprecated [email protected]: No longer supported. Install the latest release!
added 118 packages, and audited 119 packages in 8s
19 packages are looking for funding
run npm fund
for details
2 high severity vulnerabilities
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit
for details.
lolo@Lolos-MBP discord-music-bot-a260d1eb43a974ea232c603c93b0e1f40647ae68 % npm audit
@discordjs/opus <0.8.0
Severity: high
Uncontrolled Resource Consumption in @discordjs/opus - GHSA-rvgf-69j7-xh78
fix available via npm audit fix --force
Will install @discordjs/[email protected], which is a breaking change
node_modules/@discordjs/opus
prism-media 1.2.0 - 1.3.2
Depends on vulnerable versions of @discordjs/opus
node_modules/prism-media`
Request clarification here โ should I be installing a newer version of @discordjs/opus? Newer version of [email protected]? I don't know how.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.