Klubuntu
Klubuntu
DIAdiscord.js - Imagine an app
Created by Klubuntu on 7/31/2023 in #djs-voice
Problem with play external URL
TypeError [ERR_INVALID_ARG_TYPE]: The "body" argument must be of type function or an instance of Blob, ReadableStream, WritableStream, Stream, Iterable, AsyncIterable, or Promise or { readable, writable } pair. Received undefined
at new NodeError (node:internal/errors:393:5)
at duplexify (node:internal/streams/duplexify:199:9)
at Duplex.from (node:internal/streams/duplex:146:10)
at pipelineImpl (node:internal/streams/pipeline:259:22)
at pipeline (node:internal/streams/pipeline:151:10)
at new AudioResource (Manager-music-Dev-Rework\node_modules\@discordjs\voice\dist\index.js:2337:77)
at createAudioResource (Manager-music-Dev-Rework\node_modules\@discordjs\voice\dist\index.js:2431:10)
at playURL (CManager-music-Dev-Rework\cmd\play.js:104:23)
at runtime (Manager-music-Dev-Rework\cmd\play.js:135:5)
at Manager-music-Dev-Rework\cmd\list.js:48:10 {
code: 'ERR_INVALID_ARG_TYPE'
}
[ACTION] User > klubuntu in [:computer: Klubuntu Community]
[BOT] Command /play-online url:http://www.emsoft.ct8.pl/inne/time.m3u?id=2030
[DEBUG] Detected URL: http://ic1.smcdn.pl/2030-1.mp3
TypeError [ERR_INVALID_ARG_TYPE]: The "body" argument must be of type function or an instance of Blob, ReadableStream, WritableStream, Stream, Iterable, AsyncIterable, or Promise or { readable, writable } pair. Received undefined
at new NodeError (node:internal/errors:393:5)
at duplexify (node:internal/streams/duplexify:199:9)
at Duplex.from (node:internal/streams/duplex:146:10)
at pipelineImpl (node:internal/streams/pipeline:259:22)
at pipeline (node:internal/streams/pipeline:151:10)
at new AudioResource (Manager-music-Dev-Rework\node_modules\@discordjs\voice\dist\index.js:2337:77)
at createAudioResource (Manager-music-Dev-Rework\node_modules\@discordjs\voice\dist\index.js:2431:10)
at playURL (CManager-music-Dev-Rework\cmd\play.js:104:23)
at runtime (Manager-music-Dev-Rework\cmd\play.js:135:5)
at Manager-music-Dev-Rework\cmd\list.js:48:10 {
code: 'ERR_INVALID_ARG_TYPE'
}
[ACTION] User > klubuntu in [:computer: Klubuntu Community]
[BOT] Command /play-online url:http://www.emsoft.ct8.pl/inne/time.m3u?id=2030
[DEBUG] Detected URL: http://ic1.smcdn.pl/2030-1.mp3
Play only work if use detected url without playlist, add await/async no fix problem
13 replies
DIAdiscord.js - Imagine an app
Created by Klubuntu on 7/29/2023 in #djs-voice
How to return player in external function
function playURL(interaction){
let url = interaction.options.getString("url");
const player = interaction.legacyPlayer
const connection = joinVoiceChannel({
channelId: interaction.member.voice.channel.id,
guildId: interaction.member.voice.channel.guild.id,
adapterCreator: interaction.member.voice.channel.guild.voiceAdapterCreator,
});

player.play(createAudioResource(url), { type: 'unknown' });
connection.subscribe(player);
interaction.legacyPlayer.test = player
interaction.reply('Now playing audio!');

}
function playURL(interaction){
let url = interaction.options.getString("url");
const player = interaction.legacyPlayer
const connection = joinVoiceChannel({
channelId: interaction.member.voice.channel.id,
guildId: interaction.member.voice.channel.guild.id,
adapterCreator: interaction.member.voice.channel.guild.voiceAdapterCreator,
});

player.play(createAudioResource(url), { type: 'unknown' });
connection.subscribe(player);
interaction.legacyPlayer.test = player
interaction.reply('Now playing audio!');

}
How to stop if below method not work
console.log(interaction.legacyPlayer)
try{
interaction.legacyPlayer.stop();
interaction.reply({embeds: [stopEmbed]})
}
console.log(interaction.legacyPlayer)
try{
interaction.legacyPlayer.stop();
interaction.reply({embeds: [stopEmbed]})
}
3 replies
DIAdiscord.js - Imagine an app
Created by Klubuntu on 7/28/2023 in #djs-questions
Bot get crash if import external list with/without async
35 replies