[][src]Attribute Macro automate::listener

#[listener]

An event listener function. The function takes two arguments, the first being the session which contains data about the bot and methods to send instructions to discord. The second argument is the event dispatch which contains data about the event. The library will call this function each time it receives an event of the type of the second argument.

Example

This example is not tested
use automate::{Session, Error, listener};
use automate::gateway::MessageCreateDispatch;

#[listener]
async fn hello(_: &Context, _: &MessageCreateDispatch) -> Result<(), Error> {
    println!("Hello!");
    Ok(())
}