Skip to content

Commit

Permalink
Make multiple aliases actually work
Browse files Browse the repository at this point in the history
  • Loading branch information
Scotsguy committed Feb 15, 2020
1 parent 7876525 commit e663674
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ use serenity::{
use log::{debug, error};

macro_rules! static_text_command {
( $($name:ident $($aliases:ident)*, $title:tt, $message:tt;)+ ) => {
#[group]
#[commands( $($name,)* )]
( $($name:ident $($($aliases:ident)+)?, $title:tt, $message:tt;)+ ) => {
#[group("Text")]
#[commands( $($name),* )]
struct StaticText;

$(
#[command]
$(#[aliases($aliases)])*
$( #[aliases($($aliases),+)] )?
#[only_in("guilds")]
fn $name(ctx: &mut Context, msg: &Message, _: Args) -> CommandResult {
if let Err(why) = msg.channel_id.send_message(&ctx.http, |m| {
m.embed(|e| {
Expand All @@ -41,14 +42,15 @@ macro_rules! static_text_command {
}

macro_rules! static_image_command {
( $($name:ident $($aliases:ident)*, $image:tt$(, $message:tt)?;)+ ) => {
#[group]
( $($name:ident $($($aliases:ident)+)?, $image:tt$(, $message:tt)?;)+ ) => {
#[group("Images")]
#[commands( $($name,)* )]
struct StaticImage;

$(
#[command]
$(#[aliases($aliases)])*
$( #[aliases($($aliases),+)] )?
#[only_in("guilds")]
fn $name(ctx: &mut Context, msg: &Message, _: Args) -> CommandResult {
if let Err(why) = msg.channel_id.send_message(&ctx.http, |m| {
m.embed(|e| {
Expand Down

0 comments on commit e663674

Please sign in to comment.