mirror of
https://github.com/eRgo35/lyra.git
synced 2026-02-04 20:36:10 +01:00
0.5.1 refractor
This commit is contained in:
@@ -1,29 +1,28 @@
|
||||
use crate::{commands::embeds::{error_embed, embed}, Context, Error};
|
||||
use crate::commands::music::notifier::TrackErrorNotifier;
|
||||
use crate::{
|
||||
commands::embeds::{embed, error_embed},
|
||||
Context, Error,
|
||||
};
|
||||
use poise::CreateReply;
|
||||
use songbird::TrackEvent;
|
||||
use crate::commands::music::notifier::TrackErrorNotifier;
|
||||
|
||||
/// Joins your voice channel
|
||||
#[poise::command(
|
||||
prefix_command,
|
||||
slash_command,
|
||||
category = "Music"
|
||||
)]
|
||||
pub async fn join(
|
||||
ctx: Context<'_>
|
||||
) -> Result<(), Error> {
|
||||
#[poise::command(prefix_command, slash_command, category = "Music")]
|
||||
pub async fn join(ctx: Context<'_>) -> Result<(), Error> {
|
||||
let guild_id = ctx.guild_id().unwrap();
|
||||
let channel_id = ctx.guild().unwrap()
|
||||
.voice_states.get(&ctx.author().id)
|
||||
let channel_id = ctx
|
||||
.guild()
|
||||
.unwrap()
|
||||
.voice_states
|
||||
.get(&ctx.author().id)
|
||||
.and_then(|voice_state| voice_state.channel_id);
|
||||
|
||||
let connect_to = match channel_id {
|
||||
Some(channel) => channel,
|
||||
None => {
|
||||
let msg = "I am not in a voice channel!";
|
||||
ctx.send(
|
||||
CreateReply::default().embed(error_embed(ctx, msg).await.unwrap())
|
||||
).await?;
|
||||
ctx.send(CreateReply::default().embed(error_embed(ctx, msg).await.unwrap()))
|
||||
.await?;
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
@@ -38,9 +37,8 @@ pub async fn join(
|
||||
handler.add_global_event(TrackEvent::Error.into(), TrackErrorNotifier);
|
||||
}
|
||||
|
||||
ctx.send(
|
||||
CreateReply::default().embed(embed(ctx, "Joined!", "Hi there!", "").await.unwrap())
|
||||
).await?;
|
||||
ctx.send(CreateReply::default().embed(embed(ctx, "Joined!", "Hi there!", "").await.unwrap()))
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user