disconnect command
This commit is contained in:
@ -287,14 +287,7 @@ impl Framework for RegexFramework {
|
||||
|
||||
let member = guild.member(&ctx, &msg.author).await.unwrap();
|
||||
|
||||
info!(
|
||||
"Starting permission check for {} ({})",
|
||||
command.name, msg.content
|
||||
);
|
||||
|
||||
if command.check_permissions(&ctx, &guild, &member).await {
|
||||
info!("Check on {} ({}) passed", command.name, msg.content);
|
||||
|
||||
(command.func)(
|
||||
&ctx,
|
||||
&msg,
|
||||
@ -310,8 +303,6 @@ impl Framework for RegexFramework {
|
||||
.say(&ctx, "You must be an Admin to do this command")
|
||||
.await;
|
||||
}
|
||||
|
||||
info!("Finished executing {} ({})", command.name, msg.content);
|
||||
}
|
||||
|
||||
PermissionCheck::None => {
|
||||
|
18
src/main.rs
18
src/main.rs
@ -324,6 +324,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
.add_command("play", &PLAY_COMMAND)
|
||||
.add_command("p", &PLAY_COMMAND)
|
||||
.add_command("stop", &STOP_PLAYING_COMMAND)
|
||||
.add_command("disconnect", &DISCONNECT_COMMAND)
|
||||
.add_command("dc", &DISCONNECT_COMMAND)
|
||||
// sound management commands
|
||||
.add_command("upload", &UPLOAD_NEW_SOUND_COMMAND)
|
||||
.add_command("delete", &DELETE_SOUND_COMMAND)
|
||||
@ -444,7 +446,7 @@ async fn help(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
|
||||
.color(THEME_COLOR)
|
||||
.description(description)
|
||||
.field("Info", "`help` `info` `invite` `donate`", false)
|
||||
.field("Play", "`play` `p` `stop` `loop`", false)
|
||||
.field("Play", "`play` `p` `stop` `dc` `loop`", false)
|
||||
.field("Manage", "`upload` `delete` `list` `public`", false)
|
||||
.field("Settings", "`prefix` `roles` `volume` `allow_greet`", false)
|
||||
.field("Search", "`search` `random` `popular`", false)
|
||||
@ -474,6 +476,7 @@ async fn help(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
|
||||
`p` - an alias for `play`
|
||||
|
||||
`stop` - stop the bot from playing
|
||||
`dc` - disconnect the bot from the current channel
|
||||
|
||||
`loop [sound]` - play a sound matching the name \"sound\" on loop
|
||||
`loop [id]` - play a sound matching the numerical ID `id` on loop
|
||||
@ -742,6 +745,17 @@ async fn stop_playing(ctx: &Context, msg: &Message, _args: Args) -> CommandResul
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[command]
|
||||
#[permission_level(Managed)]
|
||||
async fn disconnect(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
||||
let guild_id = msg.guild_id.unwrap();
|
||||
|
||||
let songbird = songbird::get(ctx).await.unwrap();
|
||||
let _ = songbird.leave(guild_id).await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[command]
|
||||
async fn info(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
||||
let current_user = ctx.cache.current_user().await;
|
||||
@ -770,7 +784,7 @@ Find me on https://discord.jellywx.com/ and on https://github.com/JellyWX :)
|
||||
\"Small River 1 - Fast - Close\" https://freesound.org/people/Pfannkuchn/
|
||||
|
||||
**An online dashboard is available!** Visit https://soundfx.jellywx.com/dashboard
|
||||
There is a maximum sound limit per user. This can be removed by donating at https://patreon.com/jellywx", current_user.name, current_user.id.as_u64())))).await?;
|
||||
There is a maximum sound limit per user. This can be removed by subscribing at **https://patreon.com/jellywx**", current_user.name, current_user.id.as_u64())))).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user