Skip to content

Commit

Permalink
deleting inventory, use own inventory implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
HadziqM committed Nov 24, 2024
1 parent 39f726e commit 7064b0e
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
23 changes: 23 additions & 0 deletions rain-bot/src/command/register/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use crate::all::*;

struct ChangePassword;

#[async_trait]
impl CommandInteractionTrait for ChangePassword {
fn name(&self) -> String {
"change_password".to_string()
}
fn command(&self) -> serenity::all::CreateCommand {
AppReg::normal_slash(self.name(), "change your in game account password")
}
async fn handle_int(
&self,
_app: Arc<App>,
_cmd: CommandInteraction,
_ctx: Context,
) -> MyResult<()> {
Ok(())
}
}

command_reg![ChangePassword];
52 changes: 52 additions & 0 deletions rain-bot/src/macros.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#[macro_export]
macro_rules! command_reg {
( $( $x:expr ),* ) => {

pub fn reg_command() -> HashMap<String, Box<dyn CommandInteractionTrait>> {
let mut _y = HashMap::new();
$(
_y.insert($x.name(), Box::new($x) as Box<dyn CommandInteractionTrait>);
)*
_y
}
};
}
#[macro_export]
macro_rules! button_reg {
( $( $x:expr ),* ) => {

pub fn reg_button() -> HashMap<String, Box<dyn ButtonInteractionTrait>> {
let mut _y = HashMap::new();
$(
_y.insert($x.name(), Box::new($x) as Box<dyn ButtonInteractionTrait>);
)*
_y
}
};
}
#[macro_export]
macro_rules! modal_reg {
( $( $x:expr ),* ) => {

pub fn reg_modal() -> HashMap<String, Box<dyn ModalInteractionTrait>> {
let mut _y = HashMap::new();
$(
_y.insert($x.name(), Box::new($x) as Box<dyn ModalInteractionTrait>);
)*
_y
}
};
}

#[macro_export]
macro_rules! reg {
($name:ident,$trait:ident ,$($x:expr),*) => {
pub fn $name() -> HashMap<String, Box<dyn $trait>> {
let mut _x = HashMap::new();
$(
_x.extend($x);
)*
_x
}
};
}

0 comments on commit 7064b0e

Please sign in to comment.