resource.volume.setVolume returning error

I`m trying change volume in my bot, but when i try to change the volume it gives me the error
TypeError: Cannot read properties of undefined (reading 'setVolume')
TypeError: Cannot read properties of undefined (reading 'setVolume')
my code is
const volume = inter.options.get('громкость')?.value // me russian, громкость is volume


c.data.voice[inter.guildId].setVolume(volume)
// c.data.voice[inter.guildId] is object with key setVolume, setVolume contains resource.volume.setVolume
return await inter.reply('> :white_check_mark:')
const volume = inter.options.get('громкость')?.value // me russian, громкость is volume


c.data.voice[inter.guildId].setVolume(volume)
// c.data.voice[inter.guildId] is object with key setVolume, setVolume contains resource.volume.setVolume
return await inter.reply('> :white_check_mark:')
i using sodium lib libsodium-wrappers, my opus lib opusscript Thanks!
20 Replies
ever_daemon
ever_daemonOP3y ago
i add inter.guildId when i start music I guess the problem is that resource.volume is undefined, but why
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs3y ago
ReferenceError: "x" is not defined: learn moreTypeError: Cannot read properties of undefined/null (reading "x"): learn more
ever_daemon
ever_daemonOP3y ago
first i start the music but when i run the volume command it gives an error
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
ever_daemon
ever_daemonOP3y ago
btw i did if(!c.data.voice[inter.guildId]) but i excluded it
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
ever_daemon
ever_daemonOP3y ago
yes
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
ever_daemon
ever_daemonOP3y ago
console.log(resource.volume) (in playmusic) returning undefined
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
ever_daemon
ever_daemonOP3y ago
wha
ever_daemon
ever_daemonOP3y ago
there is Russian because the bot is Russian
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
ever_daemon
ever_daemonOP3y ago
by the way, pure JSON in data, because when I make parameters in Subcommand, it somehow sideways thrusts into the command itself and not into subcommand
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
ever_daemon
ever_daemonOP3y ago
by the way, maybe this is a mistake like, you need @discordjs/opus for this and not opusscript wait.
ever_daemon
ever_daemonOP3y ago
ever_daemon
ever_daemonOP3y ago
later.. i fixed i uninstalled opusscript, installed @discordjs/opus, in createAudioResource setted inlineVolume:true i close it in 5 minutes
Want results from more Discord servers?
Add your server