Crate harmony_rust_sdk[−][src]
Expand description
Rust implementation of the Harmony chat protocol. Currently implements a lightweight client and a client API (powered by hrpc), along with auto generated API via hrpc-build.
Requirements
- Latest stable Rust and Cargo.
- If you are using Nix,
nix-shell(ornix developif you use flakes) should get you covered. - Otherwise, you’ll need to get protobuf and make sure
protocis in yourPATHenv variable.- If for some reason
build.rsfails, make sure to set:PROTOCenv variable to yourprotocexecutable- and
PROTOC_INCLUDEenv variable to wherever protobuf include files are located, most likely in/usr/share/include.
- If for some reason
Examples
-
echo_bot: Showcases a simple message echo bot that operates in a guild. It will repost messages whenever someone else posts a message. -
message_log: Showcases a simple message log bot that operates in a guild. It will log messages to the console whenever someone posts a message. -
cmd_bot: A more complex bot that responds to “commands”. The commands are:- r!ping: responds with “Pong! Took X secs.”
- r!hello: responds with “Hello, username!”
- r!uptime: responds with “Been running for X secs.”
-
Bot run instructions:
- Run bots with
GUILD_INVITE=invite cargo run --example example_name. - Make sure the bot has necessary permissions to view channels / send messages etc.
- Run bots with
Crate features
- By default, only a bare-bones common API of all services is generated. You can customize the crate to your needs by enabling feature(s) listed below:
- Enable the
parking_lotfeature if you want to use parking_lotsynctypes instead ofstd::sync. - Enable the
clientfeature for a lightweight client implementation and the client API.- Enable the
request_methodfeature to enable a request method inClientwhich allows you to make requests usingclient::Client::request().
- Enable the
- Enable the
gen_clientfeature to generate client service code. - Enable the
gen_serverfeature to generate server service code. - (Default) Enable the
gen_chatfeature to generate chat service code. - (Default) Enable the
gen_authfeature to generate auth service code. - (Default) Enable the
gen_voicefeature to generate voice service code. - (Default) Enable the
gen_mediaproxyfeature to generate media proxy service code. - (Default) Enable the
gen_harmonytypesfeature to generate common Harmony types.
- Enable the
MSRV
Minimum Supported Rust Version: previous stable.
Changing MSRV is not considered a semver-breaking change.
Modules
| api | Harmony protocol API. |
| client | Rust client implementation for Harmony, powered by |