Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 26 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2024"
anyhow = "1.0.100"
chrono = "0.4.42"
config = { version = "0.15.19", default-features = false }
poise = "0.6.1"
poise = { git = "https://github.com/serenity-rs/poise" }
regex = "1.12.2"
serde = { version = "1.0.228", features = ["derive"] }
sqlx = { version = "0.8.6", features = ["chrono", "runtime-tokio", "sqlite"] }
Expand Down
6 changes: 5 additions & 1 deletion src/command/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ use poise::serenity_prelude as serenity;

use crate::{Context, Message, database, util};

/// Add one or more candidate IDs to the candidates database from a text file.
#[tracing::instrument]
#[poise::command(slash_command, prefix_command, ephemeral)]
pub async fn add(ctx: Context<'_>, id: serenity::Attachment) -> Result<()> {
pub async fn add(
ctx: Context<'_>,
#[description = "Text file with candidate IDs (one per line, UTF‑8)"] id: serenity::Attachment,
) -> Result<()> {
let pool = &ctx.data().pool;

let id = id.download().await?;
Expand Down
6 changes: 5 additions & 1 deletion src/command/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ use anyhow::Result;

use crate::{Context, Message, database, util};

/// Delete a candidate by ID from the candidates database.
#[tracing::instrument]
#[poise::command(slash_command, prefix_command, ephemeral)]
pub async fn delete(ctx: Context<'_>, id: String) -> Result<()> {
pub async fn delete(
ctx: Context<'_>,
#[description = "Candidate ID to delete"] id: String,
) -> Result<()> {
let pool = &ctx.data().pool;

if !util::is_valid_id(&id) {
Expand Down
6 changes: 3 additions & 3 deletions src/command/help.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use anyhow::Result;
use poise::builtins::HelpConfiguration;
use poise::builtins::PrettyHelpConfiguration;

use crate::Context;

#[tracing::instrument]
#[poise::command(slash_command, prefix_command, ephemeral)]
pub async fn help(ctx: Context<'_>, command: Option<String>) -> Result<()> {
let configuration = HelpConfiguration::default();
poise::builtins::help(ctx, command.as_deref(), configuration).await?;
let configuration = PrettyHelpConfiguration::default();
poise::builtins::pretty_help(ctx, command.as_deref(), configuration).await?;

Ok(())
}
1 change: 1 addition & 0 deletions src/command/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use anyhow::Result;

use crate::Context;

/// Test if bot is responsive
#[tracing::instrument]
#[poise::command(slash_command, prefix_command, ephemeral)]
pub async fn ping(ctx: Context<'_>) -> Result<()> {
Expand Down
1 change: 1 addition & 0 deletions src/command/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::{Context, Message, database, util};

const ROLE: &str = "Round 1: Challenger";

/// Verify a candidate and assign role upon success.
#[tracing::instrument]
#[poise::command(slash_command, prefix_command, ephemeral)]
pub async fn verify(ctx: Context<'_>, id: String) -> Result<()> {
Expand Down