https://github.com/aweirddev/omu
rust discord api wrapper (wip)
https://github.com/aweirddev/omu
Last synced: about 1 year ago
JSON representation
rust discord api wrapper (wip)
- Host: GitHub
- URL: https://github.com/aweirddev/omu
- Owner: AWeirdDev
- Created: 2024-11-18T14:29:52.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-09T14:48:03.000Z (about 1 year ago)
- Last Synced: 2025-03-09T15:29:52.880Z (about 1 year ago)
- Language: Rust
- Size: 93.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
omu is a simple rust discord api wrapper. it's as simple as it should be.
below is the redesigned api.
```rust
use anyhow::Result;
use omu::*;
// Make it constant to access from anywhere
const CLIENT: Client = Client::new(
Some(Intents::MESSAGE_CONTENT
| Intents::GUILD_MESSAGES
| Intents::DIRECT_MESSAGES
| Intents::GUILDS)
);
#[event(on_message)]
async fn on_message(message: Message) -> Result<()> {
message.reply(format!("Hello, {}", message.author.mention())).await?;
Ok(())
}
#[tokio::main]
async fn main() -> Result<()> {
CLIENT.add(on_message);
CLIENT.run(&dotenv::var("MY_TOKEN")).await?;
}
```
you handle events just like going through an iterator, and we do the rest, so that there's no structs, impls, or other weird stuff involved. cmon, no one likes them in your discord bot project.