From 1dc66709dd8756f72fd4c6d428a4a63b74ec739f Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Thu, 21 Jul 2022 16:09:20 -0700 Subject: [PATCH] version update --- Cargo.toml | 4 ++-- README.md | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a1bfc0d..7fefeb3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "imp" -version = "0.1.0" +version = "0.2.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -libcwtch = { path="./../libcwtch-rs"} #"0.3.2" +libcwtch = "0.4.0" serde_json = "1.0" chrono = "0.4.19" \ No newline at end of file diff --git a/README.md b/README.md index 6b18a6c..485c292 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,12 @@ It is in the very early prototype stage with one prototype use in the Cwtch [upd Start with creating a `Behaviour` struct and populating it with your desired set of bot behaviours, then `imp::spawn` your bot with the behaviour. -Define a struct fulfilling the `imp::EventHandler` trait with all your custom event handling code. +To handle Cwtch events you can either +- Define a struct fulfilling the `imp::EventHandler::event_loop` function which has the capacity to support all the events libCwtch can emit +- Override specific `on_x_event` functions in `imp::EventHandler` such as `on_new_message_from_contact` + - This is newer and more will be defined in later versions -Finally, run the imp `my_imp.event_loop(Box::new(custom_event_handler));` +Finally, run the imp `my_imp.event_loop::(update_bot.borrow_mut());` ## Examples