From 8bad9d963685e8f0fbda7df7acae350ca6159bfc Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 4 Dec 2023 09:31:14 -0500 Subject: [PATCH] feat: add descriptions to commands & arguments Signed-off-by: seth --- src/commands/general/joke.rs | 1 + src/commands/general/members.rs | 1 + src/commands/general/ping.rs | 1 + src/commands/general/rory.rs | 6 +++++- src/commands/general/say.rs | 10 ++++++++-- src/commands/general/stars.rs | 1 + src/commands/moderation/actions.rs | 4 ++-- 7 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/commands/general/joke.rs b/src/commands/general/joke.rs index f99ab1b..638db3e 100644 --- a/src/commands/general/joke.rs +++ b/src/commands/general/joke.rs @@ -3,6 +3,7 @@ use crate::Context; use color_eyre::eyre::Result; +/// It's a joke #[poise::command(slash_command, prefix_command)] pub async fn joke(ctx: Context<'_>) -> Result<()> { let joke = dadjoke::get_joke().await?; diff --git a/src/commands/general/members.rs b/src/commands/general/members.rs index 021ffa5..5498dd0 100644 --- a/src/commands/general/members.rs +++ b/src/commands/general/members.rs @@ -2,6 +2,7 @@ use crate::{consts, Context}; use color_eyre::eyre::{eyre, Result}; +/// Returns the number of members in the server #[poise::command(slash_command, prefix_command)] pub async fn members(ctx: Context<'_>) -> Result<()> { let guild = ctx.guild().ok_or_else(|| eyre!("Couldn't fetch guild!"))?; diff --git a/src/commands/general/ping.rs b/src/commands/general/ping.rs index fc9d697..4563af3 100644 --- a/src/commands/general/ping.rs +++ b/src/commands/general/ping.rs @@ -2,6 +2,7 @@ use crate::Context; use color_eyre::eyre::Result; +/// Replies with pong! #[poise::command(slash_command, prefix_command, ephemeral)] pub async fn ping(ctx: Context<'_>) -> Result<()> { ctx.reply("Pong!").await?; diff --git a/src/commands/general/rory.rs b/src/commands/general/rory.rs index 5350e32..ea62d1d 100644 --- a/src/commands/general/rory.rs +++ b/src/commands/general/rory.rs @@ -3,8 +3,12 @@ use crate::Context; use color_eyre::eyre::Result; +/// Gets a Rory photo! #[poise::command(slash_command, prefix_command)] -pub async fn rory(ctx: Context<'_>, id: Option) -> Result<()> { +pub async fn rory( + ctx: Context<'_>, + #[description = "specify a Rory ID"] id: Option, +) -> Result<()> { let resp = get_rory(id).await?; ctx.send(|m| { diff --git a/src/commands/general/say.rs b/src/commands/general/say.rs index a3f87d5..3f61fe4 100644 --- a/src/commands/general/say.rs +++ b/src/commands/general/say.rs @@ -2,8 +2,14 @@ use crate::Context; use color_eyre::eyre::{eyre, Result}; -#[poise::command(slash_command, prefix_command, ephemeral)] -pub async fn say(ctx: Context<'_>, content: String) -> Result<()> { +/// Say something through the bot +#[poise::command( + slash_command, + prefix_command, + ephemeral, + default_member_permissions = "MODERATE_MEMBERS" +)] +pub async fn say(ctx: Context<'_>, #[description = "Just content?"] content: String) -> Result<()> { let guild = ctx.guild().ok_or_else(|| eyre!("Couldn't get guild!"))?; let channel = ctx .guild_channel() diff --git a/src/commands/general/stars.rs b/src/commands/general/stars.rs index 14e4217..fef4fe8 100644 --- a/src/commands/general/stars.rs +++ b/src/commands/general/stars.rs @@ -2,6 +2,7 @@ use crate::{consts::COLORS, Context}; use color_eyre::eyre::{Context as _, Result}; +/// Returns GitHub stargazer count #[poise::command(slash_command, prefix_command)] pub async fn stars(ctx: Context<'_>) -> Result<()> { let prismlauncher = ctx diff --git a/src/commands/moderation/actions.rs b/src/commands/moderation/actions.rs index 38307d1..6f3c541 100644 --- a/src/commands/moderation/actions.rs +++ b/src/commands/moderation/actions.rs @@ -22,7 +22,7 @@ fn create_moderation_embed( |e: &mut CreateEmbed| e.title(title).fields(fields).color(COLORS["red"]) } -// ban a user +/// Ban a user #[poise::command( slash_command, prefix_command, @@ -54,7 +54,7 @@ pub async fn ban_user( Ok(()) } -// kick a user +/// Kick a user #[poise::command( slash_command, prefix_command,