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");
|
info!("Executed command `restart` successfully");
|
||||||
Ok(())
|
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();
|
let mut rng = rand::thread_rng();
|
||||||
hot.data.children.choose(&mut rng).unwrap()
|
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");
|
info!("Executed command `deer` successfully");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ pub async fn info(ctx: Context<'_>) -> Result<(), Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Add channel to the registry
|
/// Add channel to the registry
|
||||||
#[poise::command(slash_command)]
|
#[poise::command(slash_command, required_permissions = "MANAGE_CHANNELS")]
|
||||||
pub async fn add_channel(
|
pub async fn add_channel(
|
||||||
ctx: Context<'_>,
|
ctx: Context<'_>,
|
||||||
#[description = "Selected channel"] channel: serenity::Channel,
|
#[description = "Selected channel"] channel: serenity::Channel,
|
||||||
@ -70,7 +70,7 @@ pub async fn add_channel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Remove channel from the registry
|
/// Remove channel from the registry
|
||||||
#[poise::command(slash_command)]
|
#[poise::command(slash_command, required_permissions = "MANAGE_CHANNELS")]
|
||||||
pub async fn remove_channel(
|
pub async fn remove_channel(
|
||||||
ctx: Context<'_>,
|
ctx: Context<'_>,
|
||||||
#[description = "Selected channel"] channel: serenity::Channel,
|
#[description = "Selected channel"] channel: serenity::Channel,
|
||||||
@ -90,7 +90,7 @@ pub async fn remove_channel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// List channels held in the registry
|
/// 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> {
|
pub async fn list_channels(ctx: Context<'_>) -> Result<(), Error> {
|
||||||
ctx.defer_ephemeral().await?;
|
ctx.defer_ephemeral().await?;
|
||||||
let config = &mut ctx.data().config_manager.lock().await;
|
let config = &mut ctx.data().config_manager.lock().await;
|
||||||
|
@ -88,6 +88,7 @@ async fn main() {
|
|||||||
// Dev
|
// Dev
|
||||||
shutdown(),
|
shutdown(),
|
||||||
restart(),
|
restart(),
|
||||||
|
say(),
|
||||||
// Fun
|
// Fun
|
||||||
meow(),
|
meow(),
|
||||||
whack(),
|
whack(),
|
||||||
|
Loading…
Reference in New Issue
Block a user