discord-ferris-macros

Crates.iodiscord-ferris-macros
lib.rsdiscord-ferris-macros
version0.1.0
created_at2025-08-18 21:29:55.366727+00
updated_at2025-08-18 21:29:55.366727+00
descriptionProcedural macros for discord-ferris πŸ¦€ (Internal Crate)
homepage
repositoryhttps://github.com/andrewdotdev/discord-ferris
max_upload_size
id1801123
size9,290
Andrew (andrewdotdev)

documentation

https://docs.rs/discord-ferris

README

discord-ferris-macros

Procedural macros for discord-ferris.

Note: Experimental, APIs may change.

+ #[event_handler] β€” register on_* Gateway events
+ Short signatures (type inference)
! More convenience attributes (planned)
- Derives / Builders

Install

You don’t need to add this crate directly β€” discord-ferris re-exports the macros.

[dependencies]
discord-ferris = "0.x"

Usage

use discord_ferris::prelude::*;

#[event_handler]
async fn on_ready(ctx, ready) {
    log!("OK", "Logged as {}", ready.user.username);
}

#[event_handler]
async fn on_message_create(ctx, mc) {
    if mc.is_bot() { return; }
    if mc.message.content == "!ping" {
        let _ = ctx.reply("PONG!").await;
    }
}

Conventions

  • Function names start with on_ and map to Gateway events: on_ready β†’ READY, on_message_create β†’ MESSAGE_CREATE.
  • Signature: #[event_handler] async fn on_<event>(ctx[, payload]) β€” payload is inferred from the name and can be omitted.
Commit count: 0

cargo fmt