From 113aa2942d301b1bc8b87a0d557a35dee4479cec Mon Sep 17 00:00:00 2001 From: tec <tec@ucc.gu.uwa.edu.au> Date: Fri, 31 Jan 2020 22:44:00 +0800 Subject: [PATCH] Fix file-weirdness with config.rs (was symlink) --- src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 120000 => 100644 src/config.rs diff --git a/src/config.rs b/src/config.rs deleted file mode 120000 index 3290df3..0000000 --- a/src/config.rs +++ /dev/null @@ -1,47 +0,0 @@ -use serenity; -use std::fs; -use serde::Deserialize; -use toml; - -lazy_static! { - static ref CONFIG_FILE: String = fs::read_to_string("config.toml").unwrap(); -} - -lazy_static! { - pub static ref CONFIG: UccbotConfig = toml::from_str(&CONFIG_FILE).unwrap(); -} - -#[derive(Deserialize)] -pub struct UccbotConfig { - pub server_id: u64, - // #general - pub main_channel: serenity::model::id::ChannelId, - // #the-corner - pub welcome_channel: serenity::model::id::ChannelId, - // #general - pub announcement_channel: serenity::model::id::ChannelId, - pub bot_id: u64, - pub vote_pool_size: i8, - pub vote_role: u64, - pub tiebreaker_role: u64, - pub unregistered_member_role: u64, - pub registered_member_role: u64, - pub command_prefix: &'static str, - pub for_vote: &'static str, - pub against_vote: &'static str, - pub abstain_vote: &'static str, - pub approve_react: &'static str, - pub disapprove_react: &'static str, - pub unsure_react: &'static str, -} - -impl UccbotConfig { - pub fn allowed_reacts(&self) -> Vec<String> { - vec!(self.for_vote.to_string(), - self.against_vote.to_string(), - self.abstain_vote.to_string(), - self.approve_react.to_string(), - self.disapprove_react.to_string(), - self.unsure_react.to_string()) - } -} \ No newline at end of file diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..5cb89d5 --- /dev/null +++ b/src/config.rs @@ -0,0 +1,47 @@ +use serenity; +use std::fs; +use serde::Deserialize; +use toml; + +lazy_static! { + static ref CONFIG_FILE: String = fs::read_to_string("config.toml").unwrap(); +} + +lazy_static! { + pub static ref CONFIG: UccbotConfig = toml::from_str(&CONFIG_FILE).unwrap(); +} + +#[derive(Deserialize)] +pub struct UccbotConfig { + pub server_id: u64, + // #general + pub main_channel: serenity::model::id::ChannelId, + // #the-corner + pub welcome_channel: serenity::model::id::ChannelId, + // #general + pub announcement_channel: serenity::model::id::ChannelId, + pub bot_id: u64, + pub vote_pool_size: i8, + pub vote_role: u64, + pub tiebreaker_role: u64, + pub unregistered_member_role: u64, + pub registered_member_role: u64, + pub command_prefix: &'static str, + pub for_vote: &'static str, + pub against_vote: &'static str, + pub abstain_vote: &'static str, + pub approve_react: &'static str, + pub disapprove_react: &'static str, + pub unsure_react: &'static str, +} + +impl UccbotConfig { + pub fn allowed_reacts(&self) -> Vec<String> { + vec!(self.for_vote.to_string(), + self.against_vote.to_string(), + self.abstain_vote.to_string(), + self.approve_react.to_string(), + self.disapprove_react.to_string(), + self.unsure_react.to_string()) + } +} -- GitLab