0.2.0 player update

This commit is contained in:
2024-02-07 23:36:46 +01:00
parent 4cf290c840
commit 70c249787c
16 changed files with 112 additions and 122 deletions

View File

@@ -9,15 +9,8 @@ use crate::commands::{misc::check_msg, music::misc::TrackErrorNotifier};
#[command]
#[only_in(guilds)]
async fn join(ctx: &Context, msg: &Message) -> CommandResult {
let (guild_id, channel_id) = {
let guild = msg.guild(&ctx.cache).unwrap();
let channel_id = guild
.voice_states
.get(&msg.author.id)
.and_then(|voice_state| voice_state.channel_id);
(guild.id, channel_id)
};
let guild_id = msg.guild_id.unwrap();
let channel_id = msg.guild(&ctx.cache).unwrap().voice_states.get(&msg.author.id).and_then(|voice_state| voice_state.channel_id);
let connect_to = match channel_id {
Some(channel) => channel,
@@ -39,4 +32,4 @@ async fn join(ctx: &Context, msg: &Message) -> CommandResult {
}
Ok(())
}
}