Bot transitioning from playing to autopause

Hi I'm taking my first steps into coding a personal project for the first time, I decided to create a discord bot to play URL links of radio stations. After reading a decent amount of the documentation and understanding the core logic of all the setting up and event handling/command creation I decided to try to get it to join a channel, which was successful, and now I'm trying to have it play a simple track. Here's the situation: It joins the room, it transitions from buffering to playing, it registers the Playback as "started successfully" but then Audio player transitions from "playing" to "autopaused" and there is no audio. Upon inspecting the bot, I see that it is in a constant audio disabled state. As can be seen in the screenshot attached. What I have tried is to kick the bot and change all the permissions in the discord.com/developers/applications giving it all the speak permissions and whatnot, I also set all the permissions within the server (It's just me and a friend in it with no other roles besides "everyone". And also set the permissions of the server and the audio room to make sure the bot as well as any other member to have all the permissions needed to use audio in the audio channel. With no success. I'm attaching the screenshot and below the entire code for the command in my github, everything else is perfectly set as if it wasn't the bot crash before running. There goes the code; Sorry if I'm messing something up here I'm reasonably new at this https://github.com/danielmantilha/joinjs/blob/main/js I really appreciate any insights.
GitHub
joinjs/js at main · danielmantilha/joinjs
Contribute to danielmantilha/joinjs development by creating an account on GitHub.
No description
No description
7 Replies
d.js toolkit
d.js toolkit2d ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by staff
duck
duck2d ago
1. in future, #djs-voice is probably better for voice issues 2. I do see you have a few logs for state changes, does the voice connection ever actually become ready? if not, do you have the GuildVoiceStates intent?
del
delOP2d ago
hey @duck ! I appreciate the reply. I will move this if I can, I'm sorry its in the wrong. this is what I'm outputting after running index.js
dani@UDE:~/Desktop/discord-bot$ node index.js
Ready! Logged in as Del Bot#0877
This is the command: {
data: SlashCommandBuilder {
options: [],
name: 'join',
name_localizations: undefined,
description: 'Joins an audio Chat Room!',
description_localizations: undefined,
contexts: undefined,
default_permission: undefined,
default_member_permissions: undefined,
dm_permission: undefined,
integration_types: undefined,
nsfw: undefined
},
execute: [AsyncFunction: execute]
}
Audio player transitioned from idle to buffering
Audio player transitioned from buffering to playing
Playback started successfully.
Audio player transitioned from playing to autopaused
dani@UDE:~/Desktop/discord-bot$ node index.js
Ready! Logged in as Del Bot#0877
This is the command: {
data: SlashCommandBuilder {
options: [],
name: 'join',
name_localizations: undefined,
description: 'Joins an audio Chat Room!',
description_localizations: undefined,
contexts: undefined,
default_permission: undefined,
default_member_permissions: undefined,
dm_permission: undefined,
integration_types: undefined,
nsfw: undefined
},
execute: [AsyncFunction: execute]
}
Audio player transitioned from idle to buffering
Audio player transitioned from buffering to playing
Playback started successfully.
Audio player transitioned from playing to autopaused
as for the GuildVoiceStates intent. No, I'm only passing in the entire GatewayIntentBits on index.js as such
const { Client, Collection, GatewayIntentBits} = require("discord.js");
const { Client, Collection, GatewayIntentBits} = require("discord.js");
duck
duck2d ago
doesn't look like the connection becomes ready and that isn't actually where you're declaring your client's intents that'd be in your Client constructor you will need the GuildVoiceStates intent to properly connect to the voice channel
del
delOP2d ago
My apologies. The Client instance is getting created as such
const client = new Client({intents: [GatewayIntentBits.Guilds]});
const client = new Client({intents: [GatewayIntentBits.Guilds]});
should I specify the GuildVoiceStates additionally to the intents I already have?
duck
duck2d ago
you will need the GuildVoiceStates intent to properly connect to the voice channel
yes
del
delOP2d ago
Ok, thank you very much for your time. I will be trying that. Have a good night! hoooly molly it works 🙂 you da man

Did you find this page helpful?