From a9820dfd79bf24a0a6fcb2345aad6c79a21585a5 Mon Sep 17 00:00:00 2001 From: mat Date: Tue, 15 Apr 2025 22:04:43 -0430 Subject: make goto async and clean up some examples --- azalea/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'azalea/README.md') diff --git a/azalea/README.md b/azalea/README.md index de11e202..d052f7c8 100644 --- a/azalea/README.md +++ b/azalea/README.md @@ -42,9 +42,10 @@ You can just replace these with `azalea` in your code since everything from `aza ```rust,no_run //! A bot that logs chat messages sent in the server to the console. +use std::sync::Arc; + use azalea::prelude::*; use parking_lot::Mutex; -use std::sync::Arc; #[tokio::main] async fn main() { @@ -59,12 +60,15 @@ async fn main() { } #[derive(Default, Clone, Component)] -pub struct State {} +pub struct State { + pub messages_received: Arc> +} async fn handle(bot: Client, event: Event, state: State) -> anyhow::Result<()> { match event { Event::Chat(m) => { println!("{}", m.message().to_ansi()); + *state.messages_received.lock() += 1; } _ => {} } -- cgit v1.2.3