omegga

Crates.ioomegga
lib.rsomegga
version1.0.0
sourcesrc
created_at2021-06-30 03:53:38.545721
updated_at2022-04-26 17:53:29.319289
descriptionExperimental RPC interface for Omegga
homepage
repository
max_upload_size
id416420
size59,087
Zander (voximity)

documentation

README

omegga-rs

Omegga RPC interface library for Rust.

Usage

To enable support for serializing/deserializing into brickadia-rs save objects, use the optional feature brs:

omegga = { version = "1.0", features = "brs" }

The following is a sample plugin:

use omegga::{events::Event, Omegga};

#[tokio::main]
async fn main() {
    let omegga = Omegga::new();
    let mut events = omegga.spawn();

    while let Some(event) = events.recv().await {
        match event {
            // Register our commands on init...
            Event::Init { id, .. } => omegga.register_commands(id, &["ping"]),

            // Send a blank response when we're told to stop...
            Event::Stop { id, .. } => omegga.write_response(id, None, None),

            // Listen to commands sent to the plugin...
            Event::Command {
                player, command, ..
            } => match command.as_str() {
                // When the command matches `ping`, send `Pong!`
                "ping" => omegga.whisper(player, "Pong!"),
                _ => (),
            },

            _ => (),
        }
    }
}

It is recommended to check the Omegga RPC reference.

Credits

  • voximity - creator, maintainer
  • Meshiest - Omegga
Commit count: 0

cargo fmt