arpos
DFDimensional Fun
•Created by arpos on 5/1/2024 in #lavaclient
not playing
the bot is not playing the song, this is my play.js
const Discord = require('discord.js');
const config = require('../../config.json');
const { S, getUserData } = require("lavaclient");
module.exports = {
name: "Play",
aliases: ["P", "start"],
description: "Plays song for you.",
memberVoice: true,
botVoice: false,
sameVoice: true,
queueNeeded: false,
async execute(client, message, args, cmd, memberVC, botVC, queue) {
const string = args.join(' ');
if (!string) {
const stringEmbed = new Discord.EmbedBuilder()
.setColor(config.ErrorColor)
.setDescription("Please enter a song url or query to search.")
.setFooter({
text: `Commanded by ${message.author.tag}`,
iconURL: message.author.displayAvatarURL({ size: 1024 })
});
return await message.reply({ embeds: [stringEmbed] });
};
try {
let player = await client.lavaclient.players.resolve(message.guild.id);
if (!player) {
player = await client.lavaclient.players.create(message.guild.id);
}
player.channel = message.channel;
player.voice.connect(memberVC);
const results = await client.lavaclient.api.loadTracks("ytsearch:never gonna give you up");
const track = results.data[0];
await player.play({
encoded: track.encoded,
userData: { requesterId: message.author.id },
});
} catch (error) {
console.log(error);
const errorEmbed = new Discord.EmbedBuilder()
.setColor(config.ErrorColor)
.setDescription(error.message.length > 4096 ? error.message.slice(0, 4093) + "..." : error.message)
.setFooter({
text: `Commanded by ${message.author.tag}`,
iconURL: message.author.displayAvatarURL({ size: 1024 })
});
return await message.reply({ embeds: [errorEmbed] });
};
},
};
const Discord = require('discord.js');
const config = require('../../config.json');
const { S, getUserData } = require("lavaclient");
module.exports = {
name: "Play",
aliases: ["P", "start"],
description: "Plays song for you.",
memberVoice: true,
botVoice: false,
sameVoice: true,
queueNeeded: false,
async execute(client, message, args, cmd, memberVC, botVC, queue) {
const string = args.join(' ');
if (!string) {
const stringEmbed = new Discord.EmbedBuilder()
.setColor(config.ErrorColor)
.setDescription("Please enter a song url or query to search.")
.setFooter({
text: `Commanded by ${message.author.tag}`,
iconURL: message.author.displayAvatarURL({ size: 1024 })
});
return await message.reply({ embeds: [stringEmbed] });
};
try {
let player = await client.lavaclient.players.resolve(message.guild.id);
if (!player) {
player = await client.lavaclient.players.create(message.guild.id);
}
player.channel = message.channel;
player.voice.connect(memberVC);
const results = await client.lavaclient.api.loadTracks("ytsearch:never gonna give you up");
const track = results.data[0];
await player.play({
encoded: track.encoded,
userData: { requesterId: message.author.id },
});
} catch (error) {
console.log(error);
const errorEmbed = new Discord.EmbedBuilder()
.setColor(config.ErrorColor)
.setDescription(error.message.length > 4096 ? error.message.slice(0, 4093) + "..." : error.message)
.setFooter({
text: `Commanded by ${message.author.tag}`,
iconURL: message.author.displayAvatarURL({ size: 1024 })
});
return await message.reply({ embeds: [errorEmbed] });
};
},
};
77 replies