```rs extern crate botserverclient; use botserverclient::client::connection::{Connection}; use botserverclient::client::protocol::*;
struct PacketHandlers {}
impl client::connection::PacketHandlers for PacketHandlers { fn message_send(&self, pkg: &MessageSend) { println!("MSG {} {}", pkg.message, pkg.id); }
fn message_send_ack(&self, pkg: &MessageSendAck) {
println!("ACK {}", pkg.id);
}
fn internal_error(&self, pkg: &InternalError) {
println!("ERR {} {}", pkg.message, pkg.cause);
}
fn config_get_response(&self, pkg: &ConfigGetResponse) {
println!("CFG :{}:{} {}", pkg.section, pkg.key, pkg.config);
}
fn auth_response(&self, pkg: &AuthResponse) {
println!("AUTH {}", pkg.success);
}
fn message_send_media(&self, pkg: &MessageSendMedia) {
println!("MSG {:?} {} {}", pkg._type, pkg.path, pkg.id);
}
fn set_bot_status(&self, pkg: &SetBotStatus) {
println!("STATUS {}", pkg.status);
}
fn tmp_file_response(&self, pkg: &TmpFileResponse) {
println!("TMP {} {}", pkg.ext, pkg.path);
}
}
fn main() { let connection = Connection::new("ws://127.0.0.1:8080".to_owned(), Box::new(PacketHandlers {})); connection.authenticate("thebestbot"); connection.log("rust", "hewoo");
connection.config_request("websocket", "port");
connection.config_request("whatsapp", "puppeteer_args");
connection.tmp_file_request("txt", 1000 * 10);
connection.on_message("fox!ping", "rust", "rust", Option::None, Option::None, Option::None, 69);
connection.on_message("fox!fox", "rust", "rust", Option::None, Option::None, Option::None, 69);
connection.await_exit();
} ```