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.
- 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
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.- Bot run instructions:
- Run bots with
GUILD_INVITE=invite cargo run --package example_name. - Make sure the bot has necessary permissions to view channels / send messages etc.
- Run bots with
- By default, only a bare-bones common API types used in Harmony is generated.
You can customize the crate to your needs by enabling feature(s) listed below:
- Enable
gen_all_protocolsto enable all protocols, stable and staging. - Enable
rkyvfeature to deriverkyv::{Archive, Deserialize, Serialize}for all Harmony API types (except thebatchservice).- Enable
rkyv_validationto derivebytecheck::CheckBytesfor all Harmony API types and enablerkyv/validation.
- Enable
- Enable
serde_derivefeature to deriveserde::{Deserialize, Serialize}for all Harmony API types (except thebatchservice). - Enable
valuablefeature to derivevaluable::Valuablefor all Harmony API types (except thebatchservice). - customizing hRPC codegen:
- Enable the
gen_clientfeature to generate client service code for enabled protocols. - Enable the
gen_serverfeature to generate server service code for enabled protocols.
- Enable the
- Client:
- Enable the
client_nativefeature for a lightweight client implementation that useshyperand works on native platforms. - Enable the
client_webfeature for a lightweight client implementation that works on web platforms (WASM). - Enable the
client_backofffeature to enable request retrying on ratelimited requests.
- Enable the
- Stable protocols (enable
gen_stable_protocolsfor all):- Enable the
gen_chatfeature to generate chat service code. - Enable the
gen_authfeature to generate auth service code. - Enable the
gen_mediaproxyfeature to generate media proxy service code. - Enable the
gen_harmonytypesfeature to generate common Harmony types. - Enable the
gen_syncfeature to generate sync service code. - Enable the
gen_emotefeature to generate emote service code. - Enable the
gen_profilefeature to generate profile service code. - Enable the
gen_batchfeature to generate batch service code. - Enable the
restfeature to include REST API code.
- Enable the
- Staging protocols (enable
gen_staging_protocolsfor all):- Enable the
staging_gen_voicefeature to generate voice service code. - Enable the
staging_gen_botsfeature to generate bots service code.
- Enable the
- Enable
Minimum Supported Rust Version: current stable.
Changing MSRV is not considered a semver-breaking change.