Jasper
Jasper
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Turki on 7/9/2024 in #help
can't join a channel
Please check the example play code provided by Moonlink.js lib
10 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Turki on 7/9/2024 in #help
can't join a channel
There is no playback code, only the join function.
10 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Jasper on 3/10/2024 in #issues
<MoonlinkPlayer>.skip() bug
I'll do my best. πŸ™‚
134 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Jasper on 3/10/2024 in #issues
<MoonlinkPlayer>.skip() bug
It's been a while since I've studied typescript, so the code can be terrible πŸ˜‚
134 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Jasper on 3/10/2024 in #issues
<MoonlinkPlayer>.skip() bug
i think so
134 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Jasper on 3/10/2024 in #issues
<MoonlinkPlayer>.skip() bug
For now, I wrote the code as above.
134 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Jasper on 3/10/2024 in #issues
<MoonlinkPlayer>.skip() bug
const query = interaction.options.getString("쿼리", true);

if (!voiceChannel.joinable)
return interaction.reply({
content: `봇이 ν•΄λ‹Ή μŒμ„±μ±„λ„μ— μž…μž₯ν•  수 μžˆλŠ” κΆŒν•œμ΄ μ—†μŠ΅λ‹ˆλ‹€.`
});

const player = client.music.player.players.create({
guildId: interaction.guild.id,
voiceChannel: voiceChannel.id,
textChannel: interaction.channel.id,
autoPlay: selected_data ? Boolean(selected_data.autoPlay) : true,
autoLeave: selected_data ? Boolean(selected_data.autoLeave) : false
});

player.volume = selected_data ? selected_data.volume : 50;

if (!player.connected) {
player.connect({
setDeaf: true,
setMute: false
});
}

const res = await client.music.player.search({
query,
source: "youtube",
requester: interaction.user.id
});

if (res.loadType === "error") {
return interaction.reply({
content: `어라.. ν˜„μž¬ μ‹œμŠ€ν…œμ΄ μ›ν™œν•˜μ§€ μ•Šμ€ λͺ¨μ–‘μ΄μ—μš”. μ‹œκ°„ μ§€λ‚˜κ³  λ‹€μ‹œ μ‹œλ„ν•΄ 보면 될 κ±°μ˜ˆμš”!`
});
} else if (res.loadType === "empty") {
return interaction.reply({
content: `\`${query}\`에 λŒ€ν•΄ κ²€μƒ‰ν•΄λ΄€λŠ”λ° 찾을 수 μ—†μ–΄μš”.`
});
}

if (res.loadType === "playlist") {
interaction.reply({
content: `\`${res.playlistInfo?.name}\` ν•΄λ‹Ή ν”Œλ ˆμ΄λ¦¬μŠ€νŠΈμ— λŒ€ν•΄ λŒ€κΈ°μ—΄μ— μΆ”κ°€ν–ˆμ–΄μš”.`
});

for (const track of res.tracks) {
player.queue.add(track);
}
} else {
const selectMenu = new StringSelectMenuBuilder()
.setCustomId("select_track")
.setPlaceholder("λ…Έλž˜λ₯Ό μ„ νƒν•΄μ£Όμ„Έμš”.")
.addOptions(
res.tracks.slice(0, 25).map((track) => ({
label:
track.title.length > 100
? track.title.slice(0, 97) + "..."
: track.title,
description:
track.author.length > 50
? track.author.slice(0, 47) + "..."
: track.author,
value: track.identifier
}))
);

const row =
new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(
selectMenu
);

const response = await interaction.reply({
content:
"μž…λ ₯ν•˜μ‹  쿼리λ₯Ό 기반으둜 μ•„λž˜μ˜ 검색 κ²°κ³Όλ₯Ό 좜λ ₯ν•˜μ˜€μŠ΅λ‹ˆλ‹€.",
components: [row]
});

const collectorFilter = (i: { user: { id: string } }) =>
i.user.id === interaction.user.id;
try {
const confirmation = await response.awaitMessageComponent({
filter: collectorFilter,
time: 30_000,
componentType: ComponentType.StringSelect
});

if (confirmation.customId === "select_track") {
const selectedTrack = res.tracks.find(
(track) => track.identifier === confirmation.values[0]
);

if (selectedTrack) {
player.queue.add(selectedTrack);
await confirmation.update({
content: `\`${selectedTrack.title} - ${await client.date.millisecondsToDuration(selectedTrack.duration)}\` ν•΄λ‹Ή λ…Έλž˜λ₯Ό λŒ€κΈ°μ—΄μ— μΆ”κ°€ν–ˆμ–΄μš”.`,
components: []
});
if (!player.playing) {
player.play();
// player.setVolume();
}
}
}
} catch (e) {
await interaction.editReply({
content: "μ œν•œ μ‹œκ°„ 내에 λ²„νŠΌμ„ λˆ„λ₯΄μ§€ μ•Šμ•„ μ·¨μ†Œλ˜μ—ˆμŠ΅λ‹ˆλ‹€.",
components: []
});
}
}
const query = interaction.options.getString("쿼리", true);

if (!voiceChannel.joinable)
return interaction.reply({
content: `봇이 ν•΄λ‹Ή μŒμ„±μ±„λ„μ— μž…μž₯ν•  수 μžˆλŠ” κΆŒν•œμ΄ μ—†μŠ΅λ‹ˆλ‹€.`
});

const player = client.music.player.players.create({
guildId: interaction.guild.id,
voiceChannel: voiceChannel.id,
textChannel: interaction.channel.id,
autoPlay: selected_data ? Boolean(selected_data.autoPlay) : true,
autoLeave: selected_data ? Boolean(selected_data.autoLeave) : false
});

player.volume = selected_data ? selected_data.volume : 50;

if (!player.connected) {
player.connect({
setDeaf: true,
setMute: false
});
}

const res = await client.music.player.search({
query,
source: "youtube",
requester: interaction.user.id
});

if (res.loadType === "error") {
return interaction.reply({
content: `어라.. ν˜„μž¬ μ‹œμŠ€ν…œμ΄ μ›ν™œν•˜μ§€ μ•Šμ€ λͺ¨μ–‘μ΄μ—μš”. μ‹œκ°„ μ§€λ‚˜κ³  λ‹€μ‹œ μ‹œλ„ν•΄ 보면 될 κ±°μ˜ˆμš”!`
});
} else if (res.loadType === "empty") {
return interaction.reply({
content: `\`${query}\`에 λŒ€ν•΄ κ²€μƒ‰ν•΄λ΄€λŠ”λ° 찾을 수 μ—†μ–΄μš”.`
});
}

if (res.loadType === "playlist") {
interaction.reply({
content: `\`${res.playlistInfo?.name}\` ν•΄λ‹Ή ν”Œλ ˆμ΄λ¦¬μŠ€νŠΈμ— λŒ€ν•΄ λŒ€κΈ°μ—΄μ— μΆ”κ°€ν–ˆμ–΄μš”.`
});

for (const track of res.tracks) {
player.queue.add(track);
}
} else {
const selectMenu = new StringSelectMenuBuilder()
.setCustomId("select_track")
.setPlaceholder("λ…Έλž˜λ₯Ό μ„ νƒν•΄μ£Όμ„Έμš”.")
.addOptions(
res.tracks.slice(0, 25).map((track) => ({
label:
track.title.length > 100
? track.title.slice(0, 97) + "..."
: track.title,
description:
track.author.length > 50
? track.author.slice(0, 47) + "..."
: track.author,
value: track.identifier
}))
);

const row =
new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(
selectMenu
);

const response = await interaction.reply({
content:
"μž…λ ₯ν•˜μ‹  쿼리λ₯Ό 기반으둜 μ•„λž˜μ˜ 검색 κ²°κ³Όλ₯Ό 좜λ ₯ν•˜μ˜€μŠ΅λ‹ˆλ‹€.",
components: [row]
});

const collectorFilter = (i: { user: { id: string } }) =>
i.user.id === interaction.user.id;
try {
const confirmation = await response.awaitMessageComponent({
filter: collectorFilter,
time: 30_000,
componentType: ComponentType.StringSelect
});

if (confirmation.customId === "select_track") {
const selectedTrack = res.tracks.find(
(track) => track.identifier === confirmation.values[0]
);

if (selectedTrack) {
player.queue.add(selectedTrack);
await confirmation.update({
content: `\`${selectedTrack.title} - ${await client.date.millisecondsToDuration(selectedTrack.duration)}\` ν•΄λ‹Ή λ…Έλž˜λ₯Ό λŒ€κΈ°μ—΄μ— μΆ”κ°€ν–ˆμ–΄μš”.`,
components: []
});
if (!player.playing) {
player.play();
// player.setVolume();
}
}
}
} catch (e) {
await interaction.editReply({
content: "μ œν•œ μ‹œκ°„ 내에 λ²„νŠΌμ„ λˆ„λ₯΄μ§€ μ•Šμ•„ μ·¨μ†Œλ˜μ—ˆμŠ΅λ‹ˆλ‹€.",
components: []
});
}
}
134 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Jasper on 3/10/2024 in #issues
<MoonlinkPlayer>.skip() bug
When using the command, we implemented the track to be selected and played by the user based on the search. I was just trying to adjust the volume based on the selection.
134 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Jasper on 3/10/2024 in #issues
<MoonlinkPlayer>.skip() bug
what happened
134 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Jasper on 3/10/2024 in #issues
<MoonlinkPlayer>.skip() bug
I'm always grateful that you've helped me in something that's not a big deal ❀️
134 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Jasper on 3/10/2024 in #issues
<MoonlinkPlayer>.skip() bug
Yeah πŸ™‚
134 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Jasper on 3/10/2024 in #issues
<MoonlinkPlayer>.skip() bug
3|NodeLink Server | [ALL]: Received a request from client.
3|NodeLink Server | Path: /v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601
3|NodeLink Server | Headers: {"content-type":"application/json","accept-encoding":"br","authorization":"REDACTED","host":"REDACTED","connection":"keep-alive","transfer-encoding":"chunked"}
3|NodeLink Server | Body: "{\"voice\":{\"sessionId\":\"39b51df23fb1ecb3f9e63dd76c35d676\",\"endpoint\":\"south-korea1115.discord.media:443\",\"token\":\"7b8b0d83d5e3590e\"}}"
3|NodeLink Server | [voice]: Received a request from client.
3|NodeLink Server | Params: "/v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601"
3|NodeLink Server | Headers: {"content-type":"application/json","accept-encoding":"br","authorization":"REDACTED","host":"REDACTED","connection":"keep-alive","transfer-encoding":"chunked"}
3|NodeLink Server | Body: {"voice":{"sessionId":"39b51df23fb1ecb3f9e63dd76c35d676","endpoint":"south-korea1115.discord.media:443","token":"7b8b0d83d5e3590e"}}
3|NodeLink Server | [search]: Found 19 tracks on YouTube for query 7 Years
3|NodeLink Server | [ALL]: Received a request from client.
3|NodeLink Server | Path: /v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601
3|NodeLink Server | Headers: {"content-type":"application/json","accept-encoding":"br","authorization":"REDACTED","host":"REDACTED","connection":"keep-alive","transfer-encoding":"chunked"}
3|NodeLink Server | Body: "{\"track\":{\"encoded\":\"QAAAywMALUx1a2FzIEdyYWhhbSAtIDcgWWVhcnMgW09mZmljaWFsIE11c2ljIFZpZGVvXQAMTHVrYXMgR3JhaGFtAAAAAAADqYAAC0xIQ29iNzZraWdBAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9TEhDb2I3NmtpZ0EBADRodHRwczovL2kueXRpbWcuY29tL3ZpL0xIQ29iNzZraWdBL21heHJlc2RlZmF1bHQuanBnAAAHeW91dHViZQAAAAAAAAAA\"},\"volume\":30}"
3|NodeLink Server | [play]: Received a request from client.
3|NodeLink Server | Params: "/v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601"
3|NodeLink Server | Headers: {"content-type":"application/json","accept-encoding":"br","authorization":"REDACTED","host":"REDACTED","connection":"keep-alive","transfer-encoding":"chunked"}
3|NodeLink Server | Body: {"track":{"encoded":"QAAAywMALUx1a2FzIEdyYWhhbSAtIDcgWWVhcnMgW09mZmljaWFsIE11c2ljIFZpZGVvXQAMTHVrYXMgR3JhaGFtAAAAAAADqYAAC0xIQ29iNzZraWdBAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9TEhDb2I3NmtpZ0EBADRodHRwczovL2kueXRpbWcuY29tL3ZpL0xIQ29iNzZraWdBL21heHJlc2RlZmF1bHQuanBnAAAHeW91dHViZQAAAAAAAAAA"},"volume":30}
3|NodeLink Server | [volume]: Received a request from client.
3|NodeLink Server | Params: "/v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601"
3|NodeLink Server | Body: {"track":{"encoded":"QAAAywMALUx1a2FzIEdyYWhhbSAtIDcgWWVhcnMgW09mZmljaWFsIE11c2ljIFZpZGVvXQAMTHVrYXMgR3JhaGFtAAAAAAADqYAAC0xIQ29iNzZraWdBAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9TEhDb2I3NmtpZ0EBADRodHRwczovL2kueXRpbWcuY29tL3ZpL0xIQ29iNzZraWdBL21heHJlc2RlZmF1bHQuanBnAAAHeW91dHViZQAAAAAAAAAA"},"volume":30}
3|NodeLink Server | [trackStart]: Lukas Graham - 7 Years [Official Music Video] by Lukas Graham.
3|NodeLink Server | [ALL]: Received a request from client.
3|NodeLink Server | Path: /v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601
3|NodeLink Server | Headers: {"content-type":"application/json","accept-encoding":"br","authorization":"REDACTED","host":"REDACTED","connection":"keep-alive","transfer-encoding":"chunked"}
3|NodeLink Server | Body: "{\"voice\":{\"sessionId\":\"39b51df23fb1ecb3f9e63dd76c35d676\",\"endpoint\":\"south-korea1115.discord.media:443\",\"token\":\"7b8b0d83d5e3590e\"}}"
3|NodeLink Server | [voice]: Received a request from client.
3|NodeLink Server | Params: "/v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601"
3|NodeLink Server | Headers: {"content-type":"application/json","accept-encoding":"br","authorization":"REDACTED","host":"REDACTED","connection":"keep-alive","transfer-encoding":"chunked"}
3|NodeLink Server | Body: {"voice":{"sessionId":"39b51df23fb1ecb3f9e63dd76c35d676","endpoint":"south-korea1115.discord.media:443","token":"7b8b0d83d5e3590e"}}
3|NodeLink Server | [search]: Found 19 tracks on YouTube for query 7 Years
3|NodeLink Server | [ALL]: Received a request from client.
3|NodeLink Server | Path: /v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601
3|NodeLink Server | Headers: {"content-type":"application/json","accept-encoding":"br","authorization":"REDACTED","host":"REDACTED","connection":"keep-alive","transfer-encoding":"chunked"}
3|NodeLink Server | Body: "{\"track\":{\"encoded\":\"QAAAywMALUx1a2FzIEdyYWhhbSAtIDcgWWVhcnMgW09mZmljaWFsIE11c2ljIFZpZGVvXQAMTHVrYXMgR3JhaGFtAAAAAAADqYAAC0xIQ29iNzZraWdBAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9TEhDb2I3NmtpZ0EBADRodHRwczovL2kueXRpbWcuY29tL3ZpL0xIQ29iNzZraWdBL21heHJlc2RlZmF1bHQuanBnAAAHeW91dHViZQAAAAAAAAAA\"},\"volume\":30}"
3|NodeLink Server | [play]: Received a request from client.
3|NodeLink Server | Params: "/v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601"
3|NodeLink Server | Headers: {"content-type":"application/json","accept-encoding":"br","authorization":"REDACTED","host":"REDACTED","connection":"keep-alive","transfer-encoding":"chunked"}
3|NodeLink Server | Body: {"track":{"encoded":"QAAAywMALUx1a2FzIEdyYWhhbSAtIDcgWWVhcnMgW09mZmljaWFsIE11c2ljIFZpZGVvXQAMTHVrYXMgR3JhaGFtAAAAAAADqYAAC0xIQ29iNzZraWdBAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9TEhDb2I3NmtpZ0EBADRodHRwczovL2kueXRpbWcuY29tL3ZpL0xIQ29iNzZraWdBL21heHJlc2RlZmF1bHQuanBnAAAHeW91dHViZQAAAAAAAAAA"},"volume":30}
3|NodeLink Server | [volume]: Received a request from client.
3|NodeLink Server | Params: "/v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601"
3|NodeLink Server | Body: {"track":{"encoded":"QAAAywMALUx1a2FzIEdyYWhhbSAtIDcgWWVhcnMgW09mZmljaWFsIE11c2ljIFZpZGVvXQAMTHVrYXMgR3JhaGFtAAAAAAADqYAAC0xIQ29iNzZraWdBAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9TEhDb2I3NmtpZ0EBADRodHRwczovL2kueXRpbWcuY29tL3ZpL0xIQ29iNzZraWdBL21heHJlc2RlZmF1bHQuanBnAAAHeW91dHViZQAAAAAAAAAA"},"volume":30}
3|NodeLink Server | [trackStart]: Lukas Graham - 7 Years [Official Music Video] by Lukas Graham.
134 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Jasper on 3/10/2024 in #issues
<MoonlinkPlayer>.skip() bug
Its work :happypepe:
134 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Jasper on 3/10/2024 in #issues
<MoonlinkPlayer>.skip() bug
Does it mean to set the <MoonlinkPlayer>.volume property?
134 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Jasper on 3/10/2024 in #issues
<MoonlinkPlayer>.skip() bug
umm
134 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Jasper on 3/10/2024 in #issues
<MoonlinkPlayer>.skip() bug
wrong code?
134 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Jasper on 3/10/2024 in #issues
<MoonlinkPlayer>.skip() bug
Async function included play and set volume method and exec
134 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Jasper on 3/10/2024 in #issues
<MoonlinkPlayer>.skip() bug
If I do this, the Player will be created late, and the same error will occur
134 replies
MIA🎢 Moonlink.js - Imagine a Music Application
Created by Jasper on 3/10/2024 in #issues
<MoonlinkPlayer>.skip() bug
If i do this, it'll be output at the default sound value for about a second
134 replies