poise icon indicating copy to clipboard operation
poise copied to clipboard

Allow for using macros as values in `poise::command` attribute

Open valentinegb opened this issue 7 months ago • 0 comments

I'm creating a simple macro for convenience where I wrote the following:

// ($name is ident)
#[command(slash_command, rename = stringify!($name), ephemeral)]

However, I receive the following error:

error: Unexpected type `macro`
   --> src/commands/config.rs:396:47
    |
396 |               #[command(slash_command, rename = stringify!($name), ephemeral)]
    |                                                 ^^^^^^^^^

I don't have this problem usually, like with, for example, #[doc = stringify($name)]. It seems like the only way around this for me is to have another argument to my macro, which is exactly the same as $name but is a string literal, which is obviously not very clean.

valentinegb avatar Jul 16 '24 19:07 valentinegb