diff --git a/src/commands/api.rs b/src/commands/api.rs deleted file mode 100644 index 6038d86..0000000 --- a/src/commands/api.rs +++ /dev/null @@ -1,31 +0,0 @@ -use chrono; -use crate::Error; -use serde::{Serialize, Deserialize}; - -#[derive(Debug, Serialize, Deserialize)] -struct Session { - ret_msg: String, - session_id: String, - timestamp: String, -} - -pub(crate) async fn get_random_god() -> Result<(), Error> { - let timestamp = chrono::Utc::now().format("%Y%m%d%H%M%S").to_string(); - let method = "createsession"; - let dev_id: String = std::env::var("DEV_ID") - .expect("Missing DEV_ID"); - let auth_key = std::env::var("AUTH_KEY") - .expect("Missing AUTH_KEY"); - - let hash = md5::compute(format!("{}{}{}{}", dev_id, method, auth_key, timestamp)); - let signature = format!("{:x}", hash); - - let request = format!("https://api.smitegame.com/smiteapi.svc/createsessionJson/{}/{}/{}", dev_id, signature, timestamp); - println!("{}", request); - let response = reqwest::get(&request).await?; - - let sessions: Vec = response.json().await?; - println!("{:?}", sessions); - - Ok(()) -} diff --git a/src/commands/random.rs b/src/commands/random.rs deleted file mode 100644 index 8577d44..0000000 --- a/src/commands/random.rs +++ /dev/null @@ -1,31 +0,0 @@ -use crate::{Context, Error}; - -use crate::commands::api::get_random_god; - -/// Picks a random something -#[poise::command(slash_command, subcommands("god", "mode"))] -pub(crate) async fn random( - _ctx: Context<'_>, -) -> Result<(), Error> { - Ok(()) -} - -/// Picks a random god -#[poise::command(slash_command)] -pub(crate) async fn god( - ctx: Context<'_>, -) -> Result<(), Error> { - let god = "some god"; - get_random_god().await?; - // ctx.say(format!("{}", god)).await?; - Ok(()) -} - -/// Picks a random mode -#[poise::command(slash_command)] -pub(crate) async fn mode( - ctx: Context<'_>, -) -> Result<(), Error> { - ctx.say("Waiting for that sweet API access.").await?; - Ok(()) -}