Skip to content

Commit

Permalink
feat: add descriptions to commands & arguments
Browse files Browse the repository at this point in the history
Signed-off-by: seth <[email protected]>
  • Loading branch information
getchoo committed Dec 4, 2023
1 parent 6e33299 commit 8bad9d9
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/commands/general/joke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
Expand Down
1 change: 1 addition & 0 deletions src/commands/general/members.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!"))?;
Expand Down
1 change: 1 addition & 0 deletions src/commands/general/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
Expand Down
6 changes: 5 additions & 1 deletion src/commands/general/rory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u64>) -> Result<()> {
pub async fn rory(
ctx: Context<'_>,
#[description = "specify a Rory ID"] id: Option<u64>,
) -> Result<()> {
let resp = get_rory(id).await?;

ctx.send(|m| {
Expand Down
10 changes: 8 additions & 2 deletions src/commands/general/say.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions src/commands/general/stars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/commands/moderation/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -54,7 +54,7 @@ pub async fn ban_user(
Ok(())
}

// kick a user
/// Kick a user
#[poise::command(
slash_command,
prefix_command,
Expand Down

0 comments on commit 8bad9d9

Please sign in to comment.