6 releases
0.3.1 | Aug 31, 2024 |
---|---|
0.3.0 | Feb 25, 2024 |
0.2.3 | Sep 30, 2023 |
0.2.0 | Jul 31, 2022 |
#1074 in Network programming
520KB
374 lines
imp
small demon, a familiar of a witch
imp is a set of bot creating utilities built on top of libcwtch-rs
It is in the very early prototype stage with one prototype use in the Cwtch update bot
Usage
Start with creating a Behaviour
struct and populating it with your desired set of bot behaviours, then imp::spawn
your bot with the behaviour.
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 inimp::EventHandler
such ason_new_message_from_contact
- This is newer and more will be defined in later versions
Finally, run the imp my_imp.event_loop::<MyEventHandlerType>(update_bot.borrow_mut());
Examples
- Private rust-bert chat bot - rust-bert-bot
- Public utility bot - Cwtch Update Bot
Dependencies
~2.3–5MB
~102K SLoC