minor changes to README.md
This commit is contained in:
parent
ed67067f6b
commit
83f6fd4745
45
README.md
45
README.md
@ -4,40 +4,38 @@ A high-performance bleeding edge Discord library in Zig, featuring full API cove
|
||||
* Sharding Support: Ideal for large bots, enabling distributed load handling.
|
||||
* 100% API Coverage & Fully Typed: Offers complete access to Discord's API with strict typing for reliable and safe code.
|
||||
* High Performance: Faster than whichever library you can name (WIP)
|
||||
* Flexible Payload Parsing: Supports payload parsing through both zlib and zstd.
|
||||
* Flexible Payload Parsing: Supports payload parsing through both zlib and zstd*.
|
||||
* Language Agnostic: Primarily in Zig, but also compatible with JavaScript. (PERHAPS?)
|
||||
|
||||
```zig
|
||||
// Sample code
|
||||
const Session = @import("discord.zig").Session;
|
||||
const Client = @import("discord.zig").Client;
|
||||
const Shard = @import("discord.zig").Shard;
|
||||
const Discord = @import("discord.zig").Discord;
|
||||
const Intents = Discord.Intents;
|
||||
const std = @import("std");
|
||||
|
||||
const token = "Bot MTI5ODgzOTgzMDY3OTEzMDE4OA..."; // Replace with your actual token
|
||||
fn ready(_: *Shard, payload: Discord.Ready) void {
|
||||
std.debug.print("logged in as {s}\n", .{payload.user.username});
|
||||
}
|
||||
|
||||
fn message_create(message: Discord.Message) void {
|
||||
// Define your message handling logic here
|
||||
std.debug.print("Captured message: {?s}\n", .{message.content});
|
||||
fn message_create(_: *Shard, message: Discord.Message) void {
|
||||
std.debug.print("captured: {?s}\n", .{ message.content });
|
||||
}
|
||||
|
||||
pub fn main() !void {
|
||||
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
|
||||
defer arena.deinit();
|
||||
const allocator = arena.allocator();
|
||||
var tsa = std.heap.ThreadSafeAllocator{ .child_allocator = std.heap.c_allocator };
|
||||
|
||||
var handler = try Session.init(allocator, .{
|
||||
.token = token,
|
||||
var handler = Client.init(tsa.allocator());
|
||||
try handler.start(.{
|
||||
.token = std.posix.getenv("TOKEN") orelse unreachable,
|
||||
.intents = Intents.fromRaw(37379),
|
||||
.run = Session.GatewayDispatchEvent{ .message_create = &message_create },
|
||||
.run = .{ .message_create = &message_create, .ready = &ready },
|
||||
.log = .yes,
|
||||
.options = .{},
|
||||
});
|
||||
errdefer handler.deinit();
|
||||
|
||||
const t = try std.Thread.spawn(.{}, Session.readMessage, .{ &handler, null });
|
||||
defer t.join();
|
||||
}
|
||||
|
||||
|
||||
```
|
||||
## Installation
|
||||
```zig
|
||||
@ -58,6 +56,15 @@ TIP: make sure you use the latest Zig!
|
||||
## contributing
|
||||
Contributions are welcome! Please open an issue or pull request if you'd like to help improve the library.
|
||||
|
||||
## general roadmap
|
||||
| Task | Status |
|
||||
|-------------------------------------------------------------|--------|
|
||||
| stablish good sharding support with buckets | ✅ |
|
||||
| use the priority queues for handling ratelimits (half done) | ❌ |
|
||||
| make the library scalable with a gateway proxy | ❌ |
|
||||
| get a cool logo | ❌ |
|
||||
| finish the event coverage roadmap | ❌ |
|
||||
|
||||
## event coverage roadmap
|
||||
| Event | Support |
|
||||
|----------------------------------------|---------|
|
||||
@ -126,7 +133,7 @@ Contributions are welcome! Please open an issue or pull request if you'd like to
|
||||
| entitlement_delete | ❌ |
|
||||
| message_poll_vote_add | ❌ |
|
||||
| message_poll_vote_remove | ❌ |
|
||||
| ready: ?*const fn (data: Discord.Ready) void | ✅ |
|
||||
| ready: Discord.Ready | ✅ |
|
||||
| resumed | ❌ |
|
||||
| any: ?*const fn (data: []const u8) void | ✅ |
|
||||
| any: []const u8 | ✅ |
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user