From 5c315db8c6fd62b56f5f5e9ec39194074680a662 Mon Sep 17 00:00:00 2001 From: Michael Matthews Date: Tue, 13 Jul 2021 03:08:41 -0400 Subject: [PATCH] added .env file --- .gitignore | 2 +- Cargo.lock | 7 +++++++ Cargo.toml | 1 + src/main.rs | 2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7a0ec7f..8357076 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ +.env # Added by cargo - /target diff --git a/Cargo.lock b/Cargo.lock index 6a0b5cc..deb5739 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,6 +4,7 @@ name = "Osselbot" version = "0.1.0" dependencies = [ + "dotenv", "serenity", "tokio", ] @@ -151,6 +152,12 @@ dependencies = [ "generic-array", ] +[[package]] +name = "dotenv" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" + [[package]] name = "encoding_rs" version = "0.8.28" diff --git a/Cargo.toml b/Cargo.toml index 3147f91..3f68c8f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,4 +9,5 @@ edition = "2018" [dependencies] serenity = { version = "0.10.8", default-features = false, features = ["client", "gateway", "rustls_backend", "model"] } tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } +dotenv = "0.15.0" diff --git a/src/main.rs b/src/main.rs index c42cdaf..8d11740 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,6 @@ #![allow(non_snake_case)] //Osselbot doesn't follow snake case so we need this +use dotenv::dotenv; use std::env; use serenity::{ @@ -42,6 +43,7 @@ impl EventHandler for Handler { #[tokio::main] async fn main() { + dotenv().ok(); // Configure the client with your Discord bot token in the environment. let token = env::var("DISCORD_TOKEN").expect("Expected a token in the environment");