Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.
/ hubbub Public archive
forked from zxcv05/hubbub

[Patched for async] Rust library for creating discord self-bots

License

Notifications You must be signed in to change notification settings

vanorsigma/hubbub

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hubbub

Rust library for creating discord self-bots (very early in development)

Current features

  • Allows passing a model
  • Connects to gateway with token
  • Supports reconnecting to gateway (semi tested, should work)
  • Supports making calls to discords http api (any version)
  • Supports sending and receiving gateway events
  • Most of discord's many, MANY, data structures have been translated into serde-compatible structs
  • Major structs have convenience functions for doing common tasks (eg: creating a message)

Using the library

  1. Add the library to your project using cargo add hubbub
  2. Import hubbub::prelude::*:
  3. Create your model
struct App {
    // ...
}
  1. Create the client
#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let mut client = Client::new(
        App { /* ... */ },
        /* Event handler */
    ).await?;

    client.token(/* Token */).await?;
    client.login().await?;
    client.run().await?;
}
  1. Create the event handler
async fn main() {
    // ...
    
    /* Event handler */
    Box::from(
        |ctx: Ctx, ws: Ws, model: Model<App>, msg: DiscordMessage| async move {
            /* do work here */
        }
    )
    
    // ...
}
  1. Success, hopefully!

Any questions?

  • Look at the examples
  • Look at the Context and DiscordMessage structs
  • Look at prelude

About

[Patched for async] Rust library for creating discord self-bots

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%