update bot to use a prefix argument
This commit is contained in:
@@ -8,4 +8,5 @@ poise = "0.6.1"
|
|||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
dotenv = "0.15.0"
|
dotenv = "0.15.0"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
|
clap = { version = "4.5.20", features = ["derive"] }
|
||||||
lamm = { git = "https://github.com/minneelyyyy/lamm", branch = "dev" }
|
lamm = { git = "https://github.com/minneelyyyy/lamm", branch = "dev" }
|
||||||
|
|||||||
@@ -8,4 +8,4 @@ RUN cargo install --path .
|
|||||||
FROM ubuntu:24.10
|
FROM ubuntu:24.10
|
||||||
COPY --from=builder /usr/local/cargo/bin/bot /usr/local/bin/bot
|
COPY --from=builder /usr/local/cargo/bin/bot /usr/local/bin/bot
|
||||||
|
|
||||||
CMD ["bot"]
|
ENTRYPOINT ["bot"]
|
||||||
|
|||||||
12
src/main.rs
12
src/main.rs
@@ -10,9 +10,19 @@ use std::sync::Arc;
|
|||||||
use poise::serenity_prelude as serenity;
|
use poise::serenity_prelude as serenity;
|
||||||
use tokio::sync::Mutex;
|
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]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), Error> {
|
async fn main() -> Result<(), Error> {
|
||||||
dotenv::dotenv().ok();
|
dotenv::dotenv().ok();
|
||||||
|
let args = BotArgs::parse();
|
||||||
|
|
||||||
let token = env::var("DISCORD_BOT_TOKEN")?;
|
let token = env::var("DISCORD_BOT_TOKEN")?;
|
||||||
let intents = serenity::GatewayIntents::all();
|
let intents = serenity::GatewayIntents::all();
|
||||||
@@ -21,7 +31,7 @@ async fn main() -> Result<(), Error> {
|
|||||||
.options(poise::FrameworkOptions {
|
.options(poise::FrameworkOptions {
|
||||||
commands: commands::commands(),
|
commands: commands::commands(),
|
||||||
prefix_options: poise::PrefixFrameworkOptions {
|
prefix_options: poise::PrefixFrameworkOptions {
|
||||||
prefix: Some("%".into()),
|
prefix: args.prefix,
|
||||||
edit_tracker: Some(Arc::new(
|
edit_tracker: Some(Arc::new(
|
||||||
poise::EditTracker::for_timespan(std::time::Duration::from_secs(3600)))),
|
poise::EditTracker::for_timespan(std::time::Duration::from_secs(3600)))),
|
||||||
case_insensitive_commands: true,
|
case_insensitive_commands: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user