From e99f3d65fa99586353de4476d75d51004bd6d4c3 Mon Sep 17 00:00:00 2001 From: yuzu Date: Thu, 15 May 2025 18:06:34 -0500 Subject: [PATCH] fixerino? --- README.md | 18 +++++++++++++----- build.zig.zon | 5 ++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f1448d0..5c4eb51 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,11 @@ A high-performance bleeding edge Discord library in Zig, featuring full API cove const std = @import("std"); const Discord = @import("discord"); const Shard = Discord.Shard; -const Intents = Discord.Intents; - -const INTENTS = 53608447; var session: *Discord.Session = undefined; fn ready(_: *Shard, payload: Discord.Ready) !void { std.debug.print("logged in as {s}\n", .{payload.user.username}); - // cache demonstration TODO } fn message_create(_: *Shard, message: Discord.Message) !void { @@ -48,9 +44,21 @@ pub fn main() !void { @panic("DISCORD_TOKEN not found in environment variables"); }; + const intents = comptime blk: { + var bits: Discord.Intents = .{}; + bits.Guilds = true; + bits.GuildMessages = true; + bits.GuildMembers = true; + // WARNING: + // YOU MUST SET THIS ON DEV PORTAL + // OTHERWISE THE LIBRARY WILL CRASH + bits.MessageContent = true; + break :blk bits; + }; + try session.start(.{ + .intents = intents, .authorization = token, - .intents = Intents.fromRaw(INTENTS), .run = .{ .message_create = &message_create, .ready = &ready }, .log = .yes, .options = .{}, diff --git a/build.zig.zon b/build.zig.zon index c280da1..767bbbc 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -28,7 +28,10 @@ .url = "https://git.yuzucchii.xyz/yuzucchii/zlib/archive/master.tar.gz", .hash = "zlib-0.1.0-AAAAALW6QABbti7dQfKuK0IQb-xdcp3SI8zdTvs5ouUD", }, - .websocket = .{ .url = "https://github.com/karlseguin/websocket.zig/archive/refs/heads/master.zip", .hash = "websocket-0.1.0-ZPISdYBIAwB1yO6AFDHRHLaZSmpdh4Bz4dCmaQUqNNWh" }, + .websocket = .{ + .url = "https://github.com/karlseguin/websocket.zig/archive/refs/heads/master.zip", + .hash = "websocket-0.1.0-ZPISdbhVAwCL-zrOIFLKLr6CHtwV92raAnObudtbYQjJ", + }, }, .paths = .{ "build.zig",