aboutsummaryrefslogtreecommitdiff
path: root/azalea/examples
diff options
context:
space:
mode:
Diffstat (limited to 'azalea/examples')
-rw-r--r--azalea/examples/echo.rs15
-rw-r--r--azalea/examples/testbot/commands/debug.rs4
2 files changed, 10 insertions, 9 deletions
diff --git a/azalea/examples/echo.rs b/azalea/examples/echo.rs
index 1e773b7d..80b0cb15 100644
--- a/azalea/examples/echo.rs
+++ b/azalea/examples/echo.rs
@@ -18,13 +18,14 @@ async fn main() {
pub struct State {}
async fn handle(bot: Client, event: Event, _state: State) -> anyhow::Result<()> {
- if let Event::Chat(m) = event {
- if let (Some(sender), content) = m.split_sender_and_content() {
- if sender == bot.username() {
- return Ok(()); // ignore our own messages
- }
- bot.chat(&content);
- };
+ if let Event::Chat(m) = event
+ && let (Some(sender), content) = m.split_sender_and_content()
+ {
+ if sender == bot.username() {
+ // ignore our own messages
+ return Ok(());
+ }
+ bot.chat(&content);
}
Ok(())
diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs
index 075348b2..b97ad71d 100644
--- a/azalea/examples/testbot/commands/debug.rs
+++ b/azalea/examples/testbot/commands/debug.rs
@@ -1,6 +1,6 @@
//! Commands for debugging and getting the current state of the bot.
-use std::{env, fs::File, io::Write, thread, time::Duration};
+use std::{env, fs::File, io::Write, process, thread, time::Duration};
use azalea::{
BlockPos,
@@ -288,7 +288,7 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
thread::spawn(move || {
thread::sleep(Duration::from_secs(1));
- std::process::exit(0);
+ process::exit(0);
});
1