You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2b-rs/src/commands/music/join.rs

19 lines
588 B
Rust

use serenity::client::Context;
use serenity::framework::standard::macros::command;
use serenity::framework::standard::CommandResult;
use serenity::model::channel::Message;
use crate::commands::music::utils::{get_channel_for_author, join_channel};
#[command]
#[only_in(guilds)]
#[description("Joins a voice channel")]
#[usage("join")]
async fn join(ctx: &Context, msg: &Message) -> CommandResult {
let guild = msg.guild(&ctx.cache).await.unwrap();
let channel_id = get_channel_for_author(&msg.author.id, &guild)?;
join_channel(ctx, channel_id, guild.id).await;
Ok(())
}