diff --git a/Cargo.toml b/Cargo.toml index 5b423d3..92f48f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,4 +8,5 @@ poise = "0.6.1" tokio = { version = "1", features = ["full"] } dotenv = "0.15.0" rand = "0.8.5" +clap = { version = "4.5.20", features = ["derive"] } lamm = { git = "https://github.com/minneelyyyy/lamm", branch = "dev" } diff --git a/Dockerfile b/Dockerfile index f96b859..dc61a5d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,4 +8,4 @@ RUN cargo install --path . FROM ubuntu:24.10 COPY --from=builder /usr/local/cargo/bin/bot /usr/local/bin/bot -CMD ["bot"] +ENTRYPOINT ["bot"] diff --git a/src/main.rs b/src/main.rs index 907997b..dfc2d6b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,9 +10,19 @@ use std::sync::Arc; use poise::serenity_prelude as serenity; use tokio::sync::Mutex; +use clap::Parser; + +#[derive(Parser, Debug)] +struct BotArgs { + /// Prefix for the bot (if unspecified, the bot will not have one) + #[arg(short, long)] + prefix: Option, +} + #[tokio::main] async fn main() -> Result<(), Error> { dotenv::dotenv().ok(); + let args = BotArgs::parse(); let token = env::var("DISCORD_BOT_TOKEN")?; let intents = serenity::GatewayIntents::all(); @@ -21,7 +31,7 @@ async fn main() -> Result<(), Error> { .options(poise::FrameworkOptions { commands: commands::commands(), prefix_options: poise::PrefixFrameworkOptions { - prefix: Some("%".into()), + prefix: args.prefix, edit_tracker: Some(Arc::new( poise::EditTracker::for_timespan(std::time::Duration::from_secs(3600)))), case_insensitive_commands: true,