diff options
| author | mat <git@matdoes.dev> | 2025-04-15 22:04:43 -0430 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-04-15 22:04:43 -0430 |
| commit | a9820dfd79bf24a0a6fcb2345aad6c79a21585a5 (patch) | |
| tree | a8e6290707fee0e1b18812aba599da74e7fc6eed /azalea/README.md | |
| parent | 1a0c4e2de9e6d82d5efdfac2bab17a73c79fc466 (diff) | |
| download | azalea-drasl-a9820dfd79bf24a0a6fcb2345aad6c79a21585a5.tar.xz | |
make goto async and clean up some examples
Diffstat (limited to 'azalea/README.md')
| -rw-r--r-- | azalea/README.md | 8 |
1 files changed, 6 insertions, 2 deletions
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<Mutex<usize>> +} 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; } _ => {} } |
