From 2b81a621de1c0e698661f17d97ab79838bccdf9f Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Tue, 9 Jan 2024 19:45:15 -0600 Subject: [PATCH] add readme --- Cargo.toml | 2 +- README.md | 24 ++++++++++++++++++++++++ src/main.rs | 5 +++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/Cargo.toml b/Cargo.toml index 1f95201..5f882a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" anyhow = "1.0.79" async-trait = "0.1.77" chrono = { version = "0.4.31", features = ["serde"] } -clap = { version = "4.4.14", features = ["derive"] } +clap = { version = "4.4.14", features = ["derive", "env"] } dotenv = "0.15.0" reqwest = { version = "0.11.23", features = ["json"] } serde = { version = "1.0.195", features = ["derive"] } diff --git a/README.md b/README.md new file mode 100644 index 0000000..3afd463 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +ctftime discord bot +=== + +This bot updates a Discord server's upcoming event list with events from [CTFTime]. + +Usage +--- + +If my instance of the bot is still running, you can try adding it from here: https://discord.com/api/oauth2/authorize?client_id=1194435779531915355&permissions=17600776112128&scope=bot + +To self host, you need a Rust toolchain. + +``` +cargo run --release +``` + +Contact +--- + +Author: Michael Zhang + +License: AGPL-3.0 + +[ctftime]: https://ctftime.org \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index b65bbfd..85537a8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,7 +28,12 @@ use crate::each_guild::each_guild_update_events; #[derive(Debug, Parser)] struct Opt { /// Refresh rate (in seconds, defaults to 1 day) + #[clap(long = "refresh-rate")] refresh_rate: Option, + + /// Discord bot token (reads from .env files as well) + #[clap(env, long = "discord-token")] + discord_token: String, } #[derive(Default, Clone)]