update bot to use a prefix argument

This commit is contained in:
2024-10-28 20:02:00 -04:00
parent 0c896a721d
commit c5a114540c
3 changed files with 13 additions and 2 deletions

View File

@@ -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<String>,
}
#[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,