Incorecc
Incorecc
DIAdiscord.js - Imagine an app
Created by Incorecc on 10/11/2024 in #djs-questions
Failure to push a slash command
const getMp3 = () => {
const allTracks = fs.readdirSync(path.join(path.resolve(), 'audio')).filter(file => file.endsWith('.mp3'));
let trackData = [];
for (const track of allTracks) {
trackData.push({
name: track.substring(0, track.length - 4),
value: track
});
}
return trackData;
}
const getMp3 = () => {
const allTracks = fs.readdirSync(path.join(path.resolve(), 'audio')).filter(file => file.endsWith('.mp3'));
let trackData = [];
for (const track of allTracks) {
trackData.push({
name: track.substring(0, track.length - 4),
value: track
});
}
return trackData;
}
I use these as choices to a slash command option
export const data = new SlashCommandBuilder()
.setName("play")
.setDescription("Plays music in a voice channel")
.addStringOption(option => {option
.setName("query")
.setDescription("The song to play")
.setRequired(true)
.addChoices(...(getMp3()));
});
export const data = new SlashCommandBuilder()
.setName("play")
.setDescription("Plays music in a voice channel")
.addStringOption(option => {option
.setName("query")
.setDescription("The song to play")
.setRequired(true)
.addChoices(...(getMp3()));
});
I get an error Djs version 14.15.3
5 replies
DIAdiscord.js - Imagine an app
Created by Incorecc on 10/17/2023 in #djs-voice
Bot suddenly stops playing music
when playing bigger songs, bot suddenly aborts
Error: aborted
at connResetException (node:internal/errors:717:14)
at TLSSocket.socketCloseListener (node:_http_client:462:19)
at TLSSocket.emit (node:events:525:35)
at node:net:322:12
at TCP.done (node:_tls_wrap:588:7) {
code: 'ECONNRESET'
}
node:events:491
throw er; // Unhandled 'error' event
^

AudioPlayerError: aborted
at connResetException (node:internal/errors:717:14)
at TLSSocket.socketCloseListener (node:_http_client:462:19)
at TLSSocket.emit (node:events:525:35)
at node:net:322:12
at TCP.done (node:_tls_wrap:588:7)
Emitted 'error' event on AudioPlayer instance at:
at OggDemuxer.onStreamError (C:\Users\ADMIN\GitHub\v14Bot\node_modules\@discordjs\voice\dist\index.js:1110:14)
at Object.onceWrapper (node:events:628:26)
at OggDemuxer.emit (node:events:525:35)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Error: aborted
at connResetException (node:internal/errors:717:14)
at TLSSocket.socketCloseListener (node:_http_client:462:19)
at TLSSocket.emit (node:events:525:35)
at node:net:322:12
at TCP.done (node:_tls_wrap:588:7) {
code: 'ECONNRESET'
}
node:events:491
throw er; // Unhandled 'error' event
^

AudioPlayerError: aborted
at connResetException (node:internal/errors:717:14)
at TLSSocket.socketCloseListener (node:_http_client:462:19)
at TLSSocket.emit (node:events:525:35)
at node:net:322:12
at TCP.done (node:_tls_wrap:588:7)
Emitted 'error' event on AudioPlayer instance at:
at OggDemuxer.onStreamError (C:\Users\ADMIN\GitHub\v14Bot\node_modules\@discordjs\voice\dist\index.js:1110:14)
at Object.onceWrapper (node:events:628:26)
at OggDemuxer.emit (node:events:525:35)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
17 replies
DIAdiscord.js - Imagine an app
Created by Incorecc on 4/13/2023 in #djs-questions
Cant upload commands
This is the error that pops up
Error: getaddrinfo ENOTFOUND discord.com
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'discord.com'
}
Error: getaddrinfo ENOTFOUND discord.com
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'discord.com'
}
6 replies
DIAdiscord.js - Imagine an app
Created by Incorecc on 4/12/2023 in #djs-questions
Guildmemberspeaking event
This event used to be in v12 back in the day. Is there any replacement for this today?
2 replies
DIAdiscord.js - Imagine an app
Created by Incorecc on 3/25/2023 in #djs-voice
Play command
I was making a play command
await interaction.deferReply();

const search = await ytse(given_song);
const search_res = search.videos[0].url;

const userchannel = interaction.member.voice;
if (!userchannel) {return interaction.followUp('You must be in a voice channel to use this command');}

const audioplayer = createAudioPlayer();

const connection = joinVoiceChannel({
channelId:userchannel.channelId,
guildId:interaction.guildId,
adapterCreator:interaction.guild.voiceAdapterCreator
});

connection.subscribe(audioplayer);

const ytdlprocess = ytdl(search_res, {filter:'audioonly'});

ytdlprocess.on("error",(error) => {console.error(error);});

audioplayer.play(createAudioResource(ytdlprocess));

await interaction.followUp({content:'Song is playing'});

audioplayer.on(AudioPlayerStatus.Idle, (oldState, newState) => {//song ended
connection.destroy();
return interaction.followUp({content:'Song ended. Leaving channel'});
});
await interaction.deferReply();

const search = await ytse(given_song);
const search_res = search.videos[0].url;

const userchannel = interaction.member.voice;
if (!userchannel) {return interaction.followUp('You must be in a voice channel to use this command');}

const audioplayer = createAudioPlayer();

const connection = joinVoiceChannel({
channelId:userchannel.channelId,
guildId:interaction.guildId,
adapterCreator:interaction.guild.voiceAdapterCreator
});

connection.subscribe(audioplayer);

const ytdlprocess = ytdl(search_res, {filter:'audioonly'});

ytdlprocess.on("error",(error) => {console.error(error);});

audioplayer.play(createAudioResource(ytdlprocess));

await interaction.followUp({content:'Song is playing'});

audioplayer.on(AudioPlayerStatus.Idle, (oldState, newState) => {//song ended
connection.destroy();
return interaction.followUp({content:'Song ended. Leaving channel'});
});
But sometimes it joins the channel and says 'Song is playing' but does not play anything Sometimes it does not join the channel only and says 'Song is playing' It does not log any error also
7 replies