Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for using macros as values in poise::command attribute #288

Open
valentinegb opened this issue Jul 16, 2024 · 0 comments
Open

Allow for using macros as values in poise::command attribute #288

valentinegb opened this issue Jul 16, 2024 · 0 comments

Comments

@valentinegb
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant