update bot to use a prefix argument
This commit is contained in:
12
src/main.rs
12
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<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,
|
||||
|
||||
Reference in New Issue
Block a user