Initialize player in correct spot

This commit is contained in:
Mars Niermann 2024-03-19 22:48:34 +01:00
parent 3559431e2b
commit 2f0e54eb81
2 changed files with 10 additions and 13 deletions

3
.gitignore vendored
View file

@ -129,4 +129,5 @@ dist
.yarn/install-state.gz .yarn/install-state.gz
.pnp.* .pnp.*
lavalink/ lavalink/
Lavalink.jar Lavalink.jar
settings.json

View file

@ -164,12 +164,7 @@ client.on("messageCreate", async (msg: Message) => {
if (msg.guildId && msg.channelId) { if (msg.guildId && msg.channelId) {
if (!settings.requestChannels[msg.guildId]) { if (!settings.requestChannels[msg.guildId]) {
await msg.delete(); await msg.delete();
const player = await kazagumo.createPlayer({
guildId: msg.guild.id,
textId: msg.channel.id,
voiceId: msg.channel.id,
volume: 40,
});
const play = new ButtonBuilder() const play = new ButtonBuilder()
.setCustomId("play") .setCustomId("play")
.setLabel("Play/Pause") .setLabel("Play/Pause")
@ -280,6 +275,7 @@ client.on("messageCreate", async (msg: Message) => {
} }
if (msg.channel.name === "moe-song-requests") { if (msg.channel.name === "moe-song-requests") {
let controls; let controls;
if (!settings.requestChannels[msg.guild.id]) { if (!settings.requestChannels[msg.guild.id]) {
let answer = await msg.reply("Use .init first"); let answer = await msg.reply("Use .init first");
console.log(answer); console.log(answer);
@ -297,6 +293,12 @@ client.on("messageCreate", async (msg: Message) => {
// get(requestChannels[msg.guild.id]); // get(requestChannels[msg.guild.id]);
// client.channels.fetch(requestChannels[msg.guild.id]) // client.channels.fetch(requestChannels[msg.guild.id])
} }
const player = await kazagumo.createPlayer({
guildId: msg.guild.id,
textId: msg.channel.id,
voiceId: msg.channel.id,
volume: 40,
});
const query = msg.content; const query = msg.content;
const { channel } = msg.member.voice; const { channel } = msg.member.voice;
@ -309,12 +311,6 @@ client.on("messageCreate", async (msg: Message) => {
return; return;
} }
const player = await kazagumo.createPlayer({
guildId: msg.guild.id,
textId: msg.channel.id,
voiceId: channel.id,
volume: 40,
});
console.log("Player created"); console.log("Player created");
const result = await kazagumo.search(query, { requester: msg.author }); const result = await kazagumo.search(query, { requester: msg.author });
if (!result.tracks.length) { if (!result.tracks.length) {