edit perms, add say
This commit is contained in:
parent
44cb475ae3
commit
05a57be964
@ -22,3 +22,17 @@ pub async fn restart(ctx: Context<'_>) -> Result<(), Error> {
|
||||
info!("Executed command `restart` successfully");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Say a specific message
|
||||
#[poise::command(slash_command, owners_only, hide_in_help)]
|
||||
pub async fn say(
|
||||
ctx: Context<'_>,
|
||||
#[description = "The message content to send"] what: String,
|
||||
#[description = "Whether to make it ephemeral"] ephemeral: Option<bool>,
|
||||
) -> Result<(), Error> {
|
||||
if ephemeral == Some(true) {
|
||||
ctx.defer_ephemeral().await?;
|
||||
}
|
||||
ctx.say(what).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -111,7 +111,8 @@ pub async fn deer(ctx: Context<'_>) -> Result<(), Error> {
|
||||
let mut rng = rand::thread_rng();
|
||||
hot.data.children.choose(&mut rng).unwrap()
|
||||
};
|
||||
ctx.say(format!("https://reddit.com{}", &chosen_post.data.permalink)).await?;
|
||||
ctx.say(format!("https://reddit.com{}", &chosen_post.data.permalink))
|
||||
.await?;
|
||||
info!("Executed command `deer` successfully");
|
||||
Ok(())
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ pub async fn info(ctx: Context<'_>) -> Result<(), Error> {
|
||||
}
|
||||
|
||||
/// Add channel to the registry
|
||||
#[poise::command(slash_command)]
|
||||
#[poise::command(slash_command, required_permissions = "MANAGE_CHANNELS")]
|
||||
pub async fn add_channel(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Selected channel"] channel: serenity::Channel,
|
||||
@ -70,7 +70,7 @@ pub async fn add_channel(
|
||||
}
|
||||
|
||||
/// Remove channel from the registry
|
||||
#[poise::command(slash_command)]
|
||||
#[poise::command(slash_command, required_permissions = "MANAGE_CHANNELS")]
|
||||
pub async fn remove_channel(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Selected channel"] channel: serenity::Channel,
|
||||
@ -90,7 +90,7 @@ pub async fn remove_channel(
|
||||
}
|
||||
|
||||
/// List channels held in the registry
|
||||
#[poise::command(slash_command)]
|
||||
#[poise::command(slash_command, required_permissions = "MANAGE_CHANNELS")]
|
||||
pub async fn list_channels(ctx: Context<'_>) -> Result<(), Error> {
|
||||
ctx.defer_ephemeral().await?;
|
||||
let config = &mut ctx.data().config_manager.lock().await;
|
||||
|
@ -88,6 +88,7 @@ async fn main() {
|
||||
// Dev
|
||||
shutdown(),
|
||||
restart(),
|
||||
say(),
|
||||
// Fun
|
||||
meow(),
|
||||
whack(),
|
||||
|
Loading…
Reference in New Issue
Block a user