block commands in DM
This commit is contained in:
parent
651ad9dffe
commit
f3c6db036e
@ -13,7 +13,8 @@ use crate::{
|
||||
slash_command,
|
||||
rename = "upload",
|
||||
category = "Manage",
|
||||
default_member_permissions = "MANAGE_GUILD"
|
||||
default_member_permissions = "MANAGE_GUILD",
|
||||
guild_only = true
|
||||
)]
|
||||
pub async fn upload_new_sound(
|
||||
ctx: Context<'_>,
|
||||
@ -100,7 +101,12 @@ pub async fn upload_new_sound(
|
||||
}
|
||||
|
||||
/// Delete a sound you have uploaded
|
||||
#[poise::command(slash_command, rename = "delete", category = "Manage")]
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
rename = "delete",
|
||||
category = "Manage",
|
||||
guild_only = true
|
||||
)]
|
||||
pub async fn delete_sound(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Name or ID of sound to delete"]
|
||||
@ -153,7 +159,12 @@ pub async fn delete_sound(
|
||||
}
|
||||
|
||||
/// Change a sound between public and private
|
||||
#[poise::command(slash_command, rename = "public", category = "Manage")]
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
rename = "public",
|
||||
category = "Manage",
|
||||
guild_only = true
|
||||
)]
|
||||
pub async fn change_public(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Name or ID of sound to change privacy setting of"]
|
||||
@ -196,7 +207,12 @@ pub async fn change_public(
|
||||
}
|
||||
|
||||
/// Download a sound file from the bot
|
||||
#[poise::command(slash_command, rename = "download", category = "Manage")]
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
rename = "download",
|
||||
category = "Manage",
|
||||
guild_only = true
|
||||
)]
|
||||
pub async fn download_file(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Name or ID of sound to download"]
|
||||
|
@ -10,7 +10,7 @@ use crate::{
|
||||
};
|
||||
|
||||
/// Play a sound in your current voice channel
|
||||
#[poise::command(slash_command, default_member_permissions = "SPEAK")]
|
||||
#[poise::command(slash_command, default_member_permissions = "SPEAK", guild_only = true)]
|
||||
pub async fn play(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Name or ID of sound to play"]
|
||||
@ -38,7 +38,12 @@ pub async fn play(
|
||||
}
|
||||
|
||||
/// Play up to 25 sounds on queue
|
||||
#[poise::command(slash_command, rename = "queue", default_member_permissions = "SPEAK")]
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
rename = "queue",
|
||||
default_member_permissions = "SPEAK",
|
||||
guild_only = true
|
||||
)]
|
||||
pub async fn queue_play(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Name or ID for queue position 1"]
|
||||
@ -199,7 +204,12 @@ pub async fn queue_play(
|
||||
}
|
||||
|
||||
/// Loop a sound in your current voice channel
|
||||
#[poise::command(slash_command, rename = "loop", default_member_permissions = "SPEAK")]
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
rename = "loop",
|
||||
default_member_permissions = "SPEAK",
|
||||
guild_only = true
|
||||
)]
|
||||
pub async fn loop_play(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Name or ID of sound to loop"]
|
||||
@ -231,7 +241,8 @@ pub async fn loop_play(
|
||||
slash_command,
|
||||
rename = "soundboard",
|
||||
category = "Play",
|
||||
default_member_permissions = "SPEAK"
|
||||
default_member_permissions = "SPEAK",
|
||||
guild_only = true
|
||||
)]
|
||||
pub async fn soundboard(
|
||||
ctx: Context<'_>,
|
||||
|
@ -27,13 +27,13 @@ fn format_search_results<'a>(search_results: Vec<Sound>) -> CreateReply<'a> {
|
||||
}
|
||||
|
||||
/// Show uploaded sounds
|
||||
#[poise::command(slash_command, rename = "list")]
|
||||
#[poise::command(slash_command, rename = "list", guild_only = true)]
|
||||
pub async fn list_sounds(_ctx: Context<'_>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Show the sounds uploaded to this server
|
||||
#[poise::command(slash_command, rename = "server")]
|
||||
#[poise::command(slash_command, rename = "server", guild_only = true)]
|
||||
pub async fn list_guild_sounds(ctx: Context<'_>) -> Result<(), Error> {
|
||||
let sounds;
|
||||
let mut message_buffer;
|
||||
@ -68,7 +68,7 @@ pub async fn list_guild_sounds(ctx: Context<'_>) -> Result<(), Error> {
|
||||
}
|
||||
|
||||
/// Show all sounds you have uploaded
|
||||
#[poise::command(slash_command, rename = "user")]
|
||||
#[poise::command(slash_command, rename = "user", guild_only = true)]
|
||||
pub async fn list_user_sounds(ctx: Context<'_>) -> Result<(), Error> {
|
||||
let sounds;
|
||||
let mut message_buffer;
|
||||
@ -103,7 +103,12 @@ pub async fn list_user_sounds(ctx: Context<'_>) -> Result<(), Error> {
|
||||
}
|
||||
|
||||
/// Search for sounds
|
||||
#[poise::command(slash_command, rename = "search", category = "Search")]
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
rename = "search",
|
||||
category = "Search",
|
||||
guild_only = true
|
||||
)]
|
||||
pub async fn search_sounds(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Sound name to search for"] query: String,
|
||||
@ -123,7 +128,7 @@ pub async fn search_sounds(
|
||||
}
|
||||
|
||||
/// Show a page of random sounds
|
||||
#[poise::command(slash_command, rename = "random")]
|
||||
#[poise::command(slash_command, rename = "random", guild_only = true)]
|
||||
pub async fn show_random_sounds(ctx: Context<'_>) -> Result<(), Error> {
|
||||
let search_results = sqlx::query_as_unchecked!(
|
||||
Sound,
|
||||
|
@ -4,7 +4,7 @@ use crate::{
|
||||
};
|
||||
|
||||
/// Change the bot's volume in this server
|
||||
#[poise::command(slash_command, rename = "volume")]
|
||||
#[poise::command(slash_command, rename = "volume", guild_only = true)]
|
||||
pub async fn change_volume(
|
||||
ctx: Context<'_>,
|
||||
#[description = "New volume as a percentage"] volume: Option<usize>,
|
||||
@ -32,7 +32,7 @@ pub async fn change_volume(
|
||||
}
|
||||
|
||||
/// Manage greet sounds on this server
|
||||
#[poise::command(slash_command, rename = "greet")]
|
||||
#[poise::command(slash_command, rename = "greet", guild_only = true)]
|
||||
pub async fn greet_sound(_ctx: Context<'_>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
@ -70,7 +70,7 @@ pub async fn set_greet_sound(
|
||||
}
|
||||
|
||||
/// Set a join sound
|
||||
#[poise::command(slash_command, rename = "unset")]
|
||||
#[poise::command(slash_command, rename = "unset", guild_only = true)]
|
||||
pub async fn unset_greet_sound(ctx: Context<'_>) -> Result<(), Error> {
|
||||
ctx.data().update_join_sound(ctx.author().id, None).await;
|
||||
|
||||
@ -80,7 +80,7 @@ pub async fn unset_greet_sound(ctx: Context<'_>) -> Result<(), Error> {
|
||||
}
|
||||
|
||||
/// Disable greet sounds on this server
|
||||
#[poise::command(slash_command, rename = "disable")]
|
||||
#[poise::command(slash_command, rename = "disable", guild_only = true)]
|
||||
pub async fn disable_greet_sound(ctx: Context<'_>) -> Result<(), Error> {
|
||||
let guild_data_opt = ctx.guild_data(ctx.guild_id().unwrap()).await;
|
||||
|
||||
@ -97,7 +97,7 @@ pub async fn disable_greet_sound(ctx: Context<'_>) -> Result<(), Error> {
|
||||
}
|
||||
|
||||
/// Enable greet sounds on this server
|
||||
#[poise::command(slash_command, rename = "enable")]
|
||||
#[poise::command(slash_command, rename = "enable", guild_only = true)]
|
||||
pub async fn enable_greet_sound(ctx: Context<'_>) -> Result<(), Error> {
|
||||
let guild_data_opt = ctx.guild_data(ctx.guild_id().unwrap()).await;
|
||||
|
||||
|
@ -3,7 +3,12 @@ use songbird;
|
||||
use crate::{Context, Error};
|
||||
|
||||
/// Stop the bot from playing and clear the play queue
|
||||
#[poise::command(slash_command, rename = "stop", default_member_permissions = "SPEAK")]
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
rename = "stop",
|
||||
default_member_permissions = "SPEAK",
|
||||
guild_only = true
|
||||
)]
|
||||
pub async fn stop_playing(ctx: Context<'_>) -> Result<(), Error> {
|
||||
let songbird = songbird::get(ctx.discord()).await.unwrap();
|
||||
let call_opt = songbird.get(ctx.guild_id().unwrap());
|
||||
@ -20,7 +25,7 @@ pub async fn stop_playing(ctx: Context<'_>) -> Result<(), Error> {
|
||||
}
|
||||
|
||||
/// Disconnect the bot
|
||||
#[poise::command(slash_command, default_member_permissions = "SPEAK")]
|
||||
#[poise::command(slash_command, default_member_permissions = "SPEAK", guild_only = true)]
|
||||
pub async fn disconnect(ctx: Context<'_>) -> Result<(), Error> {
|
||||
let songbird = songbird::get(ctx.discord()).await.unwrap();
|
||||
let _ = songbird.leave(ctx.guild_id().unwrap()).await;
|
||||
|
Loading…
Reference in New Issue
Block a user