Feat. Adding dotenv to the project and adding the discord token via .env file

This commit is contained in:
Eoghan Conlon 2024-12-24 23:52:37 +00:00
parent 380d9cedb0
commit 64c2d46a13
4 changed files with 15 additions and 3 deletions

3
.gitignore vendored
View file

@ -1,2 +1,3 @@
/target /target
/.idea /.idea
.env

7
Cargo.lock generated
View file

@ -220,6 +220,7 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
name = "count_bot" name = "count_bot"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"dotenv",
"serenity", "serenity",
"tokio", "tokio",
] ]
@ -318,6 +319,12 @@ dependencies = [
"syn 2.0.91", "syn 2.0.91",
] ]
[[package]]
name = "dotenv"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
[[package]] [[package]]
name = "encoding_rs" name = "encoding_rs"
version = "0.8.35" version = "0.8.35"

View file

@ -4,5 +4,6 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
dotenv = "0.15.0"
serenity = "0.12.4" serenity = "0.12.4"
tokio = { version = "1.42.0", features = ["full"] } tokio = { version = "1.42.0", features = ["full"] }

View file

@ -1,3 +1,6 @@
fn main() { use dotenv::dotenv;
println!("Hello, world!"); #[tokio::main]
async fn main() {
dotenv().ok();
let token = std::env::var("TOKEN").expect("TOKEN must be set");
} }