© 2026 Hedgehog Software, LLC
const { Client, GatewayIntentBits, ActivityType} = require('discord.js'); const { joinVoiceChannel, getVoiceConnection, createAudioPlayer, NoSubscriberBehavior, createAudioResource, AudioPlayerStatus } = require('@discordjs/voice'); const client = new Client({ intents: [GatewayIntentBits.Guilds] }); client.config = require("./config.json"); const player = createAudioPlayer({ behaviors: { noSubscriber: NoSubscriberBehavior.Pause, }, }); const resource = createAudioResource('http://radio.fenixzone.com:8000/stream/1763315/', { inlineVolume: true }); require('./modules/commands.js'); client.login(client.config.token) .then(() => { console.log("Bot started..."); //Send this message when bot is online to the console. }) .catch((err) => console.log(`Error ${err}`)); client.on('ready', (c) => { client.user.setActivity({ name: '¡Crucks FM!', type: ActivityType.Listening, url: "..." }); }); client.on('interactionCreate', (interaction) => { let canal = interaction.member.voice.channel; if(interaction.commandName == 'stereo' && interaction.isChatInputCommand()) { if (!canal) { return interaction.reply({ content: ':red_circle: Debes estar conectado a un canal de voz para usar este comando!' }) } if (!canal.joinable) { return interaction.reply({ content: ':red_circle: No tengo permiso para entrar al canal de voz.' }) } const connection = joinVoiceChannel({ channelId: canal.id, guildId: canal.guild.id, adapterCreator: canal.guild.voiceAdapterCreator, }); player.play(resource); connection.subscribe(player); interaction.reply(`🟢 Conectado al canal de voz!`); } });
Join the Discord to ask follow-up questions and connect with the community
Support server for discord.js, a Node.js module to interact with Discord's apps API.
57,666 Members