-
-
Save Texlo-Dev/98f4213a20f5e75007f68e08b1715d29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use futures::{ | |
compat::Future01CompatExt, | |
future::TryFutureExt, | |
Future, Stream, | |
}; | |
use std::sync::Arc; | |
use crate::{ | |
commands::prelude::*, | |
errors::Result, | |
}; | |
pub struct LoadoutCommand; | |
impl Command for LoadoutCommand { | |
fn info(&self) -> CommandInfo { | |
CommandInfo { | |
name: "loadout".to_string(), | |
description: "Show or set your current loadout.".to_string(), | |
guild_only: true, | |
owner_only: false, | |
usage: Some("loadout [slot] [item]".to_string()), | |
aliases: vec![] | |
} | |
} | |
fn execute(&self, mg: Message, args: Args, state: Arc<State>) { | |
spawncommand(try_cmd(mg, args, state).map_err(|why| { | |
error!("Loadout Command failed. {:?}", why); | |
})) | |
} | |
} | |
async fn try_cmd(mg: Message, mut args: Args, state: Arc<State>) -> Result<()> { | |
use futures::future::Future; | |
state.postgres.run(|mut conn| { | |
conn.prepare("SELECT slot_1, slot_2, slot_3 FROM loadouts WHERE user_id = $1") | |
.then(|st| { | |
let query = conn.query(&st.unwrap(), &[&(mg.author.id.0 as i64)]); | |
Ok(()) | |
}) | |
}); | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment