diff options
| author | Nathan Perry <avaglir@gmail.com> | 2019-03-08 16:57:27 -0500 |
|---|---|---|
| committer | Nathan Perry <avaglir@gmail.com> | 2019-03-08 16:57:27 -0500 |
| commit | 86025df1f6d814c98a14211ceb4da6cf6de915c7 (patch) | |
| tree | c615b6634eea05498d772f68aec2d52fa3ca4f01 /src/main.rs | |
| parent | 24a7cb3c8eb0517b69c145170765c891a82ccc76 (diff) | |
first pass with oauth
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index 4515c6d..598b94f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,12 +13,17 @@ extern crate dotenv; extern crate either; #[macro_use] extern crate failure; extern crate fern; +extern crate fnv; #[cfg_attr(test, macro_use)] extern crate itertools; #[macro_use] extern crate lazy_static; #[macro_use] extern crate log; #[macro_use] extern crate nom; +#[cfg(feature = "games")] +extern crate oauth2; extern crate rand; extern crate regex; +extern crate reqwest; +#[macro_use] extern crate serde; extern crate serde_json; extern crate serenity; extern crate sha1; @@ -45,7 +50,7 @@ use serenity::{ }, model::{ gateway::Ready, - id::{GuildId, UserId}, + id::{ChannelId, GuildId, UserId}, }, prelude::*, }; @@ -56,6 +61,19 @@ pub use self::util::*; #[cfg(feature = "diesel")] mod db; +#[cfg(feature = "games")] +mod game; + +#[cfg(not(feature = "games"))] +mod game { + use serenity::framework::StandardFramework; + + #[inline] + fn register(f: StandardFramework) -> StandardFramework { + return f + } +} + mod commands; mod util; mod audio; @@ -65,6 +83,7 @@ pub type Result<T> = ::std::result::Result<T, Error>; lazy_static! { static ref TARGET_GUILD: u64 = dotenv!("TARGET_GUILD").parse().expect("unable to parse TARGET_GUILD as u64"); static ref TARGET_GUILD_ID: GuildId = GuildId(*TARGET_GUILD); + static ref VOICE_CHANNEL_ID: ChannelId = ChannelId(must_env_lookup::<u64>("VOICE_CHANNEL")); } struct Handler; @@ -132,6 +151,8 @@ fn run() -> Result<()> { }); framework = register_commands(framework); + framework = game::register(framework); + client.with_framework(framework); let shard_manager = client.shard_manager.clone(); |
