Closed galnir closed 2 years ago
Still testing solutions for
- [ ] When starting the bot automatically make it continue playing the queue
Much Love -Bacon
When starting the bot automatically make it continue playing the queue
https://pastebin.com/DnMLujZh <- index.ts
If the bot is still in a voice channel after restart it will remake the button collector for the old embed and restart the song it was on when the bot was restarted, sorta a recovery feature (picks up where it left off)
this may be my misinterpretation of the comment :D, still had a blast
Much Love -Bacon
When starting the bot automatically make it continue playing the queue
https://pastebin.com/DnMLujZh <-
index.ts
If the bot is still in a voice channel after restart it will remake the button collector for the old embed and restart the song it was on when the bot was restarted, sorta a recovery feature (picks up where it left off)
this may be my misinterpretation of the comment :D, still had a blast
Much Love -Bacon
I tweaked your changes a little bit. Consolidated the collector into a function in order to clean up the code. Casting the values in customVoiceStateUpdate
obj to bigInt caused the bot to leave the VC after restart. It works now but needs some testing.
When I try to start a fresh queue after a restart, bot wouldn't connect to the voice channel but still trigger the embed but locked out buttons, /leave
the redoing the play command would fix it
i moved queue.createPlayer()
down 2 lines, and it seems to fix it
if (guild.me?.voice) {
if (!customVoiceStateUpdate.channel_id) return;
queue.createPlayer();
queue.connect(customVoiceStateUpdate.channel_id);
this was the same behavior found when a MOD uses the Right Click-> Disconnect to remove bot from voice channel, the channel_id is null and lavalink freaks, so i just ask it to leave....nicely :D HAHAH
this.ws.on('VOICE_STATE_UPDATE', async data => {
// handle if a mod right-clicks disconnect on the bot
if (!data.channel_id && data.user_id === this.application?.id) {
const queue = this.music.queues.get(data.guild_id!);
await queue.leave();
}
this.music.handleVoiceUpdate(data);
return;
});
Much Love -Bacon
@Bacon-Fixation Did I forget to add anything back except trivia?
Missing a player.setVolume() in play.ts - bot starts at 100 when starting a fresh queue
Don't believe there is a way to Loop a Song or Queue or to View a what's in the queue (/loop, /queue)
Missing Stage Channel Handler https://pastebin.com/VprZhhBM <- channelHandler.ts
was able to get it to work by adding manageStageChannel()
into musicSongPlayMessage.ts
plus a check if the bot is about to stream to an empty channel
import { ApplyOptions } from '@sapphire/decorators';
import { container, Listener, ListenerOptions } from '@sapphire/framework';
import type { TextChannel } from 'discord.js';
import { manageStageChannel } from '../lib/utils/music/channelHandler';
import type { Song } from '../lib/utils/queue/Song';
@ApplyOptionsNow playing: ${track.title}
});
}
}
Much Love
-Bacon
Missing a player.setVolume() in play.ts - bot starts at 100 when starting a fresh queue
Don't believe there is a way to Loop a Song or Queue
Missing Stage Channel Handler https://pastebin.com/VprZhhBM <- channelHandler.ts
was able to get it to work by adding
manageStageChannel()
intomusicSongPlayMessage.ts
plus a check if the bot is about to stream to an empty channel
- musicSongPlayMessage.ts
import { ApplyOptions } from '@sapphire/decorators'; import { container, Listener, ListenerOptions } from '@sapphire/framework'; import type { TextChannel } from 'discord.js'; import { manageStageChannel } from '../lib/utils/music/channelHandler'; import type { Song } from '../lib/utils/queue/Song'; @ApplyOptions<ListenerOptions>({ name: 'musicSongPlayMessage' }) export class MusicSongPlayMessageListener extends Listener { public override async run(channel: TextChannel, track: Song): Promise<void> { const { client } = container; const queue = client.music.queues.get(channel.guild.id); await manageStageChannel( channel.guild.me?.voice.channel!, channel.guild.me!, queue ); // Leave Voice Channel when attempting to stream to an empty channel if (channel.guild.me?.voice.channel?.members.size == 1) { await queue.leave(); return } await channel.send({ content: `Now playing: ${track.title}` }); } }
Much Love -Bacon
Can you open a PR with this change? I'm gonna merge this PR now
Tasks left to do:
and possibly leaveTimersto also be on Redis (define them in QueueKeys)How the queue works now: Instead of it being a property on Player, Player is a property on Queue - the queue creates and destroys players