From 6c8335edf9bcf3fc923bc94308c9661cc0092a80 Mon Sep 17 00:00:00 2001 From: Timothy du Heaume <timothy.duheaume@gmail.com> Date: Thu, 30 Jan 2020 22:40:10 +0900 Subject: [PATCH] load discord_token at runtime --- src/config.rs | 2 -- src/main.rs | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/config.rs b/src/config.rs index d7aad5d..3290df3 120000 --- a/src/config.rs +++ b/src/config.rs @@ -11,8 +11,6 @@ lazy_static! { pub static ref CONFIG: UccbotConfig = toml::from_str(&CONFIG_FILE).unwrap(); } -pub static DISCORD_TOKEN: &str = include_str!("discord_token"); - #[derive(Deserialize)] pub struct UccbotConfig { pub server_id: u64, diff --git a/src/main.rs b/src/main.rs index 53cb2ff..7c05828 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,7 +5,7 @@ extern crate lazy_static; extern crate log; extern crate simplelog; use simplelog::*; -use std::fs::File; +use std::fs::{File, read_to_string}; use serenity::{ model::{channel, channel::Message, gateway::Ready, guild::Member}, @@ -155,7 +155,7 @@ fn main() { // Configure the client with your Discord bot token in the environment. - let token = config::DISCORD_TOKEN; + let token = read_to_string("discord_token").unwrap(); // Create a new instance of the Client, logging in as a bot. This will // automatically prepend your bot token with "Bot ", which is a requirement -- GitLab