Klubuntu
Klubuntu
DIAdiscord.js - Imagine an app
Created by Klubuntu on 7/31/2023 in #djs-voice
Problem with play external URL
Should I add to my playURL function , then for for detectLink, or add something else ?
13 replies
DIAdiscord.js - Imagine an app
Created by Klubuntu on 7/31/2023 in #djs-voice
Problem with play external URL
declare using in playURL from function detectLink use in Then ?
13 replies
DIAdiscord.js - Imagine an app
Created by Klubuntu on 7/31/2023 in #djs-voice
Problem with play external URL
that is, I should give the result of getLink in then ?
13 replies
DIAdiscord.js - Imagine an app
Created by Klubuntu on 7/31/2023 in #djs-voice
Problem with play external URL
That is, the next step would be to add to detectlink, then ?
13 replies
DIAdiscord.js - Imagine an app
Created by Klubuntu on 7/31/2023 in #djs-voice
Problem with play external URL
then how do I return, if I can not return by return, and I do not want to use again promise, async and await
13 replies
DIAdiscord.js - Imagine an app
Created by Klubuntu on 7/31/2023 in #djs-voice
Problem with play external URL
They should return a link, at least that's what console.log shows
13 replies
DIAdiscord.js - Imagine an app
Created by Klubuntu on 7/31/2023 in #djs-voice
Problem with play external URL
My code for this function
13 replies
DIAdiscord.js - Imagine an app
Created by Klubuntu on 7/31/2023 in #djs-voice
Problem with play external URL
Function for detect MP3 adress, from m3u or pls link, else return default adress
13 replies
DIAdiscord.js - Imagine an app
Created by Klubuntu on 7/31/2023 in #djs-voice
Problem with play external URL
config is external yml file parsed to dict
13 replies
DIAdiscord.js - Imagine an app
Created by Klubuntu on 7/31/2023 in #djs-voice
Problem with play external URL
async function playURL(interaction){
const config = interaction.locale_config
const player = interaction.legacyPlayer
const channel = interaction.member.voice.channel;
if (!channel) {
msg_user_not_voicechannel = "❌ " + config.messages.user_not_connected;
console.log(msg_user_not_voicechannel);
interaction.reply(msg_user_not_voicechannel);
userJoined = false;
return;
}
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: interaction.member.voice.channel.guild.id,
adapterCreator: interaction.member.voice.channel.guild.voiceAdapterCreator,
});

let url = interaction.options.getString("url");
newUrl = detectLink(url);
try{
await player.play(createAudioResource(detectLink(url)), { type: 'unknown' });
connection.subscribe(player);
interaction.legacyPlayer.test = player
interaction.track = {
raw: {},
__metadata: {
source: "stream URL",
uploadedAt: ""
},
title: "Stream URL",
duration: `${getEmoji("rec")} LIVE`,
url: "https://manager-discord.netlify.app",
thumbnail: "",
}
interaction.reply(`${config.messages.play[1].playing} <${url}>`);
interaction.playEvent(interaction);
}
catch(e){
console.error(e);
}
}
async function playURL(interaction){
const config = interaction.locale_config
const player = interaction.legacyPlayer
const channel = interaction.member.voice.channel;
if (!channel) {
msg_user_not_voicechannel = "❌ " + config.messages.user_not_connected;
console.log(msg_user_not_voicechannel);
interaction.reply(msg_user_not_voicechannel);
userJoined = false;
return;
}
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: interaction.member.voice.channel.guild.id,
adapterCreator: interaction.member.voice.channel.guild.voiceAdapterCreator,
});

let url = interaction.options.getString("url");
newUrl = detectLink(url);
try{
await player.play(createAudioResource(detectLink(url)), { type: 'unknown' });
connection.subscribe(player);
interaction.legacyPlayer.test = player
interaction.track = {
raw: {},
__metadata: {
source: "stream URL",
uploadedAt: ""
},
title: "Stream URL",
duration: `${getEmoji("rec")} LIVE`,
url: "https://manager-discord.netlify.app",
thumbnail: "",
}
interaction.reply(`${config.messages.play[1].playing} <${url}>`);
interaction.playEvent(interaction);
}
catch(e){
console.error(e);
}
}
13 replies
DIAdiscord.js - Imagine an app
Created by Klubuntu on 7/31/2023 in #djs-voice
Problem with play external URL
Only one function
13 replies
DIAdiscord.js - Imagine an app
Created by Klubuntu on 7/29/2023 in #djs-voice
How to return player in external function
This method return only
AudioPlayer {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
_state: { status: 'idle' },
subscribers: [],
behaviors: { noSubscriber: 'pause', maxMissedFrames: 5 },
debug: [Function (anonymous)],
[Symbol(kCapture)]: false
}
AudioPlayer {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
_state: { status: 'idle' },
subscribers: [],
behaviors: { noSubscriber: 'pause', maxMissedFrames: 5 },
debug: [Function (anonymous)],
[Symbol(kCapture)]: false
}
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
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
without Crash
35 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
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
Thanks, problem solved ✅
35 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
yes, Is my solution is to add await ?
35 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
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
in above link
35 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
I updated my code to send trigger if play
player.events.on('playerTrigger', (queue, track) => {
queue.metadata.channel.send("test");
queue.metadata.channel.send({embeds: [useEmbed(track, "play")]});
});
player.events.on('playerTrigger', (queue, track) => {
queue.metadata.channel.send("test");
queue.metadata.channel.send({embeds: [useEmbed(track, "play")]});
});
and first message send without problems useEmbed relates to: https://pastebin.com/Gw3ZgFnR
35 replies