(DMG) Cantcrit
(DMG) Cantcrit
DIAdiscord.js - Imagine an app
Created by (DMG) Cantcrit on 3/26/2023 in #djs-voice
Core Dependency showing different than a version number
3 replies
DIAdiscord.js - Imagine an app
Created by (DMG) Cantcrit on 3/26/2023 in #djs-questions
Members not a valid property on channels.fetch?
6 replies
DIAdiscord.js - Imagine an app
Created by (DMG) Cantcrit on 3/24/2023 in #djs-questions
How can I get a voice connection object from an interaction object?
Pretty straight forward question in the title, I set up my Bot as per the structure in the docs with the separate 'event', 'command' folders, I have created a new command called join which makes the bot join the channel, and also houses the "joinVoiceChannel" object. But in a separate command of 'play' I'm not sure how I can get the 'voice connection' object in it so that I can create an audio stream?
const { SlashCommandBuilder } = require('discord.js');
const { joinVoiceChannel } = require('@discordjs/voice');
const { guildId } = require('../config.json');

module.exports = {
data: new SlashCommandBuilder()
.setName("join")
.setDescription("Joins an audio channel"),
async execute(interaction) {
joinVoiceChannel({
channelId: "",
guildId,
adapterCreator: interaction.channel.guild.voiceAdapterCreator,
});

await interaction.reply("Playing!");
},
}
const { SlashCommandBuilder } = require('discord.js');
const { joinVoiceChannel } = require('@discordjs/voice');
const { guildId } = require('../config.json');

module.exports = {
data: new SlashCommandBuilder()
.setName("join")
.setDescription("Joins an audio channel"),
async execute(interaction) {
joinVoiceChannel({
channelId: "",
guildId,
adapterCreator: interaction.channel.guild.voiceAdapterCreator,
});

await interaction.reply("Playing!");
},
}
const { SlashCommandBuilder } = require('discord.js');
const { createAudioPlayer } = require('@discordjs/voice');

module.exports = {
data: new SlashCommandBuilder()
.setName("play")
.setDescription(""),
async execute(interaction) {
const player = createAudioPlayer();

// >>>> How to get the channel voice connection?


await interaction.reply("Playing!");
},
}
const { SlashCommandBuilder } = require('discord.js');
const { createAudioPlayer } = require('@discordjs/voice');

module.exports = {
data: new SlashCommandBuilder()
.setName("play")
.setDescription(""),
async execute(interaction) {
const player = createAudioPlayer();

// >>>> How to get the channel voice connection?


await interaction.reply("Playing!");
},
}
5 replies