version update
This commit is contained in:
parent
ee502998d8
commit
1dc66709dd
|
@ -1,11 +1,11 @@
|
||||||
[package]
|
[package]
|
||||||
name = "imp"
|
name = "imp"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libcwtch = { path="./../libcwtch-rs"} #"0.3.2"
|
libcwtch = "0.4.0"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
chrono = "0.4.19"
|
chrono = "0.4.19"
|
|
@ -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.
|
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::<MyEventHandlerType>(update_bot.borrow_mut());`
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue