Skip to content

Commit

Permalink
moved development to env file
Browse files Browse the repository at this point in the history
  • Loading branch information
toastxc committed Jan 2, 2024
1 parent efc1f5c commit 704dd2d
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DEVEL_BOT_ID=""
DEVEL_USER_ID=""
DEVEL_BOT_TOKEN=""
DEVEL_USER_TOKEN=""
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ Cargo.lock

src/main.rs
src/tests/bot-token.txt
/.env
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ reywen_http = { version = "0.1.18", features = ["serde"]}
native-tls = "0.2.11"
url = "2.5.0"

# development
dotenv = "0.15.0"

[features]
# engine option | mandatory
default = ["reywen_http/hyper_engine"]
Expand Down
Empty file removed src/tests/bot-id.txt
Empty file.
1 change: 0 additions & 1 deletion src/tests/bot-token.txt

This file was deleted.

18 changes: 13 additions & 5 deletions src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ pub mod session;
pub mod users;
pub mod websocket;

use std::env;
use dotenv::*;
use crate::client::Client;
pub mod emoji;

Expand All @@ -19,19 +21,25 @@ pub const USER_NOTSELF: &str = "01H2PWB11T4DY3E76Y8PHFT3EX";
// enter values here for testing

pub fn tester_bot() -> Client {
dotenv().ok();

Client::from_token(
include_str!("bot-token.txt").replace([' ', '\n'], ""),
include_str!("bot-id.txt").replace([' ', '\n'], ""),

env::var("DEVEL_BOT_TOKEN").unwrap(),
env::var("DEVEL_BOT_ID").unwrap(),

true,
)
.unwrap()
}

pub fn tester_user() -> Client {
dotenv().ok();
Client::from_token(
include_str!("self-token.txt").replace([' ', '\n'], ""),
include_str!("self-id.txt").replace([' ', '\n'], ""),
true,
env::var("DEVEL_USER_TOKEN").unwrap(),
env::var("DEVEL_USER_ID").unwrap(),

false,
)
.unwrap()
}
1 change: 0 additions & 1 deletion src/tests/self-token.txt

This file was deleted.

0 comments on commit 704dd2d

Please sign in to comment.