Implemented radio player and partially some other players #6

Merged
HLadislav merged 21 commits from player into main 2025-01-26 21:57:27 +00:00
Showing only changes of commit 800a0bcd3b - Show all commits

View file

@ -56,6 +56,33 @@ pub async fn connect(ctx: Context<'_>,
let channel: ChannelId;
if name.is_none() || name.clone().unwrap() == "" {
// ERROR: <>
// !### This will work if you comment out one of the replies ###!
// let Some(guild) = ctx.guild() else {
// ctx.reply("You must be in a voice channel or specify explicit voice channel by name").await?;
// return Ok(())
// };
// let Some(voice_channel) = guild.voice_states.get(&ctx.author().id).and_then(|voice_state| voice_state.channel_id) else {
// ctx.reply("You must be in a voice channel or specify explicit voice channel by name").await?;
// return Ok(())
// };
// channel = voice_channel;
// !### ###!
// This one liner works only if you comment out the reply
// channel = match ctx.guild().unwrap().voice_states.get(&ctx.author().id).and_then(|voice_state| voice_state.channel_id) {
// Some(channel) => channel,
// None => {
// // ERROR: <>
// // Will work if you comment this out
// ctx.reply("You must be in a voice channel or specify explicit voice channel by name").await?;
// return Ok(())
// }
// }
// This one works
// Ugly one liner since I don't know how to do this another way yet
// TODO fix please
let Some(voice_channel) = ctx.guild().unwrap().voice_states.get(&ctx.author().id).and_then(|voice_state| voice_state.channel_id) else {