finally finished
This commit is contained in:
parent
b56b7062cf
commit
f57bbdcf5d
@ -355,6 +355,6 @@ pub fn GatewayDispatchEvent(comptime T: type) type {
|
|||||||
|
|
||||||
ready: ?*const fn (save: T, data: Types.Ready) anyerror!void = undefined,
|
ready: ?*const fn (save: T, data: Types.Ready) anyerror!void = undefined,
|
||||||
// TODO: implement // resumed: null = null,
|
// TODO: implement // resumed: null = null,
|
||||||
any: ?*const fn (save: T, data: []const u8) anyerror!void = undefined,
|
any: ?*const fn (save: T, data: std.json.Value) anyerror!void = undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ pub fn AssociativeArray(comptime E: type, comptime V: type) type {
|
|||||||
var map: std.EnumMap(E, V) = .{};
|
var map: std.EnumMap(E, V) = .{};
|
||||||
|
|
||||||
const value = try std.json.innerParse(std.json.Value, allocator, src, .{
|
const value = try std.json.innerParse(std.json.Value, allocator, src, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
.max_value_len = 0x100
|
.max_value_len = 0x100
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -60,7 +61,10 @@ pub fn AssociativeArray(comptime E: type, comptime V: type) type {
|
|||||||
// eg: enum(u8) would be @"enum".tag_type where tag_type is a u8
|
// eg: enum(u8) would be @"enum".tag_type where tag_type is a u8
|
||||||
const int = std.fmt.parseInt(@typeInfo(E).@"enum".tag_type, k, 10) catch unreachable;
|
const int = std.fmt.parseInt(@typeInfo(E).@"enum".tag_type, k, 10) catch unreachable;
|
||||||
|
|
||||||
const val = try std.json.parseFromValueLeaky(V, allocator, v, .{.max_value_len = 0x100});
|
const val = try std.json.parseFromValueLeaky(V, allocator, v, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
|
.max_value_len = 0x100,
|
||||||
|
});
|
||||||
|
|
||||||
map.put(@enumFromInt(int), val);
|
map.put(@enumFromInt(int), val);
|
||||||
}
|
}
|
||||||
@ -93,6 +97,7 @@ pub fn DiscriminatedUnion(comptime U: type, comptime key: []const u8) type {
|
|||||||
// and should have a key "type" or whichever key might be
|
// and should have a key "type" or whichever key might be
|
||||||
|
|
||||||
const value = try std.json.innerParse(std.json.Value, allocator, src, .{
|
const value = try std.json.innerParse(std.json.Value, allocator, src, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
.max_value_len = 0x100
|
.max_value_len = 0x100
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -107,7 +112,10 @@ pub fn DiscriminatedUnion(comptime U: type, comptime key: []const u8) type {
|
|||||||
if (field.value == tag) {
|
if (field.value == tag) {
|
||||||
const T = comptime std.meta.fields(U)[field.value].type;
|
const T = comptime std.meta.fields(U)[field.value].type;
|
||||||
comptime std.debug.assert(@hasField(T, key));
|
comptime std.debug.assert(@hasField(T, key));
|
||||||
u = @unionInit(U, field.name, try std.json.innerParse(T, allocator, src, .{.max_value_len = 0x100}));
|
u = @unionInit(U, field.name, try std.json.innerParse(T, allocator, src, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
|
.max_value_len = 0x100,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,6 +130,7 @@ pub fn Record(comptime T: type) type {
|
|||||||
map: std.StringHashMapUnmanaged(T),
|
map: std.StringHashMapUnmanaged(T),
|
||||||
pub fn jsonParse(allocator: std.mem.Allocator, src: anytype, _: json.ParseOptions) !@This() {
|
pub fn jsonParse(allocator: std.mem.Allocator, src: anytype, _: json.ParseOptions) !@This() {
|
||||||
const value = try std.json.innerParse(std.json.Value, allocator, src, .{
|
const value = try std.json.innerParse(std.json.Value, allocator, src, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
.max_value_len = 0x100
|
.max_value_len = 0x100
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -137,7 +146,10 @@ pub fn Record(comptime T: type) type {
|
|||||||
// might leak because std.json is retarded
|
// might leak because std.json is retarded
|
||||||
// errdefer allocator.free(k);
|
// errdefer allocator.free(k);
|
||||||
// errdefer v.deinit(allocator);
|
// errdefer v.deinit(allocator);
|
||||||
try map.put(allocator, k, try std.json.parseFromValue(T, allocator, v, .{ .max_value_len =0x100}));
|
try map.put(allocator, k, try std.json.parseFromValue(T, allocator, v, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
|
.max_value_len = 0x100,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
return .{ .map = map };
|
return .{ .map = map };
|
||||||
@ -216,10 +228,14 @@ pub fn parseRight(comptime L: type, comptime R: type, child_allocator: std.mem.A
|
|||||||
owned.arena.* = .init(child_allocator);
|
owned.arena.* = .init(child_allocator);
|
||||||
const allocator = owned.arena.allocator();
|
const allocator = owned.arena.allocator();
|
||||||
const value = try json.parseFromSliceLeaky(json.Value, allocator, data, .{
|
const value = try json.parseFromSliceLeaky(json.Value, allocator, data, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
.max_value_len = 0x100,
|
.max_value_len = 0x100,
|
||||||
});
|
});
|
||||||
|
|
||||||
owned.value = .{ .right = try json.parseFromValueLeaky(R, allocator, value, .{.max_value_len = 0x100}) };
|
owned.value = .{ .right = try json.parseFromValueLeaky(R, allocator, value, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
|
.max_value_len = 0x100,
|
||||||
|
}) };
|
||||||
errdefer owned.arena.deinit();
|
errdefer owned.arena.deinit();
|
||||||
|
|
||||||
return owned;
|
return owned;
|
||||||
@ -235,10 +251,14 @@ pub fn parseLeft(comptime L: type, comptime R: type, child_allocator: std.mem.Al
|
|||||||
owned.arena.* = .init(child_allocator);
|
owned.arena.* = .init(child_allocator);
|
||||||
const allocator = owned.arena.allocator();
|
const allocator = owned.arena.allocator();
|
||||||
const value = try json.parseFromSliceLeaky(json.Value, allocator, data, .{
|
const value = try json.parseFromSliceLeaky(json.Value, allocator, data, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
.max_value_len = 0x100,
|
.max_value_len = 0x100,
|
||||||
});
|
});
|
||||||
|
|
||||||
owned.value = .{ .left = try json.parseFromValueLeaky(L, allocator, value, .{.max_value_len = 0x100}) };
|
owned.value = .{ .left = try json.parseFromValueLeaky(L, allocator, value, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
|
.max_value_len = 0x100,
|
||||||
|
}) };
|
||||||
errdefer owned.arena.deinit();
|
errdefer owned.arena.deinit();
|
||||||
|
|
||||||
return owned;
|
return owned;
|
||||||
|
308
src/shard.zig
308
src/shard.zig
@ -43,7 +43,6 @@ const Bucket = @import("internal.zig").Bucket;
|
|||||||
const default_identify_properties = @import("internal.zig").default_identify_properties;
|
const default_identify_properties = @import("internal.zig").default_identify_properties;
|
||||||
|
|
||||||
const Types = @import("./structures/types.zig");
|
const Types = @import("./structures/types.zig");
|
||||||
const GatewayPayload = Types.GatewayPayload;
|
|
||||||
const Opcode = Types.GatewayOpcodes;
|
const Opcode = Types.GatewayOpcodes;
|
||||||
const Intents = Types.Intents;
|
const Intents = Types.Intents;
|
||||||
|
|
||||||
@ -200,7 +199,7 @@ inline fn _connect_ws(allocator: mem.Allocator, url: []const u8) !ws.Client {
|
|||||||
.host = url,
|
.host = url,
|
||||||
});
|
});
|
||||||
|
|
||||||
var buf: [0x100]u8 = undefined;
|
var buf: [0x1000]u8 = undefined;
|
||||||
const host = try std.fmt.bufPrint(&buf, "host: {s}", .{url});
|
const host = try std.fmt.bufPrint(&buf, "host: {s}", .{url});
|
||||||
|
|
||||||
conn.handshake("/?v=10&encoding=json&compress=zlib-stream", .{
|
conn.handshake("/?v=10&encoding=json&compress=zlib-stream", .{
|
||||||
@ -234,28 +233,41 @@ fn readMessage(self: *Self, _: anytype) !void {
|
|||||||
const decompressed = try self.inflator.decompressAllAlloc(buf);
|
const decompressed = try self.inflator.decompressAllAlloc(buf);
|
||||||
defer self.allocator.free(decompressed);
|
defer self.allocator.free(decompressed);
|
||||||
|
|
||||||
// we use std.json here because I believe it'll perform better
|
// std.debug.print("Decompressed: {s}\n", .{decompressed});
|
||||||
const raw = try std.json.parseFromSlice(struct {
|
|
||||||
|
std.debug.assert(std.json.validate(self.allocator, decompressed) catch
|
||||||
|
@panic("Invalid JSON"));
|
||||||
|
|
||||||
|
|
||||||
|
// for some reason std.json breaks when you use a generic
|
||||||
|
const GatewayPayloadType = struct{
|
||||||
|
/// opcode for the payload
|
||||||
op: isize,
|
op: isize,
|
||||||
d: std.json.Value,
|
/// Event data
|
||||||
s: ?i64,
|
d: ?std.json.Value = null,
|
||||||
t: ?[]const u8,
|
/// Sequence isize, used for resuming sessions and heartbeats
|
||||||
}, self.allocator, decompressed, .{});
|
s: ?isize = null,
|
||||||
defer raw.deinit();
|
/// The event name for this payload
|
||||||
|
t: ?[]const u8 = null,
|
||||||
|
};
|
||||||
|
const raw = try std.json.parseFromSlice(GatewayPayloadType, self.allocator, decompressed, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
|
.max_value_len = 0x1000,
|
||||||
|
});
|
||||||
|
errdefer raw.deinit();
|
||||||
|
|
||||||
const payload = raw.value;
|
const payload = raw.value;
|
||||||
|
|
||||||
switch (@as(Opcode, @enumFromInt(payload.op))) {
|
switch (@as(Opcode, @enumFromInt(payload.op))) {
|
||||||
.Dispatch => {
|
.Dispatch => {
|
||||||
// maybe use threads and call it instead from there
|
// maybe use threads and call it instead from there
|
||||||
if (payload.t) |name| {
|
if (payload.t) |name| {
|
||||||
self.sequence.store(payload.s orelse 0, .monotonic);
|
self.sequence.store(payload.s orelse 0, .monotonic);
|
||||||
try self.handleEvent(name, decompressed);
|
try self.handleEvent(name, payload.d.?);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
.Hello => {
|
.Hello => {
|
||||||
const HelloPayload = struct { heartbeat_interval: u64, _trace: [][]const u8 };
|
const HelloPayload = struct { heartbeat_interval: u64, _trace: [][]const u8 };
|
||||||
const parsed = try std.json.parseFromValue(HelloPayload, self.allocator, payload.d, .{});
|
const parsed = try std.json.parseFromValue(HelloPayload, self.allocator, payload.d.?, .{});
|
||||||
defer parsed.deinit();
|
defer parsed.deinit();
|
||||||
|
|
||||||
const helloPayload = parsed.value;
|
const helloPayload = parsed.value;
|
||||||
@ -300,7 +312,7 @@ fn readMessage(self: *Self, _: anytype) !void {
|
|||||||
session_id: []const u8,
|
session_id: []const u8,
|
||||||
seq: ?isize,
|
seq: ?isize,
|
||||||
};
|
};
|
||||||
const parsed = try std.json.parseFromValue(WithSequence, self.allocator, payload.d, .{});
|
const parsed = try std.json.parseFromValue(WithSequence, self.allocator, payload.d.?, .{});
|
||||||
defer parsed.deinit();
|
defer parsed.deinit();
|
||||||
|
|
||||||
const resume_payload = parsed.value;
|
const resume_payload = parsed.value;
|
||||||
@ -396,398 +408,402 @@ pub fn send(self: *Self, _: bool, data: anytype) SendError!void {
|
|||||||
try self.client.write(try string.toOwnedSlice());
|
try self.client.write(try string.toOwnedSlice());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handleEvent(self: *Self, name: []const u8, payload: []const u8) !void {
|
pub fn handleEvent(self: *Self, name: []const u8, payload: json.Value) !void {
|
||||||
if (mem.eql(u8, name, "READY")) if (self.handler.ready) |event| {
|
if (mem.eql(u8, name, "READY")) if (self.handler.ready) |event| {
|
||||||
const ready = try json.parseFromSlice(GatewayPayload(Types.Ready), self.allocator, payload, .{.max_value_len=0x100});
|
const ready = try json.parseFromValue(Types.Ready, self.allocator, payload, .{
|
||||||
|
.ignore_unknown_fields=true,
|
||||||
|
.max_value_len=0x1000,
|
||||||
|
});
|
||||||
|
|
||||||
try event(self, ready.value.d.?);
|
try event(self, ready.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "APPLICATION_COMMAND_PERMISSIONS_UPDATE")) if (self.handler.application_command_permissions_update) |event| {
|
if (mem.eql(u8, name, "APPLICATION_COMMAND_PERMISSIONS_UPDATE")) if (self.handler.application_command_permissions_update) |event| {
|
||||||
const acp = try json.parseFromSlice(GatewayPayload(Types.ApplicationCommandPermissions), self.allocator, payload, .{.max_value_len=0x100});
|
const acp = try json.parseFromValue(Types.ApplicationCommandPermissions, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, acp.value.d.?);
|
try event(self, acp.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "CHANNEL_CREATE")) if (self.handler.channel_create) |event| {
|
if (mem.eql(u8, name, "CHANNEL_CREATE")) if (self.handler.channel_create) |event| {
|
||||||
const chan = try json.parseFromSlice(GatewayPayload(Types.Channel), self.allocator, payload, .{.max_value_len=0x100});
|
const chan = try json.parseFromValue(Types.Channel, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, chan.value.d.?);
|
try event(self, chan.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "CHANNEL_UPDATE")) if (self.handler.channel_update) |event| {
|
if (mem.eql(u8, name, "CHANNEL_UPDATE")) if (self.handler.channel_update) |event| {
|
||||||
const chan = try json.parseFromSlice(GatewayPayload(Types.Channel), self.allocator, payload, .{.max_value_len=0x100});
|
const chan = try json.parseFromValue(Types.Channel, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, chan.value.d.?);
|
try event(self, chan.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "CHANNEL_DELETE")) if (self.handler.channel_delete) |event| {
|
if (mem.eql(u8, name, "CHANNEL_DELETE")) if (self.handler.channel_delete) |event| {
|
||||||
const chan = try json.parseFromSlice(GatewayPayload(Types.Channel), self.allocator, payload, .{.max_value_len=0x100});
|
const chan = try json.parseFromValue(Types.Channel, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, chan.value.d.?);
|
try event(self, chan.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "CHANNEL_PINS_UPDATE")) if (self.handler.channel_pins_update) |event| {
|
if (mem.eql(u8, name, "CHANNEL_PINS_UPDATE")) if (self.handler.channel_pins_update) |event| {
|
||||||
const chan_pins_update = try json.parseFromSlice(GatewayPayload(Types.ChannelPinsUpdate), self.allocator, payload, .{.max_value_len=0x100});
|
const chan_pins_update = try json.parseFromValue(Types.ChannelPinsUpdate, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, chan_pins_update.value.d.?);
|
try event(self, chan_pins_update.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "ENTITLEMENT_CREATE")) if (self.handler.entitlement_create) |event| {
|
if (mem.eql(u8, name, "ENTITLEMENT_CREATE")) if (self.handler.entitlement_create) |event| {
|
||||||
const entitlement = try json.parseFromSlice(GatewayPayload(Types.Entitlement), self.allocator, payload, .{.max_value_len=0x100});
|
const entitlement = try json.parseFromValue(Types.Entitlement, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, entitlement.value.d.?);
|
try event(self, entitlement.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "ENTITLEMENT_UPDATE")) if (self.handler.entitlement_update) |event| {
|
if (mem.eql(u8, name, "ENTITLEMENT_UPDATE")) if (self.handler.entitlement_update) |event| {
|
||||||
const entitlement = try json.parseFromSlice(GatewayPayload(Types.Entitlement), self.allocator, payload, .{.max_value_len=0x100});
|
const entitlement = try json.parseFromValue(Types.Entitlement, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, entitlement.value.d.?);
|
try event(self, entitlement.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "ENTITLEMENT_DELETE")) if (self.handler.entitlement_delete) |event| {
|
if (mem.eql(u8, name, "ENTITLEMENT_DELETE")) if (self.handler.entitlement_delete) |event| {
|
||||||
const entitlement = try json.parseFromSlice(GatewayPayload(Types.Entitlement), self.allocator, payload, .{.max_value_len=0x100});
|
const entitlement = try json.parseFromValue(Types.Entitlement, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, entitlement.value.d.?);
|
try event(self, entitlement.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "INTEGRATION_CREATE")) if (self.handler.integration_create) |event| {
|
if (mem.eql(u8, name, "INTEGRATION_CREATE")) if (self.handler.integration_create) |event| {
|
||||||
const guild_id = try json.parseFromSlice(GatewayPayload(Types.IntegrationCreateUpdate), self.allocator, payload, .{.max_value_len=0x100});
|
const guild_id = try json.parseFromValue(Types.IntegrationCreateUpdate, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, guild_id.value.d.?);
|
try event(self, guild_id.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "INTEGRATION_UPDATE")) if (self.handler.integration_update) |event| {
|
if (mem.eql(u8, name, "INTEGRATION_UPDATE")) if (self.handler.integration_update) |event| {
|
||||||
const guild_id = try json.parseFromSlice(GatewayPayload(Types.IntegrationCreateUpdate), self.allocator, payload, .{.max_value_len=0x100});
|
const guild_id = try json.parseFromValue(Types.IntegrationCreateUpdate, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, guild_id.value.d.?);
|
try event(self, guild_id.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "INTEGRATION_DELETE")) if (self.handler.integration_delete) |event| {
|
if (mem.eql(u8, name, "INTEGRATION_DELETE")) if (self.handler.integration_delete) |event| {
|
||||||
const data = try json.parseFromSlice(GatewayPayload(Types.IntegrationDelete), self.allocator, payload, .{.max_value_len=0x100});
|
const data = try json.parseFromValue(Types.IntegrationDelete, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, data.value.d.?);
|
try event(self, data.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "INTERACTION_CREATE")) if (self.handler.interaction_create) |event| {
|
if (mem.eql(u8, name, "INTERACTION_CREATE")) if (self.handler.interaction_create) |event| {
|
||||||
const interaction = try json.parseFromSlice(GatewayPayload(Types.MessageInteraction), self.allocator, payload, .{.max_value_len=0x100});
|
const interaction = try json.parseFromValue(Types.MessageInteraction, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, interaction.value.d.?);
|
try event(self, interaction.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "INVITE_CREATE")) if (self.handler.invite_create) |event| {
|
if (mem.eql(u8, name, "INVITE_CREATE")) if (self.handler.invite_create) |event| {
|
||||||
const data = try json.parseFromSlice(GatewayPayload(Types.InviteCreate), self.allocator, payload, .{.max_value_len=0x100});
|
const data = try json.parseFromValue(Types.InviteCreate, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, data.value.d.?);
|
try event(self, data.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "INVITE_DELETE")) if (self.handler.invite_delete) |event| {
|
if (mem.eql(u8, name, "INVITE_DELETE")) if (self.handler.invite_delete) |event| {
|
||||||
const data = try json.parseFromSlice(GatewayPayload(Types.InviteDelete), self.allocator, payload, .{.max_value_len=0x100});
|
const data = try json.parseFromValue(Types.InviteDelete, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, data.value.d.?);
|
try event(self, data.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "MESSAGE_CREATE")) if (self.handler.message_create) |event| {
|
if (mem.eql(u8, name, "MESSAGE_CREATE")) if (self.handler.message_create) |event| {
|
||||||
const message = try json.parseFromSlice(GatewayPayload(Types.Message), self.allocator, payload, .{.max_value_len=0x100});
|
const message = try json.parseFromValue(Types.Message, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, message.value.d.?);
|
try event(self, message.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "MESSAGE_DELETE")) if (self.handler.message_delete) |event| {
|
if (mem.eql(u8, name, "MESSAGE_DELETE")) if (self.handler.message_delete) |event| {
|
||||||
const data = try json.parseFromSlice(GatewayPayload(Types.MessageDelete), self.allocator, payload, .{.max_value_len=0x100});
|
const data = try json.parseFromValue(Types.MessageDelete, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, data.value.d.?);
|
try event(self, data.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "MESSAGE_UPDATE")) if (self.handler.message_update) |event| {
|
if (mem.eql(u8, name, "MESSAGE_UPDATE")) if (self.handler.message_update) |event| {
|
||||||
const message = try json.parseFromSlice(GatewayPayload(Types.Message), self.allocator, payload, .{.max_value_len=0x100});
|
const message = try json.parseFromValue(Types.Message, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, message.value.d.?);
|
try event(self, message.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "MESSAGE_DELETE_BULK")) if (self.handler.message_delete_bulk) |event| {
|
if (mem.eql(u8, name, "MESSAGE_DELETE_BULK")) if (self.handler.message_delete_bulk) |event| {
|
||||||
const data = try json.parseFromSlice(GatewayPayload(Types.MessageDeleteBulk), self.allocator, payload, .{.max_value_len=0x100});
|
const data = try json.parseFromValue(Types.MessageDeleteBulk, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, data.value.d.?);
|
try event(self, data.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "MESSAGE_REACTION_ADD")) if (self.handler.message_reaction_add) |event| {
|
if (mem.eql(u8, name, "MESSAGE_REACTION_ADD")) if (self.handler.message_reaction_add) |event| {
|
||||||
const reaction = try json.parseFromSlice(GatewayPayload(Types.MessageReactionAdd), self.allocator, payload, .{.max_value_len=0x100});
|
const reaction = try json.parseFromValue(Types.MessageReactionAdd, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, reaction.value.d.?);
|
try event(self, reaction.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "MESSAGE_REACTION_REMOVE")) if (self.handler.message_reaction_remove) |event| {
|
if (mem.eql(u8, name, "MESSAGE_REACTION_REMOVE")) if (self.handler.message_reaction_remove) |event| {
|
||||||
const reaction = try json.parseFromSlice(GatewayPayload(Types.MessageReactionRemove), self.allocator, payload, .{.max_value_len=0x100});
|
const reaction = try json.parseFromValue(Types.MessageReactionRemove, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, reaction.value.d.?);
|
try event(self, reaction.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "MESSAGE_REACTION_REMOVE_ALL")) if (self.handler.message_reaction_remove_all) |event| {
|
if (mem.eql(u8, name, "MESSAGE_REACTION_REMOVE_ALL")) if (self.handler.message_reaction_remove_all) |event| {
|
||||||
const data = try json.parseFromSlice(GatewayPayload(Types.MessageReactionRemoveAll), self.allocator, payload, .{.max_value_len=0x100});
|
const data = try json.parseFromValue(Types.MessageReactionRemoveAll, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, data.value.d.?);
|
try event(self, data.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "MESSAGE_REACTION_REMOVE_EMOJI")) if (self.handler.message_reaction_remove_emoji) |event| {
|
if (mem.eql(u8, name, "MESSAGE_REACTION_REMOVE_EMOJI")) if (self.handler.message_reaction_remove_emoji) |event| {
|
||||||
const emoji = try json.parseFromSlice(GatewayPayload(Types.MessageReactionRemoveEmoji), self.allocator, payload, .{.max_value_len=0x100});
|
const emoji = try json.parseFromValue(Types.MessageReactionRemoveEmoji, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, emoji.value.d.?);
|
try event(self, emoji.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_CREATE")) {
|
if (mem.eql(u8, name, "GUILD_CREATE")) {
|
||||||
const isAvailable =
|
const isAvailable =
|
||||||
try json.parseFromSlice(GatewayPayload(struct { unavailable: ?bool }), self.allocator, payload, .{.max_value_len=0x100});
|
try json.parseFromValue(struct { unavailable: ?bool }, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
if (isAvailable.value.d.?.unavailable == true) {
|
if (isAvailable.value.unavailable == true) {
|
||||||
const guild = try json.parseFromSlice(GatewayPayload(Types.Guild), self.allocator, payload, .{.max_value_len=0x100});
|
const guild = try json.parseFromValue(Types.Guild, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
if (self.handler.guild_create) |event| try event(self, guild.value.d.?);
|
if (self.handler.guild_create) |event| try event(self, guild.value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const guild = try json.parseFromSlice(GatewayPayload(Types.UnavailableGuild), self.allocator, payload, .{.max_value_len=0x100});
|
const guild = try json.parseFromValue(Types.UnavailableGuild, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
if (self.handler.guild_create_unavailable) |event| try event(self, guild.value.d.?);
|
if (self.handler.guild_create_unavailable) |event| try event(self, guild.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_UPDATE")) if (self.handler.guild_update) |event| {
|
if (mem.eql(u8, name, "GUILD_UPDATE")) if (self.handler.guild_update) |event| {
|
||||||
const guild = try json.parseFromSlice(GatewayPayload(Types.Guild), self.allocator, payload, .{.max_value_len=0x100});
|
const guild = try json.parseFromValue(Types.Guild, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, guild.value.d.?);
|
try event(self, guild.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_DELETE")) if (self.handler.guild_delete) |event| {
|
if (mem.eql(u8, name, "GUILD_DELETE")) if (self.handler.guild_delete) |event| {
|
||||||
const guild = try json.parseFromSlice(GatewayPayload(Types.UnavailableGuild), self.allocator, payload, .{.max_value_len=0x100});
|
const guild = try json.parseFromValue(Types.UnavailableGuild, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, guild.value.d.?);
|
try event(self, guild.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_SCHEDULED_EVENT_CREATE")) if (self.handler.guild_scheduled_event_create) |event| {
|
if (mem.eql(u8, name, "GUILD_SCHEDULED_EVENT_CREATE")) if (self.handler.guild_scheduled_event_create) |event| {
|
||||||
const s_event = try json.parseFromSlice(GatewayPayload(Types.ScheduledEvent), self.allocator, payload, .{.max_value_len=0x100});
|
const s_event = try json.parseFromValue(Types.ScheduledEvent, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, s_event.value.d.?);
|
try event(self, s_event.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_SCHEDULED_EVENT_UPDATE")) if (self.handler.guild_scheduled_event_update) |event| {
|
if (mem.eql(u8, name, "GUILD_SCHEDULED_EVENT_UPDATE")) if (self.handler.guild_scheduled_event_update) |event| {
|
||||||
const s_event = try json.parseFromSlice(GatewayPayload(Types.ScheduledEvent), self.allocator, payload, .{.max_value_len=0x100});
|
const s_event = try json.parseFromValue(Types.ScheduledEvent, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, s_event.value.d.?);
|
try event(self, s_event.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_SCHEDULED_EVENT_DELETE")) if (self.handler.guild_scheduled_event_delete) |event| {
|
if (mem.eql(u8, name, "GUILD_SCHEDULED_EVENT_DELETE")) if (self.handler.guild_scheduled_event_delete) |event| {
|
||||||
const s_event = try json.parseFromSlice(GatewayPayload(Types.ScheduledEvent), self.allocator, payload, .{.max_value_len=0x100});
|
const s_event = try json.parseFromValue(Types.ScheduledEvent, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, s_event.value.d.?);
|
try event(self, s_event.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_SCHEDULED_EVENT_USER_ADD")) if (self.handler.guild_scheduled_event_user_add) |event| {
|
if (mem.eql(u8, name, "GUILD_SCHEDULED_EVENT_USER_ADD")) if (self.handler.guild_scheduled_event_user_add) |event| {
|
||||||
const data = try json.parseFromSlice(GatewayPayload(Types.ScheduledEventUserAdd), self.allocator, payload, .{.max_value_len=0x100});
|
const data = try json.parseFromValue(Types.ScheduledEventUserAdd, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, data.value.d.?);
|
try event(self, data.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_SCHEDULED_EVENT_USER_REMOVE")) if (self.handler.guild_scheduled_event_user_remove) |event| {
|
if (mem.eql(u8, name, "GUILD_SCHEDULED_EVENT_USER_REMOVE")) if (self.handler.guild_scheduled_event_user_remove) |event| {
|
||||||
const data = try json.parseFromSlice(GatewayPayload(Types.ScheduledEventUserRemove), self.allocator, payload, .{.max_value_len=0x100});
|
const data = try json.parseFromValue(Types.ScheduledEventUserRemove, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, data.value.d.?);
|
try event(self, data.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_MEMBER_ADD")) if (self.handler.guild_member_add) |event| {
|
if (mem.eql(u8, name, "GUILD_MEMBER_ADD")) if (self.handler.guild_member_add) |event| {
|
||||||
const guild_id = try json.parseFromSlice(GatewayPayload(Types.GuildMemberAdd), self.allocator, payload, .{.max_value_len=0x100});
|
const guild_id = try json.parseFromValue(Types.GuildMemberAdd, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, guild_id.value.d.?);
|
try event(self, guild_id.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_MEMBER_UPDATE")) if (self.handler.guild_member_update) |event| {
|
if (mem.eql(u8, name, "GUILD_MEMBER_UPDATE")) if (self.handler.guild_member_update) |event| {
|
||||||
const fields = try json.parseFromSlice(GatewayPayload(Types.GuildMemberUpdate), self.allocator, payload, .{.max_value_len=0x100});
|
const fields = try json.parseFromValue(Types.GuildMemberUpdate, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, fields.value.d.?);
|
try event(self, fields.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_MEMBER_REMOVE")) if (self.handler.guild_member_remove) |event| {
|
if (mem.eql(u8, name, "GUILD_MEMBER_REMOVE")) if (self.handler.guild_member_remove) |event| {
|
||||||
const user = try json.parseFromSlice(GatewayPayload(Types.GuildMemberRemove), self.allocator, payload, .{.max_value_len=0x100});
|
const user = try json.parseFromValue(Types.GuildMemberRemove, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, user.value.d.?);
|
try event(self, user.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_MEMBERS_CHUNK")) if (self.handler.guild_members_chunk) |event| {
|
if (mem.eql(u8, name, "GUILD_MEMBERS_CHUNK")) if (self.handler.guild_members_chunk) |event| {
|
||||||
const data = try json.parseFromSlice(GatewayPayload(Types.GuildMembersChunk), self.allocator, payload, .{.max_value_len=0x100});
|
const data = try json.parseFromValue(Types.GuildMembersChunk, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, data.value.d.?);
|
try event(self, data.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_ROLE_CREATE")) if (self.handler.guild_role_create) |event| {
|
if (mem.eql(u8, name, "GUILD_ROLE_CREATE")) if (self.handler.guild_role_create) |event| {
|
||||||
const role = try json.parseFromSlice(GatewayPayload(Types.GuildRoleCreate), self.allocator, payload, .{.max_value_len=0x100});
|
const role = try json.parseFromValue(Types.GuildRoleCreate, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, role.value.d.?);
|
try event(self, role.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_ROLE_UPDATE")) if (self.handler.guild_role_update) |event| {
|
if (mem.eql(u8, name, "GUILD_ROLE_UPDATE")) if (self.handler.guild_role_update) |event| {
|
||||||
const role = try json.parseFromSlice(GatewayPayload(Types.GuildRoleUpdate), self.allocator, payload, .{.max_value_len=0x100});
|
const role = try json.parseFromValue(Types.GuildRoleUpdate, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, role.value.d.?);
|
try event(self, role.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_ROLE_DELETE")) if (self.handler.guild_role_delete) |event| {
|
if (mem.eql(u8, name, "GUILD_ROLE_DELETE")) if (self.handler.guild_role_delete) |event| {
|
||||||
const role_id = try json.parseFromSlice(GatewayPayload(Types.GuildRoleDelete), self.allocator, payload, .{.max_value_len=0x100});
|
const role_id = try json.parseFromValue(Types.GuildRoleDelete, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, role_id.value.d.?);
|
try event(self, role_id.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_DELETE")) if (self.handler.guild_delete) |event| {
|
if (mem.eql(u8, name, "GUILD_DELETE")) if (self.handler.guild_delete) |event| {
|
||||||
const guild = try json.parseFromSlice(GatewayPayload(Types.UnavailableGuild), self.allocator, payload, .{.max_value_len=0x100});
|
const guild = try json.parseFromValue(Types.UnavailableGuild, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, guild.value.d.?);
|
try event(self, guild.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_BAN_ADD")) if (self.handler.guild_ban_add) |event| {
|
if (mem.eql(u8, name, "GUILD_BAN_ADD")) if (self.handler.guild_ban_add) |event| {
|
||||||
const gba = try json.parseFromSlice(GatewayPayload(Types.GuildBanAddRemove), self.allocator, payload, .{.max_value_len=0x100});
|
const gba = try json.parseFromValue(Types.GuildBanAddRemove, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, gba.value.d.?);
|
try event(self, gba.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_BAN_REMOVE")) if (self.handler.guild_ban_remove) |event| {
|
if (mem.eql(u8, name, "GUILD_BAN_REMOVE")) if (self.handler.guild_ban_remove) |event| {
|
||||||
const gbr = try json.parseFromSlice(GatewayPayload(Types.GuildBanAddRemove), self.allocator, payload, .{.max_value_len=0x100});
|
const gbr = try json.parseFromValue(Types.GuildBanAddRemove, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, gbr.value.d.?);
|
try event(self, gbr.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_EMOJIS_UPDATE")) if (self.handler.guild_emojis_update) |event| {
|
if (mem.eql(u8, name, "GUILD_EMOJIS_UPDATE")) if (self.handler.guild_emojis_update) |event| {
|
||||||
const emojis = try json.parseFromSlice(GatewayPayload(Types.GuildEmojisUpdate), self.allocator, payload, .{.max_value_len=0x100});
|
const emojis = try json.parseFromValue(Types.GuildEmojisUpdate, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, emojis.value.d.?);
|
try event(self, emojis.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_STICKERS_UPDATE")) if (self.handler.guild_stickers_update) |event| {
|
if (mem.eql(u8, name, "GUILD_STICKERS_UPDATE")) if (self.handler.guild_stickers_update) |event| {
|
||||||
const stickers = try json.parseFromSlice(GatewayPayload(Types.GuildStickersUpdate), self.allocator, payload, .{.max_value_len=0x100});
|
const stickers = try json.parseFromValue(Types.GuildStickersUpdate, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, stickers.value.d.?);
|
try event(self, stickers.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "GUILD_INTEGRATIONS_UPDATE")) if (self.handler.guild_integrations_update) |event| {
|
if (mem.eql(u8, name, "GUILD_INTEGRATIONS_UPDATE")) if (self.handler.guild_integrations_update) |event| {
|
||||||
const guild_id = try json.parseFromSlice(GatewayPayload(Types.GuildIntegrationsUpdate), self.allocator, payload, .{.max_value_len=0x100});
|
const guild_id = try json.parseFromValue(Types.GuildIntegrationsUpdate, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, guild_id.value.d.?);
|
try event(self, guild_id.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "THREAD_CREATE")) if (self.handler.thread_create) |event| {
|
if (mem.eql(u8, name, "THREAD_CREATE")) if (self.handler.thread_create) |event| {
|
||||||
const thread = try json.parseFromSlice(GatewayPayload(Types.Channel), self.allocator, payload, .{.max_value_len=0x100});
|
const thread = try json.parseFromValue(Types.Channel, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, thread.value.d.?);
|
try event(self, thread.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "THREAD_UPDATE")) if (self.handler.thread_update) |event| {
|
if (mem.eql(u8, name, "THREAD_UPDATE")) if (self.handler.thread_update) |event| {
|
||||||
const thread = try json.parseFromSlice(GatewayPayload(Types.Channel), self.allocator, payload, .{.max_value_len=0x100});
|
const thread = try json.parseFromValue(Types.Channel, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, thread.value.d.?);
|
try event(self, thread.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "THREAD_DELETE")) if (self.handler.thread_delete) |event| {
|
if (mem.eql(u8, name, "THREAD_DELETE")) if (self.handler.thread_delete) |event| {
|
||||||
const thread_data = try json.parseFromSlice(GatewayPayload(Types.Partial(Types.Channel)), self.allocator, payload, .{.max_value_len=0x100});
|
const thread_data = try json.parseFromValue(Types.Partial(Types.Channel), self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, thread_data.value.d.?);
|
try event(self, thread_data.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "THREAD_LIST_SYNC")) if (self.handler.thread_list_sync) |event| {
|
if (mem.eql(u8, name, "THREAD_LIST_SYNC")) if (self.handler.thread_list_sync) |event| {
|
||||||
const data = try json.parseFromSlice(GatewayPayload(Types.ThreadListSync), self.allocator, payload, .{.max_value_len=0x100});
|
const data = try json.parseFromValue(Types.ThreadListSync, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, data.value.d.?);
|
try event(self, data.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "THREAD_MEMBER_UPDATE")) if (self.handler.thread_member_update) |event| {
|
if (mem.eql(u8, name, "THREAD_MEMBER_UPDATE")) if (self.handler.thread_member_update) |event| {
|
||||||
const guild_id = try json.parseFromSlice(GatewayPayload(Types.ThreadMemberUpdate), self.allocator, payload, .{.max_value_len=0x100});
|
const guild_id = try json.parseFromValue(Types.ThreadMemberUpdate, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, guild_id.value.d.?);
|
try event(self, guild_id.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "THREAD_MEMBERS_UPDATE")) if (self.handler.thread_members_update) |event| {
|
if (mem.eql(u8, name, "THREAD_MEMBERS_UPDATE")) if (self.handler.thread_members_update) |event| {
|
||||||
const data = try json.parseFromSlice(GatewayPayload(Types.ThreadMembersUpdate), self.allocator, payload, .{.max_value_len=0x100});
|
const data = try json.parseFromValue(Types.ThreadMembersUpdate, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, data.value.d.?);
|
try event(self, data.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "TYPING_START")) if (self.handler.typing_start) |event| {
|
if (mem.eql(u8, name, "TYPING_START")) if (self.handler.typing_start) |event| {
|
||||||
const data = try json.parseFromSlice(GatewayPayload(Types.TypingStart), self.allocator, payload, .{.max_value_len=0x100});
|
const data = try json.parseFromValue(Types.TypingStart, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, data.value.d.?);
|
try event(self, data.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "USER_UPDATE")) if (self.handler.user_update) |event| {
|
if (mem.eql(u8, name, "USER_UPDATE")) if (self.handler.user_update) |event| {
|
||||||
const user = try json.parseFromSlice(GatewayPayload(Types.User), self.allocator, payload, .{.max_value_len=0x100});
|
const user = try json.parseFromValue(Types.User, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, user.value.d.?);
|
try event(self, user.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "PRESENCE_UPDATE")) if (self.handler.presence_update) |event| {
|
if (mem.eql(u8, name, "PRESENCE_UPDATE")) if (self.handler.presence_update) |event| {
|
||||||
const pu = try json.parseFromSlice(GatewayPayload(Types.PresenceUpdate), self.allocator, payload, .{.max_value_len=0x100});
|
const pu = try json.parseFromValue(Types.PresenceUpdate, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, pu.value.d.?);
|
try event(self, pu.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "MESSSAGE_POLL_VOTE_ADD")) if (self.handler.message_poll_vote_add) |event| {
|
if (mem.eql(u8, name, "MESSSAGE_POLL_VOTE_ADD")) if (self.handler.message_poll_vote_add) |event| {
|
||||||
const data = try json.parseFromSlice(GatewayPayload(Types.PollVoteAdd), self.allocator, payload, .{.max_value_len=0x100});
|
const data = try json.parseFromValue(Types.PollVoteAdd, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, data.value.d.?);
|
try event(self, data.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "MESSSAGE_POLL_VOTE_REMOVE")) if (self.handler.message_poll_vote_remove) |event| {
|
if (mem.eql(u8, name, "MESSSAGE_POLL_VOTE_REMOVE")) if (self.handler.message_poll_vote_remove) |event| {
|
||||||
const data = try json.parseFromSlice(GatewayPayload(Types.PollVoteRemove), self.allocator, payload, .{.max_value_len=0x100});
|
const data = try json.parseFromValue(Types.PollVoteRemove, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, data.value.d.?);
|
try event(self, data.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "WEBHOOKS_UPDATE")) if (self.handler.webhooks_update) |event| {
|
if (mem.eql(u8, name, "WEBHOOKS_UPDATE")) if (self.handler.webhooks_update) |event| {
|
||||||
const fields = try json.parseFromSlice(GatewayPayload(Types.WebhookUpdate), self.allocator, payload, .{.max_value_len=0x100});
|
const fields = try json.parseFromValue(Types.WebhookUpdate, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, fields.value.d.?);
|
try event(self, fields.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "STAGE_INSTANCE_CREATE")) if (self.handler.stage_instance_create) |event| {
|
if (mem.eql(u8, name, "STAGE_INSTANCE_CREATE")) if (self.handler.stage_instance_create) |event| {
|
||||||
const stage = try json.parseFromSlice(GatewayPayload(Types.StageInstance), self.allocator, payload, .{.max_value_len=0x100});
|
const stage = try json.parseFromValue(Types.StageInstance, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, stage.value.d.?);
|
try event(self, stage.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "STAGE_INSTANCE_UPDATE")) if (self.handler.stage_instance_update) |event| {
|
if (mem.eql(u8, name, "STAGE_INSTANCE_UPDATE")) if (self.handler.stage_instance_update) |event| {
|
||||||
const stage = try json.parseFromSlice(GatewayPayload(Types.StageInstance), self.allocator, payload, .{.max_value_len=0x100});
|
const stage = try json.parseFromValue(Types.StageInstance, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, stage.value.d.?);
|
try event(self, stage.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "STAGE_INSTANCE_DELETE")) if (self.handler.stage_instance_delete) |event| {
|
if (mem.eql(u8, name, "STAGE_INSTANCE_DELETE")) if (self.handler.stage_instance_delete) |event| {
|
||||||
const stage = try json.parseFromSlice(GatewayPayload(Types.StageInstance), self.allocator, payload, .{.max_value_len=0x100});
|
const stage = try json.parseFromValue(Types.StageInstance, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, stage.value.d.?);
|
try event(self, stage.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "AUTO_MODERATION_RULE_CREATE")) if (self.handler.auto_moderation_rule_create) |event| {
|
if (mem.eql(u8, name, "AUTO_MODERATION_RULE_CREATE")) if (self.handler.auto_moderation_rule_create) |event| {
|
||||||
const rule = try json.parseFromSlice(GatewayPayload(Types.AutoModerationRule), self.allocator, payload, .{.max_value_len=0x100});
|
const rule = try json.parseFromValue(Types.AutoModerationRule, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, rule.value.d.?);
|
try event(self, rule.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "AUTO_MODERATION_RULE_UPDATE")) if (self.handler.auto_moderation_rule_update) |event| {
|
if (mem.eql(u8, name, "AUTO_MODERATION_RULE_UPDATE")) if (self.handler.auto_moderation_rule_update) |event| {
|
||||||
const rule = try json.parseFromSlice(GatewayPayload(Types.AutoModerationRule), self.allocator, payload, .{.max_value_len=0x100});
|
const rule = try json.parseFromValue(Types.AutoModerationRule, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, rule.value.d.?);
|
try event(self, rule.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "AUTO_MODERATION_RULE_DELETE")) if (self.handler.auto_moderation_rule_delete) |event| {
|
if (mem.eql(u8, name, "AUTO_MODERATION_RULE_DELETE")) if (self.handler.auto_moderation_rule_delete) |event| {
|
||||||
const rule = try json.parseFromSlice(GatewayPayload(Types.AutoModerationRule), self.allocator, payload, .{.max_value_len=0x100});
|
const rule = try json.parseFromValue(Types.AutoModerationRule, self.allocator, payload, .{.ignore_unknown_fields=true, .max_value_len=0x1000});
|
||||||
|
|
||||||
try event(self, rule.value.d.?);
|
try event(self, rule.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mem.eql(u8, name, "AUTO_MODERATION_ACTION_EXECUTION")) if (self.handler.auto_moderation_action_execution) |event| {
|
if (mem.eql(u8, name, "AUTO_MODERATION_ACTION_EXECUTION")) if (self.handler.auto_moderation_action_execution) |event| {
|
||||||
const ax = try json.parseFromSlice(GatewayPayload(Types.AutoModerationActionExecution), self.allocator, payload, .{.max_value_len = 0x100});
|
const ax = try json.parseFromValue(Types.AutoModerationActionExecution, self.allocator, payload, .{ .ignore_unknown_fields=true, .max_value_len = 0x1000,
|
||||||
|
});
|
||||||
|
|
||||||
try event(self, ax.value.d.?);
|
try event(self, ax.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
// default handler for whoever wants it
|
// default handler for whoever wants it
|
||||||
if (self.handler.any) |anyEvent|
|
//if (self.handler.any) |anyEvent|
|
||||||
try anyEvent(self, payload);
|
//try anyEvent(self, payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const RequestFailedError = MakeRequestError || error{FailedRequest} || json.ParseError(json.Scanner);
|
pub const RequestFailedError = MakeRequestError || error{FailedRequest} || json.ParseError(json.Scanner);
|
||||||
|
@ -30,116 +30,116 @@ pub const Application = struct {
|
|||||||
/// The description of the app
|
/// The description of the app
|
||||||
description: []const u8,
|
description: []const u8,
|
||||||
/// An array of rpc origin urls, if rpc is enabled
|
/// An array of rpc origin urls, if rpc is enabled
|
||||||
rpc_origins: ?[][]const u8,
|
rpc_origins: ?[][]const u8 = null,
|
||||||
/// The url of the app's terms of service
|
/// The url of the app's terms of service
|
||||||
terms_of_service_url: ?[]const u8,
|
terms_of_service_url: ?[]const u8 = null,
|
||||||
/// The url of the app's privacy policy
|
/// The url of the app's privacy policy
|
||||||
privacy_policy_url: ?[]const u8,
|
privacy_policy_url: ?[]const u8 = null,
|
||||||
/// The hex encoded key for verification in interactions and the GameSDK's GetTicket
|
/// The hex encoded key for verification in interactions and the GameSDK's GetTicket
|
||||||
verify_key: []const u8,
|
verify_key: []const u8,
|
||||||
///If this application is a game sold on , this field will be the id of the "Game SKU" that is created, if exists
|
///If this application is a game sold on , this field will be the id of the "Game SKU" that is created, if exists
|
||||||
primary_sku_id: ?Snowflake,
|
primary_sku_id: ?Snowflake = null,
|
||||||
///If this application is a game sold on , this field will be the URL slug that links to the store page
|
///If this application is a game sold on , this field will be the URL slug that links to the store page
|
||||||
slug: ?[]const u8,
|
slug: ?[]const u8 = null,
|
||||||
/// The application's public flags
|
/// The application's public flags
|
||||||
flags: ?ApplicationFlags,
|
flags: ?ApplicationFlags = null,
|
||||||
/// The id of the app
|
/// The id of the app
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// The icon hash of the app
|
/// The icon hash of the app
|
||||||
icon: ?[]const u8,
|
icon: ?[]const u8 = null,
|
||||||
/// When false only app owner can join the app's bot to guilds
|
/// When false only app owner can join the app's bot to guilds
|
||||||
bot_public: bool,
|
bot_public: bool,
|
||||||
/// When true the app's bot will only join upon completion of the full oauth2 code grant flow
|
/// When true the app's bot will only join upon completion of the full oauth2 code grant flow
|
||||||
bot_require_code_grant: bool,
|
bot_require_code_grant: bool,
|
||||||
/// Partial user object containing info on the owner of the application
|
/// Partial user object containing info on the owner of the application
|
||||||
owner: ?Partial(User),
|
owner: ?Partial(User) = null,
|
||||||
/// If the application belongs to a team, this will be a list of the members of that team
|
/// If the application belongs to a team, this will be a list of the members of that team
|
||||||
team: ?Team,
|
team: ?Team = null,
|
||||||
/// Guild associated with the app. For example, a developer support server.
|
/// Guild associated with the app. For example, a developer support server.
|
||||||
guild_id: ?Snowflake,
|
guild_id: ?Snowflake = null,
|
||||||
/// A partial object of the associated guild
|
/// A partial object of the associated guild
|
||||||
guild: ?Partial(Guild),
|
guild: ?Partial(Guild) = null,
|
||||||
///If this application is a game sold on , this field will be the hash of the image on store embeds
|
///If this application is a game sold on , this field will be the hash of the image on store embeds
|
||||||
cover_image: ?[]const u8,
|
cover_image: ?[]const u8 = null,
|
||||||
/// up to 5 tags describing the content and functionality of the application
|
/// up to 5 tags describing the content and functionality of the application
|
||||||
tags: ?[][]const u8,
|
tags: ?[][]const u8 = null,
|
||||||
/// settings for the application's default in-app authorization link, if enabled
|
/// settings for the application's default in-app authorization link, if enabled
|
||||||
install_params: ?InstallParams,
|
install_params: ?InstallParams = null,
|
||||||
// Default scopes and permissions for each supported installation context.
|
// Default scopes and permissions for each supported installation context.
|
||||||
integration_types_config: ?AssociativeArray(ApplicationIntegrationType, ApplicationIntegrationTypeConfiguration),
|
integration_types_config: ?AssociativeArray(ApplicationIntegrationType, ApplicationIntegrationTypeConfiguration) = null,
|
||||||
/// the application's default custom authorization link, if enabled
|
/// the application's default custom authorization link, if enabled
|
||||||
custom_install_url: ?[]const u8,
|
custom_install_url: ?[]const u8 = null,
|
||||||
/// the application's role connection verification entry point, which when configured will render the app as a verification method in the guild role verification configuration
|
/// the application's role connection verification entry point, which when configured will render the app as a verification method in the guild role verification configuration
|
||||||
role_connections_verification_url: ?[]const u8,
|
role_connections_verification_url: ?[]const u8 = null,
|
||||||
/// An approximate count of the app's guild membership.
|
/// An approximate count of the app's guild membership.
|
||||||
approximate_guild_count: ?isize,
|
approximate_guild_count: ?isize = null,
|
||||||
/// Approximate count of users that have installed the app.
|
/// Approximate count of users that have installed the app.
|
||||||
approximate_user_install_count: ?isize,
|
approximate_user_install_count: ?isize = null,
|
||||||
/// Partial user object for the bot user associated with the app
|
/// Partial user object for the bot user associated with the app
|
||||||
bot: ?Partial(User),
|
bot: ?Partial(User) = null,
|
||||||
/// Array of redirect URIs for the app
|
/// Array of redirect URIs for the app
|
||||||
redirect_uris: ?[][]const u8,
|
redirect_uris: ?[][]const u8 = null,
|
||||||
/// Interactions endpoint URL for the app
|
/// Interactions endpoint URL for the app
|
||||||
interactions_endpoint_url: ?[]const u8,
|
interactions_endpoint_url: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/application#application-object-application-integration-type-configuration-object
|
/// https://discord.com/developers/docs/resources/application#application-object-application-integration-type-configuration-object
|
||||||
pub const ApplicationIntegrationTypeConfiguration = struct {
|
pub const ApplicationIntegrationTypeConfiguration = struct {
|
||||||
///
|
///
|
||||||
/// Install params for each installation context's default in-app authorization link
|
/// Install params for each installation context's default in-app authorization link
|
||||||
///
|
///
|
||||||
/// https://discord.com/developers/docs/resources/application#install-params-object-install-params-structure
|
/// https://discord.com/developers/docs/resources/application#install-params-object-install-params-structure
|
||||||
///
|
///
|
||||||
oauth2_install_params: ?InstallParams,
|
oauth2_install_params: ?InstallParams = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const ApplicationIntegrationType = enum(u4) {
|
pub const ApplicationIntegrationType = enum(u4) {
|
||||||
/// App is installable to servers
|
/// App is installable to servers
|
||||||
GuildInstall = 0,
|
GuildInstall = 0,
|
||||||
/// App is installable to users
|
/// App is installable to users
|
||||||
UserInstall = 1,
|
UserInstall = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const InstallParams = struct {
|
pub const InstallParams = struct {
|
||||||
/// Scopes to add the application to the server with
|
/// Scopes to add the application to the server with
|
||||||
scopes: []OAuth2Scope,
|
scopes: []OAuth2Scope,
|
||||||
/// Permissions to request for the bot role
|
/// Permissions to request for the bot role
|
||||||
permissions: []const u8,
|
permissions: []const u8,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const ModifyApplication = struct {
|
pub const ModifyApplication = struct {
|
||||||
/// Default custom authorization URL for the app, if enabled
|
/// Default custom authorization URL for the app, if enabled
|
||||||
custom_install_url: ?[]const u8,
|
custom_install_url: ?[]const u8 = null,
|
||||||
/// Description of the app
|
/// Description of the app
|
||||||
description: ?[]const u8,
|
description: ?[]const u8 = null,
|
||||||
/// Role connection verification URL for the app
|
/// Role connection verification URL for the app
|
||||||
role_connections_verification_url: ?[]const u8,
|
role_connections_verification_url: ?[]const u8 = null,
|
||||||
/// Settings for the app's default in-app authorization link, if enabled
|
/// Settings for the app's default in-app authorization link, if enabled
|
||||||
install_params: ?InstallParams,
|
install_params: ?InstallParams = null,
|
||||||
/// Default scopes and permissions for each supported installation context.
|
/// Default scopes and permissions for each supported installation context.
|
||||||
integration_types_config: ?ApplicationIntegrationType,
|
integration_types_config: ?ApplicationIntegrationType = null,
|
||||||
/// App's public flags
|
/// App's public flags
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Only limited intent flags (`GATEWAY_PRESENCE_LIMITED`, `GATEWAY_GUILD_MEMBERS_LIMITED`, and `GATEWAY_MESSAGE_CONTENT_LIMITED`) can be updated via the API.
|
/// Only limited intent flags (`GATEWAY_PRESENCE_LIMITED`, `GATEWAY_GUILD_MEMBERS_LIMITED`, and `GATEWAY_MESSAGE_CONTENT_LIMITED`) can be updated via the API.
|
||||||
flags: ?ApplicationFlags,
|
flags: ?ApplicationFlags = null,
|
||||||
/// Icon for the app
|
/// Icon for the app
|
||||||
icon: ?[]const u8,
|
icon: ?[]const u8 = null,
|
||||||
/// Default rich presence invite cover image for the app
|
/// Default rich presence invite cover image for the app
|
||||||
cover_image: ?[]const u8,
|
cover_image: ?[]const u8 = null,
|
||||||
/// Interactions endpoint URL for the app
|
/// Interactions endpoint URL for the app
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// To update an Interactions endpoint URL via the API, the URL must be valid
|
/// To update an Interactions endpoint URL via the API, the URL must be valid
|
||||||
interaction_endpoint_url: ?[]const u8,
|
interaction_endpoint_url: ?[]const u8 = null,
|
||||||
/// List of tags describing the content and functionality of the app (max of 20 characters per tag)
|
/// List of tags describing the content and functionality of the app (max of 20 characters per tag)
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// There can only be a max of 5 tags
|
/// There can only be a max of 5 tags
|
||||||
tags: ?[][]const u8,
|
tags: ?[][]const u8 = null,
|
||||||
/// Event webhook URL for the app to receive webhook events
|
/// Event webhook URL for the app to receive webhook events
|
||||||
event_webhooks_url: ?[]const u8,
|
event_webhooks_url: ?[]const u8 = null,
|
||||||
/// If webhook events are enabled for the app. 1 to disable, and 2 to enable.
|
/// If webhook events are enabled for the app. 1 to disable, and 2 to enable.
|
||||||
event_webhooks_status: ?ApplicationEventWebhookStatus,
|
event_webhooks_status: ?ApplicationEventWebhookStatus = null,
|
||||||
/// List of Webhook event types the app subscribes to
|
/// List of Webhook event types the app subscribes to
|
||||||
event_webhooks_types: ?[]WebhookEventType,
|
event_webhooks_types: ?[]WebhookEventType = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const ApplicationEventWebhookStatus = enum(u8) {
|
pub const ApplicationEventWebhookStatus = enum(u8) {
|
||||||
|
@ -1,50 +1,50 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const AttachmentFlags = @import("shared.zig").AttachmentFlags;
|
const AttachmentFlags = @import("shared.zig").AttachmentFlags;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#attachment-object
|
/// https://discord.com/developers/docs/resources/channel#attachment-object
|
||||||
pub const Attachment = struct {
|
pub const Attachment = struct {
|
||||||
/// Name of file attached
|
/// Name of file attached
|
||||||
filename: []const u8,
|
filename: []const u8,
|
||||||
/// The title of the file
|
/// The title of the file
|
||||||
title: ?[]const u8,
|
title: ?[]const u8 = null,
|
||||||
/// The attachment's [media type](https://en.wikipedia.org/wiki/Media_type)
|
/// The attachment's [media type](https://en.wikipedia.org/wiki/Media_type)
|
||||||
content_type: ?[]const u8,
|
content_type: ?[]const u8 = null,
|
||||||
/// Size of file in bytes
|
/// Size of file in bytes
|
||||||
size: isize,
|
size: isize,
|
||||||
/// Source url of file
|
/// Source url of file
|
||||||
url: []const u8,
|
url: []const u8,
|
||||||
/// A proxied url of file
|
/// A proxied url of file
|
||||||
proxy_url: []const u8,
|
proxy_url: []const u8,
|
||||||
/// Attachment id
|
/// Attachment id
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// description for the file (max 1024 characters)
|
/// description for the file (max 1024 characters)
|
||||||
description: ?[]const u8,
|
description: ?[]const u8 = null,
|
||||||
/// Height of file (if image)
|
/// Height of file (if image)
|
||||||
height: ?isize,
|
height: ?isize = null,
|
||||||
/// Width of file (if image)
|
/// Width of file (if image)
|
||||||
width: ?isize,
|
width: ?isize = null,
|
||||||
/// whether this attachment is ephemeral. Ephemeral attachments will automatically be removed after a set period of time. Ephemeral attachments on messages are guaranteed to be available as long as the message itself exists.
|
/// whether this attachment is ephemeral. Ephemeral attachments will automatically be removed after a set period of time. Ephemeral attachments on messages are guaranteed to be available as long as the message itself exists.
|
||||||
ephemeral: ?bool,
|
ephemeral: ?bool = null,
|
||||||
/// The duration of the audio file for a voice message
|
/// The duration of the audio file for a voice message
|
||||||
duration_secs: ?isize,
|
duration_secs: ?isize = null,
|
||||||
/// A base64 encoded bytearray representing a sampled waveform for a voice message
|
/// A base64 encoded bytearray representing a sampled waveform for a voice message
|
||||||
waveform: ?[]const u8,
|
waveform: ?[]const u8 = null,
|
||||||
/// Attachment flags combined as a bitfield
|
/// Attachment flags combined as a bitfield
|
||||||
flags: ?AttachmentFlags,
|
flags: ?AttachmentFlags = null,
|
||||||
};
|
};
|
||||||
|
@ -1,148 +1,148 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const Webhook = @import("webhook.zig").Webhook;
|
const Webhook = @import("webhook.zig").Webhook;
|
||||||
const User = @import("user.zig").User;
|
const User = @import("user.zig").User;
|
||||||
const Channel = @import("channel.zig").Channel;
|
const Channel = @import("channel.zig").Channel;
|
||||||
const ScheduledEvent = @import("scheduled_event.zig").ScheduledEvent;
|
const ScheduledEvent = @import("scheduled_event.zig").ScheduledEvent;
|
||||||
const AutoModerationRule = @import("automod.zig").AutoModerationRule;
|
const AutoModerationRule = @import("automod.zig").AutoModerationRule;
|
||||||
const Integration = @import("integration.zig").Integration;
|
const Integration = @import("integration.zig").Integration;
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const AuditLogEvents = @import("shared.zig").AuditLogEvents;
|
const AuditLogEvents = @import("shared.zig").AuditLogEvents;
|
||||||
const Partial = @import("partial.zig").Partial;
|
const Partial = @import("partial.zig").Partial;
|
||||||
const ApplicationCommand = @import("command.zig").ApplicationCommand;
|
const ApplicationCommand = @import("command.zig").ApplicationCommand;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/audit-log#audit-log-object
|
/// https://discord.com/developers/docs/resources/audit-log#audit-log-object
|
||||||
pub const AuditLog = struct {
|
pub const AuditLog = struct {
|
||||||
/// List of webhooks found in the audit log
|
/// List of webhooks found in the audit log
|
||||||
webhooks: []Webhook,
|
webhooks: []Webhook,
|
||||||
/// List of users found in the audit log
|
/// List of users found in the audit log
|
||||||
users: []User,
|
users: []User,
|
||||||
/// List of audit log entries, sorted from most to least recent
|
/// List of audit log entries, sorted from most to least recent
|
||||||
audit_log_entries: []AuditLogEntry,
|
audit_log_entries: []AuditLogEntry,
|
||||||
/// List of partial integration objects
|
/// List of partial integration objects
|
||||||
integrations: []Partial(Integration),
|
integrations: []Partial(Integration),
|
||||||
///
|
///
|
||||||
/// List of threads found in the audit log.
|
/// List of threads found in the audit log.
|
||||||
/// Threads referenced in `THREAD_CREATE` and `THREAD_UPDATE` events are included in the threads map since archived threads might not be kept in memory by clients.
|
/// Threads referenced in `THREAD_CREATE` and `THREAD_UPDATE` events are included in the threads map since archived threads might not be kept in memory by clients.
|
||||||
///
|
///
|
||||||
threads: []Channel,
|
threads: []Channel,
|
||||||
/// List of guild scheduled events found in the audit log
|
/// List of guild scheduled events found in the audit log
|
||||||
guild_scheduled_events: ?[]ScheduledEvent,
|
guild_scheduled_events: ?[]ScheduledEvent = null,
|
||||||
/// List of auto moderation rules referenced in the audit log
|
/// List of auto moderation rules referenced in the audit log
|
||||||
auto_moderation_rules: ?[]AutoModerationRule,
|
auto_moderation_rules: ?[]AutoModerationRule = null,
|
||||||
/// List of application commands referenced in the audit log
|
/// List of application commands referenced in the audit log
|
||||||
application_commands: []ApplicationCommand,
|
application_commands: []ApplicationCommand,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure
|
/// https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure
|
||||||
pub const AuditLogEntry = struct {
|
pub const AuditLogEntry = struct {
|
||||||
/// ID of the affected entity (webhook, user, role, etc.)
|
/// ID of the affected entity (webhook, user, role, etc.)
|
||||||
target_id: ?Snowflake,
|
target_id: ?Snowflake = null,
|
||||||
/// Changes made to the `target_id`
|
/// Changes made to the `target_id`
|
||||||
/// TODO: change this
|
/// TODO: change this
|
||||||
changes: ?[]AuditLogChange(noreturn),
|
changes: ?[]AuditLogChange(noreturn) = null,
|
||||||
/// User or app that made the changes
|
/// User or app that made the changes
|
||||||
user_id: ?Snowflake,
|
user_id: ?Snowflake = null,
|
||||||
/// ID of the entry
|
/// ID of the entry
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// Type of action that occurred
|
/// Type of action that occurred
|
||||||
action_type: AuditLogEvents,
|
action_type: AuditLogEvents,
|
||||||
/// Additional info for certain event types
|
/// Additional info for certain event types
|
||||||
options: ?OptionalAuditEntryInfo,
|
options: ?OptionalAuditEntryInfo = null,
|
||||||
/// Reason for the change (1-512 characters)
|
/// Reason for the change (1-512 characters)
|
||||||
reason: ?[]const u8,
|
reason: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn AuditLogChange(comptime T: type) type {
|
pub fn AuditLogChange(comptime T: type) type {
|
||||||
return T;
|
return T;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
|
/// https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
|
||||||
pub const OptionalAuditEntryInfo = struct {
|
pub const OptionalAuditEntryInfo = struct {
|
||||||
///
|
///
|
||||||
/// ID of the app whose permissions were targeted.
|
/// ID of the app whose permissions were targeted.
|
||||||
///
|
///
|
||||||
/// Event types: `APPLICATION_COMMAND_PERMISSION_UPDATE`,
|
/// Event types: `APPLICATION_COMMAND_PERMISSION_UPDATE`,
|
||||||
///
|
///
|
||||||
application_id: ?Snowflake,
|
application_id: ?Snowflake = null,
|
||||||
///
|
///
|
||||||
/// Name of the Auto Moderation rule that was triggered.
|
/// Name of the Auto Moderation rule that was triggered.
|
||||||
///
|
///
|
||||||
/// Event types: `AUTO_MODERATION_BLOCK_MESSAGE`, `AUTO_MODERATION_FLAG_TO_CHANNEL`, `AUTO_MODERATION_USER_COMMUNICATION_DISABLED`,
|
/// Event types: `AUTO_MODERATION_BLOCK_MESSAGE`, `AUTO_MODERATION_FLAG_TO_CHANNEL`, `AUTO_MODERATION_USER_COMMUNICATION_DISABLED`,
|
||||||
///
|
///
|
||||||
auto_moderation_rule_name: ?[]const u8,
|
auto_moderation_rule_name: ?[]const u8 = null,
|
||||||
///
|
///
|
||||||
/// Trigger type of the Auto Moderation rule that was triggered.
|
/// Trigger type of the Auto Moderation rule that was triggered.
|
||||||
///
|
///
|
||||||
/// Event types: `AUTO_MODERATION_BLOCK_MESSAGE`, `AUTO_MODERATION_FLAG_TO_CHANNEL`, `AUTO_MODERATION_USER_COMMUNICATION_DISABLED`,
|
/// Event types: `AUTO_MODERATION_BLOCK_MESSAGE`, `AUTO_MODERATION_FLAG_TO_CHANNEL`, `AUTO_MODERATION_USER_COMMUNICATION_DISABLED`,
|
||||||
///
|
///
|
||||||
auto_moderation_rule_trigger_type: ?[]const u8,
|
auto_moderation_rule_trigger_type: ?[]const u8 = null,
|
||||||
///
|
///
|
||||||
/// Channel in which the entities were targeted.
|
/// Channel in which the entities were targeted.
|
||||||
///
|
///
|
||||||
/// Event types: `MEMBER_MOVE`, `MESSAGE_PIN`, `MESSAGE_UNPIN`, `MESSAGE_DELETE`, `STAGE_INSTANCE_CREATE`, `STAGE_INSTANCE_UPDATE`, `STAGE_INSTANCE_DELETE`,
|
/// Event types: `MEMBER_MOVE`, `MESSAGE_PIN`, `MESSAGE_UNPIN`, `MESSAGE_DELETE`, `STAGE_INSTANCE_CREATE`, `STAGE_INSTANCE_UPDATE`, `STAGE_INSTANCE_DELETE`,
|
||||||
///
|
///
|
||||||
channel_id: ?Snowflake,
|
channel_id: ?Snowflake = null,
|
||||||
///
|
///
|
||||||
/// isize of entities that were targeted.
|
/// isize of entities that were targeted.
|
||||||
///
|
///
|
||||||
/// Event types: `MESSAGE_DELETE`, `MESSAGE_BULK_DELETE`, `MEMBER_DISCONNECT`, `MEMBER_MOVE`,
|
/// Event types: `MESSAGE_DELETE`, `MESSAGE_BULK_DELETE`, `MEMBER_DISCONNECT`, `MEMBER_MOVE`,
|
||||||
///
|
///
|
||||||
count: ?[]const u8,
|
count: ?[]const u8 = null,
|
||||||
///
|
///
|
||||||
/// isize of days after which inactive members were kicked.
|
/// isize of days after which inactive members were kicked.
|
||||||
///
|
///
|
||||||
/// Event types: `MEMBER_PRUNE`,
|
/// Event types: `MEMBER_PRUNE`,
|
||||||
///
|
///
|
||||||
delete_member_days: ?[]const u8,
|
delete_member_days: ?[]const u8 = null,
|
||||||
///
|
///
|
||||||
/// ID of the overwritten entity.
|
/// ID of the overwritten entity.
|
||||||
///
|
///
|
||||||
/// Event types: `CHANNEL_OVERWRITE_CREATE`, `CHANNEL_OVERWRITE_UPDATE`, `CHANNEL_OVERWRITE_DELETE`,
|
/// Event types: `CHANNEL_OVERWRITE_CREATE`, `CHANNEL_OVERWRITE_UPDATE`, `CHANNEL_OVERWRITE_DELETE`,
|
||||||
///
|
///
|
||||||
id: ?Snowflake,
|
id: ?Snowflake = null,
|
||||||
///
|
///
|
||||||
/// isize of members removed by the prune.
|
/// isize of members removed by the prune.
|
||||||
///
|
///
|
||||||
/// Event types: `MEMBER_PRUNE`,
|
/// Event types: `MEMBER_PRUNE`,
|
||||||
///
|
///
|
||||||
members_removed: ?[]const u8,
|
members_removed: ?[]const u8 = null,
|
||||||
///
|
///
|
||||||
/// ID of the message that was targeted.
|
/// ID of the message that was targeted.
|
||||||
///
|
///
|
||||||
/// Event types: `MESSAGE_PIN`, `MESSAGE_UNPIN`, `STAGE_INSTANCE_CREATE`, `STAGE_INSTANCE_UPDATE`, `STAGE_INSTANCE_DELETE`,
|
/// Event types: `MESSAGE_PIN`, `MESSAGE_UNPIN`, `STAGE_INSTANCE_CREATE`, `STAGE_INSTANCE_UPDATE`, `STAGE_INSTANCE_DELETE`,
|
||||||
///
|
///
|
||||||
message_id: ?Snowflake,
|
message_id: ?Snowflake = null,
|
||||||
///
|
///
|
||||||
/// Name of the role if type is "0" (not present if type is "1").
|
/// Name of the role if type is "0" (not present if type is "1").
|
||||||
///
|
///
|
||||||
/// Event types: `CHANNEL_OVERWRITE_CREATE`, `CHANNEL_OVERWRITE_UPDATE`, `CHANNEL_OVERWRITE_DELETE`,
|
/// Event types: `CHANNEL_OVERWRITE_CREATE`, `CHANNEL_OVERWRITE_UPDATE`, `CHANNEL_OVERWRITE_DELETE`,
|
||||||
///
|
///
|
||||||
role_name: ?[]const u8,
|
role_name: ?[]const u8 = null,
|
||||||
///
|
///
|
||||||
/// Type of overwritten entity - "0", for "role", or "1" for "member".
|
/// Type of overwritten entity - "0", for "role", or "1" for "member".
|
||||||
///
|
///
|
||||||
/// Event types: `CHANNEL_OVERWRITE_CREATE`, `CHANNEL_OVERWRITE_UPDATE`, `CHANNEL_OVERWRITE_DELETE`,
|
/// Event types: `CHANNEL_OVERWRITE_CREATE`, `CHANNEL_OVERWRITE_UPDATE`, `CHANNEL_OVERWRITE_DELETE`,
|
||||||
///
|
///
|
||||||
type: ?[]const u8,
|
type: ?[]const u8 = null,
|
||||||
///
|
///
|
||||||
/// The type of integration which performed the action
|
/// The type of integration which performed the action
|
||||||
///
|
///
|
||||||
/// Event types: `MEMBER_KICK`, `MEMBER_ROLE_UPDATE`,
|
/// Event types: `MEMBER_KICK`, `MEMBER_ROLE_UPDATE`,
|
||||||
///
|
///
|
||||||
integration_type: ?[]const u8,
|
integration_type: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
@ -1,186 +1,186 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object
|
/// https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object
|
||||||
pub const AutoModerationRule = struct {
|
pub const AutoModerationRule = struct {
|
||||||
/// The id of this rule
|
/// The id of this rule
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// The guild id of the rule
|
/// The guild id of the rule
|
||||||
guild_id: Snowflake,
|
guild_id: Snowflake,
|
||||||
/// The name of the rule
|
/// The name of the rule
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// The id of the user who created this rule.
|
/// The id of the user who created this rule.
|
||||||
creator_id: Snowflake,
|
creator_id: Snowflake,
|
||||||
/// Indicates in what event context a rule should be checked.
|
/// Indicates in what event context a rule should be checked.
|
||||||
event_type: AutoModerationEventTypes,
|
event_type: AutoModerationEventTypes,
|
||||||
/// The type of trigger for this rule
|
/// The type of trigger for this rule
|
||||||
trigger_type: AutoModerationTriggerTypes,
|
trigger_type: AutoModerationTriggerTypes,
|
||||||
/// The metadata used to determine whether a rule should be triggered.
|
/// The metadata used to determine whether a rule should be triggered.
|
||||||
trigger_metadata: AutoModerationRuleTriggerMetadata,
|
trigger_metadata: AutoModerationRuleTriggerMetadata,
|
||||||
/// Actions which will execute whenever a rule is triggered.
|
/// Actions which will execute whenever a rule is triggered.
|
||||||
actions: []AutoModerationAction,
|
actions: []AutoModerationAction,
|
||||||
/// Whether the rule is enabled.
|
/// Whether the rule is enabled.
|
||||||
enabled: bool,
|
enabled: bool,
|
||||||
/// The role ids that are whitelisted. Max 20.
|
/// The role ids that are whitelisted. Max 20.
|
||||||
exempt_roles: [][]const u8,
|
exempt_roles: [][]const u8,
|
||||||
/// The channel ids that are whitelisted. Max 50.
|
/// The channel ids that are whitelisted. Max 50.
|
||||||
exempt_channels: [][]const u8,
|
exempt_channels: [][]const u8,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const AutoModerationEventTypes = enum(u4) {
|
pub const AutoModerationEventTypes = enum(u4) {
|
||||||
/// When a user sends a message
|
/// When a user sends a message
|
||||||
MessageSend = 1,
|
MessageSend = 1,
|
||||||
/// Wen a member edits their profile
|
/// Wen a member edits their profile
|
||||||
MemberUpdate,
|
MemberUpdate,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const AutoModerationTriggerTypes = enum(u4) {
|
pub const AutoModerationTriggerTypes = enum(u4) {
|
||||||
/// Check if content contains words from a user defined list of keywords. Max 6 per guild
|
/// Check if content contains words from a user defined list of keywords. Max 6 per guild
|
||||||
Keyword = 1,
|
Keyword = 1,
|
||||||
/// Check if content represents generic spam. Max 1 per guild
|
/// Check if content represents generic spam. Max 1 per guild
|
||||||
Spam = 3,
|
Spam = 3,
|
||||||
/// Check if content contains words from internal pre-defined word sets. Max 1 per guild
|
/// Check if content contains words from internal pre-defined word sets. Max 1 per guild
|
||||||
KeywordPreset,
|
KeywordPreset,
|
||||||
/// Check if content contains more unique mentions than allowed. Max 1 per guild
|
/// Check if content contains more unique mentions than allowed. Max 1 per guild
|
||||||
MentionSpam,
|
MentionSpam,
|
||||||
/// Check if member profile contains words from a user defined list of keywords. Max 1 per guild
|
/// Check if member profile contains words from a user defined list of keywords. Max 1 per guild
|
||||||
MemberProfile,
|
MemberProfile,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const AutoModerationRuleTriggerMetadata = struct {
|
pub const AutoModerationRuleTriggerMetadata = struct {
|
||||||
///
|
///
|
||||||
/// The keywords needed to match.
|
/// The keywords needed to match.
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Only present with {@link AutoModerationTriggerTypes.Keyword}; and {@link AutoModerationTriggerTypes.MemberProfile};.
|
/// Only present with {@link AutoModerationTriggerTypes.Keyword}; and {@link AutoModerationTriggerTypes.MemberProfile};.
|
||||||
///
|
///
|
||||||
/// Can have up to 1000 elements in the array and each []const u8 can have up to 60 characters
|
/// Can have up to 1000 elements in the array and each []const u8 can have up to 60 characters
|
||||||
///
|
///
|
||||||
keyword_filter: ?[][]const u8,
|
keyword_filter: ?[][]const u8 = null,
|
||||||
///
|
///
|
||||||
/// Regular expression patterns which will be matched against content.
|
/// Regular expression patterns which will be matched against content.
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Only present with {@link AutoModerationTriggerTypes.Keyword}; and {@link AutoModerationTriggerTypes.MemberProfile};.
|
/// Only present with {@link AutoModerationTriggerTypes.Keyword}; and {@link AutoModerationTriggerTypes.MemberProfile};.
|
||||||
///
|
///
|
||||||
/// Can have up to 10 elements in the array and each []const u8 can have up to 260 characters
|
/// Can have up to 10 elements in the array and each []const u8 can have up to 260 characters
|
||||||
///
|
///
|
||||||
regex_patterns: [][]const u8,
|
regex_patterns: [][]const u8,
|
||||||
///
|
///
|
||||||
/// The pre-defined lists of words to match from.
|
/// The pre-defined lists of words to match from.
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Only present with {@link AutoModerationTriggerTypes.KeywordPreset};.
|
/// Only present with {@link AutoModerationTriggerTypes.KeywordPreset};.
|
||||||
///
|
///
|
||||||
presets: ?[]AutoModerationRuleTriggerMetadataPresets,
|
presets: ?[]AutoModerationRuleTriggerMetadataPresets = null,
|
||||||
///
|
///
|
||||||
/// The substrings which will exempt from triggering the preset trigger type.
|
/// The substrings which will exempt from triggering the preset trigger type.
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Only present with {@link AutoModerationTriggerTypes.Keyword};, {@link AutoModerationTriggerTypes.KeywordPreset}; and {@link AutoModerationTriggerTypes.MemberProfile};.
|
/// Only present with {@link AutoModerationTriggerTypes.Keyword};, {@link AutoModerationTriggerTypes.KeywordPreset}; and {@link AutoModerationTriggerTypes.MemberProfile};.
|
||||||
///
|
///
|
||||||
/// When used with {@link AutoModerationTriggerTypes.Keyword}; and {@link AutoModerationTriggerTypes.MemberProfile}; there can have up to 100 elements in the array and each []const u8 can have up to 60 characters.
|
/// When used with {@link AutoModerationTriggerTypes.Keyword}; and {@link AutoModerationTriggerTypes.MemberProfile}; there can have up to 100 elements in the array and each []const u8 can have up to 60 characters.
|
||||||
/// When used with {@link AutoModerationTriggerTypes.KeywordPreset}; there can have up to 1000 elements in the array and each []const u8 can have up to 60 characters.
|
/// When used with {@link AutoModerationTriggerTypes.KeywordPreset}; there can have up to 1000 elements in the array and each []const u8 can have up to 60 characters.
|
||||||
///
|
///
|
||||||
allow_list: ?[][]const u8,
|
allow_list: ?[][]const u8 = null,
|
||||||
///
|
///
|
||||||
/// Total isize of mentions (role & user) allowed per message.
|
/// Total isize of mentions (role & user) allowed per message.
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Only present with {@link AutoModerationTriggerTypes.MentionSpam};.
|
/// Only present with {@link AutoModerationTriggerTypes.MentionSpam};.
|
||||||
///
|
///
|
||||||
/// Maximum of 50
|
/// Maximum of 50
|
||||||
///
|
///
|
||||||
mention_total_limit: ?isize,
|
mention_total_limit: ?isize = null,
|
||||||
///
|
///
|
||||||
/// Whether to automatically detect mention raids.
|
/// Whether to automatically detect mention raids.
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Only present with {@link AutoModerationTriggerTypes.MentionSpam};.
|
/// Only present with {@link AutoModerationTriggerTypes.MentionSpam};.
|
||||||
///
|
///
|
||||||
mention_raid_protection_enabled: ?bool,
|
mention_raid_protection_enabled: ?bool = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const AutoModerationRuleTriggerMetadataPresets = enum(u4) {
|
pub const AutoModerationRuleTriggerMetadataPresets = enum(u4) {
|
||||||
/// Words that may be considered forms of swearing or cursing
|
/// Words that may be considered forms of swearing or cursing
|
||||||
Profanity = 1,
|
Profanity = 1,
|
||||||
/// Words that refer to sexually explicit behavior or activity
|
/// Words that refer to sexually explicit behavior or activity
|
||||||
SexualContent,
|
SexualContent,
|
||||||
/// Personal insults or words that may be considered hate speech
|
/// Personal insults or words that may be considered hate speech
|
||||||
Slurs,
|
Slurs,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const AutoModerationAction = struct {
|
pub const AutoModerationAction = struct {
|
||||||
/// The type of action to take when a rule is triggered
|
/// The type of action to take when a rule is triggered
|
||||||
type: AutoModerationActionType,
|
type: AutoModerationActionType,
|
||||||
/// additional metadata needed during execution for this specific action type
|
/// additional metadata needed during execution for this specific action type
|
||||||
metadata: AutoModerationActionMetadata,
|
metadata: AutoModerationActionMetadata,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const AutoModerationActionType = enum(u4) {
|
pub const AutoModerationActionType = enum(u4) {
|
||||||
/// Blocks the content of a message according to the rule
|
/// Blocks the content of a message according to the rule
|
||||||
BlockMessage = 1,
|
BlockMessage = 1,
|
||||||
/// Logs user content to a specified channel
|
/// Logs user content to a specified channel
|
||||||
SendAlertMessage,
|
SendAlertMessage,
|
||||||
///
|
///
|
||||||
/// Times out user for specified duration
|
/// Times out user for specified duration
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// A timeout action can only be set up for {@link AutoModerationTriggerTypes.Keyword}; and {@link AutoModerationTriggerTypes.MentionSpam}; rules.
|
/// A timeout action can only be set up for {@link AutoModerationTriggerTypes.Keyword}; and {@link AutoModerationTriggerTypes.MentionSpam}; rules.
|
||||||
///
|
///
|
||||||
/// The `MODERATE_MEMBERS` permission is required to use the timeout action type.
|
/// The `MODERATE_MEMBERS` permission is required to use the timeout action type.
|
||||||
///
|
///
|
||||||
Timeout,
|
Timeout,
|
||||||
/// prevents a member from using text, voice, or other interactions
|
/// prevents a member from using text, voice, or other interactions
|
||||||
BlockMemberInteraction,
|
BlockMemberInteraction,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const AutoModerationActionMetadata = struct {
|
pub const AutoModerationActionMetadata = struct {
|
||||||
/// The id of channel to which user content should be logged. Only in ActionType.SendAlertMessage
|
/// The id of channel to which user content should be logged. Only in ActionType.SendAlertMessage
|
||||||
channel_id: ?Snowflake,
|
channel_id: ?Snowflake = null,
|
||||||
/// Additional explanation that will be shown to members whenever their message is blocked. Maximum of 150 characters. Only supported for AutoModerationActionType.BlockMessage
|
/// Additional explanation that will be shown to members whenever their message is blocked. Maximum of 150 characters. Only supported for AutoModerationActionType.BlockMessage
|
||||||
custom_message: ?[]const u8,
|
custom_message: ?[]const u8 = null,
|
||||||
/// Timeout duration in seconds maximum of 2419200 seconds (4 weeks). Only supported for TriggerType.Keyword && Only in ActionType.Timeout
|
/// Timeout duration in seconds maximum of 2419200 seconds (4 weeks). Only supported for TriggerType.Keyword && Only in ActionType.Timeout
|
||||||
duration_seconds: ?isize,
|
duration_seconds: ?isize = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway-events#auto-moderation-action-execution-auto-moderation-action-execution-event-fields
|
/// https://discord.com/developers/docs/topics/gateway-events#auto-moderation-action-execution-auto-moderation-action-execution-event-fields
|
||||||
pub const AutoModerationActionExecution = struct {
|
pub const AutoModerationActionExecution = struct {
|
||||||
/// The id of the guild
|
/// The id of the guild
|
||||||
guild_id: Snowflake,
|
guild_id: Snowflake,
|
||||||
/// The id of the rule that was executed
|
/// The id of the rule that was executed
|
||||||
rule_id: Snowflake,
|
rule_id: Snowflake,
|
||||||
/// The id of the user which generated the content which triggered the rule
|
/// The id of the user which generated the content which triggered the rule
|
||||||
user_id: Snowflake,
|
user_id: Snowflake,
|
||||||
/// The content from the user
|
/// The content from the user
|
||||||
content: []const u8,
|
content: []const u8,
|
||||||
/// Action which was executed
|
/// Action which was executed
|
||||||
action: AutoModerationAction,
|
action: AutoModerationAction,
|
||||||
/// The trigger type of the rule that was executed.
|
/// The trigger type of the rule that was executed.
|
||||||
rule_trigger_type: AutoModerationTriggerTypes,
|
rule_trigger_type: AutoModerationTriggerTypes,
|
||||||
/// The id of the channel in which user content was posted
|
/// The id of the channel in which user content was posted
|
||||||
channel_id: ?Snowflake,
|
channel_id: ?Snowflake = null,
|
||||||
/// The id of the message. Will not exist if message was blocked by automod or content was not part of any message
|
/// The id of the message. Will not exist if message was blocked by automod or content was not part of any message
|
||||||
message_id: ?Snowflake,
|
message_id: ?Snowflake = null,
|
||||||
/// The id of any system auto moderation messages posted as a result of this action
|
/// The id of any system auto moderation messages posted as a result of this action
|
||||||
alert_system_message_id: ?Snowflake,
|
alert_system_message_id: ?Snowflake = null,
|
||||||
/// The word or phrase that triggerred the rule.
|
/// The word or phrase that triggerred the rule.
|
||||||
matched_keyword: ?[]const u8,
|
matched_keyword: ?[]const u8 = null,
|
||||||
/// The substring in content that triggered the rule
|
/// The substring in content that triggered the rule
|
||||||
matched_content: ?[]const u8,
|
matched_content: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
@ -1,234 +1,234 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const Member = @import("member.zig").Member;
|
const Member = @import("member.zig").Member;
|
||||||
|
|
||||||
const AllowedMentionsTypes = @import("shared.zig").AllowedMentionsTypes;
|
const AllowedMentionsTypes = @import("shared.zig").AllowedMentionsTypes;
|
||||||
const ChannelTypes = @import("shared.zig").ChannelTypes;
|
const ChannelTypes = @import("shared.zig").ChannelTypes;
|
||||||
const OverwriteTypes = @import("shared.zig").OverwriteTypes;
|
const OverwriteTypes = @import("shared.zig").OverwriteTypes;
|
||||||
const ChannelFlags = @import("shared.zig").ChannelFlags;
|
const ChannelFlags = @import("shared.zig").ChannelFlags;
|
||||||
const TargetTypes = @import("shared.zig").TargetTypes;
|
const TargetTypes = @import("shared.zig").TargetTypes;
|
||||||
const VideoQualityModes = @import("shared.zig").VideoQualityModes;
|
const VideoQualityModes = @import("shared.zig").VideoQualityModes;
|
||||||
const SortOrderTypes = @import("shared.zig").SortOrderTypes;
|
const SortOrderTypes = @import("shared.zig").SortOrderTypes;
|
||||||
const User = @import("user.zig").User;
|
const User = @import("user.zig").User;
|
||||||
const ThreadMetadata = @import("thread.zig").ThreadMetadata;
|
const ThreadMetadata = @import("thread.zig").ThreadMetadata;
|
||||||
const ThreadMember = @import("thread.zig").ThreadMember;
|
const ThreadMember = @import("thread.zig").ThreadMember;
|
||||||
const ForumLayout = @import("shared.zig").ForumLayout;
|
const ForumLayout = @import("shared.zig").ForumLayout;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#allowed-mentions-object
|
/// https://discord.com/developers/docs/resources/channel#allowed-mentions-object
|
||||||
pub const AllowedMentions = struct {
|
pub const AllowedMentions = struct {
|
||||||
/// An array of allowed mention types to parse from the content.
|
/// An array of allowed mention types to parse from the content.
|
||||||
parse: ?[]AllowedMentionsTypes,
|
parse: ?[]AllowedMentionsTypes = null,
|
||||||
/// For replies, whether to mention the author of the message being replied to (default false)
|
/// For replies, whether to mention the author of the message being replied to (default false)
|
||||||
replied_user: ?bool,
|
replied_user: ?bool = null,
|
||||||
/// Array of role_ids to mention (Max size of 100)
|
/// Array of role_ids to mention (Max size of 100)
|
||||||
roles: ?[][]const u8,
|
roles: ?[][]const u8 = null,
|
||||||
/// Array of user_ids to mention (Max size of 100)
|
/// Array of user_ids to mention (Max size of 100)
|
||||||
users: ?[][]const u8,
|
users: ?[][]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway#typing-start
|
/// https://discord.com/developers/docs/topics/gateway#typing-start
|
||||||
pub const TypingStart = struct {
|
pub const TypingStart = struct {
|
||||||
/// Unix time (in seconds) of when the user started typing
|
/// Unix time (in seconds) of when the user started typing
|
||||||
timestamp: isize,
|
timestamp: isize,
|
||||||
/// id of the channel
|
/// id of the channel
|
||||||
channel_id: Snowflake,
|
channel_id: Snowflake,
|
||||||
/// id of the guild
|
/// id of the guild
|
||||||
guild_id: ?Snowflake,
|
guild_id: ?Snowflake = null,
|
||||||
/// id of the user
|
/// id of the user
|
||||||
user_id: Snowflake,
|
user_id: Snowflake,
|
||||||
/// The member who started typing if this happened in a guild
|
/// The member who started typing if this happened in a guild
|
||||||
member: ?Member,
|
member: ?Member = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#channel-object
|
/// https://discord.com/developers/docs/resources/channel#channel-object
|
||||||
pub const Channel = struct {
|
pub const Channel = struct {
|
||||||
/// The id of the channel
|
/// The id of the channel
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// The type of channel
|
/// The type of channel
|
||||||
type: ChannelTypes,
|
type: ChannelTypes,
|
||||||
/// The id of the guild
|
/// The id of the guild
|
||||||
guild_id: ?Snowflake,
|
guild_id: ?Snowflake = null,
|
||||||
/// Sorting position of the channel (channels with the same position are sorted by id)
|
/// Sorting position of the channel (channels with the same position are sorted by id)
|
||||||
position: ?isize,
|
position: ?isize = null,
|
||||||
/// Explicit permission overwrites for members and roles
|
/// Explicit permission overwrites for members and roles
|
||||||
permission_overwrites: ?[]Overwrite,
|
permission_overwrites: ?[]Overwrite = null,
|
||||||
/// The name of the channel (1-100 characters)
|
/// The name of the channel (1-100 characters)
|
||||||
name: ?[]const u8,
|
name: ?[]const u8 = null,
|
||||||
/// The channel topic (0-4096 characters for GUILD_FORUM channels, 0-1024 characters for all others)
|
/// The channel topic (0-4096 characters for GUILD_FORUM channels, 0-1024 characters for all others)
|
||||||
topic: ?[]const u8,
|
topic: ?[]const u8 = null,
|
||||||
/// Whether the channel is nsfw
|
/// Whether the channel is nsfw
|
||||||
nsfw: ?bool,
|
nsfw: ?bool = null,
|
||||||
/// The id of the last message sent in this channel (may not point to an existing or valid message)
|
/// The id of the last message sent in this channel (may not point to an existing or valid message)
|
||||||
last_message_id: ?Snowflake,
|
last_message_id: ?Snowflake = null,
|
||||||
/// The bitrate (in bits) of the voice or stage channel
|
/// The bitrate (in bits) of the voice or stage channel
|
||||||
bitrate: ?isize,
|
bitrate: ?isize = null,
|
||||||
/// The user limit of the voice or stage channel
|
/// The user limit of the voice or stage channel
|
||||||
user_limit: ?isize,
|
user_limit: ?isize = null,
|
||||||
/// Amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission `manage_messages` or `manage_channel`, are unaffected
|
/// Amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission `manage_messages` or `manage_channel`, are unaffected
|
||||||
rate_limit_per_user: ?isize,
|
rate_limit_per_user: ?isize = null,
|
||||||
/// the recipients of the DM
|
/// the recipients of the DM
|
||||||
recipients: ?[]User,
|
recipients: ?[]User = null,
|
||||||
/// icon hash of the group DM
|
/// icon hash of the group DM
|
||||||
icon: ?[]const u8,
|
icon: ?[]const u8 = null,
|
||||||
/// Id of the creator of the thread
|
/// Id of the creator of the thread
|
||||||
owner_id: ?Snowflake,
|
owner_id: ?Snowflake = null,
|
||||||
/// Application id of the group DM creator if it is bot-created
|
/// Application id of the group DM creator if it is bot-created
|
||||||
application_id: ?Snowflake,
|
application_id: ?Snowflake = null,
|
||||||
/// For group DM channels: whether the channel is managed by an application via the `gdm.join` OAuth2 scope.,
|
/// For group DM channels: whether the channel is managed by an application via the `gdm.join` OAuth2 scope.,
|
||||||
managed: ?bool,
|
managed: ?bool = null,
|
||||||
/// For guild channels: Id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created,
|
/// For guild channels: Id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created,
|
||||||
parent_id: ?Snowflake,
|
parent_id: ?Snowflake = null,
|
||||||
/// When the last pinned message was pinned. This may be null in events such as GUILD_CREATE when a message is not pinned.
|
/// When the last pinned message was pinned. This may be null in events such as GUILD_CREATE when a message is not pinned.
|
||||||
last_pin_timestamp: ?[]const u8,
|
last_pin_timestamp: ?[]const u8 = null,
|
||||||
/// Voice region id for the voice or stage channel, automatic when set to null
|
/// Voice region id for the voice or stage channel, automatic when set to null
|
||||||
rtc_region: ?[]const u8,
|
rtc_region: ?[]const u8 = null,
|
||||||
/// The camera video quality mode of the voice channel, 1 when not present
|
/// The camera video quality mode of the voice channel, 1 when not present
|
||||||
video_quality_mode: ?VideoQualityModes,
|
video_quality_mode: ?VideoQualityModes = null,
|
||||||
/// An approximate count of messages in a thread, stops counting at 50
|
/// An approximate count of messages in a thread, stops counting at 50
|
||||||
message_count: ?isize,
|
message_count: ?isize = null,
|
||||||
/// An approximate count of users in a thread, stops counting at 50
|
/// An approximate count of users in a thread, stops counting at 50
|
||||||
member_count: ?isize,
|
member_count: ?isize = null,
|
||||||
/// Thread-specific fields not needed by other channels
|
/// Thread-specific fields not needed by other channels
|
||||||
thread_metadata: ?ThreadMetadata,
|
thread_metadata: ?ThreadMetadata = null,
|
||||||
/// Thread member object for the current user, if they have joined the thread, only included on certain API endpoints
|
/// Thread member object for the current user, if they have joined the thread, only included on certain API endpoints
|
||||||
member: ?ThreadMember,
|
member: ?ThreadMember = null,
|
||||||
/// Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080,
|
/// Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080,
|
||||||
default_auto_archive_duration: ?isize,
|
default_auto_archive_duration: ?isize = null,
|
||||||
/// computed permissions for the invoking user in the channel, including overwrites, only included when part of the resolved data received on a slash command interaction. This does not include implicit permissions, which may need to be checked separately.
|
/// computed permissions for the invoking user in the channel, including overwrites, only included when part of the resolved data received on a slash command interaction. This does not include implicit permissions, which may need to be checked separately.
|
||||||
permissions: ?[]const u8,
|
permissions: ?[]const u8 = null,
|
||||||
/// The flags of the channel
|
/// The flags of the channel
|
||||||
flags: ?ChannelFlags,
|
flags: ?ChannelFlags = null,
|
||||||
/// isize of messages ever sent in a thread, it's similar to `message_count` on message creation, but will not decrement the isize when a message is deleted
|
/// isize of messages ever sent in a thread, it's similar to `message_count` on message creation, but will not decrement the isize when a message is deleted
|
||||||
total_message_sent: ?isize,
|
total_message_sent: ?isize = null,
|
||||||
/// The set of tags that can be used in a GUILD_FORUM channel
|
/// The set of tags that can be used in a GUILD_FORUM channel
|
||||||
available_tags: ?[]ForumTag,
|
available_tags: ?[]ForumTag = null,
|
||||||
/// The IDs of the set of tags that have been applied to a thread in a GUILD_FORUM channel
|
/// The IDs of the set of tags that have been applied to a thread in a GUILD_FORUM channel
|
||||||
applied_tags: ?[][]const u8,
|
applied_tags: ?[][]const u8 = null,
|
||||||
/// the emoji to show in the add reaction button on a thread in a GUILD_FORUM channel
|
/// the emoji to show in the add reaction button on a thread in a GUILD_FORUM channel
|
||||||
default_reaction_emoji: ?DefaultReactionEmoji,
|
default_reaction_emoji: ?DefaultReactionEmoji = null,
|
||||||
/// the initial rate_limit_per_user to set on newly created threads in a channel. this field is copied to the thread at creation time and does not live update.
|
/// the initial rate_limit_per_user to set on newly created threads in a channel. this field is copied to the thread at creation time and does not live update.
|
||||||
default_thread_rate_limit_per_user: ?isize,
|
default_thread_rate_limit_per_user: ?isize = null,
|
||||||
/// the default sort order type used to order posts in GUILD_FORUM channels. Defaults to null, which indicates a preferred sort order hasn't been set by a channel admin
|
/// the default sort order type used to order posts in GUILD_FORUM channels. Defaults to null, which indicates a preferred sort order hasn't been set by a channel admin
|
||||||
default_sort_order: ?SortOrderTypes,
|
default_sort_order: ?SortOrderTypes = null,
|
||||||
/// the default forum layout view used to display posts in `GUILD_FORUM` channels. Defaults to `0`, which indicates a layout view has not been set by a channel admin
|
/// the default forum layout view used to display posts in `GUILD_FORUM` channels. Defaults to `0`, which indicates a layout view has not been set by a channel admin
|
||||||
default_forum_layout: ?ForumLayout,
|
default_forum_layout: ?ForumLayout = null,
|
||||||
/// When a thread is created this will be true on that channel payload for the thread.
|
/// When a thread is created this will be true on that channel payload for the thread.
|
||||||
newly_created: ?bool,
|
newly_created: ?bool = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#welcome-screen-object-welcome-screen-structure
|
/// https://discord.com/developers/docs/resources/guild#welcome-screen-object-welcome-screen-structure
|
||||||
pub const WelcomeScreen = struct {
|
pub const WelcomeScreen = struct {
|
||||||
/// The server description shown in the welcome screen
|
/// The server description shown in the welcome screen
|
||||||
description: ?[]const u8,
|
description: ?[]const u8 = null,
|
||||||
/// The channels shown in the welcome screen, up to 5
|
/// The channels shown in the welcome screen, up to 5
|
||||||
welcome_channels: []WelcomeScreenChannel,
|
welcome_channels: []WelcomeScreenChannel,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#welcome-screen-object-welcome-screen-channel-structure
|
/// https://discord.com/developers/docs/resources/guild#welcome-screen-object-welcome-screen-channel-structure
|
||||||
pub const WelcomeScreenChannel = struct {
|
pub const WelcomeScreenChannel = struct {
|
||||||
/// The description shown for the channel
|
/// The description shown for the channel
|
||||||
description: []const u8,
|
description: []const u8,
|
||||||
/// The channel's id
|
/// The channel's id
|
||||||
channel_id: Snowflake,
|
channel_id: Snowflake,
|
||||||
/// The emoji id, if the emoji is custom
|
/// The emoji id, if the emoji is custom
|
||||||
emoji_id: ?Snowflake,
|
emoji_id: ?Snowflake = null,
|
||||||
/// The emoji name if custom, the unicode character if standard, or `null` if no emoji is set
|
/// The emoji name if custom, the unicode character if standard, or `null` if no emoji is set
|
||||||
emoji_name: ?[]const u8,
|
emoji_name: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/stage-instance#auto-closing-stage-instance-structure
|
/// https://discord.com/developers/docs/resources/stage-instance#auto-closing-stage-instance-structure
|
||||||
pub const StageInstance = struct {
|
pub const StageInstance = struct {
|
||||||
/// The topic of the Stage instance (1-120 characters)
|
/// The topic of the Stage instance (1-120 characters)
|
||||||
topic: []const u8,
|
topic: []const u8,
|
||||||
/// The id of this Stage instance
|
/// The id of this Stage instance
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// The guild id of the associated Stage channel
|
/// The guild id of the associated Stage channel
|
||||||
guild_id: Snowflake,
|
guild_id: Snowflake,
|
||||||
/// The id of the associated Stage channel
|
/// The id of the associated Stage channel
|
||||||
channel_id: Snowflake,
|
channel_id: Snowflake,
|
||||||
/// The id of the scheduled event for this Stage instance
|
/// The id of the scheduled event for this Stage instance
|
||||||
guild_scheduled_event_id: ?Snowflake,
|
guild_scheduled_event_id: ?Snowflake = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const Overwrite = struct {
|
pub const Overwrite = struct {
|
||||||
/// Either 0 (role) or 1 (member)
|
/// Either 0 (role) or 1 (member)
|
||||||
type: OverwriteTypes,
|
type: OverwriteTypes,
|
||||||
/// Role or user id
|
/// Role or user id
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// Permission bit set
|
/// Permission bit set
|
||||||
allow: ?[]const u8,
|
allow: ?[]const u8 = null,
|
||||||
/// Permission bit set
|
/// Permission bit set
|
||||||
deny: ?[]const u8,
|
deny: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#followed-channel-object
|
/// https://discord.com/developers/docs/resources/channel#followed-channel-object
|
||||||
pub const FollowedChannel = struct {
|
pub const FollowedChannel = struct {
|
||||||
/// Source message id
|
/// Source message id
|
||||||
channel_id: Snowflake,
|
channel_id: Snowflake,
|
||||||
/// Created target webhook id
|
/// Created target webhook id
|
||||||
webhook_id: Snowflake,
|
webhook_id: Snowflake,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const ForumTag = struct {
|
pub const ForumTag = struct {
|
||||||
/// The id of the tag
|
/// The id of the tag
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// The name of the tag (0-20 characters)
|
/// The name of the tag (0-20 characters)
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// Whether this tag can only be added to or removed from threads by a member with the MANAGE_THREADS permission
|
/// Whether this tag can only be added to or removed from threads by a member with the MANAGE_THREADS permission
|
||||||
moderated: bool,
|
moderated: bool,
|
||||||
/// The id of a guild's custom emoji At most one of emoji_id and emoji_name may be set.
|
/// The id of a guild's custom emoji At most one of emoji_id and emoji_name may be set.
|
||||||
emoji_id: Snowflake,
|
emoji_id: Snowflake,
|
||||||
/// The unicode character of the emoji
|
/// The unicode character of the emoji
|
||||||
emoji_name: ?[]const u8,
|
emoji_name: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const DefaultReactionEmoji = struct {
|
pub const DefaultReactionEmoji = struct {
|
||||||
/// The id of a guild's custom emoji
|
/// The id of a guild's custom emoji
|
||||||
emoji_id: Snowflake,
|
emoji_id: Snowflake,
|
||||||
/// The unicode character of the emoji
|
/// The unicode character of the emoji
|
||||||
emoji_name: ?[]const u8,
|
emoji_name: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
|
/// https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
|
||||||
pub const ModifyGuildChannelPositions = struct {
|
pub const ModifyGuildChannelPositions = struct {
|
||||||
/// Channel id
|
/// Channel id
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// Sorting position of the channel (channels with the same position are sorted by id)
|
/// Sorting position of the channel (channels with the same position are sorted by id)
|
||||||
position: ?isize,
|
position: ?isize = null,
|
||||||
/// Syncs the permission overwrites with the new parent, if moving to a new category
|
/// Syncs the permission overwrites with the new parent, if moving to a new category
|
||||||
lock_positions: ?bool,
|
lock_positions: ?bool = null,
|
||||||
/// The new parent ID for the channel that is moved
|
/// The new parent ID for the channel that is moved
|
||||||
parent_id: ?Snowflake,
|
parent_id: ?Snowflake = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const CreateChannelInvite = struct {
|
pub const CreateChannelInvite = struct {
|
||||||
/// Duration of invite in seconds before expiry, or 0 for never. Between 0 and 604800 (7 days). Default: 86400 (24 hours)
|
/// Duration of invite in seconds before expiry, or 0 for never. Between 0 and 604800 (7 days). Default: 86400 (24 hours)
|
||||||
max_age: ?isize,
|
max_age: ?isize = null,
|
||||||
/// Max number of users or 0 for unlimited. Between 0 and 100. Default: 0
|
/// Max number of users or 0 for unlimited. Between 0 and 100. Default: 0
|
||||||
max_uses: ?isize,
|
max_uses: ?isize = null,
|
||||||
/// Whether this invite only grants temporary membership. Default: false
|
/// Whether this invite only grants temporary membership. Default: false
|
||||||
temporary: ?bool,
|
temporary: ?bool = null,
|
||||||
/// If true, don't try to reuse similar invite (useful for creating many unique one time use invites). Default: false
|
/// If true, don't try to reuse similar invite (useful for creating many unique one time use invites). Default: false
|
||||||
unique: ?bool,
|
unique: ?bool = null,
|
||||||
/// The type of target for this voice channel invite
|
/// The type of target for this voice channel invite
|
||||||
target_type: ?TargetTypes,
|
target_type: ?TargetTypes = null,
|
||||||
/// The id of the user whose stream to display for this invite, required if `target_type` is 1, the user must be streaming in the channel
|
/// The id of the user whose stream to display for this invite, required if `target_type` is 1, the user must be streaming in the channel
|
||||||
target_user_id: ?Snowflake,
|
target_user_id: ?Snowflake = null,
|
||||||
/// The id of the embedded application to open for this invite, required if `target_type` is 2, the application must have the `EMBEDDED` flag
|
/// The id of the embedded application to open for this invite, required if `target_type` is 2, the application must have the `EMBEDDED` flag
|
||||||
target_application_id: ?Snowflake,
|
target_application_id: ?Snowflake = null,
|
||||||
};
|
};
|
||||||
|
@ -1,243 +1,243 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const ApplicationCommandTypes = @import("shared.zig").ApplicationCommandTypes;
|
const ApplicationCommandTypes = @import("shared.zig").ApplicationCommandTypes;
|
||||||
const InteractionContextType = @import("integration.zig").InteractionContextType;
|
const InteractionContextType = @import("integration.zig").InteractionContextType;
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const ApplicationCommandPermissionTypes = @import("shared.zig").ApplicationCommandPermissionTypes;
|
const ApplicationCommandPermissionTypes = @import("shared.zig").ApplicationCommandPermissionTypes;
|
||||||
const ApplicationIntegrationType = @import("application.zig").ApplicationIntegrationType;
|
const ApplicationIntegrationType = @import("application.zig").ApplicationIntegrationType;
|
||||||
const ApplicationCommandOptionTypes = @import("shared.zig").ApplicationCommandOptionTypes;
|
const ApplicationCommandOptionTypes = @import("shared.zig").ApplicationCommandOptionTypes;
|
||||||
const ChannelTypes = @import("shared.zig").ChannelTypes;
|
const ChannelTypes = @import("shared.zig").ChannelTypes;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-structure
|
/// https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-structure
|
||||||
pub const ApplicationCommand = struct {
|
pub const ApplicationCommand = struct {
|
||||||
/// Type of command, defaults to `ApplicationCommandTypes.ChatInput`
|
/// Type of command, defaults to `ApplicationCommandTypes.ChatInput`
|
||||||
type: ?ApplicationCommandTypes,
|
type: ?ApplicationCommandTypes = null,
|
||||||
///
|
///
|
||||||
/// Name of command, 1-32 characters.
|
/// Name of command, 1-32 characters.
|
||||||
/// `ApplicationCommandTypes.ChatInput` command names must match the following regex `^[-_\p{L};\p{N};\p{sc=Deva};\p{sc=Thai};]{1,32};$` with the unicode flag set.
|
/// `ApplicationCommandTypes.ChatInput` command names must match the following regex `^[-_\p{L};\p{N};\p{sc=Deva};\p{sc=Thai};]{1,32};$` with the unicode flag set.
|
||||||
/// If there is a lowercase variant of any letters used, you must use those.
|
/// If there is a lowercase variant of any letters used, you must use those.
|
||||||
/// Characters with no lowercase variants and/or uncased letters are still allowed.
|
/// Characters with no lowercase variants and/or uncased letters are still allowed.
|
||||||
/// ApplicationCommandTypes.User` and `ApplicationCommandTypes.Message` commands may be mixed case and can include spaces.
|
/// ApplicationCommandTypes.User` and `ApplicationCommandTypes.Message` commands may be mixed case and can include spaces.
|
||||||
///
|
///
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// Localization object for `name` field. Values follow the same restrictions as `name`
|
/// Localization object for `name` field. Values follow the same restrictions as `name`
|
||||||
name_localizations: ?[]const u8, //?Localization,
|
name_localizations: ?[]const u8, //?Localization = null,
|
||||||
/// Description for `ApplicationCommandTypes.ChatInput` commands, 1-100 characters.
|
/// Description for `ApplicationCommandTypes.ChatInput` commands, 1-100 characters.
|
||||||
description: ?[]const u8,
|
description: ?[]const u8 = null,
|
||||||
/// Localization object for `description` field. Values follow the same restrictions as `description`
|
/// Localization object for `description` field. Values follow the same restrictions as `description`
|
||||||
description_localizations: ?[]const u8, //?Localization,
|
description_localizations: ?[]const u8, //?Localization = null,
|
||||||
/// Parameters for the command, max of 25
|
/// Parameters for the command, max of 25
|
||||||
options: ?[]ApplicationCommandOption,
|
options: ?[]ApplicationCommandOption = null,
|
||||||
/// Set of permissions represented as a bit set
|
/// Set of permissions represented as a bit set
|
||||||
default_member_permissions: ?[]const u8,
|
default_member_permissions: ?[]const u8 = null,
|
||||||
///
|
///
|
||||||
/// Installation contexts where the command is available
|
/// Installation contexts where the command is available
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// This value is available only for globally-scoped commands
|
/// This value is available only for globally-scoped commands
|
||||||
/// Defaults to the application configured contexts
|
/// Defaults to the application configured contexts
|
||||||
///
|
///
|
||||||
integration_types: ?[]ApplicationIntegrationType,
|
integration_types: ?[]ApplicationIntegrationType = null,
|
||||||
///
|
///
|
||||||
/// Interaction context(s) where the command can be used
|
/// Interaction context(s) where the command can be used
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// This value is available only for globally-scoped commands
|
/// This value is available only for globally-scoped commands
|
||||||
/// By default, all interaction context types included for new commands.
|
/// By default, all interaction context types included for new commands.
|
||||||
///
|
///
|
||||||
contexts: ?[]InteractionContextType,
|
contexts: ?[]InteractionContextType = null,
|
||||||
///
|
///
|
||||||
/// Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible.
|
/// Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible.
|
||||||
///
|
///
|
||||||
/// @deprecated use {@link contexts}; instead
|
/// @deprecated use {@link contexts}; instead
|
||||||
///
|
///
|
||||||
dm_permission: ?bool,
|
dm_permission: ?bool = null,
|
||||||
/// Indicates whether the command is age-restricted, defaults to false
|
/// Indicates whether the command is age-restricted, defaults to false
|
||||||
nsfw: ?bool,
|
nsfw: ?bool = null,
|
||||||
/// Auto incrementing version identifier updated during substantial record changes
|
/// Auto incrementing version identifier updated during substantial record changes
|
||||||
version: ?[]const u8,
|
version: ?[]const u8 = null,
|
||||||
///
|
///
|
||||||
///Determines whether the interaction is handled by the app's interactions handler or by
|
///Determines whether the interaction is handled by the app's interactions handler or by
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// This can only be set for application commands of type `PRIMARY_ENTRY_POINT` for applications with the `EMBEDDED` flag (i.e. applications that have an Activity).
|
/// This can only be set for application commands of type `PRIMARY_ENTRY_POINT` for applications with the `EMBEDDED` flag (i.e. applications that have an Activity).
|
||||||
///
|
///
|
||||||
handler: ?InteractionEntryPointCommandHandlerType,
|
handler: ?InteractionEntryPointCommandHandlerType = null,
|
||||||
/// Unique ID of command
|
/// Unique ID of command
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// ID of the parent application
|
/// ID of the parent application
|
||||||
application_id: Snowflake,
|
application_id: Snowflake,
|
||||||
/// Guild id of the command, if not global
|
/// Guild id of the command, if not global
|
||||||
guild_id: ?Snowflake,
|
guild_id: ?Snowflake = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const CreateApplicationCommand = struct {
|
pub const CreateApplicationCommand = struct {
|
||||||
/// Type of command, defaults to `ApplicationCommandTypes.ChatInput`
|
/// Type of command, defaults to `ApplicationCommandTypes.ChatInput`
|
||||||
type: ?ApplicationCommandTypes,
|
type: ?ApplicationCommandTypes = null,
|
||||||
///
|
///
|
||||||
/// Name of command, 1-32 characters.
|
/// Name of command, 1-32 characters.
|
||||||
/// `ApplicationCommandTypes.ChatInput` command names must match the following regex `^[-_\p{L};\p{N};\p{sc=Deva};\p{sc=Thai};]{1,32};$` with the unicode flag set.
|
/// `ApplicationCommandTypes.ChatInput` command names must match the following regex `^[-_\p{L};\p{N};\p{sc=Deva};\p{sc=Thai};]{1,32};$` with the unicode flag set.
|
||||||
/// If there is a lowercase variant of any letters used, you must use those.
|
/// If there is a lowercase variant of any letters used, you must use those.
|
||||||
/// Characters with no lowercase variants and/or uncased letters are still allowed.
|
/// Characters with no lowercase variants and/or uncased letters are still allowed.
|
||||||
/// ApplicationCommandTypes.User` and `ApplicationCommandTypes.Message` commands may be mixed case and can include spaces.
|
/// ApplicationCommandTypes.User` and `ApplicationCommandTypes.Message` commands may be mixed case and can include spaces.
|
||||||
///
|
///
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// Localization object for `name` field. Values follow the same restrictions as `name`
|
/// Localization object for `name` field. Values follow the same restrictions as `name`
|
||||||
name_localizations: []const u8, //?Localization,
|
name_localizations: []const u8, //?Localization,
|
||||||
/// Description for `ApplicationCommandTypes.ChatInput` commands, 1-100 characters.
|
/// Description for `ApplicationCommandTypes.ChatInput` commands, 1-100 characters.
|
||||||
description: ?[]const u8,
|
description: ?[]const u8 = null,
|
||||||
/// Localization object for `description` field. Values follow the same restrictions as `description`
|
/// Localization object for `description` field. Values follow the same restrictions as `description`
|
||||||
description_localizations: []const u8, //?Localization,
|
description_localizations: []const u8, //?Localization,
|
||||||
/// Parameters for the command, max of 25
|
/// Parameters for the command, max of 25
|
||||||
options: ?[]ApplicationCommandOption,
|
options: ?[]ApplicationCommandOption = null,
|
||||||
/// Set of permissions represented as a bit set
|
/// Set of permissions represented as a bit set
|
||||||
default_member_permissions: ?[]const u8,
|
default_member_permissions: ?[]const u8 = null,
|
||||||
///
|
///
|
||||||
/// Installation contexts where the command is available
|
/// Installation contexts where the command is available
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// This value is available only for globally-scoped commands
|
/// This value is available only for globally-scoped commands
|
||||||
/// Defaults to the application configured contexts
|
/// Defaults to the application configured contexts
|
||||||
///
|
///
|
||||||
integration_types: ?[]ApplicationIntegrationType,
|
integration_types: ?[]ApplicationIntegrationType = null,
|
||||||
///
|
///
|
||||||
/// Interaction context(s) where the command can be used
|
/// Interaction context(s) where the command can be used
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// This value is available only for globally-scoped commands
|
/// This value is available only for globally-scoped commands
|
||||||
/// By default, all interaction context types included for new commands.
|
/// By default, all interaction context types included for new commands.
|
||||||
///
|
///
|
||||||
contexts: ?[]InteractionContextType,
|
contexts: ?[]InteractionContextType = null,
|
||||||
///
|
///
|
||||||
/// Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible.
|
/// Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible.
|
||||||
///
|
///
|
||||||
/// @deprecated use {@link contexts}; instead
|
/// @deprecated use {@link contexts}; instead
|
||||||
///
|
///
|
||||||
dm_permission: ?bool,
|
dm_permission: ?bool = null,
|
||||||
/// Indicates whether the command is age-restricted, defaults to false
|
/// Indicates whether the command is age-restricted, defaults to false
|
||||||
nsfw: ?bool,
|
nsfw: ?bool = null,
|
||||||
/// Auto incrementing version identifier updated during substantial record changes
|
/// Auto incrementing version identifier updated during substantial record changes
|
||||||
version: ?[]const u8,
|
version: ?[]const u8 = null,
|
||||||
///
|
///
|
||||||
///Determines whether the interaction is handled by the app's interactions handler or by
|
///Determines whether the interaction is handled by the app's interactions handler or by
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// This can only be set for application commands of type `PRIMARY_ENTRY_POINT` for applications with the `EMBEDDED` flag (i.e. applications that have an Activity).
|
/// This can only be set for application commands of type `PRIMARY_ENTRY_POINT` for applications with the `EMBEDDED` flag (i.e. applications that have an Activity).
|
||||||
///
|
///
|
||||||
handler: ?InteractionEntryPointCommandHandlerType,
|
handler: ?InteractionEntryPointCommandHandlerType = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const InteractionEntryPointCommandHandlerType = enum(u4) {
|
pub const InteractionEntryPointCommandHandlerType = enum(u4) {
|
||||||
/// The app handles the interaction using an interaction token
|
/// The app handles the interaction using an interaction token
|
||||||
AppHandler = 1,
|
AppHandler = 1,
|
||||||
/// handles the interaction by launching an Activity and sending a follow-up message without coordinating with the app
|
/// handles the interaction by launching an Activity and sending a follow-up message without coordinating with the app
|
||||||
LaunchActivity = 2,
|
LaunchActivity = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
|
/// https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
|
||||||
pub const ApplicationCommandOption = struct {
|
pub const ApplicationCommandOption = struct {
|
||||||
/// Type of option
|
/// Type of option
|
||||||
type: ApplicationCommandOptionTypes,
|
type: ApplicationCommandOptionTypes,
|
||||||
///
|
///
|
||||||
/// Name of command, 1-32 characters.
|
/// Name of command, 1-32 characters.
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
///This value should be unique within an array of {@link ApplicationCommandOption};
|
///This value should be unique within an array of {@link ApplicationCommandOption};
|
||||||
///
|
///
|
||||||
/// {@link ApplicationCommandTypes.ChatInput | ChatInput}; command names must match the following regex `^[-_\p{L};\p{N};\p{sc=Deva};\p{sc=Thai};]{1,32};$` with the unicode flag set.
|
/// {@link ApplicationCommandTypes.ChatInput | ChatInput}; command names must match the following regex `^[-_\p{L};\p{N};\p{sc=Deva};\p{sc=Thai};]{1,32};$` with the unicode flag set.
|
||||||
/// If there is a lowercase variant of any letters used, you must use those.
|
/// If there is a lowercase variant of any letters used, you must use those.
|
||||||
/// Characters with no lowercase variants and/or uncased letters are still allowed.
|
/// Characters with no lowercase variants and/or uncased letters are still allowed.
|
||||||
///
|
///
|
||||||
/// {@link ApplicationCommandTypes.User | User}; and {@link ApplicationCommandTypes.Message | Message}; commands may be mixed case and can include spaces.
|
/// {@link ApplicationCommandTypes.User | User}; and {@link ApplicationCommandTypes.Message | Message}; commands may be mixed case and can include spaces.
|
||||||
///
|
///
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// Localization object for the `name` field. Values follow the same restrictions as `name`
|
/// Localization object for the `name` field. Values follow the same restrictions as `name`
|
||||||
name_localizations: []const u4, //?Localization,
|
name_localizations: []const u4, //?Localization,
|
||||||
/// 1-100 character description
|
/// 1-100 character description
|
||||||
description: []const u8,
|
description: []const u8,
|
||||||
/// Localization object for the `description` field. Values follow the same restrictions as `description`
|
/// Localization object for the `description` field. Values follow the same restrictions as `description`
|
||||||
description_localizations: ?[]const u8, //?Localization,
|
description_localizations: ?[]const u8, //?Localization = null,
|
||||||
///
|
///
|
||||||
/// If the parameter is required or optional. default `false`
|
/// If the parameter is required or optional. default `false`
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Valid in all option types except {@link ApplicationCommandOptionTypes.SubCommand | SubCommand}; and {@link ApplicationCommandOptionTypes.SubCommandGroup | SubCommandGroup};
|
/// Valid in all option types except {@link ApplicationCommandOptionTypes.SubCommand | SubCommand}; and {@link ApplicationCommandOptionTypes.SubCommandGroup | SubCommandGroup};
|
||||||
///
|
///
|
||||||
required: ?bool,
|
required: ?bool = null,
|
||||||
///
|
///
|
||||||
/// Choices for the option from which the user can choose, max 25
|
/// Choices for the option from which the user can choose, max 25
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Only valid in options of type {@link ApplicationCommandOptionTypes.[]const u8 | []const u8};, {@link ApplicationCommandOptionTypes.Integer | Integer};, or {@link ApplicationCommandOptionTypes.isize | isize};
|
/// Only valid in options of type {@link ApplicationCommandOptionTypes.[]const u8 | []const u8};, {@link ApplicationCommandOptionTypes.Integer | Integer};, or {@link ApplicationCommandOptionTypes.isize | isize};
|
||||||
///
|
///
|
||||||
/// If you provide an array of choices, they will be the ONLY accepted values for this option
|
/// If you provide an array of choices, they will be the ONLY accepted values for this option
|
||||||
///
|
///
|
||||||
choices: ?[]ApplicationCommandOptionChoice,
|
choices: ?[]ApplicationCommandOptionChoice = null,
|
||||||
///
|
///
|
||||||
/// If the option is a subcommand or subcommand group type, these nested options will be the parameters
|
/// If the option is a subcommand or subcommand group type, these nested options will be the parameters
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Only valid in option of type {@link ApplicationCommandOptionTypes.SubCommand | SubCommand}; or {@link ApplicationCommandOptionTypes.SubCommandGroup | SubCommandGroup};
|
/// Only valid in option of type {@link ApplicationCommandOptionTypes.SubCommand | SubCommand}; or {@link ApplicationCommandOptionTypes.SubCommandGroup | SubCommandGroup};
|
||||||
///
|
///
|
||||||
options: ?[]ApplicationCommandOption,
|
options: ?[]ApplicationCommandOption = null,
|
||||||
///
|
///
|
||||||
/// If autocomplete interactions are enabled for this option.
|
/// If autocomplete interactions are enabled for this option.
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Only valid in options of type {@link ApplicationCommandOptionTypes.[]const u8 | []const u8};, {@link ApplicationCommandOptionTypes.Integer | Integer};, or {@link ApplicationCommandOptionTypes.isize | isize};
|
/// Only valid in options of type {@link ApplicationCommandOptionTypes.[]const u8 | []const u8};, {@link ApplicationCommandOptionTypes.Integer | Integer};, or {@link ApplicationCommandOptionTypes.isize | isize};
|
||||||
///
|
///
|
||||||
///When {@link ApplicationCommandOption.choices | choices}; are provided, this may not be set to true
|
///When {@link ApplicationCommandOption.choices | choices}; are provided, this may not be set to true
|
||||||
///
|
///
|
||||||
autocomplete: ?bool,
|
autocomplete: ?bool = null,
|
||||||
///
|
///
|
||||||
/// The channels shown will be restricted to these types
|
/// The channels shown will be restricted to these types
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Only valid in option of type {@link ApplicationCommandOptionTypes.Channel | Channel};
|
/// Only valid in option of type {@link ApplicationCommandOptionTypes.Channel | Channel};
|
||||||
///
|
///
|
||||||
channel_types: ?[]ChannelTypes,
|
channel_types: ?[]ChannelTypes = null,
|
||||||
///
|
///
|
||||||
/// The minimum permitted value
|
/// The minimum permitted value
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Only valid in options of type {@link ApplicationCommandOptionTypes.Integer | Integer}; or {@link ApplicationCommandOptionTypes.isize | isize};
|
/// Only valid in options of type {@link ApplicationCommandOptionTypes.Integer | Integer}; or {@link ApplicationCommandOptionTypes.isize | isize};
|
||||||
///
|
///
|
||||||
min_value: ?isize,
|
min_value: ?isize = null,
|
||||||
///
|
///
|
||||||
/// The maximum permitted value
|
/// The maximum permitted value
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Only valid in options of type {@link ApplicationCommandOptionTypes.Integer | Integer}; or {@link ApplicationCommandOptionTypes.isize | isize};
|
/// Only valid in options of type {@link ApplicationCommandOptionTypes.Integer | Integer}; or {@link ApplicationCommandOptionTypes.isize | isize};
|
||||||
///
|
///
|
||||||
max_value: ?isize,
|
max_value: ?isize = null,
|
||||||
///
|
///
|
||||||
/// The minimum permitted length, should be in the range of from 0 to 600
|
/// The minimum permitted length, should be in the range of from 0 to 600
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Only valid in options of type {@link ApplicationCommandOptionTypes.[]const u8 | []const u8};
|
/// Only valid in options of type {@link ApplicationCommandOptionTypes.[]const u8 | []const u8};
|
||||||
///
|
///
|
||||||
min_length: ?isize,
|
min_length: ?isize = null,
|
||||||
///
|
///
|
||||||
/// The maximum permitted length, should be in the range of from 0 to 600
|
/// The maximum permitted length, should be in the range of from 0 to 600
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Only valid in options of type {@link ApplicationCommandOptionTypes.[]const u8 | []const u8};
|
/// Only valid in options of type {@link ApplicationCommandOptionTypes.[]const u8 | []const u8};
|
||||||
///
|
///
|
||||||
max_length: ?isize,
|
max_length: ?isize = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object
|
/// https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object
|
||||||
|
@ -1,208 +1,224 @@
|
|||||||
const Partial = @import("partial.zig").Partial;
|
const Partial = @import("partial.zig").Partial;
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const Emoji = @import("emoji.zig").Emoji;
|
const Emoji = @import("emoji.zig").Emoji;
|
||||||
const ButtonStyles = @import("shared.zig").ButtonStyles;
|
const ButtonStyles = @import("shared.zig").ButtonStyles;
|
||||||
const ChannelTypes = @import("shared.zig").ChannelTypes;
|
const ChannelTypes = @import("shared.zig").ChannelTypes;
|
||||||
const MessageComponentTypes = @import("shared.zig").MessageComponentTypes;
|
const MessageComponentTypes = @import("shared.zig").MessageComponentTypes;
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/interactions/message-components#buttons
|
/// https://discord.com/developers/docs/interactions/message-components#buttons
|
||||||
pub const Button = struct {
|
pub const Button = struct {
|
||||||
/// 2 for a button
|
/// 2 for a button
|
||||||
type: MessageComponentTypes,
|
type: MessageComponentTypes,
|
||||||
/// A button style
|
/// A button style
|
||||||
style: ButtonStyles,
|
style: ButtonStyles,
|
||||||
/// Text that appears on the button; max 80 characters
|
/// Text that appears on the button; max 80 characters
|
||||||
label: ?[]const u8,
|
label: ?[]const u8 = null,
|
||||||
/// name, id, and animated
|
/// name, id, and animated
|
||||||
emoji: Partial(Emoji),
|
emoji: Partial(Emoji),
|
||||||
/// Developer-defined identifier for the button; max 100 characters
|
/// Developer-defined identifier for the button; max 100 characters
|
||||||
custom_id: ?[]const u8,
|
custom_id: ?[]const u8 = null,
|
||||||
/// Identifier for a purchasable SKU, only available when using premium-style buttons
|
/// Identifier for a purchasable SKU, only available when using premium-style buttons
|
||||||
sku_id: ?Snowflake,
|
sku_id: ?Snowflake = null,
|
||||||
/// URL for link-style buttons
|
/// URL for link-style buttons
|
||||||
url: ?[]const u8,
|
url: ?[]const u8 = null,
|
||||||
/// Whether the button is disabled (defaults to false)
|
/// Whether the button is disabled (defaults to false)
|
||||||
disabled: ?bool,
|
disabled: ?bool = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const SelectOption = struct {
|
pub const SelectOption = struct {
|
||||||
/// User-facing name of the option; max 100 characters
|
/// User-facing name of the option; max 100 characters
|
||||||
label: []const u8,
|
label: []const u8,
|
||||||
/// Dev-defined value of the option; max 100 characters
|
/// Dev-defined value of the option; max 100 characters
|
||||||
value: []const u8,
|
value: []const u8,
|
||||||
/// Additional description of the option; max 100 characters
|
/// Additional description of the option; max 100 characters
|
||||||
description: ?[]const u8,
|
description: ?[]const u8 = null,
|
||||||
/// id, name, and animated
|
/// id, name, and animated
|
||||||
emoji: ?Partial(Emoji),
|
emoji: ?Partial(Emoji) = null,
|
||||||
/// Will show this option as selected by default
|
/// Will show this option as selected by default
|
||||||
default: ?bool,
|
default: ?bool = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const DefaultValue = struct {
|
pub const DefaultValue = struct {
|
||||||
/// ID of a user, role, or channel
|
/// ID of a user, role, or channel
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// Type of value that id represents. Either "user", "role", or "channel"
|
/// Type of value that id represents. Either "user", "role", or "channel"
|
||||||
type: union(enum) { user, role, channel },
|
type: union(enum) { user, role, channel },
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/interactions/message-components#select-menus
|
/// https://discord.com/developers/docs/interactions/message-components#select-menus
|
||||||
pub const SelectMenuString = struct {
|
pub const SelectMenuString = struct {
|
||||||
/// Type of select menu component (text: 3, user: 5, role: 6, mentionable: 7, channels: 8)
|
/// Type of select menu component (text: 3, user: 5, role: 6, mentionable: 7, channels: 8)
|
||||||
type: MessageComponentTypes,
|
type: MessageComponentTypes,
|
||||||
/// ID for the select menu; max 100 characters
|
/// ID for the select menu; max 100 characters
|
||||||
custom_id: []const u8,
|
custom_id: []const u8,
|
||||||
/// Specified choices in a select menu (only required and available for string selects (type 3); max 25
|
/// Specified choices in a select menu (only required and available for string selects (type 3); max 25
|
||||||
/// * options is required for string select menus (component type 3), and unavailable for all other select menu components.
|
/// * options is required for string select menus (component type 3), and unavailable for all other select menu components.
|
||||||
options: ?[]SelectOption,
|
options: ?[]SelectOption = null,
|
||||||
/// Placeholder text if nothing is selected; max 150 characters
|
/// Placeholder text if nothing is selected; max 150 characters
|
||||||
placeholder: ?[]const u8,
|
placeholder: ?[]const u8 = null,
|
||||||
/// Minimum number of items that must be chosen (defaults to 1); min 0, max 25
|
/// Minimum number of items that must be chosen (defaults to 1); min 0, max 25
|
||||||
min_values: ?usize,
|
min_values: ?usize = null,
|
||||||
/// Maximum number of items that can be chosen (defaults to 1); max 25
|
/// Maximum number of items that can be chosen (defaults to 1); max 25
|
||||||
max_values: ?usize,
|
max_values: ?usize = null,
|
||||||
/// Whether select menu is disabled (defaults to false)
|
/// Whether select menu is disabled (defaults to false)
|
||||||
disabled: ?bool,
|
disabled: ?bool = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/interactions/message-components#select-menus
|
/// https://discord.com/developers/docs/interactions/message-components#select-menus
|
||||||
pub const SelectMenuUsers = struct {
|
pub const SelectMenuUsers = struct {
|
||||||
/// Type of select menu component (text: 3, user: 5, role: 6, mentionable: 7, channels: 8)
|
/// Type of select menu component (text: 3, user: 5, role: 6, mentionable: 7, channels: 8)
|
||||||
type: MessageComponentTypes,
|
type: MessageComponentTypes,
|
||||||
/// ID for the select menu; max 100 characters
|
/// ID for the select menu; max 100 characters
|
||||||
custom_id: []const u8,
|
custom_id: []const u8,
|
||||||
/// Placeholder text if nothing is selected; max 150 characters
|
/// Placeholder text if nothing is selected; max 150 characters
|
||||||
placeholder: ?[]const u8,
|
placeholder: ?[]const u8 = null,
|
||||||
/// List of default values for auto-populated select menu components; number of default values must be in the range defined by min_values and max_values
|
/// List of default values for auto-populated select menu components; number of default values must be in the range defined by min_values and max_values
|
||||||
/// *** default_values is only available for auto-populated select menu components, which include user (5), role (6), mentionable (7), and channel (8) components.
|
/// *** default_values is only available for auto-populated select menu components, which include user (5), role (6), mentionable (7), and channel (8) components.
|
||||||
default_values: ?[]DefaultValue,
|
default_values: ?[]DefaultValue = null,
|
||||||
/// Minimum number of items that must be chosen (defaults to 1); min 0, max 25
|
/// Minimum number of items that must be chosen (defaults to 1); min 0, max 25
|
||||||
min_values: ?usize,
|
min_values: ?usize = null,
|
||||||
/// Maximum number of items that can be chosen (defaults to 1); max 25
|
/// Maximum number of items that can be chosen (defaults to 1); max 25
|
||||||
max_values: ?usize,
|
max_values: ?usize = null,
|
||||||
/// Whether select menu is disabled (defaults to false)
|
/// Whether select menu is disabled (defaults to false)
|
||||||
disabled: ?bool,
|
disabled: ?bool = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/interactions/message-components#select-menus
|
/// https://discord.com/developers/docs/interactions/message-components#select-menus
|
||||||
pub const SelectMenuRoles = struct {
|
pub const SelectMenuRoles = struct {
|
||||||
/// Type of select menu component (text: 3, user: 5, role: 6, mentionable: 7, channels: 8)
|
/// Type of select menu component (text: 3, user: 5, role: 6, mentionable: 7, channels: 8)
|
||||||
type: MessageComponentTypes,
|
type: MessageComponentTypes,
|
||||||
/// ID for the select menu; max 100 characters
|
/// ID for the select menu; max 100 characters
|
||||||
custom_id: []const u8,
|
custom_id: []const u8,
|
||||||
/// Placeholder text if nothing is selected; max 150 characters
|
/// Placeholder text if nothing is selected; max 150 characters
|
||||||
placeholder: ?[]const u8,
|
placeholder: ?[]const u8 = null,
|
||||||
/// List of default values for auto-populated select menu components; number of default values must be in the range defined by min_values and max_values
|
/// List of default values for auto-populated select menu components; number of default values must be in the range defined by min_values and max_values
|
||||||
/// *** default_values is only available for auto-populated select menu components, which include user (5), role (6), mentionable (7), and channel (8) components.
|
/// *** default_values is only available for auto-populated select menu components, which include user (5), role (6), mentionable (7), and channel (8) components.
|
||||||
default_values: ?[]DefaultValue,
|
default_values: ?[]DefaultValue = null,
|
||||||
/// Minimum number of items that must be chosen (defaults to 1); min 0, max 25
|
/// Minimum number of items that must be chosen (defaults to 1); min 0, max 25
|
||||||
min_values: ?usize,
|
min_values: ?usize = null,
|
||||||
/// Maximum number of items that can be chosen (defaults to 1); max 25
|
/// Maximum number of items that can be chosen (defaults to 1); max 25
|
||||||
max_values: ?usize,
|
max_values: ?usize = null,
|
||||||
/// Whether select menu is disabled (defaults to false)
|
/// Whether select menu is disabled (defaults to false)
|
||||||
disabled: ?bool,
|
disabled: ?bool = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/interactions/message-components#select-menus
|
/// https://discord.com/developers/docs/interactions/message-components#select-menus
|
||||||
pub const SelectMenuUsersAndRoles = struct {
|
pub const SelectMenuUsersAndRoles = struct {
|
||||||
/// Type of select menu component (text: 3, user: 5, role: 6, mentionable: 7, channels: 8)
|
/// Type of select menu component (text: 3, user: 5, role: 6, mentionable: 7, channels: 8)
|
||||||
type: MessageComponentTypes,
|
type: MessageComponentTypes,
|
||||||
/// ID for the select menu; max 100 characters
|
/// ID for the select menu; max 100 characters
|
||||||
custom_id: []const u8,
|
custom_id: []const u8,
|
||||||
/// Placeholder text if nothing is selected; max 150 characters
|
/// Placeholder text if nothing is selected; max 150 characters
|
||||||
placeholder: ?[]const u8,
|
placeholder: ?[]const u8 = null,
|
||||||
/// List of default values for auto-populated select menu components; number of default values must be in the range defined by min_values and max_values
|
/// List of default values for auto-populated select menu components; number of default values must be in the range defined by min_values and max_values
|
||||||
/// *** default_values is only available for auto-populated select menu components, which include user (5), role (6), mentionable (7), and channel (8) components.
|
/// *** default_values is only available for auto-populated select menu components, which include user (5), role (6), mentionable (7), and channel (8) components.
|
||||||
default_values: ?[]DefaultValue,
|
default_values: ?[]DefaultValue = null,
|
||||||
/// Minimum number of items that must be chosen (defaults to 1); min 0, max 25
|
/// Minimum number of items that must be chosen (defaults to 1); min 0, max 25
|
||||||
min_values: ?usize,
|
min_values: ?usize = null,
|
||||||
/// Maximum number of items that can be chosen (defaults to 1); max 25
|
/// Maximum number of items that can be chosen (defaults to 1); max 25
|
||||||
max_values: ?usize,
|
max_values: ?usize = null,
|
||||||
/// Whether select menu is disabled (defaults to false)
|
/// Whether select menu is disabled (defaults to false)
|
||||||
disabled: ?bool,
|
disabled: ?bool = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/interactions/message-components#select-menus
|
/// https://discord.com/developers/docs/interactions/message-components#select-menus
|
||||||
pub const SelectMenuChannels = struct {
|
pub const SelectMenuChannels = struct {
|
||||||
/// Type of select menu component (text: 3, user: 5, role: 6, mentionable: 7, channels: 8)
|
/// Type of select menu component (text: 3, user: 5, role: 6, mentionable: 7, channels: 8)
|
||||||
type: MessageComponentTypes,
|
type: MessageComponentTypes,
|
||||||
/// ID for the select menu; max 100 characters
|
/// ID for the select menu; max 100 characters
|
||||||
custom_id: []const u8,
|
custom_id: []const u8,
|
||||||
/// List of channel types to include in the channel select component (type 8)
|
/// List of channel types to include in the channel select component (type 8)
|
||||||
/// ** channel_types can only be used for channel select menu components.
|
/// ** channel_types can only be used for channel select menu components.
|
||||||
channel_types: ?[]ChannelTypes,
|
channel_types: ?[]ChannelTypes = null,
|
||||||
/// Placeholder text if nothing is selected; max 150 characters
|
/// Placeholder text if nothing is selected; max 150 characters
|
||||||
placeholder: ?[]const u8,
|
placeholder: ?[]const u8 = null,
|
||||||
/// List of default values for auto-populated select menu components; number of default values must be in the range defined by min_values and max_values
|
/// List of default values for auto-populated select menu components; number of default values must be in the range defined by min_values and max_values
|
||||||
/// *** default_values is only available for auto-populated select menu components, which include user (5), role (6), mentionable (7), and channel (8) components.
|
/// *** default_values is only available for auto-populated select menu components, which include user (5), role (6), mentionable (7), and channel (8) components.
|
||||||
default_values: ?[]DefaultValue,
|
default_values: ?[]DefaultValue = null,
|
||||||
/// Minimum number of items that must be chosen (defaults to 1); min 0, max 25
|
/// Minimum number of items that must be chosen (defaults to 1); min 0, max 25
|
||||||
min_values: ?usize,
|
min_values: ?usize = null,
|
||||||
/// Maximum number of items that can be chosen (defaults to 1); max 25
|
/// Maximum number of items that can be chosen (defaults to 1); max 25
|
||||||
max_values: ?usize,
|
max_values: ?usize = null,
|
||||||
/// Whether select menu is disabled (defaults to false)
|
/// Whether select menu is disabled (defaults to false)
|
||||||
disabled: ?bool,
|
disabled: ?bool = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const SelectMenu = union(MessageComponentTypes) {
|
pub const SelectMenu = union(MessageComponentTypes) {
|
||||||
SelectMenu: SelectMenuString,
|
SelectMenu: SelectMenuString,
|
||||||
SelectMenuUsers: SelectMenuUsers,
|
SelectMenuUsers: SelectMenuUsers,
|
||||||
SelectMenuRoles: SelectMenuRoles,
|
SelectMenuRoles: SelectMenuRoles,
|
||||||
SelectMenuUsersAndRoles: SelectMenuUsersAndRoles,
|
SelectMenuUsersAndRoles: SelectMenuUsersAndRoles,
|
||||||
SelectMenuChannels: SelectMenuChannels,
|
SelectMenuChannels: SelectMenuChannels,
|
||||||
|
|
||||||
pub fn jsonParse(allocator: std.mem.Allocator, src: anytype, _: std.json.ParseOptions) !@This() {
|
pub fn jsonParse(allocator: std.mem.Allocator, src: anytype, _: std.json.ParseOptions) !@This() {
|
||||||
const value = try std.json.innerParse(std.json.Value, allocator, src, .{
|
const value = try std.json.innerParse(std.json.Value, allocator, src, .{
|
||||||
.max_value_len = 0x100,
|
.ignore_unknown_fields = true,
|
||||||
});
|
.max_value_len = 0x1000,
|
||||||
|
});
|
||||||
|
|
||||||
if (value != .object) @panic("coulnd't match against non-object type");
|
if (value != .object) @panic("coulnd't match against non-object type");
|
||||||
|
|
||||||
switch (value.object.get("type") orelse @panic("couldn't find property `type`")) {
|
switch (value.object.get("type") orelse @panic("couldn't find property `type`")) {
|
||||||
.integer => |num| return switch (@as(MessageComponentTypes, @enumFromInt(num))) {
|
.integer => |num| return switch (@as(MessageComponentTypes, @enumFromInt(num))) {
|
||||||
.SelectMenu => .{ .SelectMenu = try std.json.parseFromValueLeaky(SelectMenuString, allocator, value, .{.max_value_len = 0x100})},
|
.SelectMenu => .{ .SelectMenu = try std.json.parseFromValueLeaky(SelectMenuString, allocator, value, .{
|
||||||
.SelectMenuUsers => .{ .SelectMenuUsers = try std.json.parseFromValueLeaky(SelectMenuUsers, allocator, value, .{.max_value_len = 0x100})},
|
.ignore_unknown_fields = true,
|
||||||
.SelectMenuRoles => .{ .SelectMenuRoles = try std.json.parseFromValueLeaky(SelectMenuRoles, allocator, value, .{.max_value_len = 0x100})},
|
.max_value_len = 0x1000,
|
||||||
.SelectMenuUsersAndRoles => .{ .SelectMenuUsersAndRoles = try std.json.parseFromValueLeaky(SelectMenuUsersAndRoles, allocator, value, .{.max_value_len = 0x100})},
|
})},
|
||||||
.SelectMenuChannels => .{ .SelectMenuChannels = try std.json.parseFromValueLeaky(SelectMenuChannels, allocator, value, .{.max_value_len = 0x100})},
|
.SelectMenuUsers => .{ .SelectMenuUsers = try std.json.parseFromValueLeaky(SelectMenuUsers, allocator, value, .{
|
||||||
},
|
.ignore_unknown_fields = true,
|
||||||
else => @panic("got type but couldn't match against non enum member `type`"),
|
.max_value_len = 0x1000,
|
||||||
|
})},
|
||||||
|
.SelectMenuRoles => .{ .SelectMenuRoles = try std.json.parseFromValueLeaky(SelectMenuRoles, allocator, value, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
|
.max_value_len = 0x1000,
|
||||||
|
})},
|
||||||
|
.SelectMenuUsersAndRoles => .{ .SelectMenuUsersAndRoles = try std.json.parseFromValueLeaky(SelectMenuUsersAndRoles, allocator, value, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
|
.max_value_len = 0x1000,
|
||||||
|
})},
|
||||||
|
.SelectMenuChannels => .{ .SelectMenuChannels = try std.json.parseFromValueLeaky(SelectMenuChannels, allocator, value, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
|
.max_value_len = 0x1000,
|
||||||
|
})},
|
||||||
|
},
|
||||||
|
else => @panic("got type but couldn't match against non enum member `type`"),
|
||||||
|
}
|
||||||
|
|
||||||
|
return try MessageComponent.json(allocator, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return try MessageComponent.json(allocator, value);
|
// legacy
|
||||||
}
|
pub fn json(_: std.mem.Allocator) !SelectMenu {
|
||||||
|
@compileError("Deprecated, use std.json instead.");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// legacy
|
pub const InputTextStyles = enum(u4) {
|
||||||
pub fn json(_: std.mem.Allocator) !SelectMenu {
|
Short = 1,
|
||||||
@compileError("Deprecated, use std.json instead.");
|
Paragraph,
|
||||||
}
|
};
|
||||||
};
|
|
||||||
|
|
||||||
pub const InputTextStyles = enum(u4) {
|
pub const InputText = struct {
|
||||||
Short = 1,
|
/// 4 for a text input
|
||||||
Paragraph,
|
type: MessageComponentTypes,
|
||||||
};
|
/// Developer-defined identifier for the input; max 100 characters
|
||||||
|
custom_id: []const u8,
|
||||||
pub const InputText = struct {
|
/// The Text Input Style
|
||||||
/// 4 for a text input
|
style: InputTextStyles,
|
||||||
type: MessageComponentTypes,
|
/// Label for this component; max 45 characters
|
||||||
/// Developer-defined identifier for the input; max 100 characters
|
label: []const u8,
|
||||||
custom_id: []const u8,
|
/// Minimum input length for a text input; min 0, max 4000
|
||||||
/// The Text Input Style
|
min_length: ?usize = null,
|
||||||
style: InputTextStyles,
|
/// Maximum input length for a text input; min 1, max 4000
|
||||||
/// Label for this component; max 45 characters
|
max_length: ?usize = null,
|
||||||
label: []const u8,
|
/// Whether this component is required to be filled (defaults to true)
|
||||||
/// Minimum input length for a text input; min 0, max 4000
|
required: ?bool = null,
|
||||||
min_length: ?usize,
|
/// Pre-filled value for this component; max 4000 characters
|
||||||
/// Maximum input length for a text input; min 1, max 4000
|
value: ?[]const u8 = null,
|
||||||
max_length: ?usize,
|
/// Custom placeholder text if the input is empty; max 100 characters
|
||||||
/// Whether this component is required to be filled (defaults to true)
|
placeholder: ?[]const u8 = null,
|
||||||
required: ?bool,
|
|
||||||
/// Pre-filled value for this component; max 4000 characters
|
|
||||||
value: ?[]const u8,
|
|
||||||
/// Custom placeholder text if the input is empty; max 100 characters
|
|
||||||
placeholder: ?[]const u8,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const MessageComponent = union(MessageComponentTypes) {
|
pub const MessageComponent = union(MessageComponentTypes) {
|
||||||
@ -223,21 +239,43 @@ pub const MessageComponent = union(MessageComponentTypes) {
|
|||||||
|
|
||||||
pub fn jsonParse(allocator: std.mem.Allocator, src: anytype, _: std.json.ParseOptions) !@This() {
|
pub fn jsonParse(allocator: std.mem.Allocator, src: anytype, _: std.json.ParseOptions) !@This() {
|
||||||
const value = try std.json.innerParse(std.json.Value, allocator, src, .{
|
const value = try std.json.innerParse(std.json.Value, allocator, src, .{
|
||||||
.max_value_len = 0x100,
|
.ignore_unknown_fields = true,
|
||||||
|
.max_value_len = 0x1000,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (value != .object) @panic("coulnd't match against non-object type");
|
if (value != .object) @panic("coulnd't match against non-object type");
|
||||||
|
|
||||||
switch (value.object.get("type") orelse @panic("couldn't find property `type`")) {
|
switch (value.object.get("type") orelse @panic("couldn't find property `type`")) {
|
||||||
.integer => |num| return switch (@as(MessageComponentTypes, @enumFromInt(num))) {
|
.integer => |num| return switch (@as(MessageComponentTypes, @enumFromInt(num))) {
|
||||||
.ActionRow => .{ .ActionRow = try std.json.parseFromValueLeaky([]MessageComponent, allocator, value, .{.max_value_len = 0x100}) },
|
.ActionRow => .{ .ActionRow = try std.json.parseFromValueLeaky([]MessageComponent, allocator, value, .{
|
||||||
.Button => .{ .Button = try std.json.parseFromValueLeaky(Button, allocator, value, .{.max_value_len = 0x100}) },
|
.ignore_unknown_fields = true,
|
||||||
.SelectMenu => .{ .SelectMenu = try std.json.parseFromValueLeaky(SelectMenuString, allocator, value, .{.max_value_len = 0x100})},
|
.max_value_len = 0x1000,
|
||||||
.InputText => .{ .InputText = try std.json.parseFromValueLeaky(InputText, allocator, value, .{.max_value_len = 0x100}) },
|
}) },
|
||||||
.SelectMenuUsers => .{ .SelectMenuUsers = try std.json.parseFromValueLeaky(SelectMenuUsers, allocator, value, .{.max_value_len = 0x100})},
|
.Button => .{ .Button = try std.json.parseFromValueLeaky(Button, allocator, value, .{
|
||||||
.SelectMenuRoles => .{ .SelectMenuRoles = try std.json.parseFromValueLeaky(SelectMenuRoles, allocator, value, .{.max_value_len = 0x100})},
|
.ignore_unknown_fields = true,
|
||||||
.SelectMenuUsersAndRoles => .{ .SelectMenuUsersAndRoles = try std.json.parseFromValueLeaky(SelectMenuUsersAndRoles, allocator, value, .{.max_value_len = 0x100})},
|
.max_value_len = 0x1000,
|
||||||
.SelectMenuChannels => .{ .SelectMenuChannels = try std.json.parseFromValueLeaky(SelectMenuChannels, allocator, value, .{.max_value_len = 0x100})},
|
}) },
|
||||||
|
.SelectMenu => .{ .SelectMenu = try std.json.parseFromValueLeaky(SelectMenuString, allocator, value, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
|
.max_value_len = 0x1000,
|
||||||
|
})},
|
||||||
|
.InputText => .{ .InputText = try std.json.parseFromValueLeaky(InputText, allocator, value, .{.max_value_len = 0x1000}) },
|
||||||
|
.SelectMenuUsers => .{ .SelectMenuUsers = try std.json.parseFromValueLeaky(SelectMenuUsers, allocator, value, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
|
.max_value_len = 0x1000,
|
||||||
|
})},
|
||||||
|
.SelectMenuRoles => .{ .SelectMenuRoles = try std.json.parseFromValueLeaky(SelectMenuRoles, allocator, value, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
|
.max_value_len = 0x1000,
|
||||||
|
})},
|
||||||
|
.SelectMenuUsersAndRoles => .{ .SelectMenuUsersAndRoles = try std.json.parseFromValueLeaky(SelectMenuUsersAndRoles, allocator, value, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
|
.max_value_len = 0x1000,
|
||||||
|
})},
|
||||||
|
.SelectMenuChannels => .{ .SelectMenuChannels = try std.json.parseFromValueLeaky(SelectMenuChannels, allocator, value, .{
|
||||||
|
.ignore_unknown_fields = true,
|
||||||
|
.max_value_len = 0x1000,
|
||||||
|
})},
|
||||||
},
|
},
|
||||||
else => @panic("got type but couldn't match against non enum member `type`"),
|
else => @panic("got type but couldn't match against non enum member `type`"),
|
||||||
}
|
}
|
||||||
|
@ -1,122 +1,122 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const EmbedTypes = @import("shared.zig").EmbedTypes;
|
const EmbedTypes = @import("shared.zig").EmbedTypes;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#embed-object
|
/// https://discord.com/developers/docs/resources/channel#embed-object
|
||||||
pub const Embed = struct {
|
pub const Embed = struct {
|
||||||
/// Title of embed
|
/// Title of embed
|
||||||
title: ?[]const u8,
|
title: ?[]const u8 = null,
|
||||||
/// Type of embed (always "rich" for webhook embeds)
|
/// Type of embed (always "rich" for webhook embeds)
|
||||||
type: ?EmbedTypes,
|
type: ?EmbedTypes = null,
|
||||||
/// Description of embed
|
/// Description of embed
|
||||||
description: ?[]const u8,
|
description: ?[]const u8 = null,
|
||||||
/// Url of embed
|
/// Url of embed
|
||||||
url: ?[]const u8,
|
url: ?[]const u8 = null,
|
||||||
/// Color code of the embed
|
/// Color code of the embed
|
||||||
color: ?isize,
|
color: ?isize = null,
|
||||||
/// Timestamp of embed content
|
/// Timestamp of embed content
|
||||||
timestamp: ?[]const u8,
|
timestamp: ?[]const u8 = null,
|
||||||
/// Footer information
|
/// Footer information
|
||||||
footer: ?EmbedFooter,
|
footer: ?EmbedFooter = null,
|
||||||
/// Image information
|
/// Image information
|
||||||
image: ?EmbedImage,
|
image: ?EmbedImage = null,
|
||||||
/// Thumbnail information
|
/// Thumbnail information
|
||||||
thumbnail: ?EmbedThumbnail,
|
thumbnail: ?EmbedThumbnail = null,
|
||||||
/// Video information
|
/// Video information
|
||||||
video: ?EmbedVideo,
|
video: ?EmbedVideo = null,
|
||||||
/// Provider information
|
/// Provider information
|
||||||
provider: ?EmbedProvider,
|
provider: ?EmbedProvider = null,
|
||||||
/// Author information
|
/// Author information
|
||||||
author: ?EmbedAuthor,
|
author: ?EmbedAuthor = null,
|
||||||
/// Fields information
|
/// Fields information
|
||||||
fields: ?[]EmbedField,
|
fields: ?[]EmbedField = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure
|
/// https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure
|
||||||
pub const EmbedAuthor = struct {
|
pub const EmbedAuthor = struct {
|
||||||
/// Name of author
|
/// Name of author
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// Url of author
|
/// Url of author
|
||||||
url: ?[]const u8,
|
url: ?[]const u8 = null,
|
||||||
/// Url of author icon (only supports http(s) and attachments)
|
/// Url of author icon (only supports http(s) and attachments)
|
||||||
icon_url: ?[]const u8,
|
icon_url: ?[]const u8 = null,
|
||||||
/// A proxied url of author icon
|
/// A proxied url of author icon
|
||||||
proxy_icon_url: ?[]const u8,
|
proxy_icon_url: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure
|
/// https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure
|
||||||
pub const EmbedField = struct {
|
pub const EmbedField = struct {
|
||||||
/// Name of the field
|
/// Name of the field
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// Value of the field
|
/// Value of the field
|
||||||
value: []const u8,
|
value: []const u8,
|
||||||
/// Whether or not this field should display inline
|
/// Whether or not this field should display inline
|
||||||
@"inline": ?bool,
|
@"inline" : ?bool = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure
|
/// https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure
|
||||||
pub const EmbedFooter = struct {
|
pub const EmbedFooter = struct {
|
||||||
/// Footer text
|
/// Footer text
|
||||||
text: []const u8,
|
text: []const u8,
|
||||||
/// Url of footer icon (only supports http(s) and attachments)
|
/// Url of footer icon (only supports http(s) and attachments)
|
||||||
icon_url: ?[]const u8,
|
icon_url: ?[]const u8 = null,
|
||||||
/// A proxied url of footer icon
|
/// A proxied url of footer icon
|
||||||
proxy_icon_url: ?[]const u8,
|
proxy_icon_url: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure
|
/// https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure
|
||||||
pub const EmbedImage = struct {
|
pub const EmbedImage = struct {
|
||||||
/// Source url of image (only supports http(s) and attachments)
|
/// Source url of image (only supports http(s) and attachments)
|
||||||
url: []const u8,
|
url: []const u8,
|
||||||
/// A proxied url of the image
|
/// A proxied url of the image
|
||||||
proxy_url: ?[]const u8,
|
proxy_url: ?[]const u8 = null,
|
||||||
/// Height of image
|
/// Height of image
|
||||||
height: ?isize,
|
height: ?isize = null,
|
||||||
/// Width of image
|
/// Width of image
|
||||||
width: ?isize,
|
width: ?isize = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const EmbedProvider = struct {
|
pub const EmbedProvider = struct {
|
||||||
/// Name of provider
|
/// Name of provider
|
||||||
name: ?[]const u8,
|
name: ?[]const u8 = null,
|
||||||
/// Url of provider
|
/// Url of provider
|
||||||
url: ?[]const u8,
|
url: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure
|
/// https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure
|
||||||
pub const EmbedThumbnail = struct {
|
pub const EmbedThumbnail = struct {
|
||||||
/// Source url of thumbnail (only supports http(s) and attachments)
|
/// Source url of thumbnail (only supports http(s) and attachments)
|
||||||
url: []const u8,
|
url: []const u8,
|
||||||
/// A proxied url of the thumbnail
|
/// A proxied url of the thumbnail
|
||||||
proxy_url: ?[]const u8,
|
proxy_url: ?[]const u8 = null,
|
||||||
/// Height of thumbnail
|
/// Height of thumbnail
|
||||||
height: ?isize,
|
height: ?isize = null,
|
||||||
/// Width of thumbnail
|
/// Width of thumbnail
|
||||||
width: ?isize,
|
width: ?isize = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure
|
/// https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure
|
||||||
pub const EmbedVideo = struct {
|
pub const EmbedVideo = struct {
|
||||||
/// Source url of video
|
/// Source url of video
|
||||||
url: ?[]const u8,
|
url: ?[]const u8 = null,
|
||||||
/// A proxied url of the video
|
/// A proxied url of the video
|
||||||
proxy_url: ?[]const u8,
|
proxy_url: ?[]const u8 = null,
|
||||||
/// Height of video
|
/// Height of video
|
||||||
height: ?isize,
|
height: ?isize = null,
|
||||||
/// Width of video
|
/// Width of video
|
||||||
width: ?isize,
|
width: ?isize = null,
|
||||||
};
|
};
|
||||||
|
@ -1,38 +1,38 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const User = @import("user.zig").User;
|
const User = @import("user.zig").User;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/emoji#emoji-object-emoji-structure
|
/// https://discord.com/developers/docs/resources/emoji#emoji-object-emoji-structure
|
||||||
pub const Emoji = struct {
|
pub const Emoji = struct {
|
||||||
/// Emoji name (can only be null in reaction emoji objects)
|
/// Emoji name (can only be null in reaction emoji objects)
|
||||||
name: ?[]const u8,
|
name: ?[]const u8 = null,
|
||||||
/// Emoji id
|
/// Emoji id
|
||||||
id: ?Snowflake,
|
id: ?Snowflake = null,
|
||||||
/// Roles allowed to use this emoji
|
/// Roles allowed to use this emoji
|
||||||
roles: ?[][]const u8,
|
roles: ?[][]const u8 = null,
|
||||||
/// User that created this emoji
|
/// User that created this emoji
|
||||||
user: ?User,
|
user: ?User = null,
|
||||||
/// Whether this emoji must be wrapped in colons
|
/// Whether this emoji must be wrapped in colons
|
||||||
require_colons: ?bool,
|
require_colons: ?bool = null,
|
||||||
/// Whether this emoji is managed
|
/// Whether this emoji is managed
|
||||||
managed: ?bool,
|
managed: ?bool = null,
|
||||||
/// Whether this emoji is animated
|
/// Whether this emoji is animated
|
||||||
animated: ?bool,
|
animated: ?bool = null,
|
||||||
/// Whether this emoji can be used, may be false due to loss of Server Boosts
|
/// Whether this emoji can be used, may be false due to loss of Server Boosts
|
||||||
available: ?bool,
|
available: ?bool = null,
|
||||||
};
|
};
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,195 +1,195 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const User = @import("user.zig").User;
|
const User = @import("user.zig").User;
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const ActivityTypes = @import("shared.zig").ActivityTypes;
|
const ActivityTypes = @import("shared.zig").ActivityTypes;
|
||||||
const Partial = @import("partial.zig").Partial;
|
const Partial = @import("partial.zig").Partial;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway#get-gateway-bot
|
/// https://discord.com/developers/docs/topics/gateway#get-gateway-bot
|
||||||
pub const GetGatewayBot = struct {
|
pub const GetGatewayBot = struct {
|
||||||
/// The WSS URL that can be used for connecting to the gateway
|
/// The WSS URL that can be used for connecting to the gateway
|
||||||
url: []const u8,
|
url: []const u8,
|
||||||
/// The recommended isize of shards to use when connecting
|
/// The recommended isize of shards to use when connecting
|
||||||
shards: isize,
|
shards: isize,
|
||||||
/// Information on the current session start limit
|
/// Information on the current session start limit
|
||||||
session_start_limit: SessionStartLimit,
|
session_start_limit: SessionStartLimit,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway#session-start-limit-object
|
/// https://discord.com/developers/docs/topics/gateway#session-start-limit-object
|
||||||
pub const SessionStartLimit = struct {
|
pub const SessionStartLimit = struct {
|
||||||
/// The total isize of session starts the current user is allowed
|
/// The total isize of session starts the current user is allowed
|
||||||
total: isize,
|
total: isize,
|
||||||
/// The remaining isize of session starts the current user is allowed
|
/// The remaining isize of session starts the current user is allowed
|
||||||
remaining: isize,
|
remaining: isize,
|
||||||
/// The isize of milliseconds after which the limit resets
|
/// The isize of milliseconds after which the limit resets
|
||||||
reset_after: isize,
|
reset_after: isize,
|
||||||
/// The isize of identify requests allowed per 5 seconds
|
/// The isize of identify requests allowed per 5 seconds
|
||||||
max_concurrency: isize,
|
max_concurrency: isize,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway#presence-update
|
/// https://discord.com/developers/docs/topics/gateway#presence-update
|
||||||
pub const PresenceUpdate = struct {
|
pub const PresenceUpdate = struct {
|
||||||
/// Either "idle", "dnd", "online", or "offline"
|
/// Either "idle", "dnd", "online", or "offline"
|
||||||
status: union(enum) {
|
status: union(enum) {
|
||||||
idle,
|
idle,
|
||||||
dnd,
|
dnd,
|
||||||
online,
|
online,
|
||||||
offline,
|
offline,
|
||||||
},
|
},
|
||||||
/// The user presence is being updated for
|
/// The user presence is being updated for
|
||||||
user: Partial(User),
|
user: Partial(User),
|
||||||
/// id of the guild
|
/// id of the guild
|
||||||
guild_id: Snowflake,
|
guild_id: Snowflake,
|
||||||
/// User's current activities
|
/// User's current activities
|
||||||
activities: []Activity,
|
activities: []Activity,
|
||||||
/// User's platform-dependent status
|
/// User's platform-dependent status
|
||||||
client_status: ClientStatus,
|
client_status: ClientStatus,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway-events#activity-object
|
/// https://discord.com/developers/docs/topics/gateway-events#activity-object
|
||||||
pub const Activity = struct {
|
pub const Activity = struct {
|
||||||
/// The activity's name
|
/// The activity's name
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// Activity type
|
/// Activity type
|
||||||
type: ActivityTypes,
|
type: ActivityTypes,
|
||||||
/// Stream url, is validated when type is 1
|
/// Stream url, is validated when type is 1
|
||||||
url: ?[]const u8,
|
url: ?[]const u8 = null,
|
||||||
/// Unix timestamp of when the activity was added to the user's session
|
/// Unix timestamp of when the activity was added to the user's session
|
||||||
created_at: isize,
|
created_at: isize,
|
||||||
/// What the player is currently doing
|
/// What the player is currently doing
|
||||||
details: ?[]const u8,
|
details: ?[]const u8 = null,
|
||||||
/// The user's current party status
|
/// The user's current party status
|
||||||
state: ?[]const u8,
|
state: ?[]const u8 = null,
|
||||||
/// Whether or not the activity is an instanced game session
|
/// Whether or not the activity is an instanced game session
|
||||||
instance: ?bool,
|
instance: ?bool = null,
|
||||||
/// Activity flags `OR`d together, describes what the payload includes
|
/// Activity flags `OR`d together, describes what the payload includes
|
||||||
flags: ?isize,
|
flags: ?isize = null,
|
||||||
/// Unix timestamps for start and/or end of the game
|
/// Unix timestamps for start and/or end of the game
|
||||||
timestamps: ?ActivityTimestamps,
|
timestamps: ?ActivityTimestamps = null,
|
||||||
/// Application id for the game
|
/// Application id for the game
|
||||||
/// a string
|
/// a string
|
||||||
application_id: ?[]const u8,
|
application_id: ?[]const u8 = null,
|
||||||
/// The emoji used for a custom status
|
/// The emoji used for a custom status
|
||||||
emoji: ?ActivityEmoji,
|
emoji: ?ActivityEmoji = null,
|
||||||
/// Information for the current party of the player
|
/// Information for the current party of the player
|
||||||
party: ?ActivityParty,
|
party: ?ActivityParty = null,
|
||||||
/// Images for the presence and their hover texts
|
/// Images for the presence and their hover texts
|
||||||
assets: ?ActivityAssets,
|
assets: ?ActivityAssets = null,
|
||||||
/// Secrets for Rich Presence joining and spectating
|
/// Secrets for Rich Presence joining and spectating
|
||||||
secrets: ?ActivitySecrets,
|
secrets: ?ActivitySecrets = null,
|
||||||
/// The custom buttons shown in the Rich Presence (max 2)
|
/// The custom buttons shown in the Rich Presence (max 2)
|
||||||
buttons: ?[]ActivityButton,
|
buttons: ?[]ActivityButton = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/application#get-application-activity-instance-activity-instance-object
|
/// https://discord.com/developers/docs/resources/application#get-application-activity-instance-activity-instance-object
|
||||||
pub const ActivityInstance = struct {
|
pub const ActivityInstance = struct {
|
||||||
/// Application ID
|
/// Application ID
|
||||||
/// a string
|
/// a string
|
||||||
application_id: []const u8,
|
application_id: []const u8,
|
||||||
/// Activity Instance ID
|
/// Activity Instance ID
|
||||||
/// a string
|
/// a string
|
||||||
instance_id: []const u8,
|
instance_id: []const u8,
|
||||||
/// Unique identifier for the launch
|
/// Unique identifier for the launch
|
||||||
/// a string
|
/// a string
|
||||||
launch_id: []const u8,
|
launch_id: []const u8,
|
||||||
/// The Location the instance is runnning in
|
/// The Location the instance is runnning in
|
||||||
location: ActivityLocation,
|
location: ActivityLocation,
|
||||||
/// The IDs of the Users currently connected to the instance
|
/// The IDs of the Users currently connected to the instance
|
||||||
users: []Snowflake,
|
users: []Snowflake,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/application#get-application-activity-instance-activity-location-object
|
/// https://discord.com/developers/docs/resources/application#get-application-activity-instance-activity-location-object
|
||||||
pub const ActivityLocation = struct {
|
pub const ActivityLocation = struct {
|
||||||
/// The unique identifier for the location
|
/// The unique identifier for the location
|
||||||
/// a string
|
/// a string
|
||||||
id: []const u8,
|
id: []const u8,
|
||||||
/// Enum describing kind of location
|
/// Enum describing kind of location
|
||||||
kind: ActivityLocationKind,
|
kind: ActivityLocationKind,
|
||||||
/// The id of the Channel
|
/// The id of the Channel
|
||||||
channel_id: Snowflake,
|
channel_id: Snowflake,
|
||||||
/// The id of the Guild
|
/// The id of the Guild
|
||||||
guild_id: ?Snowflake,
|
guild_id: ?Snowflake = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/application#get-application-activity-instance-activity-location-kind-enum
|
/// https://discord.com/developers/docs/resources/application#get-application-activity-instance-activity-location-kind-enum
|
||||||
pub const ActivityLocationKind = union(enum) {
|
pub const ActivityLocationKind = union(enum) {
|
||||||
/// The Location is a Guild Channel
|
/// The Location is a Guild Channel
|
||||||
gc,
|
gc,
|
||||||
/// The Location is a Private Channel, such as a DM or GDM
|
/// The Location is a Private Channel, such as a DM or GDM
|
||||||
pc,
|
pc,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway#client-status-object
|
/// https://discord.com/developers/docs/topics/gateway#client-status-object
|
||||||
pub const ClientStatus = struct {
|
pub const ClientStatus = struct {
|
||||||
/// The user's status set for an active desktop (Windows, Linux, Mac) application session
|
/// The user's status set for an active desktop (Windows, Linux, Mac) application session
|
||||||
desktop: ?[]const u8,
|
desktop: ?[]const u8 = null,
|
||||||
/// The user's status set for an active mobile (iOS, Android) application session
|
/// The user's status set for an active mobile (iOS, Android) application session
|
||||||
mobile: ?[]const u8,
|
mobile: ?[]const u8 = null,
|
||||||
/// The user's status set for an active web (browser, bot account) application session
|
/// The user's status set for an active web (browser, bot account) application session
|
||||||
web: ?[]const u8,
|
web: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway#activity-object-activity-timestamps
|
/// https://discord.com/developers/docs/topics/gateway#activity-object-activity-timestamps
|
||||||
pub const ActivityTimestamps = struct {
|
pub const ActivityTimestamps = struct {
|
||||||
/// Unix time (in milliseconds) of when the activity started
|
/// Unix time (in milliseconds) of when the activity started
|
||||||
start: ?isize,
|
start: ?isize = null,
|
||||||
/// Unix time (in milliseconds) of when the activity ends
|
/// Unix time (in milliseconds) of when the activity ends
|
||||||
end: ?isize,
|
end: ?isize = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway#activity-object-activity-emoji
|
/// https://discord.com/developers/docs/topics/gateway#activity-object-activity-emoji
|
||||||
pub const ActivityEmoji = struct {
|
pub const ActivityEmoji = struct {
|
||||||
/// The name of the emoji
|
/// The name of the emoji
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// Whether this emoji is animated
|
/// Whether this emoji is animated
|
||||||
animated: ?bool,
|
animated: ?bool = null,
|
||||||
/// The id of the emoji
|
/// The id of the emoji
|
||||||
/// a string
|
/// a string
|
||||||
id: ?[]const u8,
|
id: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway#activity-object-activity-party
|
/// https://discord.com/developers/docs/topics/gateway#activity-object-activity-party
|
||||||
pub const ActivityParty = struct {
|
pub const ActivityParty = struct {
|
||||||
/// Used to show the party's current and maximum size
|
/// Used to show the party's current and maximum size
|
||||||
size: ?[2]i64,
|
size: ?[2]i64 = null,
|
||||||
/// The id of the party
|
/// The id of the party
|
||||||
id: ?Snowflake,
|
id: ?Snowflake = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway#activity-object-activity-assets
|
/// https://discord.com/developers/docs/topics/gateway#activity-object-activity-assets
|
||||||
pub const ActivityAssets = struct {
|
pub const ActivityAssets = struct {
|
||||||
/// Text displayed when hovering over the large image of the activity
|
/// Text displayed when hovering over the large image of the activity
|
||||||
large_text: ?[]const u8,
|
large_text: ?[]const u8 = null,
|
||||||
/// Text displayed when hovering over the small image of the activity
|
/// Text displayed when hovering over the small image of the activity
|
||||||
small_text: ?[]const u8,
|
small_text: ?[]const u8 = null,
|
||||||
/// The id for a large asset of the activity, usually a snowflake
|
/// The id for a large asset of the activity, usually a snowflake
|
||||||
large_image: ?[]const u8,
|
large_image: ?[]const u8 = null,
|
||||||
/// The id for a small asset of the activity, usually a snowflake
|
/// The id for a small asset of the activity, usually a snowflake
|
||||||
small_image: ?[]const u8,
|
small_image: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway#activity-object-activity-secrets
|
/// https://discord.com/developers/docs/topics/gateway#activity-object-activity-secrets
|
||||||
pub const ActivitySecrets = struct {
|
pub const ActivitySecrets = struct {
|
||||||
/// The secret for joining a party
|
/// The secret for joining a party
|
||||||
join: ?[]const u8,
|
join: ?[]const u8 = null,
|
||||||
/// The secret for spectating a game
|
/// The secret for spectating a game
|
||||||
spectate: ?[]const u8,
|
spectate: ?[]const u8 = null,
|
||||||
/// The secret for a specific instanced match
|
/// The secret for a specific instanced match
|
||||||
match: ?[]const u8,
|
match: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway#activity-object-activity-buttons
|
/// https://discord.com/developers/docs/topics/gateway#activity-object-activity-buttons
|
||||||
|
@ -1,387 +1,387 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const VerificationLevels = @import("shared.zig").VerificationLevels;
|
const VerificationLevels = @import("shared.zig").VerificationLevels;
|
||||||
const DefaultMessageNotificationLevels = @import("shared.zig").DefaultMessageNotificationLevels;
|
const DefaultMessageNotificationLevels = @import("shared.zig").DefaultMessageNotificationLevels;
|
||||||
const ExplicitContentFilterLevels = @import("shared.zig").ExplicitContentFilterLevels;
|
const ExplicitContentFilterLevels = @import("shared.zig").ExplicitContentFilterLevels;
|
||||||
const GuildFeatures = @import("shared.zig").GuildFeatures;
|
const GuildFeatures = @import("shared.zig").GuildFeatures;
|
||||||
const GuildNsfwLevel = @import("shared.zig").GuildNsfwLevel;
|
const GuildNsfwLevel = @import("shared.zig").GuildNsfwLevel;
|
||||||
const Role = @import("role.zig").Role;
|
const Role = @import("role.zig").Role;
|
||||||
const MemberWithUser = @import("member.zig").MemberWithUser;
|
const MemberWithUser = @import("member.zig").MemberWithUser;
|
||||||
const Member = @import("member.zig").Member;
|
const Member = @import("member.zig").Member;
|
||||||
const Channel = @import("channel.zig").Channel;
|
const Channel = @import("channel.zig").Channel;
|
||||||
const MfaLevels = @import("shared.zig").MfaLevels;
|
const MfaLevels = @import("shared.zig").MfaLevels;
|
||||||
const SystemChannelFlags = @import("shared.zig").SystemChannelFlags;
|
const SystemChannelFlags = @import("shared.zig").SystemChannelFlags;
|
||||||
const PremiumTiers = @import("shared.zig").PremiumTiers;
|
const PremiumTiers = @import("shared.zig").PremiumTiers;
|
||||||
const Emoji = @import("emoji.zig").Emoji;
|
const Emoji = @import("emoji.zig").Emoji;
|
||||||
const Sticker = @import("sticker.zig").Sticker;
|
const Sticker = @import("sticker.zig").Sticker;
|
||||||
const Partial = @import("partial.zig").Partial;
|
const Partial = @import("partial.zig").Partial;
|
||||||
const PresenceUpdate = @import("gateway.zig").PresenceUpdate;
|
const PresenceUpdate = @import("gateway.zig").PresenceUpdate;
|
||||||
const WelcomeScreen = @import("channel.zig").WelcomeScreen;
|
const WelcomeScreen = @import("channel.zig").WelcomeScreen;
|
||||||
const StageInstance = @import("channel.zig").StageInstance;
|
const StageInstance = @import("channel.zig").StageInstance;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#guild-object
|
/// https://discord.com/developers/docs/resources/guild#guild-object
|
||||||
pub const Guild = struct {
|
pub const Guild = struct {
|
||||||
/// Guild name (2-100 characters, excluding trailing and leading whitespace)
|
/// Guild name (2-100 characters, excluding trailing and leading whitespace)
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// True if the user is the owner of the guild
|
/// True if the user is the owner of the guild
|
||||||
owner: ?bool,
|
owner: ?bool = null,
|
||||||
/// Afk timeout in seconds
|
/// Afk timeout in seconds
|
||||||
afk_timeout: isize,
|
afk_timeout: isize,
|
||||||
/// True if the server widget is enabled
|
/// True if the server widget is enabled
|
||||||
widget_enabled: ?bool,
|
widget_enabled: ?bool = null,
|
||||||
/// Verification level required for the guild
|
/// Verification level required for the guild
|
||||||
verification_level: VerificationLevels,
|
verification_level: VerificationLevels,
|
||||||
/// Default message notifications level
|
/// Default message notifications level
|
||||||
default_message_notifications: DefaultMessageNotificationLevels,
|
default_message_notifications: DefaultMessageNotificationLevels,
|
||||||
/// Explicit content filter level
|
/// Explicit content filter level
|
||||||
explicit_content_filter: ExplicitContentFilterLevels,
|
explicit_content_filter: ExplicitContentFilterLevels,
|
||||||
/// Enabled guild features
|
/// Enabled guild features
|
||||||
features: []GuildFeatures,
|
features: []GuildFeatures,
|
||||||
/// Required MFA level for the guild
|
/// Required MFA level for the guild
|
||||||
mfa_level: MfaLevels,
|
mfa_level: MfaLevels,
|
||||||
/// System channel flags
|
/// System channel flags
|
||||||
system_channel_flags: SystemChannelFlags,
|
system_channel_flags: SystemChannelFlags,
|
||||||
/// True if this is considered a large guild
|
/// True if this is considered a large guild
|
||||||
large: ?bool,
|
large: ?bool = null,
|
||||||
/// True if this guild is unavailable due to an outage
|
/// True if this guild is unavailable due to an outage
|
||||||
unavailable: ?bool,
|
unavailable: ?bool = null,
|
||||||
/// Total isize of members in this guild
|
/// Total isize of members in this guild
|
||||||
member_count: ?isize,
|
member_count: ?isize = null,
|
||||||
/// The maximum isize of presences for the guild (the default value, currently 25000, is in effect when null is returned)
|
/// The maximum isize of presences for the guild (the default value, currently 25000, is in effect when null is returned)
|
||||||
max_presences: ?isize,
|
max_presences: ?isize = null,
|
||||||
/// The maximum isize of members for the guild
|
/// The maximum isize of members for the guild
|
||||||
max_members: ?isize,
|
max_members: ?isize = null,
|
||||||
/// The vanity url code for the guild
|
/// The vanity url code for the guild
|
||||||
vanity_url_code: ?[]const u8,
|
vanity_url_code: ?[]const u8 = null,
|
||||||
/// The description of a guild
|
/// The description of a guild
|
||||||
description: ?[]const u8,
|
description: ?[]const u8 = null,
|
||||||
/// Premium tier (Server Boost level)
|
/// Premium tier (Server Boost level)
|
||||||
premium_tier: PremiumTiers,
|
premium_tier: PremiumTiers,
|
||||||
/// The isize of boosts this guild currently has
|
/// The isize of boosts this guild currently has
|
||||||
premium_subscription_count: ?isize,
|
premium_subscription_count: ?isize = null,
|
||||||
/// The maximum amount of users in a video channel
|
/// The maximum amount of users in a video channel
|
||||||
max_video_channel_users: ?isize,
|
max_video_channel_users: ?isize = null,
|
||||||
/// Maximum amount of users in a stage video channel
|
/// Maximum amount of users in a stage video channel
|
||||||
max_stage_video_channel_users: ?isize,
|
max_stage_video_channel_users: ?isize = null,
|
||||||
/// Approximate isize of members in this guild, returned from the GET /guilds/id endpoint when with_counts is true
|
/// Approximate isize of members in this guild, returned from the GET /guilds/id endpoint when with_counts is true
|
||||||
approximate_member_count: ?isize,
|
approximate_member_count: ?isize = null,
|
||||||
/// Approximate isize of non-offline members in this guild, returned from the GET /guilds/id endpoint when with_counts is true
|
/// Approximate isize of non-offline members in this guild, returned from the GET /guilds/id endpoint when with_counts is true
|
||||||
approximate_presence_count: ?isize,
|
approximate_presence_count: ?isize = null,
|
||||||
/// Guild NSFW level
|
/// Guild NSFW level
|
||||||
nsfw_level: GuildNsfwLevel,
|
nsfw_level: GuildNsfwLevel,
|
||||||
/// Whether the guild has the boost progress bar enabled
|
/// Whether the guild has the boost progress bar enabled
|
||||||
premium_progress_bar_enabled: bool,
|
premium_progress_bar_enabled: bool,
|
||||||
/// Guild id
|
/// Guild id
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// Icon hash
|
/// Icon hash
|
||||||
icon: ?[]const u8,
|
icon: ?[]const u8 = null,
|
||||||
/// Icon hash, returned when in the template object
|
/// Icon hash, returned when in the template object
|
||||||
icon_hash: ?[]const u8,
|
icon_hash: ?[]const u8 = null,
|
||||||
/// Splash hash
|
/// Splash hash
|
||||||
splash: ?[]const u8,
|
splash: ?[]const u8 = null,
|
||||||
/// Discovery splash hash; only present for guilds with the "DISCOVERABLE" feature
|
/// Discovery splash hash; only present for guilds with the "DISCOVERABLE" feature
|
||||||
discovery_splash: ?[]const u8,
|
discovery_splash: ?[]const u8 = null,
|
||||||
/// Id of the owner
|
/// Id of the owner
|
||||||
owner_id: Snowflake,
|
owner_id: Snowflake,
|
||||||
/// Total permissions for the user in the guild (excludes overwrites and implicit permissions)
|
/// Total permissions for the user in the guild (excludes overwrites and implicit permissions)
|
||||||
permissions: ?[]const u8,
|
permissions: ?[]const u8 = null,
|
||||||
/// Id of afk channel
|
/// Id of afk channel
|
||||||
afk_channel_id: ?Snowflake,
|
afk_channel_id: ?Snowflake = null,
|
||||||
/// The channel id that the widget will generate an invite to, or null if set to no invite
|
/// The channel id that the widget will generate an invite to, or null if set to no invite
|
||||||
widget_channel_id: ?Snowflake,
|
widget_channel_id: ?Snowflake = null,
|
||||||
/// Roles in the guild
|
/// Roles in the guild
|
||||||
roles: []Role,
|
roles: []Role,
|
||||||
/// Custom guild emojis
|
/// Custom guild emojis
|
||||||
emojis: []Emoji,
|
emojis: []Emoji,
|
||||||
/// Application id of the guild creator if it is bot-created
|
/// Application id of the guild creator if it is bot-created
|
||||||
application_id: ?Snowflake,
|
application_id: ?Snowflake = null,
|
||||||
/// The id of the channel where guild notices such as welcome messages and boost events are posted
|
/// The id of the channel where guild notices such as welcome messages and boost events are posted
|
||||||
system_channel_id: ?Snowflake,
|
system_channel_id: ?Snowflake = null,
|
||||||
/// The id of the channel where community guilds can display rules and/or guidelines
|
/// The id of the channel where community guilds can display rules and/or guidelines
|
||||||
rules_channel_id: ?Snowflake,
|
rules_channel_id: ?Snowflake = null,
|
||||||
/// When this guild was joined at
|
/// When this guild was joined at
|
||||||
joined_at: ?[]const u8,
|
joined_at: ?[]const u8 = null,
|
||||||
// States of members currently in voice channels; lacks the guild_id key
|
// States of members currently in voice channels; lacks the guild_id key
|
||||||
// voice_states: ?[]Omit(VoiceState, .{"guildId"}),
|
// voice_states: ?[]Omit(VoiceState, .{"guildId"}) = null,
|
||||||
/// Users in the guild
|
/// Users in the guild
|
||||||
members: ?[]Member,
|
members: ?[]Member = null,
|
||||||
/// Channels in the guild
|
/// Channels in the guild
|
||||||
channels: ?[]Channel,
|
channels: ?[]Channel = null,
|
||||||
/// All active threads in the guild that the current user has permission to view
|
/// All active threads in the guild that the current user has permission to view
|
||||||
threads: ?[]Channel,
|
threads: ?[]Channel = null,
|
||||||
/// Presences of the members in the guild, will only include non-offline members if the size is greater than large threshold
|
/// Presences of the members in the guild, will only include non-offline members if the size is greater than large threshold
|
||||||
presences: ?[]Partial(PresenceUpdate),
|
presences: ?[]Partial(PresenceUpdate) = null,
|
||||||
/// Banner hash
|
/// Banner hash
|
||||||
banner: ?[]const u8,
|
banner: ?[]const u8 = null,
|
||||||
///The preferred locale of a Community guild; used in server discovery and notices from ; defaults to "en-US"
|
///The preferred locale of a Community guild; used in server discovery and notices from ; defaults to "en-US"
|
||||||
preferred_locale: []const u8,
|
preferred_locale: []const u8,
|
||||||
///The id of the channel where admins and moderators of Community guilds receive notices from
|
///The id of the channel where admins and moderators of Community guilds receive notices from
|
||||||
public_updates_channel_id: ?Snowflake,
|
public_updates_channel_id: ?Snowflake = null,
|
||||||
/// The welcome screen of a Community guild, shown to new members, returned in an Invite's guild object
|
/// The welcome screen of a Community guild, shown to new members, returned in an Invite's guild object
|
||||||
welcome_screen: ?WelcomeScreen,
|
welcome_screen: ?WelcomeScreen = null,
|
||||||
/// Stage instances in the guild
|
/// Stage instances in the guild
|
||||||
stage_instances: ?[]StageInstance,
|
stage_instances: ?[]StageInstance = null,
|
||||||
/// Custom guild stickers
|
/// Custom guild stickers
|
||||||
stickers: ?[]Sticker,
|
stickers: ?[]Sticker = null,
|
||||||
///The id of the channel where admins and moderators of Community guilds receive safety alerts from
|
///The id of the channel where admins and moderators of Community guilds receive safety alerts from
|
||||||
safety_alerts_channel_id: ?Snowflake,
|
safety_alerts_channel_id: ?Snowflake = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/voice#voice-state-object-voice-state-structure
|
/// https://discord.com/developers/docs/resources/voice#voice-state-object-voice-state-structure
|
||||||
pub const VoiceState = struct {
|
pub const VoiceState = struct {
|
||||||
/// The session id for this voice state
|
/// The session id for this voice state
|
||||||
session_id: []const u8,
|
session_id: []const u8,
|
||||||
/// The guild id this voice state is for
|
/// The guild id this voice state is for
|
||||||
guild_id: ?Snowflake,
|
guild_id: ?Snowflake = null,
|
||||||
/// The channel id this user is connected to
|
/// The channel id this user is connected to
|
||||||
channel_id: ?Snowflake,
|
channel_id: ?Snowflake = null,
|
||||||
/// The user id this voice state is for
|
/// The user id this voice state is for
|
||||||
user_id: Snowflake,
|
user_id: Snowflake,
|
||||||
/// The guild member this voice state is for
|
/// The guild member this voice state is for
|
||||||
member: ?MemberWithUser,
|
member: ?MemberWithUser = null,
|
||||||
/// Whether this user is deafened by the server
|
/// Whether this user is deafened by the server
|
||||||
deaf: bool,
|
deaf: bool,
|
||||||
/// Whether this user is muted by the server
|
/// Whether this user is muted by the server
|
||||||
mute: bool,
|
mute: bool,
|
||||||
/// Whether this user is locally deafened
|
/// Whether this user is locally deafened
|
||||||
self_deaf: bool,
|
self_deaf: bool,
|
||||||
/// Whether this user is locally muted
|
/// Whether this user is locally muted
|
||||||
self_mute: bool,
|
self_mute: bool,
|
||||||
/// Whether this user is streaming using "Go Live"
|
/// Whether this user is streaming using "Go Live"
|
||||||
self_stream: ?bool,
|
self_stream: ?bool = null,
|
||||||
/// Whether this user's camera is enabled
|
/// Whether this user's camera is enabled
|
||||||
self_video: bool,
|
self_video: bool,
|
||||||
/// Whether this user is muted by the current user
|
/// Whether this user is muted by the current user
|
||||||
suppress: bool,
|
suppress: bool,
|
||||||
/// The time at which the user requested to speak
|
/// The time at which the user requested to speak
|
||||||
request_to_speak_timestamp: ?[]const u8,
|
request_to_speak_timestamp: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#get-guild-widget-example-get-guild-widget
|
/// https://discord.com/developers/docs/resources/guild#get-guild-widget-example-get-guild-widget
|
||||||
pub const GuildWidget = struct {
|
pub const GuildWidget = struct {
|
||||||
id: Snowflake,
|
|
||||||
name: []const u8,
|
|
||||||
instant_invite: []const u8,
|
|
||||||
channels: []struct {
|
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
position: isize,
|
instant_invite: []const u8,
|
||||||
},
|
channels: []struct {
|
||||||
members: []struct {
|
id: Snowflake,
|
||||||
|
name: []const u8,
|
||||||
|
position: isize,
|
||||||
|
},
|
||||||
|
members: []struct {
|
||||||
|
id: Snowflake,
|
||||||
|
username: []const u8,
|
||||||
|
discriminator: []const u8,
|
||||||
|
avatar: ?[]const u8 = null,
|
||||||
|
status: []const u8,
|
||||||
|
avatar_url: []const u8,
|
||||||
|
},
|
||||||
|
presence_count: isize,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// https://discord.com/developers/docs/resources/guild#guild-preview-object
|
||||||
|
pub const GuildPreview = struct {
|
||||||
|
/// Guild id
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
username: []const u8,
|
/// Guild name (2-100 characters)
|
||||||
discriminator: []const u8,
|
name: []const u8,
|
||||||
avatar: ?[]const u8,
|
/// Icon hash
|
||||||
status: []const u8,
|
icon: ?[]const u8 = null,
|
||||||
avatar_url: []const u8,
|
/// Splash hash
|
||||||
},
|
splash: ?[]const u8 = null,
|
||||||
presence_count: isize,
|
/// Discovery splash hash
|
||||||
};
|
discovery_splash: ?[]const u8 = null,
|
||||||
|
/// Custom guild emojis
|
||||||
|
emojis: []Emoji,
|
||||||
|
/// Enabled guild features
|
||||||
|
features: []GuildFeatures,
|
||||||
|
/// Approximate isize of members in this guild
|
||||||
|
approximate_member_count: isize,
|
||||||
|
/// Approximate isize of online members in this guild
|
||||||
|
approximate_presence_count: isize,
|
||||||
|
/// The description for the guild, if the guild is discoverable
|
||||||
|
description: ?[]const u8 = null,
|
||||||
|
/// Custom guild stickers
|
||||||
|
stickers: []Sticker,
|
||||||
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#guild-preview-object
|
/// https://discord.com/developers/docs/resources/guild#create-guild
|
||||||
pub const GuildPreview = struct {
|
pub const CreateGuild = struct {
|
||||||
/// Guild id
|
/// Name of the guild (1-100 characters)
|
||||||
id: Snowflake,
|
name: []const u8,
|
||||||
/// Guild name (2-100 characters)
|
/// Base64 128x128 image for the guild icon
|
||||||
name: []const u8,
|
icon: ?[]const u8 = null,
|
||||||
/// Icon hash
|
/// Verification level
|
||||||
icon: ?[]const u8,
|
verification_level: ?VerificationLevels = null,
|
||||||
/// Splash hash
|
/// Default message notification level
|
||||||
splash: ?[]const u8,
|
default_message_notifications: DefaultMessageNotificationLevels,
|
||||||
/// Discovery splash hash
|
/// Explicit content filter level
|
||||||
discovery_splash: ?[]const u8,
|
explicit_content_filter: ?ExplicitContentFilterLevels = null,
|
||||||
/// Custom guild emojis
|
/// New guild roles (first role is the everyone role)
|
||||||
emojis: []Emoji,
|
roles: ?[]Role = null,
|
||||||
/// Enabled guild features
|
/// New guild's channels
|
||||||
features: []GuildFeatures,
|
channels: ?[]Partial(Channel) = null,
|
||||||
/// Approximate isize of members in this guild
|
/// Id for afk channel
|
||||||
approximate_member_count: isize,
|
afk_channel_id: ?[]const u8 = null,
|
||||||
/// Approximate isize of online members in this guild
|
/// Afk timeout in seconds
|
||||||
approximate_presence_count: isize,
|
afk_timeout: ?isize = null,
|
||||||
/// The description for the guild, if the guild is discoverable
|
/// The id of the channel where guild notices such as welcome messages and boost events are posted
|
||||||
description: ?[]const u8,
|
system_channel_id: ?[]const u8 = null,
|
||||||
/// Custom guild stickers
|
/// System channel flags
|
||||||
stickers: []Sticker,
|
system_channel_flags: ?SystemChannelFlags = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#create-guild
|
/// https://discord.com/developers/docs/resources/guild#modify-guild
|
||||||
pub const CreateGuild = struct {
|
pub const ModifyGuild = struct {
|
||||||
/// Name of the guild (1-100 characters)
|
/// Guild name
|
||||||
name: []const u8,
|
name: ?[]const u8 = null,
|
||||||
/// Base64 128x128 image for the guild icon
|
/// Verification level
|
||||||
icon: ?[]const u8,
|
verification_level: ?VerificationLevels = null,
|
||||||
/// Verification level
|
/// Default message notification filter level
|
||||||
verification_level: ?VerificationLevels,
|
default_message_notifications: ?DefaultMessageNotificationLevels = null,
|
||||||
/// Default message notification level
|
/// Explicit content filter level
|
||||||
default_message_notifications: DefaultMessageNotificationLevels,
|
explicit_content_filter: ?ExplicitContentFilterLevels = null,
|
||||||
/// Explicit content filter level
|
/// Id for afk channel
|
||||||
explicit_content_filter: ?ExplicitContentFilterLevels,
|
afk_channel_id: ?Snowflake = null,
|
||||||
/// New guild roles (first role is the everyone role)
|
/// Afk timeout in seconds
|
||||||
roles: ?[]Role,
|
afk_timeout: ?isize = null,
|
||||||
/// New guild's channels
|
/// Base64 1024x1024 png/jpeg/gif image for the guild icon (can be animated gif when the server has the `ANIMATED_ICON` feature)
|
||||||
channels: ?[]Partial(Channel),
|
icon: ?[]const u8 = null,
|
||||||
/// Id for afk channel
|
/// User id to transfer guild ownership to (must be owner)
|
||||||
afk_channel_id: ?[]const u8,
|
owner_id: ?Snowflake = null,
|
||||||
/// Afk timeout in seconds
|
/// Base64 16:9 png/jpeg image for the guild splash (when the server has `INVITE_SPLASH` fe
|
||||||
afk_timeout: ?isize,
|
splash: ?[]const u8 = null,
|
||||||
/// The id of the channel where guild notices such as welcome messages and boost events are posted
|
/// Base64 16:9 png/jpeg image for the guild discovery spash (when the server has the `DISCOVERABLE` feature)
|
||||||
system_channel_id: ?[]const u8,
|
discovery_splash: ?[]const u8 = null,
|
||||||
/// System channel flags
|
/// Base64 16:9 png/jpeg image for the guild banner (when the server has BANNER feature)
|
||||||
system_channel_flags: ?SystemChannelFlags,
|
banner: ?[]const u8 = null,
|
||||||
};
|
/// The id of the channel where guild notices such as welcome messages and boost events are posted
|
||||||
|
system_channel_id: ?Snowflake = null,
|
||||||
|
/// System channel flags
|
||||||
|
system_channel_flags: ?SystemChannelFlags = null,
|
||||||
|
/// The id of the channel where Community guilds display rules and/or guidelines
|
||||||
|
rules_channel_id: ?Snowflake = null,
|
||||||
|
/// The id of the channel where admins and moderators of Community guilds receive notices from Discord
|
||||||
|
public_updates_channel_id: ?Snowflake = null,
|
||||||
|
/// The preferred locale of a Community guild used in server discovery and notices from Discord; defaults to "en-US"
|
||||||
|
preferred_locale: ?[]const u8 = null,
|
||||||
|
/// Enabled guild features
|
||||||
|
features: ?[]GuildFeatures = null,
|
||||||
|
/// Whether the guild's boost progress bar should be enabled
|
||||||
|
premium_progress_bar_enabled: ?bool = null,
|
||||||
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#modify-guild
|
pub const CreateGuildBan = struct {
|
||||||
pub const ModifyGuild = struct {
|
/// list of user ids to ban (max 200)
|
||||||
/// Guild name
|
user_ids: []Snowflake,
|
||||||
name: ?[]const u8,
|
/// number of seconds to delete messages for, between 0 and 604800 (7 days)
|
||||||
/// Verification level
|
delete_message_seconds: ?isize = null,
|
||||||
verification_level: ?VerificationLevels,
|
};
|
||||||
/// Default message notification filter level
|
|
||||||
default_message_notifications: ?DefaultMessageNotificationLevels,
|
|
||||||
/// Explicit content filter level
|
|
||||||
explicit_content_filter: ?ExplicitContentFilterLevels,
|
|
||||||
/// Id for afk channel
|
|
||||||
afk_channel_id: ?Snowflake,
|
|
||||||
/// Afk timeout in seconds
|
|
||||||
afk_timeout: ?isize,
|
|
||||||
/// Base64 1024x1024 png/jpeg/gif image for the guild icon (can be animated gif when the server has the `ANIMATED_ICON` feature)
|
|
||||||
icon: ?[]const u8,
|
|
||||||
/// User id to transfer guild ownership to (must be owner)
|
|
||||||
owner_id: ?Snowflake,
|
|
||||||
/// Base64 16:9 png/jpeg image for the guild splash (when the server has `INVITE_SPLASH` fe
|
|
||||||
splash: ?[]const u8,
|
|
||||||
/// Base64 16:9 png/jpeg image for the guild discovery spash (when the server has the `DISCOVERABLE` feature)
|
|
||||||
discovery_splash: ?[]const u8,
|
|
||||||
/// Base64 16:9 png/jpeg image for the guild banner (when the server has BANNER feature)
|
|
||||||
banner: ?[]const u8,
|
|
||||||
/// The id of the channel where guild notices such as welcome messages and boost events are posted
|
|
||||||
system_channel_id: ?Snowflake,
|
|
||||||
/// System channel flags
|
|
||||||
system_channel_flags: ?SystemChannelFlags,
|
|
||||||
/// The id of the channel where Community guilds display rules and/or guidelines
|
|
||||||
rules_channel_id: ?Snowflake,
|
|
||||||
/// The id of the channel where admins and moderators of Community guilds receive notices from Discord
|
|
||||||
public_updates_channel_id: ?Snowflake,
|
|
||||||
/// The preferred locale of a Community guild used in server discovery and notices from Discord; defaults to "en-US"
|
|
||||||
preferred_locale: ?[]const u8,
|
|
||||||
/// Enabled guild features
|
|
||||||
features: ?[]GuildFeatures,
|
|
||||||
/// Whether the guild's boost progress bar should be enabled
|
|
||||||
premium_progress_bar_enabled: ?bool,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub const CreateGuildBan = struct {
|
/// https://discord.com/developers/docs/resources/guild#get-guild-prune-count
|
||||||
/// list of user ids to ban (max 200)
|
pub const GetGuildPruneCountQuery = struct {
|
||||||
user_ids: []Snowflake,
|
/// Number of days to count prune for (1 or more), default: 7
|
||||||
/// number of seconds to delete messages for, between 0 and 604800 (7 days)
|
days: ?isize = null,
|
||||||
delete_message_seconds: ?isize,
|
/// Role(s) to include, default: none
|
||||||
};
|
include_roles: ?[]Snowflake = null,
|
||||||
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#get-guild-prune-count
|
/// https://discord.com/developers/docs/resources/guild#begin-guild-prune
|
||||||
pub const GetGuildPruneCountQuery = struct {
|
pub const BeginGuildPrune = struct {
|
||||||
/// Number of days to count prune for (1 or more), default: 7
|
/// Number of days to prune (1 or more), default: 7
|
||||||
days: ?isize,
|
days: ?isize = null,
|
||||||
/// Role(s) to include, default: none
|
/// Whether 'pruned' is returned, discouraged for large guilds, default: true
|
||||||
include_roles: ?[]Snowflake,
|
compute_prune_count: ?bool = null,
|
||||||
};
|
/// Role(s) ro include, default: none
|
||||||
|
include_roles: ?[]Snowflake = null,
|
||||||
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#begin-guild-prune
|
/// https://discord.com/developers/docs/resources/guild#modify-guild-onboarding-json-params
|
||||||
pub const BeginGuildPrune = struct {
|
pub const ModifyGuildOnboarding = struct {
|
||||||
/// Number of days to prune (1 or more), default: 7
|
/// Prompts shown during onboarding and in customize community
|
||||||
days: ?isize,
|
prompts: []GuildOnboardingPrompt,
|
||||||
/// Whether 'pruned' is returned, discouraged for large guilds, default: true
|
/// Channel IDs that members get opted into automatically
|
||||||
compute_prune_count: ?bool,
|
defaultChannelIds: []Snowflake,
|
||||||
/// Role(s) ro include, default: none
|
/// Whether onboarding is enabled in the guild
|
||||||
include_roles: ?[]Snowflake,
|
enabled: bool,
|
||||||
};
|
/// Current mode of onboarding
|
||||||
|
mode: GuildOnboardingMode,
|
||||||
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#modify-guild-onboarding-json-params
|
/// https://discord.com/developers/docs/resources/guild#guild-onboarding-object-guild-onboarding-structure
|
||||||
pub const ModifyGuildOnboarding = struct {
|
pub const GuildOnboarding = struct {
|
||||||
/// Prompts shown during onboarding and in customize community
|
/// ID of the guild this onboarding is part of
|
||||||
prompts: []GuildOnboardingPrompt,
|
guild_id: []const u8,
|
||||||
/// Channel IDs that members get opted into automatically
|
/// Prompts shown during onboarding and in customize community
|
||||||
defaultChannelIds: []Snowflake,
|
prompts: []GuildOnboardingPrompt,
|
||||||
/// Whether onboarding is enabled in the guild
|
/// Channel IDs that members get opted into automatically
|
||||||
enabled: bool,
|
default_channel_ids: [][]const u8,
|
||||||
/// Current mode of onboarding
|
/// Whether onboarding is enabled in the guild
|
||||||
mode: GuildOnboardingMode,
|
enabled: bool,
|
||||||
};
|
/// Current mode of onboarding
|
||||||
|
mode: GuildOnboardingMode,
|
||||||
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#guild-onboarding-object-guild-onboarding-structure
|
/// https://discord.com/developers/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure
|
||||||
pub const GuildOnboarding = struct {
|
pub const GuildOnboardingPrompt = struct {
|
||||||
/// ID of the guild this onboarding is part of
|
/// ID of the prompt
|
||||||
guild_id: []const u8,
|
id: Snowflake,
|
||||||
/// Prompts shown during onboarding and in customize community
|
/// Type of prompt
|
||||||
prompts: []GuildOnboardingPrompt,
|
type: GuildOnboardingPromptType,
|
||||||
/// Channel IDs that members get opted into automatically
|
/// Options available within the prompt
|
||||||
default_channel_ids: [][]const u8,
|
options: []GuildOnboardingPromptOption,
|
||||||
/// Whether onboarding is enabled in the guild
|
/// Title of the prompt
|
||||||
enabled: bool,
|
title: []const u8,
|
||||||
/// Current mode of onboarding
|
/// Indicates whether users are limited to selecting one option for the prompt
|
||||||
mode: GuildOnboardingMode,
|
single_select: bool,
|
||||||
};
|
/// Indicates whether the prompt is required before a user completes the onboarding flow
|
||||||
|
required: bool,
|
||||||
|
/// Indicates whether the prompt is present in the onboarding flow. If `false`, the prompt will only appear in the Channels & Roles tab
|
||||||
|
in_onboarding: bool,
|
||||||
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure
|
/// https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-option-structure
|
||||||
pub const GuildOnboardingPrompt = struct {
|
pub const GuildOnboardingPromptOption = struct {
|
||||||
/// ID of the prompt
|
/// ID of the prompt option
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// Type of prompt
|
/// IDs for channels a member is added to when the option is selected
|
||||||
type: GuildOnboardingPromptType,
|
channel_ids: [][]const u8,
|
||||||
/// Options available within the prompt
|
/// IDs for roles assigned to a member when the option is selected
|
||||||
options: []GuildOnboardingPromptOption,
|
role_ids: []Snowflake,
|
||||||
/// Title of the prompt
|
/// Emoji of the option
|
||||||
title: []const u8,
|
/// @remarks
|
||||||
/// Indicates whether users are limited to selecting one option for the prompt
|
/// When creating or updating a prompt option, the `emoji_id`, `emoji_name`, and `emoji_animated` fields must be used instead of the emoji object.
|
||||||
single_select: bool,
|
emoji: ?Emoji = null,
|
||||||
/// Indicates whether the prompt is required before a user completes the onboarding flow
|
/// Emoji ID of the option
|
||||||
required: bool,
|
/// @remarks
|
||||||
/// Indicates whether the prompt is present in the onboarding flow. If `false`, the prompt will only appear in the Channels & Roles tab
|
/// When creating or updating a prompt option, the `emoji_id`, `emoji_name`, and `emoji_animated` fields must be used instead of the emoji object.
|
||||||
in_onboarding: bool,
|
emoji_id: ?[]const u8 = null,
|
||||||
};
|
/// Emoji name of the option
|
||||||
|
/// @remarks
|
||||||
/// https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-option-structure
|
/// When creating or updating a prompt option, the `emoji_id`, `emoji_name`, and `emoji_animated` fields must be used instead of the emoji object.
|
||||||
pub const GuildOnboardingPromptOption = struct {
|
emoji_name: ?[]const u8 = null,
|
||||||
/// ID of the prompt option
|
/// Whether the emoji is animated
|
||||||
id: Snowflake,
|
/// @remarks
|
||||||
/// IDs for channels a member is added to when the option is selected
|
/// When creating or updating a prompt option, the `emoji_id`, `emoji_name`, and `emoji_animated` fields must be used instead of the emoji object.
|
||||||
channel_ids: [][]const u8,
|
emoji_animated: bool,
|
||||||
/// IDs for roles assigned to a member when the option is selected
|
/// Title of the option
|
||||||
role_ids: []Snowflake,
|
title: []const u8,
|
||||||
/// Emoji of the option
|
/// Description of the option
|
||||||
/// @remarks
|
description: ?[]const u8 = null,
|
||||||
/// When creating or updating a prompt option, the `emoji_id`, `emoji_name`, and `emoji_animated` fields must be used instead of the emoji object.
|
|
||||||
emoji: ?Emoji,
|
|
||||||
/// Emoji ID of the option
|
|
||||||
/// @remarks
|
|
||||||
/// When creating or updating a prompt option, the `emoji_id`, `emoji_name`, and `emoji_animated` fields must be used instead of the emoji object.
|
|
||||||
emoji_id: ?[]const u8,
|
|
||||||
/// Emoji name of the option
|
|
||||||
/// @remarks
|
|
||||||
/// When creating or updating a prompt option, the `emoji_id`, `emoji_name`, and `emoji_animated` fields must be used instead of the emoji object.
|
|
||||||
emoji_name: ?[]const u8,
|
|
||||||
/// Whether the emoji is animated
|
|
||||||
/// @remarks
|
|
||||||
/// When creating or updating a prompt option, the `emoji_id`, `emoji_name`, and `emoji_animated` fields must be used instead of the emoji object.
|
|
||||||
emoji_animated: bool,
|
|
||||||
/// Title of the option
|
|
||||||
title: []const u8,
|
|
||||||
/// Description of the option
|
|
||||||
description: ?[]const u8,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-types
|
/// https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-types
|
||||||
|
@ -1,136 +1,136 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const IntegrationExpireBehaviors = @import("shared.zig").IntegrationExpireBehaviors;
|
const IntegrationExpireBehaviors = @import("shared.zig").IntegrationExpireBehaviors;
|
||||||
const OAuth2Scope = @import("shared.zig").OAuth2Scope;
|
const OAuth2Scope = @import("shared.zig").OAuth2Scope;
|
||||||
const User = @import("user.zig").User;
|
const User = @import("user.zig").User;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#integration-object-integration-structure
|
/// https://discord.com/developers/docs/resources/guild#integration-object-integration-structure
|
||||||
pub const Integration = struct {
|
pub const Integration = struct {
|
||||||
/// Integration Id
|
/// Integration Id
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// Integration name
|
/// Integration name
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// Integration type (twitch, youtube, discord, or guild_subscription).
|
/// Integration type (twitch, youtube, discord, or guild_subscription).
|
||||||
type: union(enum) {
|
type: union(enum) {
|
||||||
twitch,
|
twitch,
|
||||||
youtube,
|
youtube,
|
||||||
discord,
|
discord,
|
||||||
},
|
},
|
||||||
/// Is this integration enabled
|
/// Is this integration enabled
|
||||||
enabled: ?bool,
|
enabled: ?bool = null,
|
||||||
/// Is this integration syncing
|
/// Is this integration syncing
|
||||||
syncing: ?bool,
|
syncing: ?bool = null,
|
||||||
/// Role Id that this integration uses for "subscribers"
|
/// Role Id that this integration uses for "subscribers"
|
||||||
role_id: ?Snowflake,
|
role_id: ?Snowflake = null,
|
||||||
/// Whether emoticons should be synced for this integration (twitch only currently)
|
/// Whether emoticons should be synced for this integration (twitch only currently)
|
||||||
enable_emoticons: ?bool,
|
enable_emoticons: ?bool = null,
|
||||||
/// The behavior of expiring subscribers
|
/// The behavior of expiring subscribers
|
||||||
expire_behavior: ?IntegrationExpireBehaviors,
|
expire_behavior: ?IntegrationExpireBehaviors = null,
|
||||||
/// The grace period (in days) before expiring subscribers
|
/// The grace period (in days) before expiring subscribers
|
||||||
expire_grace_period: ?isize,
|
expire_grace_period: ?isize = null,
|
||||||
/// When this integration was last synced
|
/// When this integration was last synced
|
||||||
synced_at: ?[]const u8,
|
synced_at: ?[]const u8 = null,
|
||||||
/// How many subscribers this integration has
|
/// How many subscribers this integration has
|
||||||
subscriber_count: ?isize,
|
subscriber_count: ?isize = null,
|
||||||
/// Has this integration been revoked
|
/// Has this integration been revoked
|
||||||
revoked: ?bool,
|
revoked: ?bool = null,
|
||||||
/// User for this integration
|
/// User for this integration
|
||||||
user: ?User,
|
user: ?User = null,
|
||||||
/// Integration account information
|
/// Integration account information
|
||||||
account: IntegrationAccount,
|
account: IntegrationAccount,
|
||||||
/// The bot/OAuth2 application for discord integrations
|
/// The bot/OAuth2 application for discord integrations
|
||||||
application: ?IntegrationApplication,
|
application: ?IntegrationApplication = null,
|
||||||
/// the scopes the application has been authorized for
|
/// the scopes the application has been authorized for
|
||||||
scopes: []OAuth2Scope,
|
scopes: []OAuth2Scope,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#integration-account-object-integration-account-structure
|
/// https://discord.com/developers/docs/resources/guild#integration-account-object-integration-account-structure
|
||||||
pub const IntegrationAccount = struct {
|
pub const IntegrationAccount = struct {
|
||||||
/// Id of the account
|
/// Id of the account
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// Name of the account
|
/// Name of the account
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#integration-application-object-integration-application-structure
|
/// https://discord.com/developers/docs/resources/guild#integration-application-object-integration-application-structure
|
||||||
pub const IntegrationApplication = struct {
|
pub const IntegrationApplication = struct {
|
||||||
/// The id of the app
|
/// The id of the app
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// The name of the app
|
/// The name of the app
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// the icon hash of the app
|
/// the icon hash of the app
|
||||||
icon: ?[]const u8,
|
icon: ?[]const u8 = null,
|
||||||
/// The description of the app
|
/// The description of the app
|
||||||
description: []const u8,
|
description: []const u8,
|
||||||
/// The bot associated with this application
|
/// The bot associated with this application
|
||||||
bot: ?User,
|
bot: ?User = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://github.com/discord/discord-api-docs/blob/master/docs/topics/Gateway.md#integration-create-event-additional-fields
|
/// https://github.com/discord/discord-api-docs/blob/master/docs/topics/Gateway.md#integration-create-event-additional-fields
|
||||||
pub const IntegrationCreateUpdate = struct {
|
pub const IntegrationCreateUpdate = struct {
|
||||||
/// Integration Id
|
/// Integration Id
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// Integration name
|
/// Integration name
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// Integration type (twitch, youtube, discord, or guild_subscription).
|
/// Integration type (twitch, youtube, discord, or guild_subscription).
|
||||||
type: union(enum) {
|
type: union(enum) {
|
||||||
twitch,
|
twitch,
|
||||||
youtube,
|
youtube,
|
||||||
discord,
|
discord,
|
||||||
},
|
},
|
||||||
/// Is this integration enabled
|
/// Is this integration enabled
|
||||||
enabled: ?bool,
|
enabled: ?bool = null,
|
||||||
/// Is this integration syncing
|
/// Is this integration syncing
|
||||||
syncing: ?bool,
|
syncing: ?bool = null,
|
||||||
/// Role Id that this integration uses for "subscribers"
|
/// Role Id that this integration uses for "subscribers"
|
||||||
role_id: ?Snowflake,
|
role_id: ?Snowflake = null,
|
||||||
/// Whether emoticons should be synced for this integration (twitch only currently)
|
/// Whether emoticons should be synced for this integration (twitch only currently)
|
||||||
enable_emoticons: ?bool,
|
enable_emoticons: ?bool = null,
|
||||||
/// The behavior of expiring subscribers
|
/// The behavior of expiring subscribers
|
||||||
expire_behavior: ?IntegrationExpireBehaviors,
|
expire_behavior: ?IntegrationExpireBehaviors = null,
|
||||||
/// The grace period (in days) before expiring subscribers
|
/// The grace period (in days) before expiring subscribers
|
||||||
expire_grace_period: ?isize,
|
expire_grace_period: ?isize = null,
|
||||||
/// When this integration was last synced
|
/// When this integration was last synced
|
||||||
synced_at: ?[]const u8,
|
synced_at: ?[]const u8 = null,
|
||||||
/// How many subscribers this integration has
|
/// How many subscribers this integration has
|
||||||
subscriber_count: ?isize,
|
subscriber_count: ?isize = null,
|
||||||
/// Has this integration been revoked
|
/// Has this integration been revoked
|
||||||
revoked: ?bool,
|
revoked: ?bool = null,
|
||||||
/// User for this integration
|
/// User for this integration
|
||||||
user: ?User,
|
user: ?User = null,
|
||||||
/// Integration account information
|
/// Integration account information
|
||||||
account: IntegrationAccount,
|
account: IntegrationAccount,
|
||||||
/// The bot/OAuth2 application for discord integrations
|
/// The bot/OAuth2 application for discord integrations
|
||||||
application: ?IntegrationApplication,
|
application: ?IntegrationApplication = null,
|
||||||
/// the scopes the application has been authorized for
|
/// the scopes the application has been authorized for
|
||||||
scopes: []OAuth2Scope,
|
scopes: []OAuth2Scope,
|
||||||
/// Id of the guild
|
/// Id of the guild
|
||||||
guild_id: Snowflake,
|
guild_id: Snowflake,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://github.com/discord/discord-api-docs/blob/master/docs/topics/Gateway.md#integration-delete-event-fields
|
/// https://github.com/discord/discord-api-docs/blob/master/docs/topics/Gateway.md#integration-delete-event-fields
|
||||||
pub const IntegrationDelete = struct {
|
pub const IntegrationDelete = struct {
|
||||||
/// Integration id
|
/// Integration id
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// Id of the guild
|
/// Id of the guild
|
||||||
guild_id: Snowflake,
|
guild_id: Snowflake,
|
||||||
/// Id of the bot/OAuth2 application for this discord integration
|
/// Id of the bot/OAuth2 application for this discord integration
|
||||||
application_id: ?Snowflake,
|
application_id: ?Snowflake = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway#guild-integrations-update
|
/// https://discord.com/developers/docs/topics/gateway#guild-integrations-update
|
||||||
|
@ -1,216 +1,216 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const InteractionTypes = @import("shared.zig").InteractionTypes;
|
const InteractionTypes = @import("shared.zig").InteractionTypes;
|
||||||
const Guild = @import("guild.zig").Guild;
|
const Guild = @import("guild.zig").Guild;
|
||||||
const Attachment = @import("attachment.zig").Attachment;
|
const Attachment = @import("attachment.zig").Attachment;
|
||||||
const Message = @import("message.zig").Message;
|
const Message = @import("message.zig").Message;
|
||||||
const Channel = @import("channel.zig").Channel;
|
const Channel = @import("channel.zig").Channel;
|
||||||
const User = @import("user.zig").User;
|
const User = @import("user.zig").User;
|
||||||
const Role = @import("role.zig").Role;
|
const Role = @import("role.zig").Role;
|
||||||
const AvatarDecorationData = @import("user.zig").AvatarDecorationData;
|
const AvatarDecorationData = @import("user.zig").AvatarDecorationData;
|
||||||
const Partial = @import("partial.zig").Partial;
|
const Partial = @import("partial.zig").Partial;
|
||||||
const ApplicationCommandOptionTypes = @import("shared.zig").ApplicationCommandOptionTypes;
|
const ApplicationCommandOptionTypes = @import("shared.zig").ApplicationCommandOptionTypes;
|
||||||
const MessageComponentTypes = @import("shared.zig").MessageComponentTypes;
|
const MessageComponentTypes = @import("shared.zig").MessageComponentTypes;
|
||||||
const ChannelTypes = @import("shared.zig").ChannelTypes;
|
const ChannelTypes = @import("shared.zig").ChannelTypes;
|
||||||
const MessageComponent = @import("message.zig").MessageComponent;
|
const MessageComponent = @import("message.zig").MessageComponent;
|
||||||
const ApplicationCommandTypes = @import("shared.zig").ApplicationCommandTypes;
|
const ApplicationCommandTypes = @import("shared.zig").ApplicationCommandTypes;
|
||||||
const InteractionResponseTypes = @import("shared.zig").InteractionResponseTypes;
|
const InteractionResponseTypes = @import("shared.zig").InteractionResponseTypes;
|
||||||
const InteractionContextType = @import("command.zig").InteractionContextType;
|
const InteractionContextType = @import("command.zig").InteractionContextType;
|
||||||
const Entitlement = @import("monetization.zig").Entitlement;
|
const Entitlement = @import("monetization.zig").Entitlement;
|
||||||
const Record = @import("../json-helper.zig").Record;
|
const Record = @import("../json-helper.zig").Record;
|
||||||
|
|
||||||
pub const Interaction = struct {
|
pub const Interaction = struct {
|
||||||
/// Id of the interaction
|
/// Id of the interaction
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// Id of the application this interaction is for
|
/// Id of the application this interaction is for
|
||||||
application_id: Snowflake,
|
application_id: Snowflake,
|
||||||
/// The type of interaction
|
/// The type of interaction
|
||||||
type: InteractionTypes,
|
type: InteractionTypes,
|
||||||
/// Guild that the interaction was sent from
|
/// Guild that the interaction was sent from
|
||||||
guild: ?Partial(Guild),
|
guild: ?Partial(Guild) = null,
|
||||||
/// The guild it was sent from
|
/// The guild it was sent from
|
||||||
guild_id: ?Snowflake,
|
guild_id: ?Snowflake = null,
|
||||||
/// The channel it was sent from
|
/// The channel it was sent from
|
||||||
channel: Partial(Channel),
|
channel: Partial(Channel),
|
||||||
///
|
///
|
||||||
/// The ID of channel it was sent from
|
/// The ID of channel it was sent from
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// It is recommended that you begin using this channel field to identify the source channel of the interaction as they may deprecate the existing channel_id field in the future.
|
/// It is recommended that you begin using this channel field to identify the source channel of the interaction as they may deprecate the existing channel_id field in the future.
|
||||||
///
|
///
|
||||||
channel_id: ?Snowflake,
|
channel_id: ?Snowflake = null,
|
||||||
/// Guild member data for the invoking user, including permissions
|
/// Guild member data for the invoking user, including permissions
|
||||||
member: ?InteractionMember,
|
member: ?InteractionMember = null,
|
||||||
/// User object for the invoking user, if invoked in a DM
|
/// User object for the invoking user, if invoked in a DM
|
||||||
user: ?User,
|
user: ?User = null,
|
||||||
/// A continuation token for responding to the interaction
|
/// A continuation token for responding to the interaction
|
||||||
token: []const u8,
|
token: []const u8,
|
||||||
/// Read-only property, always `1`
|
/// Read-only property, always `1`
|
||||||
version: 1,
|
version: 1,
|
||||||
/// For the message the button was attached to
|
/// For the message the button was attached to
|
||||||
message: ?Message,
|
message: ?Message = null,
|
||||||
/// the command data payload
|
/// the command data payload
|
||||||
data: ?InteractionData,
|
data: ?InteractionData = null,
|
||||||
/// The selected language of the invoking user
|
/// The selected language of the invoking user
|
||||||
locale: ?[]const u8,
|
locale: ?[]const u8 = null,
|
||||||
/// The guild's preferred locale, if invoked in a guild
|
/// The guild's preferred locale, if invoked in a guild
|
||||||
guild_locale: ?[]const u8,
|
guild_locale: ?[]const u8 = null,
|
||||||
/// The computed permissions for a bot or app in the context of a specific interaction (including channel overwrites)
|
/// The computed permissions for a bot or app in the context of a specific interaction (including channel overwrites)
|
||||||
app_permissions: []const u8,
|
app_permissions: []const u8,
|
||||||
/// For monetized apps, any entitlements for the invoking user, representing access to premium SKUs
|
/// For monetized apps, any entitlements for the invoking user, representing access to premium SKUs
|
||||||
entitlements: []Entitlement,
|
entitlements: []Entitlement,
|
||||||
// Mapping of installation contexts that the interaction was authorized for to related user or guild IDs.
|
// Mapping of installation contexts that the interaction was authorized for to related user or guild IDs.
|
||||||
// authorizing_integration_owners: Partial(AutoArrayHashMap(ApplicationIntegrationType, []const u8)),
|
// authorizing_integration_owners: Partial(AutoArrayHashMap(ApplicationIntegrationType, []const u8)),
|
||||||
/// Context where the interaction was triggered from
|
/// Context where the interaction was triggered from
|
||||||
context: ?InteractionContextType,
|
context: ?InteractionContextType = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-response-object
|
/// https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-response-object
|
||||||
pub const InteractionCallbackResponse = struct {
|
pub const InteractionCallbackResponse = struct {
|
||||||
/// The interaction object associated with the interaction response
|
/// The interaction object associated with the interaction response
|
||||||
interaction: InteractionCallback,
|
interaction: InteractionCallback,
|
||||||
/// The resource that was created by the interaction response.
|
/// The resource that was created by the interaction response.
|
||||||
resource: ?InteractionResource,
|
resource: ?InteractionResource = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-object
|
/// https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-object
|
||||||
pub const InteractionCallback = struct {
|
pub const InteractionCallback = struct {
|
||||||
/// ID of the interaction
|
/// ID of the interaction
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// Interaction type
|
/// Interaction type
|
||||||
type: InteractionTypes,
|
type: InteractionTypes,
|
||||||
/// Instance ID of the Activity if one was launched or joined
|
/// Instance ID of the Activity if one was launched or joined
|
||||||
activity_instance_id: ?Snowflake,
|
activity_instance_id: ?Snowflake = null,
|
||||||
/// ID of the message that was created by the interaction
|
/// ID of the message that was created by the interaction
|
||||||
response_message_id: ?Snowflake,
|
response_message_id: ?Snowflake = null,
|
||||||
/// Whether or not the message is in a loading state
|
/// Whether or not the message is in a loading state
|
||||||
response_message_loading: ?bool,
|
response_message_loading: ?bool = null,
|
||||||
/// Whether or not the response message was ephemeral
|
/// Whether or not the response message was ephemeral
|
||||||
response_message_ephemeral: ?bool,
|
response_message_ephemeral: ?bool = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-resource-object
|
/// https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-resource-object
|
||||||
pub const InteractionResource = struct {
|
pub const InteractionResource = struct {
|
||||||
type: InteractionResponseTypes,
|
type: InteractionResponseTypes,
|
||||||
///
|
///
|
||||||
/// Represents the Activity launched by this interaction.
|
/// Represents the Activity launched by this interaction.
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Only present if type is `LAUNCH_ACTIVITY`.
|
/// Only present if type is `LAUNCH_ACTIVITY`.
|
||||||
///
|
///
|
||||||
activity_instance: ?ActivityInstanceResource,
|
activity_instance: ?ActivityInstanceResource = null,
|
||||||
///
|
///
|
||||||
/// Message created by the interaction.
|
/// Message created by the interaction.
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// Only present if type is either `CHANNEL_MESSAGE_WITH_SOURCE` or `UPDATE_MESSAGE`.
|
/// Only present if type is either `CHANNEL_MESSAGE_WITH_SOURCE` or `UPDATE_MESSAGE`.
|
||||||
///
|
///
|
||||||
message: ?Message,
|
message: ?Message = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-activity-instance-resource
|
/// https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-activity-instance-resource
|
||||||
pub const ActivityInstanceResource = struct {
|
pub const ActivityInstanceResource = struct {
|
||||||
/// Instance ID of the Activity if one was launched or joined.
|
/// Instance ID of the Activity if one was launched or joined.
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#guild-member-object
|
/// https://discord.com/developers/docs/resources/guild#guild-member-object
|
||||||
pub const InteractionMember = struct {
|
pub const InteractionMember = struct {
|
||||||
/// Whether the user is deafened in voice channels
|
/// Whether the user is deafened in voice channels
|
||||||
deaf: ?bool,
|
deaf: ?bool = null,
|
||||||
/// Whether the user is muted in voice channels
|
/// Whether the user is muted in voice channels
|
||||||
mute: ?bool,
|
mute: ?bool = null,
|
||||||
/// Whether the user has not yet passed the guild's Membership Screening requirements
|
/// Whether the user has not yet passed the guild's Membership Screening requirements
|
||||||
pending: ?bool,
|
pending: ?bool = null,
|
||||||
/// This users guild nickname
|
/// This users guild nickname
|
||||||
nick: ?[]const u8,
|
nick: ?[]const u8 = null,
|
||||||
/// The members custom avatar for this server.
|
/// The members custom avatar for this server.
|
||||||
avatar: ?[]const u8,
|
avatar: ?[]const u8 = null,
|
||||||
/// Array of role object ids
|
/// Array of role object ids
|
||||||
roles: [][]const u8,
|
roles: [][]const u8,
|
||||||
/// When the user joined the guild
|
/// When the user joined the guild
|
||||||
joined_at: []const u8,
|
joined_at: []const u8,
|
||||||
/// When the user started boosting the guild
|
/// When the user started boosting the guild
|
||||||
premium_since: ?[]const u8,
|
premium_since: ?[]const u8 = null,
|
||||||
/// when the user's timeout will expire and the user will be able to communicate in the guild again (set null to remove timeout), null or a time in the past if the user is not timed out
|
/// when the user's timeout will expire and the user will be able to communicate in the guild again (set null to remove timeout), null or a time in the past if the user is not timed out
|
||||||
communication_disabled_until: ?[]const u8,
|
communication_disabled_until: ?[]const u8 = null,
|
||||||
/// Guild member flags
|
/// Guild member flags
|
||||||
flags: isize,
|
flags: isize,
|
||||||
/// data for the member's guild avatar decoration
|
/// data for the member's guild avatar decoration
|
||||||
avatar_decoration_data: ?AvatarDecorationData,
|
avatar_decoration_data: ?AvatarDecorationData = null,
|
||||||
/// The user object for this member
|
/// The user object for this member
|
||||||
user: User,
|
user: User,
|
||||||
/// Total permissions of the member in the channel, including overwrites, returned when in the interaction object
|
/// Total permissions of the member in the channel, including overwrites, returned when in the interaction object
|
||||||
permissions: []const u8,
|
permissions: []const u8,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const InteractionData = struct {
|
pub const InteractionData = struct {
|
||||||
/// The type of component
|
/// The type of component
|
||||||
component_type: ?MessageComponentTypes,
|
component_type: ?MessageComponentTypes = null,
|
||||||
/// The custom id provided for this component.
|
/// The custom id provided for this component.
|
||||||
custom_id: ?Snowflake,
|
custom_id: ?Snowflake = null,
|
||||||
/// The components if its a Modal Submit interaction.
|
/// The components if its a Modal Submit interaction.
|
||||||
components: ?[]MessageComponent,
|
components: ?[]MessageComponent = null,
|
||||||
/// The values chosen by the user.
|
/// The values chosen by the user.
|
||||||
values: ?[][]const u8,
|
values: ?[][]const u8 = null,
|
||||||
/// The Id of the invoked command
|
/// The Id of the invoked command
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// The name of the invoked command
|
/// The name of the invoked command
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// the type of the invoked command
|
/// the type of the invoked command
|
||||||
type: ApplicationCommandTypes,
|
type: ApplicationCommandTypes,
|
||||||
/// Converted users + roles + channels + attachments
|
/// Converted users + roles + channels + attachments
|
||||||
resolved: ?struct {
|
resolved: ?struct {
|
||||||
/// The Ids and Message objects
|
/// The Ids and Message objects
|
||||||
messages: ?Record(Message),
|
messages: ?Record(Message) = null,
|
||||||
/// The Ids and User objects
|
/// The Ids and User objects
|
||||||
users: ?Record(User),
|
users: ?Record(User) = null,
|
||||||
// The Ids and partial Member objects
|
// The Ids and partial Member objects
|
||||||
//members: ?Record(Omit(InteractionMember, .{ "user", "deaf", "mute" })),
|
// members: ?Record(Omit(InteractionMember, .{ "user", "deaf", "mute" })) = null,
|
||||||
/// The Ids and Role objects
|
/// The Ids and Role objects
|
||||||
roles: ?Record(Role),
|
roles: ?Record(Role) = null,
|
||||||
/// The Ids and partial Channel objects
|
/// The Ids and partial Channel objects
|
||||||
channels: ?Record(struct {
|
channels: ?Record(struct {
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
type: ChannelTypes,
|
type: ChannelTypes,
|
||||||
name: ?[]const u8,
|
name: ?[]const u8 = null,
|
||||||
permissions: ?[]const u8,
|
permissions: ?[]const u8 = null,
|
||||||
}),
|
}),
|
||||||
/// The ids and attachment objects
|
/// The ids and attachment objects
|
||||||
attachments: Record(Attachment),
|
attachments: Record(Attachment),
|
||||||
},
|
},
|
||||||
/// The params + values from the user
|
/// The params + values from the user
|
||||||
options: ?[]InteractionDataOption,
|
options: ?[]InteractionDataOption = null,
|
||||||
/// The target id if this is a context menu command.
|
/// The target id if this is a context menu command.
|
||||||
target_id: ?Snowflake,
|
target_id: ?Snowflake = null,
|
||||||
/// the id of the guild the command is registered to
|
/// the id of the guild the command is registered to
|
||||||
guild_id: ?Snowflake,
|
guild_id: ?Snowflake = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const InteractionDataOption = struct {
|
pub const InteractionDataOption = struct {
|
||||||
/// Name of the parameter
|
/// Name of the parameter
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// Value of application command option type
|
/// Value of application command option type
|
||||||
type: ApplicationCommandOptionTypes,
|
type: ApplicationCommandOptionTypes,
|
||||||
/// Value of the option resulting from user input
|
/// Value of the option resulting from user input
|
||||||
value: ?union { string: []const u8, bool: bool, integer: isize },
|
value: ?union { string: []const u8, bool: bool, integer: isize } = null,
|
||||||
/// Present if this option is a group or subcommand
|
/// Present if this option is a group or subcommand
|
||||||
options: ?[]InteractionDataOption,
|
options: ?[]InteractionDataOption = null,
|
||||||
/// `true` if this option is the currently focused option for autocomplete
|
/// `true` if this option is the currently focused option for autocomplete
|
||||||
focused: ?bool,
|
focused: ?bool = null,
|
||||||
};
|
};
|
||||||
|
@ -1,98 +1,98 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const User = @import("user.zig").User;
|
const User = @import("user.zig").User;
|
||||||
const Guild = @import("guild.zig").Guild;
|
const Guild = @import("guild.zig").Guild;
|
||||||
const Channel = @import("channel.zig").Channel;
|
const Channel = @import("channel.zig").Channel;
|
||||||
const Member = @import("member.zig").Member;
|
const Member = @import("member.zig").Member;
|
||||||
const Application = @import("application.zig").Application;
|
const Application = @import("application.zig").Application;
|
||||||
const MessageActivityTypes = @import("shared.zig").MessageActivityTypes;
|
const MessageActivityTypes = @import("shared.zig").MessageActivityTypes;
|
||||||
const ScheduledEvent = @import("scheduled_event.zig").ScheduledEvent;
|
const ScheduledEvent = @import("scheduled_event.zig").ScheduledEvent;
|
||||||
const TargetTypes = @import("shared.zig").TargetTypes;
|
const TargetTypes = @import("shared.zig").TargetTypes;
|
||||||
const Partial = @import("partial.zig").Partial;
|
const Partial = @import("partial.zig").Partial;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/invite#invite-metadata-object
|
/// https://discord.com/developers/docs/resources/invite#invite-metadata-object
|
||||||
pub const InviteMetadata = struct {
|
pub const InviteMetadata = struct {
|
||||||
/// The type of invite
|
/// The type of invite
|
||||||
type: InviteType,
|
type: InviteType,
|
||||||
/// The invite code (unique Id)
|
/// The invite code (unique Id)
|
||||||
code: []const u8,
|
code: []const u8,
|
||||||
/// The guild this invite is for
|
/// The guild this invite is for
|
||||||
guild: ?Partial(Guild),
|
guild: ?Partial(Guild) = null,
|
||||||
/// The channel this invite is for
|
/// The channel this invite is for
|
||||||
channel: ?Partial(Channel),
|
channel: ?Partial(Channel) = null,
|
||||||
/// The user who created the invite
|
/// The user who created the invite
|
||||||
inviter: ?User,
|
inviter: ?User = null,
|
||||||
/// The type of target for this voice channel invite
|
/// The type of target for this voice channel invite
|
||||||
target_type: ?TargetTypes,
|
target_type: ?TargetTypes = null,
|
||||||
/// The target user for this invite
|
/// The target user for this invite
|
||||||
target_user: ?User,
|
target_user: ?User = null,
|
||||||
/// The embedded application to open for this voice channel embedded application invite
|
/// The embedded application to open for this voice channel embedded application invite
|
||||||
target_application: ?Partial(Application),
|
target_application: ?Partial(Application) = null,
|
||||||
/// Approximate count of online members (only present when target_user is set)
|
/// Approximate count of online members (only present when target_user is set)
|
||||||
approximate_presence_count: ?isize,
|
approximate_presence_count: ?isize = null,
|
||||||
/// Approximate count of total members
|
/// Approximate count of total members
|
||||||
approximate_member_count: ?isize,
|
approximate_member_count: ?isize = null,
|
||||||
/// The expiration date of this invite, returned from the `GET /invites/<code>` endpoint when `with_expiration` is `true`
|
/// The expiration date of this invite, returned from the `GET /invites/<code>` endpoint when `with_expiration` is `true`
|
||||||
expires_at: ?[]const u8,
|
expires_at: ?[]const u8 = null,
|
||||||
/// Stage instance data if there is a public Stage instance in the Stage channel this invite is for
|
/// Stage instance data if there is a public Stage instance in the Stage channel this invite is for
|
||||||
stage_instance: ?InviteStageInstance,
|
stage_instance: ?InviteStageInstance = null,
|
||||||
/// guild scheduled event data
|
/// guild scheduled event data
|
||||||
guild_scheduled_event: ?ScheduledEvent,
|
guild_scheduled_event: ?ScheduledEvent = null,
|
||||||
/// isize of times this invite has been used
|
/// isize of times this invite has been used
|
||||||
uses: isize,
|
uses: isize,
|
||||||
/// Max isize of times this invite can be used
|
/// Max isize of times this invite can be used
|
||||||
max_uses: isize,
|
max_uses: isize,
|
||||||
/// Duration (in seconds) after which the invite expires
|
/// Duration (in seconds) after which the invite expires
|
||||||
max_age: isize,
|
max_age: isize,
|
||||||
/// Whether this invite only grants temporary membership
|
/// Whether this invite only grants temporary membership
|
||||||
temporary: bool,
|
temporary: bool,
|
||||||
/// When this invite was created
|
/// When this invite was created
|
||||||
created_at: []const u8,
|
created_at: []const u8,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/invite#invite-object
|
/// https://discord.com/developers/docs/resources/invite#invite-object
|
||||||
pub const Invite = struct {
|
pub const Invite = struct {
|
||||||
/// The type of invite
|
/// The type of invite
|
||||||
type: InviteType,
|
type: InviteType,
|
||||||
/// The invite code (unique Id)
|
/// The invite code (unique Id)
|
||||||
code: []const u8,
|
code: []const u8,
|
||||||
/// The guild this invite is for
|
/// The guild this invite is for
|
||||||
guild: ?Partial(Guild),
|
guild: ?Partial(Guild) = null,
|
||||||
/// The channel this invite is for
|
/// The channel this invite is for
|
||||||
channel: ?Partial(Channel),
|
channel: ?Partial(Channel) = null,
|
||||||
/// The user who created the invite
|
/// The user who created the invite
|
||||||
inviter: ?User,
|
inviter: ?User = null,
|
||||||
/// The type of target for this voice channel invite
|
/// The type of target for this voice channel invite
|
||||||
target_type: ?TargetTypes,
|
target_type: ?TargetTypes = null,
|
||||||
/// The target user for this invite
|
/// The target user for this invite
|
||||||
target_user: ?User,
|
target_user: ?User = null,
|
||||||
/// The embedded application to open for this voice channel embedded application invite
|
/// The embedded application to open for this voice channel embedded application invite
|
||||||
target_application: ?Partial(Application),
|
target_application: ?Partial(Application) = null,
|
||||||
/// Approximate count of online members (only present when target_user is set)
|
/// Approximate count of online members (only present when target_user is set)
|
||||||
approximate_presence_count: ?isize,
|
approximate_presence_count: ?isize = null,
|
||||||
/// Approximate count of total members
|
/// Approximate count of total members
|
||||||
approximate_member_count: ?isize,
|
approximate_member_count: ?isize = null,
|
||||||
/// The expiration date of this invite, returned from the `GET /invites/<code>` endpoint when `with_expiration` is `true`
|
/// The expiration date of this invite, returned from the `GET /invites/<code>` endpoint when `with_expiration` is `true`
|
||||||
expires_at: ?[]const u8,
|
expires_at: ?[]const u8 = null,
|
||||||
/// Stage instance data if there is a public Stage instance in the Stage channel this invite is for
|
/// Stage instance data if there is a public Stage instance in the Stage channel this invite is for
|
||||||
stage_instance: ?InviteStageInstance,
|
stage_instance: ?InviteStageInstance = null,
|
||||||
/// guild scheduled event data
|
/// guild scheduled event data
|
||||||
guild_scheduled_event: ?ScheduledEvent,
|
guild_scheduled_event: ?ScheduledEvent = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const InviteType = enum {
|
pub const InviteType = enum {
|
||||||
|
@ -1,111 +1,111 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const User = @import("user.zig").User;
|
const User = @import("user.zig").User;
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const AvatarDecorationData = @import("user.zig").AvatarDecorationData;
|
const AvatarDecorationData = @import("user.zig").AvatarDecorationData;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#guild-member-object
|
/// https://discord.com/developers/docs/resources/guild#guild-member-object
|
||||||
pub const Member = struct {
|
pub const Member = struct {
|
||||||
/// Whether the user is deafened in voice channels
|
/// Whether the user is deafened in voice channels
|
||||||
deaf: ?bool,
|
deaf: ?bool = null,
|
||||||
/// Whether the user is muted in voice channels
|
/// Whether the user is muted in voice channels
|
||||||
mute: ?bool,
|
mute: ?bool = null,
|
||||||
/// Whether the user has not yet passed the guild's Membership Screening requirements
|
/// Whether the user has not yet passed the guild's Membership Screening requirements
|
||||||
pending: ?bool,
|
pending: ?bool = null,
|
||||||
/// The user this guild member represents
|
/// The user this guild member represents
|
||||||
user: ?User,
|
user: ?User = null,
|
||||||
/// This users guild nickname
|
/// This users guild nickname
|
||||||
nick: ?[]const u8,
|
nick: ?[]const u8 = null,
|
||||||
/// The members custom avatar for this server.
|
/// The members custom avatar for this server.
|
||||||
avatar: ?[]const u8,
|
avatar: ?[]const u8 = null,
|
||||||
/// Array of role object ids
|
/// Array of role object ids
|
||||||
roles: [][]const u8,
|
roles: [][]const u8,
|
||||||
/// When the user joined the guild
|
/// When the user joined the guild
|
||||||
joined_at: []const u8,
|
joined_at: []const u8,
|
||||||
/// When the user started boosting the guild
|
/// When the user started boosting the guild
|
||||||
premium_since: ?[]const u8,
|
premium_since: ?[]const u8 = null,
|
||||||
/// The permissions this member has in the guild. Only present on interaction events and OAuth2 current member fetch.
|
/// The permissions this member has in the guild. Only present on interaction events and OAuth2 current member fetch.
|
||||||
permissions: ?[]const u8,
|
permissions: ?[]const u8 = null,
|
||||||
/// when the user's timeout will expire and the user will be able to communicate in the guild again (set null to remove timeout), null or a time in the past if the user is not timed out
|
/// when the user's timeout will expire and the user will be able to communicate in the guild again (set null to remove timeout), null or a time in the past if the user is not timed out
|
||||||
communication_disabled_until: ?[]const u8,
|
communication_disabled_until: ?[]const u8 = null,
|
||||||
/// Guild member flags
|
/// Guild member flags
|
||||||
flags: isize,
|
flags: isize,
|
||||||
/// data for the member's guild avatar decoration
|
/// data for the member's guild avatar decoration
|
||||||
avatar_decoration_data: ?AvatarDecorationData,
|
avatar_decoration_data: ?AvatarDecorationData = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// inherits
|
/// inherits
|
||||||
pub const MemberWithUser = struct {
|
pub const MemberWithUser = struct {
|
||||||
/// Whether the user is deafened in voice channels
|
/// Whether the user is deafened in voice channels
|
||||||
deaf: ?bool,
|
deaf: ?bool = null,
|
||||||
/// Whether the user is muted in voice channels
|
/// Whether the user is muted in voice channels
|
||||||
mute: ?bool,
|
mute: ?bool = null,
|
||||||
/// Whether the user has not yet passed the guild's Membership Screening requirements
|
/// Whether the user has not yet passed the guild's Membership Screening requirements
|
||||||
pending: ?bool,
|
pending: ?bool = null,
|
||||||
/// This users guild nickname
|
/// This users guild nickname
|
||||||
nick: ?[]const u8,
|
nick: ?[]const u8 = null,
|
||||||
/// The members custom avatar for this server.
|
/// The members custom avatar for this server.
|
||||||
avatar: ?[]const u8,
|
avatar: ?[]const u8 = null,
|
||||||
/// Array of role object ids
|
/// Array of role object ids
|
||||||
roles: [][]const u8,
|
roles: [][]const u8,
|
||||||
/// When the user joined the guild
|
/// When the user joined the guild
|
||||||
joined_at: []const u8,
|
joined_at: []const u8,
|
||||||
/// When the user started boosting the guild
|
/// When the user started boosting the guild
|
||||||
premium_since: ?[]const u8,
|
premium_since: ?[]const u8 = null,
|
||||||
/// The permissions this member has in the guild. Only present on interaction events and OAuth2 current member fetch.
|
/// The permissions this member has in the guild. Only present on interaction events and OAuth2 current member fetch.
|
||||||
permissions: ?[]const u8,
|
permissions: ?[]const u8 = null,
|
||||||
/// when the user's timeout will expire and the user will be able to communicate in the guild again (set null to remove timeout), null or a time in the past if the user is not timed out
|
/// when the user's timeout will expire and the user will be able to communicate in the guild again (set null to remove timeout), null or a time in the past if the user is not timed out
|
||||||
communication_disabled_until: ?[]const u8,
|
communication_disabled_until: ?[]const u8 = null,
|
||||||
/// Guild member flags
|
/// Guild member flags
|
||||||
flags: isize,
|
flags: isize,
|
||||||
/// data for the member's guild avatar decoration
|
/// data for the member's guild avatar decoration
|
||||||
avatar_decoration_data: ?AvatarDecorationData,
|
avatar_decoration_data: ?AvatarDecorationData = null,
|
||||||
/// The user object for this member
|
/// The user object for this member
|
||||||
user: User,
|
user: User,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#add-guild-member-json-params
|
/// https://discord.com/developers/docs/resources/guild#add-guild-member-json-params
|
||||||
pub const AddGuildMember = struct {
|
pub const AddGuildMember = struct {
|
||||||
/// access token of a user that has granted your app the `guilds.join` scope
|
/// access token of a user that has granted your app the `guilds.join` scope
|
||||||
access_token: []const u8,
|
access_token: []const u8,
|
||||||
/// Value to set user's nickname to. Requires MANAGE_NICKNAMES permission on the bot
|
/// Value to set user's nickname to. Requires MANAGE_NICKNAMES permission on the bot
|
||||||
nick: ?[]const u8,
|
nick: ?[]const u8 = null,
|
||||||
/// Array of role ids the member is assigned. Requires MANAGE_ROLES permission on the bot
|
/// Array of role ids the member is assigned. Requires MANAGE_ROLES permission on the bot
|
||||||
roles: ?[][]const u8,
|
roles: ?[][]const u8 = null,
|
||||||
/// Whether the user is muted in voice channels. Requires MUTE_MEMBERS permission on the bot
|
/// Whether the user is muted in voice channels. Requires MUTE_MEMBERS permission on the bot
|
||||||
mute: ?bool,
|
mute: ?bool = null,
|
||||||
/// Whether the user is deafened in voice channels. Requires DEAFEN_MEMBERS permission on the bot
|
/// Whether the user is deafened in voice channels. Requires DEAFEN_MEMBERS permission on the bot
|
||||||
deaf: ?bool,
|
deaf: ?bool = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#modify-guild-member
|
/// https://discord.com/developers/docs/resources/guild#modify-guild-member
|
||||||
pub const ModifyGuildMember = struct {
|
pub const ModifyGuildMember = struct {
|
||||||
/// Value to set users nickname to. Requires the `MANAGE_NICKNAMES` permission
|
/// Value to set users nickname to. Requires the `MANAGE_NICKNAMES` permission
|
||||||
nick: ?[]const u8,
|
nick: ?[]const u8 = null,
|
||||||
/// Array of role ids the member is assigned. Requires the `MANAGE_ROLES` permission
|
/// Array of role ids the member is assigned. Requires the `MANAGE_ROLES` permission
|
||||||
roles: ?Snowflake,
|
roles: ?Snowflake = null,
|
||||||
/// Whether the user is muted in voice channels. Will throw a 400 if the user is not in a voice channel. Requires the `MUTE_MEMBERS` permission
|
/// Whether the user is muted in voice channels. Will throw a 400 if the user is not in a voice channel. Requires the `MUTE_MEMBERS` permission
|
||||||
mute: ?bool,
|
mute: ?bool = null,
|
||||||
/// Whether the user is deafened in voice channels. Will throw a 400 if the user is not in a voice channel. Requires the `MOVE_MEMBERS` permission
|
/// Whether the user is deafened in voice channels. Will throw a 400 if the user is not in a voice channel. Requires the `MOVE_MEMBERS` permission
|
||||||
deaf: ?bool,
|
deaf: ?bool = null,
|
||||||
/// Id of channel to move user to (if they are connected to voice). Requires the `MOVE_MEMBERS` permission
|
/// Id of channel to move user to (if they are connected to voice). Requires the `MOVE_MEMBERS` permission
|
||||||
channel_id: ?Snowflake,
|
channel_id: ?Snowflake = null,
|
||||||
/// When the user's timeout will expire and the user will be able to communicate in the guild again (up to 28 days in the future), set to null to remove timeout. Requires the `MODERATE_MEMBERS` permission. The date must be given in a ISO string form.
|
/// When the user's timeout will expire and the user will be able to communicate in the guild again (up to 28 days in the future), set to null to remove timeout. Requires the `MODERATE_MEMBERS` permission. The date must be given in a ISO string form.
|
||||||
communication_disabled_until: ?[]const u8,
|
communication_disabled_until: ?[]const u8 = null,
|
||||||
/// Set the flags for the guild member. Requires the `MANAGE_GUILD` or `MANAGE_ROLES` or the combination of `MODERATE_MEMBERS` and `KICK_MEMBERS` and `BAN_MEMBERS`
|
/// Set the flags for the guild member. Requires the `MANAGE_GUILD` or `MANAGE_ROLES` or the combination of `MODERATE_MEMBERS` and `KICK_MEMBERS` and `BAN_MEMBERS`
|
||||||
flags: ?isize,
|
flags: ?isize = null,
|
||||||
};
|
};
|
||||||
|
@ -1,328 +1,328 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const User = @import("user.zig").User;
|
const User = @import("user.zig").User;
|
||||||
const Member = @import("member.zig").Member;
|
const Member = @import("member.zig").Member;
|
||||||
const Attachment = @import("attachment.zig").Attachment;
|
const Attachment = @import("attachment.zig").Attachment;
|
||||||
const Application = @import("application.zig").Application;
|
const Application = @import("application.zig").Application;
|
||||||
const Embed = @import("embed.zig").Embed;
|
const Embed = @import("embed.zig").Embed;
|
||||||
const AllowedMentionTypes = @import("shared.zig").AllowedMentionsTypes;
|
const AllowedMentionTypes = @import("shared.zig").AllowedMentionsTypes;
|
||||||
const PremiumTypes = @import("shared.zig").PremiumTypes;
|
const PremiumTypes = @import("shared.zig").PremiumTypes;
|
||||||
const InteractionTypes = @import("shared.zig").InteractionTypes;
|
const InteractionTypes = @import("shared.zig").InteractionTypes;
|
||||||
const MessageTypes = @import("shared.zig").MessageTypes;
|
const MessageTypes = @import("shared.zig").MessageTypes;
|
||||||
const Sticker = @import("sticker.zig").Sticker;
|
const Sticker = @import("sticker.zig").Sticker;
|
||||||
const StickerItem = @import("sticker.zig").StickerItem;
|
const StickerItem = @import("sticker.zig").StickerItem;
|
||||||
const StickerPath = @import("sticker.zig").StickerPack;
|
const StickerPath = @import("sticker.zig").StickerPack;
|
||||||
const MessageFlags = @import("shared.zig").MessageFlags;
|
const MessageFlags = @import("shared.zig").MessageFlags;
|
||||||
const Emoji = @import("emoji.zig").Emoji;
|
const Emoji = @import("emoji.zig").Emoji;
|
||||||
const Poll = @import("poll.zig").Poll;
|
const Poll = @import("poll.zig").Poll;
|
||||||
const AvatarDecorationData = @import("user.zig").AvatarDecorationData;
|
const AvatarDecorationData = @import("user.zig").AvatarDecorationData;
|
||||||
const MessageActivityTypes = @import("shared.zig").MessageActivityTypes;
|
const MessageActivityTypes = @import("shared.zig").MessageActivityTypes;
|
||||||
const Partial = @import("partial.zig").Partial;
|
const Partial = @import("partial.zig").Partial;
|
||||||
const MessageComponent = @import("component.zig").MessageComponent;
|
const MessageComponent = @import("component.zig").MessageComponent;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#message-object
|
|
||||||
pub const Message = struct {
|
|
||||||
/// id of the message
|
|
||||||
id: Snowflake,
|
|
||||||
/// id of the channel the message was sent in
|
|
||||||
channel_id: Snowflake,
|
|
||||||
///
|
|
||||||
/// id of the guild the message was sent in
|
|
||||||
/// Note: For MESSAGE_CREATE and MESSAGE_UPDATE events, the message object may not contain a guild_id or member field since the events are sent directly to the receiving user and the bot who sent the message, rather than being sent through the guild like non-ephemeral messages.,
|
|
||||||
///
|
|
||||||
guild_id: ?Snowflake,
|
|
||||||
///
|
|
||||||
/// The author of this message (not guaranteed to be a valid user)
|
|
||||||
/// Note: The author object follows the structure of the user object, but is only a valid user in the case where the message is generated by a user or bot user. If the message is generated by a webhook, the author object corresponds to the webhook's id, username, and avatar. You can tell if a message is generated by a webhook by checking for the webhook_id on the message object.,
|
|
||||||
///
|
|
||||||
author: User,
|
|
||||||
///
|
|
||||||
/// Member properties for this message's author
|
|
||||||
/// Note: The member object exists in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events from text-based guild channels. This allows bots to obtain real-time member data without requiring bots to store member state in memory.,
|
|
||||||
///
|
|
||||||
member: ?Member,
|
|
||||||
/// Contents of the message
|
|
||||||
content: ?[]const u8,
|
|
||||||
/// When this message was sent
|
|
||||||
timestamp: []const u8,
|
|
||||||
/// When this message was edited (or null if never)
|
|
||||||
edited_timestamp: ?[]const u8,
|
|
||||||
/// Whether this was a TTS message
|
|
||||||
tts: bool,
|
|
||||||
/// Whether this message mentions everyone
|
|
||||||
mention_everyone: bool,
|
|
||||||
///
|
|
||||||
/// Users specifically mentioned in the message
|
|
||||||
/// Note: The user objects in the mentions array will only have the partial member field present in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events from text-based guild channels.,
|
|
||||||
///
|
|
||||||
mentions: []User,
|
|
||||||
/// Roles specifically mentioned in this message
|
|
||||||
mention_roles: ?[][]const u8,
|
|
||||||
///
|
|
||||||
/// Channels specifically mentioned in this message
|
|
||||||
/// Note: Not all channel mentions in a message will appear in `mention_channels`. Only textual channels that are visible to everyone in a discoverable guild will ever be included. Only crossposted messages (via Channel Following) currently include `mention_channels` at all. If no mentions in the message meet these requirements, this field will not be sent.,
|
|
||||||
///
|
|
||||||
mention_channels: ?[]ChannelMention,
|
|
||||||
/// Any attached files
|
|
||||||
attachments: []Attachment,
|
|
||||||
/// Any embedded content
|
|
||||||
embeds: []Embed,
|
|
||||||
/// Reactions to the message
|
|
||||||
reactions: ?[]Reaction,
|
|
||||||
// Used for validating a message was sent
|
|
||||||
//nonce: ?union(enum) {int: isize,string: []const u8,},
|
|
||||||
/// Whether this message is pinned
|
|
||||||
pinned: bool,
|
|
||||||
/// If the message is generated by a webhook, this is the webhook's id
|
|
||||||
webhook_id: ?Snowflake,
|
|
||||||
/// Type of message
|
|
||||||
type: MessageTypes,
|
|
||||||
/// Sent with Rich Presence-related chat embeds
|
|
||||||
activity: ?MessageActivity,
|
|
||||||
/// Sent with Rich Presence-related chat embeds
|
|
||||||
application: ?Partial(Application),
|
|
||||||
/// if the message is an Interaction or application-owned webhook, this is the id of the application
|
|
||||||
application_id: ?Snowflake,
|
|
||||||
// Data showing the source of a crosspost, channel follow add, pin, or reply message
|
|
||||||
// message_reference: ?Omit(MessageReference, .{"failIfNotExists"}),
|
|
||||||
/// Message flags combined as a bitfield
|
|
||||||
flags: ?MessageFlags,
|
|
||||||
///
|
|
||||||
/// The stickers sent with the message (bots currently can only receive messages with stickers, not send)
|
|
||||||
/// @deprecated
|
|
||||||
///
|
|
||||||
stickers: ?[]Sticker,
|
|
||||||
///
|
|
||||||
/// The message associated with the `message_reference`
|
|
||||||
/// Note: This field is only returned for messages with a `type` of `19` (REPLY). If the message is a reply but the `referenced_message` field is not present, the backend did not attempt to fetch the message that was being replied to, so its state is unknown. If the field exists but is null, the referenced message was deleted.,
|
|
||||||
/// TAKES A POINTER
|
|
||||||
referenced_message: ?*Message,
|
|
||||||
/// The message associated with the `message_reference`. This is a minimal subset of fields in a message (e.g. `author` is excluded.)
|
|
||||||
message_snapshots: ?[]MessageSnapshot,
|
|
||||||
/// sent if the message is sent as a result of an interaction
|
|
||||||
interaction_metadata: ?MessageInteractionMetadata,
|
|
||||||
///
|
|
||||||
/// Sent if the message is a response to an Interaction
|
|
||||||
///
|
|
||||||
/// @deprecated Deprecated in favor of {@link interaction_metadata};
|
|
||||||
///
|
|
||||||
interaction: ?MessageInteraction,
|
|
||||||
// The thread that was started from this message, includes thread member object
|
|
||||||
// thread: ?Omit(Channel, .{"member"}), //& { member: ThreadMember };,
|
|
||||||
/// The components related to this message
|
|
||||||
components: ?[]MessageComponent,
|
|
||||||
/// Sent if the message contains stickers
|
|
||||||
sticker_items: ?[]StickerItem,
|
|
||||||
/// A generally increasing integer (there may be gaps or duplicates) that represents the approximate position of the message in a thread, it can be used to estimate the relative position of the message in a thread in company with `total_message_sent` on parent thread
|
|
||||||
position: ?isize,
|
|
||||||
/// The poll object
|
|
||||||
poll: ?Poll,
|
|
||||||
/// The call associated with the message
|
|
||||||
call: ?MessageCall,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#message-call-object
|
|
||||||
pub const MessageCall = struct {
|
|
||||||
/// Array of user object ids that participated in the call
|
|
||||||
participants: [][]const u8,
|
|
||||||
/// Time when call ended
|
|
||||||
ended_timestamp: []const u8,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#channel-mention-object
|
|
||||||
pub const ChannelMention = struct {
|
|
||||||
/// id of the channel
|
|
||||||
id: Snowflake,
|
|
||||||
/// id of the guild containing the channel
|
|
||||||
guild_id: Snowflake,
|
|
||||||
/// The type of channel
|
|
||||||
type: isize,
|
|
||||||
/// The name of the channel
|
|
||||||
name: []const u8,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#reaction-object
|
|
||||||
pub const Reaction = struct {
|
|
||||||
/// Total isize of times this emoji has been used to react (including super reacts)
|
|
||||||
count: isize,
|
|
||||||
///
|
|
||||||
count_details: ReactionCountDetails,
|
|
||||||
/// Whether the current user reacted using this emoji
|
|
||||||
me: bool,
|
|
||||||
///
|
|
||||||
me_burst: bool,
|
|
||||||
/// Emoji information
|
|
||||||
emoji: Partial(Emoji),
|
|
||||||
/// HEX colors used for super reaction
|
|
||||||
burst_colors: [][]const u8,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#get-reactions-reaction-types
|
|
||||||
pub const ReactionType = enum {
|
|
||||||
Normal,
|
|
||||||
Burst,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#reaction-count-details-object
|
|
||||||
pub const ReactionCountDetails = struct {
|
|
||||||
/// Count of super reactions
|
|
||||||
burst: isize,
|
|
||||||
///
|
|
||||||
normal: isize,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure
|
|
||||||
pub const MessageActivity = struct {
|
|
||||||
/// Type of message activity
|
|
||||||
type: MessageActivityTypes,
|
|
||||||
/// `party_id` from a Rich Presence event
|
|
||||||
party_id: ?Snowflake,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
|
|
||||||
pub const MessageReference = struct {
|
|
||||||
/// Type of reference
|
|
||||||
type: ?MessageReferenceType,
|
|
||||||
/// id of the originating message
|
|
||||||
message_id: ?Snowflake,
|
|
||||||
///
|
|
||||||
/// id of the originating message's channel
|
|
||||||
/// Note: `channel_id` is optional when creating a reply, but will always be present when receiving an event/response that includes this data model.,
|
|
||||||
///
|
|
||||||
channel_id: ?Snowflake,
|
|
||||||
/// id of the originating message's guild
|
|
||||||
guild_id: ?Snowflake,
|
|
||||||
/// When sending, whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message, default true
|
|
||||||
fail_if_not_exists: bool,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#message-reference-object-message-reference-types
|
|
||||||
pub const MessageReferenceType = enum {
|
|
||||||
///
|
|
||||||
/// A standard reference used by replies.
|
|
||||||
///
|
|
||||||
/// @remarks
|
|
||||||
/// When the type is set to this value, the field referenced_message on the message will be present
|
|
||||||
///
|
|
||||||
Default,
|
|
||||||
///
|
|
||||||
/// Reference used to point to a message at a point in time.
|
|
||||||
///
|
|
||||||
/// @remarks
|
|
||||||
/// When the type is set to this value, the field message_snapshot on the message will be present
|
|
||||||
///
|
|
||||||
/// This value can only be used for basic messages;
|
|
||||||
/// i.e. messages which do not have strong bindings to a non global entity.
|
|
||||||
/// Thus we support only messages with `DEFAULT` or `REPLY` types, but disallowed if there are any polls, calls, or components.
|
|
||||||
///
|
|
||||||
Forward,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#message-snapshot-object-message-snapshot-structure
|
|
||||||
pub const MessageSnapshot = struct {
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#message-object
|
/// https://discord.com/developers/docs/resources/channel#message-object
|
||||||
/// Minimal subset of fields in the forwarded message
|
pub const Message = struct {
|
||||||
message: struct {
|
/// id of the message
|
||||||
content: ?[]const u8,
|
id: Snowflake,
|
||||||
|
/// id of the channel the message was sent in
|
||||||
|
channel_id: Snowflake,
|
||||||
|
///
|
||||||
|
/// id of the guild the message was sent in
|
||||||
|
/// Note: For MESSAGE_CREATE and MESSAGE_UPDATE events, the message object may not contain a guild_id or member field since the events are sent directly to the receiving user and the bot who sent the message, rather than being sent through the guild like non-ephemeral messages.,
|
||||||
|
///
|
||||||
|
guild_id: ?Snowflake = null,
|
||||||
|
///
|
||||||
|
/// The author of this message (not guaranteed to be a valid user)
|
||||||
|
/// Note: The author object follows the structure of the user object, but is only a valid user in the case where the message is generated by a user or bot user. If the message is generated by a webhook, the author object corresponds to the webhook's id, username, and avatar. You can tell if a message is generated by a webhook by checking for the webhook_id on the message object.,
|
||||||
|
///
|
||||||
|
author: User,
|
||||||
|
///
|
||||||
|
/// Member properties for this message's author
|
||||||
|
/// Note: The member object exists in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events from text-based guild channels. This allows bots to obtain real-time member data without requiring bots to store member state in memory.,
|
||||||
|
///
|
||||||
|
member: ?Member = null,
|
||||||
|
/// Contents of the message
|
||||||
|
content: ?[]const u8 = null,
|
||||||
|
/// When this message was sent
|
||||||
timestamp: []const u8,
|
timestamp: []const u8,
|
||||||
edited_timestamp: ?[]const u8,
|
/// When this message was edited (or null if never)
|
||||||
mentions: []struct {
|
edited_timestamp: ?[]const u8 = null,
|
||||||
username: []const u8,
|
/// Whether this was a TTS message
|
||||||
global_name: ?[]const u8,
|
tts: bool,
|
||||||
locale: ?[]const u8,
|
/// Whether this message mentions everyone
|
||||||
flags: ?isize,
|
mention_everyone: bool,
|
||||||
premium_type: ?PremiumTypes,
|
///
|
||||||
public_flags: ?isize,
|
/// Users specifically mentioned in the message
|
||||||
accent_color: ?isize,
|
/// Note: The user objects in the mentions array will only have the partial member field present in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events from text-based guild channels.,
|
||||||
id: Snowflake,
|
///
|
||||||
discriminator: []const u8,
|
mentions: []User,
|
||||||
avatar: ?[]const u8,
|
/// Roles specifically mentioned in this message
|
||||||
bot: ?bool,
|
mention_roles: ?[][]const u8 = null,
|
||||||
system: ?bool,
|
///
|
||||||
mfa_enabled: ?bool,
|
/// Channels specifically mentioned in this message
|
||||||
verified: ?bool,
|
/// Note: Not all channel mentions in a message will appear in `mention_channels`. Only textual channels that are visible to everyone in a discoverable guild will ever be included. Only crossposted messages (via Channel Following) currently include `mention_channels` at all. If no mentions in the message meet these requirements, this field will not be sent.,
|
||||||
email: ?[]const u8,
|
///
|
||||||
banner: ?[]const u8,
|
mention_channels: ?[]ChannelMention = null,
|
||||||
avatar_decoration_data: ?AvatarDecorationData,
|
/// Any attached files
|
||||||
member: ?Partial(Member),
|
|
||||||
},
|
|
||||||
mention_roles: ?[][]const u8,
|
|
||||||
type: MessageTypes,
|
|
||||||
flags: ?MessageFlags,
|
|
||||||
stickers: ?[]Sticker,
|
|
||||||
components: ?[]MessageComponent,
|
|
||||||
sticker_items: ?[]StickerItem,
|
|
||||||
attachments: []Attachment,
|
attachments: []Attachment,
|
||||||
|
/// Any embedded content
|
||||||
embeds: []Embed,
|
embeds: []Embed,
|
||||||
},
|
/// Reactions to the message
|
||||||
};
|
reactions: ?[]Reaction = null,
|
||||||
|
// Used for validating a message was sent
|
||||||
|
// nonce: ?union(enum) {int: isize,string: []const u8,} = null,
|
||||||
|
/// Whether this message is pinned
|
||||||
|
pinned: bool,
|
||||||
|
/// If the message is generated by a webhook, this is the webhook's id
|
||||||
|
webhook_id: ?Snowflake = null,
|
||||||
|
/// Type of message
|
||||||
|
type: MessageTypes,
|
||||||
|
/// Sent with Rich Presence-related chat embeds
|
||||||
|
activity: ?MessageActivity = null,
|
||||||
|
/// Sent with Rich Presence-related chat embeds
|
||||||
|
application: ?Partial(Application) = null,
|
||||||
|
/// if the message is an Interaction or application-owned webhook, this is the id of the application
|
||||||
|
application_id: ?Snowflake = null,
|
||||||
|
// Data showing the source of a crosspost, channel follow add, pin, or reply message
|
||||||
|
// message_reference: ?Omit(MessageReference, .{"failIfNotExists"}) = null,
|
||||||
|
/// Message flags combined as a bitfield
|
||||||
|
flags: ?MessageFlags = null,
|
||||||
|
///
|
||||||
|
/// The stickers sent with the message (bots currently can only receive messages with stickers, not send)
|
||||||
|
/// @deprecated
|
||||||
|
///
|
||||||
|
stickers: ?[]Sticker = null,
|
||||||
|
///
|
||||||
|
/// The message associated with the `message_reference`
|
||||||
|
/// Note: This field is only returned for messages with a `type` of `19` (REPLY). If the message is a reply but the `referenced_message` field is not present, the backend did not attempt to fetch the message that was being replied to, so its state is unknown. If the field exists but is null, the referenced message was deleted.,
|
||||||
|
/// TAKES A POINTER
|
||||||
|
referenced_message: ?*Message = null,
|
||||||
|
/// The message associated with the `message_reference`. This is a minimal subset of fields in a message (e.g. `author` is excluded.)
|
||||||
|
message_snapshots: ?[]MessageSnapshot = null,
|
||||||
|
/// sent if the message is sent as a result of an interaction
|
||||||
|
interaction_metadata: ?MessageInteractionMetadata = null,
|
||||||
|
///
|
||||||
|
/// Sent if the message is a response to an Interaction
|
||||||
|
///
|
||||||
|
/// @deprecated Deprecated in favor of {@link interaction_metadata};
|
||||||
|
///
|
||||||
|
interaction: ?MessageInteraction = null,
|
||||||
|
// The thread that was started from this message, includes thread member object
|
||||||
|
// thread: ?Omit(Channel, .{"member"}), //& { member: ThreadMember }; = null,
|
||||||
|
/// The components related to this message
|
||||||
|
components: ?[]MessageComponent = null,
|
||||||
|
/// Sent if the message contains stickers
|
||||||
|
sticker_items: ?[]StickerItem = null,
|
||||||
|
/// A generally increasing integer (there may be gaps or duplicates) that represents the approximate position of the message in a thread, it can be used to estimate the relative position of the message in a thread in company with `total_message_sent` on parent thread
|
||||||
|
position: ?isize = null,
|
||||||
|
/// The poll object
|
||||||
|
poll: ?Poll = null,
|
||||||
|
/// The call associated with the message
|
||||||
|
call: ?MessageCall = null,
|
||||||
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object-message-interaction-structure
|
/// https://discord.com/developers/docs/resources/channel#message-call-object
|
||||||
pub const MessageInteraction = struct {
|
pub const MessageCall = struct {
|
||||||
/// Id of the interaction
|
/// Array of user object ids that participated in the call
|
||||||
id: Snowflake,
|
participants: [][]const u8,
|
||||||
/// The type of interaction
|
/// Time when call ended
|
||||||
type: InteractionTypes,
|
ended_timestamp: []const u8,
|
||||||
/// The name of the ApplicationCommand including the name of the subcommand/subcommand group
|
};
|
||||||
name: []const u8,
|
|
||||||
/// The user who invoked the interaction
|
|
||||||
user: User,
|
|
||||||
/// The member who invoked the interaction in the guild
|
|
||||||
member: ?Partial(Member),
|
|
||||||
};
|
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#message-interaction-metadata-object-message-interaction-metadata-structure
|
/// https://discord.com/developers/docs/resources/channel#channel-mention-object
|
||||||
pub const MessageInteractionMetadata = struct {
|
pub const ChannelMention = struct {
|
||||||
/// Id of the interaction
|
/// id of the channel
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// The type of interaction
|
/// id of the guild containing the channel
|
||||||
type: InteractionTypes,
|
guild_id: Snowflake,
|
||||||
/// User who triggered the interaction
|
/// The type of channel
|
||||||
user: User,
|
type: isize,
|
||||||
// IDs for installation context(s) related to an interaction
|
/// The name of the channel
|
||||||
// authorizing_integration_owners: Partial(AutoArrayHashMap(ApplicationIntegrationType, []const u8)),
|
name: []const u8,
|
||||||
/// ID of the original response message, present only on follow-up messages
|
};
|
||||||
original_response_message_id: ?Snowflake,
|
|
||||||
/// ID of the message that contained interactive component, present only on messages created from component interactions
|
|
||||||
interacted_message_id: ?Snowflake,
|
|
||||||
/// Metadata for the interaction that was used to open the modal, present only on modal submit interactions
|
|
||||||
/// TAKES A POINTER
|
|
||||||
triggering_interaction_metadata: ?*MessageInteractionMetadata,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub const AllowedMentions = struct {
|
/// https://discord.com/developers/docs/resources/channel#reaction-object
|
||||||
/// An array of allowed mention types to parse from the content.
|
pub const Reaction = struct {
|
||||||
parse: []AllowedMentionTypes,
|
/// Total isize of times this emoji has been used to react (including super reacts)
|
||||||
/// Array of role_ids to mention (Max size of 100)
|
count: isize,
|
||||||
roles: []Snowflake,
|
///
|
||||||
/// Array of user_ids to mention (Max size of 100)
|
count_details: ReactionCountDetails,
|
||||||
users: []Snowflake,
|
/// Whether the current user reacted using this emoji
|
||||||
/// For replies, whether to mention the author of the message being replied to (default false)
|
me: bool,
|
||||||
replied_user: ?bool,
|
///
|
||||||
};
|
me_burst: bool,
|
||||||
|
/// Emoji information
|
||||||
|
emoji: Partial(Emoji),
|
||||||
|
/// HEX colors used for super reaction
|
||||||
|
burst_colors: [][]const u8,
|
||||||
|
};
|
||||||
|
|
||||||
pub const GetMessagesQuery = struct {
|
/// https://discord.com/developers/docs/resources/channel#get-reactions-reaction-types
|
||||||
/// Get messages around this message ID,
|
pub const ReactionType = enum {
|
||||||
around: ?Snowflake,
|
Normal,
|
||||||
/// Get messages before this message ID
|
Burst,
|
||||||
before: ?Snowflake,
|
};
|
||||||
/// Get messages after this message ID
|
|
||||||
after: ?Snowflake,
|
/// https://discord.com/developers/docs/resources/channel#reaction-count-details-object
|
||||||
/// Max number of messages to return (1-100),
|
pub const ReactionCountDetails = struct {
|
||||||
limit: ?usize = 50,
|
/// Count of super reactions
|
||||||
|
burst: isize,
|
||||||
|
///
|
||||||
|
normal: isize,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure
|
||||||
|
pub const MessageActivity = struct {
|
||||||
|
/// Type of message activity
|
||||||
|
type: MessageActivityTypes,
|
||||||
|
/// `party_id` from a Rich Presence event
|
||||||
|
party_id: ?Snowflake = null,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
|
||||||
|
pub const MessageReference = struct {
|
||||||
|
/// Type of reference
|
||||||
|
type: ?MessageReferenceType = null,
|
||||||
|
/// id of the originating message
|
||||||
|
message_id: ?Snowflake = null,
|
||||||
|
///
|
||||||
|
/// id of the originating message's channel
|
||||||
|
/// Note: `channel_id` is optional when creating a reply, but will always be present when receiving an event/response that includes this data model.,
|
||||||
|
///
|
||||||
|
channel_id: ?Snowflake = null,
|
||||||
|
/// id of the originating message's guild
|
||||||
|
guild_id: ?Snowflake = null,
|
||||||
|
/// When sending, whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message, default true
|
||||||
|
fail_if_not_exists: bool,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// https://discord.com/developers/docs/resources/channel#message-reference-object-message-reference-types
|
||||||
|
pub const MessageReferenceType = enum {
|
||||||
|
///
|
||||||
|
/// A standard reference used by replies.
|
||||||
|
///
|
||||||
|
/// @remarks
|
||||||
|
/// When the type is set to this value, the field referenced_message on the message will be present
|
||||||
|
///
|
||||||
|
Default,
|
||||||
|
///
|
||||||
|
/// Reference used to point to a message at a point in time.
|
||||||
|
///
|
||||||
|
/// @remarks
|
||||||
|
/// When the type is set to this value, the field message_snapshot on the message will be present
|
||||||
|
///
|
||||||
|
/// This value can only be used for basic messages;
|
||||||
|
/// i.e. messages which do not have strong bindings to a non global entity.
|
||||||
|
/// Thus we support only messages with `DEFAULT` or `REPLY` types, but disallowed if there are any polls, calls, or components.
|
||||||
|
///
|
||||||
|
Forward,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// https://discord.com/developers/docs/resources/channel#message-snapshot-object-message-snapshot-structure
|
||||||
|
pub const MessageSnapshot = struct {
|
||||||
|
/// https://discord.com/developers/docs/resources/channel#message-object
|
||||||
|
/// Minimal subset of fields in the forwarded message
|
||||||
|
message: struct {
|
||||||
|
content: ?[]const u8 = null,
|
||||||
|
timestamp: []const u8,
|
||||||
|
edited_timestamp: ?[]const u8 = null,
|
||||||
|
mentions: []struct {
|
||||||
|
username: []const u8,
|
||||||
|
global_name: ?[]const u8 = null,
|
||||||
|
locale: ?[]const u8 = null,
|
||||||
|
flags: ?isize = null,
|
||||||
|
premium_type: ?PremiumTypes = null,
|
||||||
|
public_flags: ?isize = null,
|
||||||
|
accent_color: ?isize = null,
|
||||||
|
id: Snowflake,
|
||||||
|
discriminator: []const u8,
|
||||||
|
avatar: ?[]const u8 = null,
|
||||||
|
bot: ?bool = null,
|
||||||
|
system: ?bool = null,
|
||||||
|
mfa_enabled: ?bool = null,
|
||||||
|
verified: ?bool = null,
|
||||||
|
email: ?[]const u8 = null,
|
||||||
|
banner: ?[]const u8 = null,
|
||||||
|
avatar_decoration_data: ?AvatarDecorationData = null,
|
||||||
|
member: ?Partial(Member) = null,
|
||||||
|
},
|
||||||
|
mention_roles: ?[][]const u8 = null,
|
||||||
|
type: MessageTypes,
|
||||||
|
flags: ?MessageFlags = null,
|
||||||
|
stickers: ?[]Sticker = null,
|
||||||
|
components: ?[]MessageComponent = null,
|
||||||
|
sticker_items: ?[]StickerItem = null,
|
||||||
|
attachments: []Attachment,
|
||||||
|
embeds: []Embed,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/// https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object-message-interaction-structure
|
||||||
|
pub const MessageInteraction = struct {
|
||||||
|
/// Id of the interaction
|
||||||
|
id: Snowflake,
|
||||||
|
/// The type of interaction
|
||||||
|
type: InteractionTypes,
|
||||||
|
/// The name of the ApplicationCommand including the name of the subcommand/subcommand group
|
||||||
|
name: []const u8,
|
||||||
|
/// The user who invoked the interaction
|
||||||
|
user: User,
|
||||||
|
/// The member who invoked the interaction in the guild
|
||||||
|
member: ?Partial(Member) = null,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// https://discord.com/developers/docs/resources/channel#message-interaction-metadata-object-message-interaction-metadata-structure
|
||||||
|
pub const MessageInteractionMetadata = struct {
|
||||||
|
/// Id of the interaction
|
||||||
|
id: Snowflake,
|
||||||
|
/// The type of interaction
|
||||||
|
type: InteractionTypes,
|
||||||
|
/// User who triggered the interaction
|
||||||
|
user: User,
|
||||||
|
// IDs for installation context(s) related to an interaction
|
||||||
|
// authorizing_integration_owners: Partial(AutoArrayHashMap(ApplicationIntegrationType, []const u8)),
|
||||||
|
/// ID of the original response message, present only on follow-up messages
|
||||||
|
original_response_message_id: ?Snowflake = null,
|
||||||
|
/// ID of the message that contained interactive component, present only on messages created from component interactions
|
||||||
|
interacted_message_id: ?Snowflake = null,
|
||||||
|
/// Metadata for the interaction that was used to open the modal, present only on modal submit interactions
|
||||||
|
/// TAKES A POINTER
|
||||||
|
triggering_interaction_metadata: ?*MessageInteractionMetadata = null,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const AllowedMentions = struct {
|
||||||
|
/// An array of allowed mention types to parse from the content.
|
||||||
|
parse: []AllowedMentionTypes,
|
||||||
|
/// Array of role_ids to mention (Max size of 100)
|
||||||
|
roles: []Snowflake,
|
||||||
|
/// Array of user_ids to mention (Max size of 100)
|
||||||
|
users: []Snowflake,
|
||||||
|
/// For replies, whether to mention the author of the message being replied to (default false)
|
||||||
|
replied_user: ?bool = null,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const GetMessagesQuery = struct {
|
||||||
|
/// Get messages around this message ID,
|
||||||
|
around: ?Snowflake = null,
|
||||||
|
/// Get messages before this message ID
|
||||||
|
before: ?Snowflake = null,
|
||||||
|
/// Get messages after this message ID
|
||||||
|
after: ?Snowflake = null,
|
||||||
|
/// Max number of messages to return (1-100),
|
||||||
|
limit: ?usize = null,
|
||||||
};
|
};
|
||||||
|
@ -1,44 +1,44 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const SkuFlags = @import("shared.zig").SkuFlags;
|
const SkuFlags = @import("shared.zig").SkuFlags;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/monetization/entitlements#entitlement-object-entitlement-structure
|
/// https://discord.com/developers/docs/monetization/entitlements#entitlement-object-entitlement-structure
|
||||||
pub const Entitlement = struct {
|
pub const Entitlement = struct {
|
||||||
/// ID of the entitlement
|
/// ID of the entitlement
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// ID of the SKU
|
/// ID of the SKU
|
||||||
sku_id: Snowflake,
|
sku_id: Snowflake,
|
||||||
/// ID of the user that is granted access to the entitlement's sku
|
/// ID of the user that is granted access to the entitlement's sku
|
||||||
user_id: ?Snowflake,
|
user_id: ?Snowflake = null,
|
||||||
/// ID of the guild that is granted access to the entitlement's sku
|
/// ID of the guild that is granted access to the entitlement's sku
|
||||||
guild_id: ?Snowflake,
|
guild_id: ?Snowflake = null,
|
||||||
/// ID of the parent application
|
/// ID of the parent application
|
||||||
application_id: Snowflake,
|
application_id: Snowflake,
|
||||||
/// Type of entitlement
|
/// Type of entitlement
|
||||||
type: EntitlementType,
|
type: EntitlementType,
|
||||||
/// Entitlement was deleted
|
/// Entitlement was deleted
|
||||||
deleted: bool,
|
deleted: bool,
|
||||||
/// Start date at which the entitlement is valid. Not present when using test entitlements
|
/// Start date at which the entitlement is valid. Not present when using test entitlements
|
||||||
starts_at: ?[]const u8,
|
starts_at: ?[]const u8 = null,
|
||||||
/// Date at which the entitlement is no longer valid. Not present when using test entitlements
|
/// Date at which the entitlement is no longer valid. Not present when using test entitlements
|
||||||
ends_at: ?[]const u8,
|
ends_at: ?[]const u8 = null,
|
||||||
/// For consumable items, whether or not the entitlement has been consumed
|
/// For consumable items, whether or not the entitlement has been consumed
|
||||||
consumed: ?bool,
|
consumed: ?bool = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/monetization/entitlements#entitlement-object-entitlement-types
|
/// https://discord.com/developers/docs/monetization/entitlements#entitlement-object-entitlement-types
|
||||||
|
@ -1,63 +1,63 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const OAuth2Scope = @import("shared.zig").OAuth2Scope;
|
const OAuth2Scope = @import("shared.zig").OAuth2Scope;
|
||||||
const Guild = @import("guild.zig").Guild;
|
const Guild = @import("guild.zig").Guild;
|
||||||
const IncomingWebhook = @import("webhook.zig").IncomingWebhook;
|
const IncomingWebhook = @import("webhook.zig").IncomingWebhook;
|
||||||
|
|
||||||
pub const TokenExchangeAuthorizationCode = struct {
|
pub const TokenExchangeAuthorizationCode = struct {
|
||||||
grant_type: []const u8, //"authorization_code",
|
grant_type: []const u8, //"authorization_code",
|
||||||
/// The code for the token exchange
|
/// The code for the token exchange
|
||||||
code: []const u8,
|
code: []const u8,
|
||||||
/// The redirect_uri associated with this authorization
|
/// The redirect_uri associated with this authorization
|
||||||
redirect_uri: []const u8,
|
redirect_uri: []const u8,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/oauth2#client-credentials-grant
|
/// https://discord.com/developers/docs/topics/oauth2#client-credentials-grant
|
||||||
pub const TokenExchangeRefreshToken = struct {
|
pub const TokenExchangeRefreshToken = struct {
|
||||||
grant_type: "refresh_token",
|
grant_type: "refresh_token",
|
||||||
/// the user's refresh token
|
/// the user's refresh token
|
||||||
refresh_token: []const u8,
|
refresh_token: []const u8,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/oauth2#client-credentials-grant
|
/// https://discord.com/developers/docs/topics/oauth2#client-credentials-grant
|
||||||
pub const TokenExchangeClientCredentials = struct {
|
pub const TokenExchangeClientCredentials = struct {
|
||||||
grant_type: "client_credentials",
|
grant_type: "client_credentials",
|
||||||
/// The scope(s) for the access token
|
/// The scope(s) for the access token
|
||||||
scope: []OAuth2Scope,
|
scope: []OAuth2Scope,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const AccessTokenResponse = struct {
|
pub const AccessTokenResponse = struct {
|
||||||
/// The access token of the user
|
/// The access token of the user
|
||||||
access_token: []const u8,
|
access_token: []const u8,
|
||||||
/// The type of token
|
/// The type of token
|
||||||
token_type: []const u8,
|
token_type: []const u8,
|
||||||
/// The isize of seconds after that the access token is expired
|
/// The isize of seconds after that the access token is expired
|
||||||
expires_in: isize,
|
expires_in: isize,
|
||||||
///
|
///
|
||||||
/// The refresh token to refresh the access token
|
/// The refresh token to refresh the access token
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// When the token exchange is a client credentials type grant this value is not defined.
|
/// When the token exchange is a client credentials type grant this value is not defined.
|
||||||
///
|
///
|
||||||
refresh_token: []const u8,
|
refresh_token: []const u8,
|
||||||
/// The scopes for the access token
|
/// The scopes for the access token
|
||||||
scope: []const u8,
|
scope: []const u8,
|
||||||
/// The webhook the user created for the application. Requires the `webhook.incoming` scope
|
/// The webhook the user created for the application. Requires the `webhook.incoming` scope
|
||||||
webhook: ?IncomingWebhook,
|
webhook: ?IncomingWebhook = null,
|
||||||
/// The guild the bot has been added. Requires the `bot` scope
|
/// The guild the bot has been added. Requires the `bot` scope
|
||||||
guild: ?Guild,
|
guild: ?Guild = null,
|
||||||
};
|
};
|
||||||
|
@ -1,136 +1,136 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const User = @import("user.zig").User;
|
const User = @import("user.zig").User;
|
||||||
const Emoji = @import("emoji.zig").Emoji;
|
const Emoji = @import("emoji.zig").Emoji;
|
||||||
const Partial = @import("partial.zig").Partial;
|
const Partial = @import("partial.zig").Partial;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/poll#poll-object
|
/// https://discord.com/developers/docs/resources/poll#poll-object
|
||||||
pub const Poll = struct {
|
pub const Poll = struct {
|
||||||
/// The question of the poll. Only `text` is supported.
|
/// The question of the poll. Only `text` is supported.
|
||||||
question: PollMedia,
|
question: PollMedia,
|
||||||
/// Each of the answers available in the poll. There is a maximum of 10 answers per poll.
|
/// Each of the answers available in the poll. There is a maximum of 10 answers per poll.
|
||||||
answers: []PollAnswer,
|
answers: []PollAnswer,
|
||||||
///
|
///
|
||||||
/// The time when the poll ends.
|
/// The time when the poll ends.
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// `expiry` is marked as nullable to support non-expiring polls in the future, but all polls have an expiry currently.
|
/// `expiry` is marked as nullable to support non-expiring polls in the future, but all polls have an expiry currently.
|
||||||
///
|
///
|
||||||
expiry: ?[]const u8,
|
expiry: ?[]const u8 = null,
|
||||||
/// Whether a user can select multiple answers
|
/// Whether a user can select multiple answers
|
||||||
allow_multiselect: bool,
|
allow_multiselect: bool,
|
||||||
/// The layout type of the poll
|
/// The layout type of the poll
|
||||||
layout_type: PollLayoutType,
|
layout_type: PollLayoutType,
|
||||||
///
|
///
|
||||||
/// The results of the poll
|
/// The results of the poll
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// This value will not be sent by discord under specific conditions where they don't fetch them on their backend. When this value is missing it should be interpreted as "Unknown results" and not as "No results"
|
/// This value will not be sent by discord under specific conditions where they don't fetch them on their backend. When this value is missing it should be interpreted as "Unknown results" and not as "No results"
|
||||||
///The results may not be totally accurate while the poll has not ended. When it ends discord will re-calculate all the results and set {@link PollResult.is_finalized}; to true
|
///The results may not be totally accurate while the poll has not ended. When it ends discord will re-calculate all the results and set {@link PollResult.is_finalized}; to true
|
||||||
///
|
///
|
||||||
results: ?PollResult,
|
results: ?PollResult = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/poll#layout-type
|
/// https://discord.com/developers/docs/resources/poll#layout-type
|
||||||
pub const PollLayoutType = enum(u4) {
|
pub const PollLayoutType = enum(u4) {
|
||||||
/// The default layout
|
/// The default layout
|
||||||
Default = 1,
|
Default = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/poll#poll-media-object
|
/// https://discord.com/developers/docs/resources/poll#poll-media-object
|
||||||
pub const PollMedia = struct {
|
pub const PollMedia = struct {
|
||||||
///
|
///
|
||||||
/// The text of the field
|
/// The text of the field
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// `text` should always be non-null for both questions and answers, but this is subject to changes.
|
/// `text` should always be non-null for both questions and answers, but this is subject to changes.
|
||||||
/// The maximum length of `text` is 300 for the question, and 55 for any answer.
|
/// The maximum length of `text` is 300 for the question, and 55 for any answer.
|
||||||
///
|
///
|
||||||
text: ?[]const u8,
|
text: ?[]const u8 = null,
|
||||||
///
|
///
|
||||||
/// The emoji of the field
|
/// The emoji of the field
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
/// When creating a poll answer with an emoji, one only needs to send either the `id` (custom emoji) or `name` (default emoji) as the only field.
|
/// When creating a poll answer with an emoji, one only needs to send either the `id` (custom emoji) or `name` (default emoji) as the only field.
|
||||||
///
|
///
|
||||||
emoji: ?Partial(Emoji),
|
emoji: ?Partial(Emoji) = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/poll#poll-answer-object
|
/// https://discord.com/developers/docs/resources/poll#poll-answer-object
|
||||||
pub const PollAnswer = struct {
|
pub const PollAnswer = struct {
|
||||||
///
|
///
|
||||||
/// The id of the answer
|
/// The id of the answer
|
||||||
///
|
///
|
||||||
/// @remarks
|
/// @remarks
|
||||||
///This id labels each answer. It starts at 1 and goes up sequentially. recommend against depending on this value as is a implementation detail.
|
///This id labels each answer. It starts at 1 and goes up sequentially. recommend against depending on this value as is a implementation detail.
|
||||||
///
|
///
|
||||||
answer_id: isize,
|
answer_id: isize,
|
||||||
/// The data of the answer
|
/// The data of the answer
|
||||||
poll_media: PollMedia,
|
poll_media: PollMedia,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const PollAnswerCount = struct {
|
pub const PollAnswerCount = struct {
|
||||||
///The {@link PollAnswer.answer_id | answer_id};
|
///The {@link PollAnswer.answer_id | answer_id};
|
||||||
id: isize,
|
id: isize,
|
||||||
/// The isize of votes for this answer
|
/// The isize of votes for this answer
|
||||||
count: isize,
|
count: isize,
|
||||||
/// Whether the current user voted for this answer
|
/// Whether the current user voted for this answer
|
||||||
me_voted: bool,
|
me_voted: bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/poll#poll-results-object
|
/// https://discord.com/developers/docs/resources/poll#poll-results-object
|
||||||
pub const PollResult = struct {
|
pub const PollResult = struct {
|
||||||
/// Whether the votes have been precisely counted
|
/// Whether the votes have been precisely counted
|
||||||
is_finalized: bool,
|
is_finalized: bool,
|
||||||
/// The counts for each answer
|
/// The counts for each answer
|
||||||
answer_counts: []PollAnswerCount,
|
answer_counts: []PollAnswerCount,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/poll#get-answer-voters-response-body
|
/// https://discord.com/developers/docs/resources/poll#get-answer-voters-response-body
|
||||||
pub const GetAnswerVotesResponse = struct {
|
pub const GetAnswerVotesResponse = struct {
|
||||||
/// Users who voted for this answer
|
/// Users who voted for this answer
|
||||||
users: []User,
|
users: []User,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway-events#message-poll-vote-add
|
/// https://discord.com/developers/docs/topics/gateway-events#message-poll-vote-add
|
||||||
pub const PollVoteAdd = struct {
|
pub const PollVoteAdd = struct {
|
||||||
/// ID of the user. Usually a snowflake
|
/// ID of the user. Usually a snowflake
|
||||||
user_id: Snowflake,
|
user_id: Snowflake,
|
||||||
/// ID of the channel. Usually a snowflake
|
/// ID of the channel. Usually a snowflake
|
||||||
channel_id: Snowflake,
|
channel_id: Snowflake,
|
||||||
/// ID of the message. Usually a snowflake
|
/// ID of the message. Usually a snowflake
|
||||||
message_id: Snowflake,
|
message_id: Snowflake,
|
||||||
/// ID of the guild. Usually a snowflake
|
/// ID of the guild. Usually a snowflake
|
||||||
guild_id: ?Snowflake,
|
guild_id: ?Snowflake = null,
|
||||||
/// ID of the answer.
|
/// ID of the answer.
|
||||||
answer_id: isize,
|
answer_id: isize,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway-events#message-poll-vote-remove
|
/// https://discord.com/developers/docs/topics/gateway-events#message-poll-vote-remove
|
||||||
pub const PollVoteRemove = struct {
|
pub const PollVoteRemove = struct {
|
||||||
/// ID of the user. Usually a snowflake
|
/// ID of the user. Usually a snowflake
|
||||||
user_id: Snowflake,
|
user_id: Snowflake,
|
||||||
/// ID of the channel. Usually a snowflake
|
/// ID of the channel. Usually a snowflake
|
||||||
channel_id: Snowflake,
|
channel_id: Snowflake,
|
||||||
/// ID of the message. Usually a snowflake
|
/// ID of the message. Usually a snowflake
|
||||||
message_id: Snowflake,
|
message_id: Snowflake,
|
||||||
/// ID of the guild. Usually a snowflake
|
/// ID of the guild. Usually a snowflake
|
||||||
guild_id: ?Snowflake,
|
guild_id: ?Snowflake = null,
|
||||||
/// ID of the answer.
|
/// ID of the answer.
|
||||||
answer_id: isize,
|
answer_id: isize,
|
||||||
};
|
};
|
||||||
|
@ -1,101 +1,101 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const RoleFlags = @import("shared.zig").RoleFlags;
|
const RoleFlags = @import("shared.zig").RoleFlags;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/permissions#role-object-role-structure
|
/// https://discord.com/developers/docs/topics/permissions#role-object-role-structure
|
||||||
pub const Role = struct {
|
pub const Role = struct {
|
||||||
/// Role id
|
/// Role id
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// If this role is showed separately in the user listing
|
/// If this role is showed separately in the user listing
|
||||||
hoist: bool,
|
hoist: bool,
|
||||||
/// Permission bit set
|
/// Permission bit set
|
||||||
permissions: []const u8,
|
permissions: []const u8,
|
||||||
/// Whether this role is managed by an integration
|
/// Whether this role is managed by an integration
|
||||||
managed: bool,
|
managed: bool,
|
||||||
/// Whether this role is mentionable
|
/// Whether this role is mentionable
|
||||||
mentionable: bool,
|
mentionable: bool,
|
||||||
/// The tags this role has
|
/// The tags this role has
|
||||||
tags: ?RoleTags,
|
tags: ?RoleTags = null,
|
||||||
/// the role emoji hash
|
/// the role emoji hash
|
||||||
icon: ?[]const u8,
|
icon: ?[]const u8 = null,
|
||||||
/// Role name
|
/// Role name
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// Integer representation of hexadecimal color code
|
/// Integer representation of hexadecimal color code
|
||||||
color: isize,
|
color: isize,
|
||||||
/// Position of this role (roles with the same position are sorted by id)
|
/// Position of this role (roles with the same position are sorted by id)
|
||||||
position: isize,
|
position: isize,
|
||||||
/// role unicode emoji
|
/// role unicode emoji
|
||||||
unicode_emoji: ?[]const u8,
|
unicode_emoji: ?[]const u8 = null,
|
||||||
/// Role flags combined as a bitfield
|
/// Role flags combined as a bitfield
|
||||||
flags: RoleFlags,
|
flags: RoleFlags,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure
|
/// https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure
|
||||||
pub const RoleTags = struct {
|
pub const RoleTags = struct {
|
||||||
/// The id of the bot this role belongs to
|
/// The id of the bot this role belongs to
|
||||||
bot_id: ?Snowflake,
|
bot_id: ?Snowflake = null,
|
||||||
/// The id of the integration this role belongs to
|
/// The id of the integration this role belongs to
|
||||||
integration_id: ?Snowflake,
|
integration_id: ?Snowflake = null,
|
||||||
/// Whether this is the guild's premium subscriber role
|
/// Whether this is the guild's premium subscriber role
|
||||||
/// Tags with type ?bool represent booleans. They will be present and set to null if they are "true", and will be not present if they are "false".
|
/// Tags with type ?bool represent booleans. They will be present and set to null if they are "true", and will be not present if they are "false".
|
||||||
premium_subscriber: ?bool,
|
premium_subscriber: ?bool = null,
|
||||||
/// Id of this role's subscription sku and listing.
|
/// Id of this role's subscription sku and listing.
|
||||||
subscription_listing_id: ?Snowflake,
|
subscription_listing_id: ?Snowflake = null,
|
||||||
/// Whether this role is available for purchase.
|
/// Whether this role is available for purchase.
|
||||||
/// Tags with type ?bool represent booleans. They will be present and set to null if they are "true", and will be not present if they are "false".
|
/// Tags with type ?bool represent booleans. They will be present and set to null if they are "true", and will be not present if they are "false".
|
||||||
available_for_purchase: ?bool,
|
available_for_purchase: ?bool = null,
|
||||||
/// Whether this is a guild's linked role
|
/// Whether this is a guild's linked role
|
||||||
/// Tags with type ?bool represent booleans. They will be present and set to null if they are "true", and will be not present if they are "false".
|
/// Tags with type ?bool represent booleans. They will be present and set to null if they are "true", and will be not present if they are "false".
|
||||||
guild_connections: ?bool,
|
guild_connections: ?bool = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#create-guild-role
|
/// https://discord.com/developers/docs/resources/guild#create-guild-role
|
||||||
pub const CreateGuildRole = struct {
|
pub const CreateGuildRole = struct {
|
||||||
/// Name of the role, max 100 characters, default: "new role"
|
/// Name of the role, max 100 characters, default: "new role"
|
||||||
name: ?[]const u8,
|
name: ?[]const u8 = null,
|
||||||
/// Bitwise value of the enabled/disabled permissions, default: everyone permissions in guild
|
/// Bitwise value of the enabled/disabled permissions, default: everyone permissions in guild
|
||||||
permissions: ?[][]const u8,
|
permissions: ?[][]const u8 = null,
|
||||||
/// RGB color value, default: 0
|
/// RGB color value, default: 0
|
||||||
color: ?isize,
|
color: ?isize = null,
|
||||||
/// Whether the role should be displayed separately in the sidebar, default: false
|
/// Whether the role should be displayed separately in the sidebar, default: false
|
||||||
hoist: ?bool,
|
hoist: ?bool = null,
|
||||||
/// Whether the role should be mentionable, default: false
|
/// Whether the role should be mentionable, default: false
|
||||||
mentionable: ?bool,
|
mentionable: ?bool = null,
|
||||||
/// The role's unicode emoji (if the guild has the `ROLE_ICONS` feature)
|
/// The role's unicode emoji (if the guild has the `ROLE_ICONS` feature)
|
||||||
unicode_emoji: ?[]const u8,
|
unicode_emoji: ?[]const u8 = null,
|
||||||
/// the role's icon image (if the guild has the `ROLE_ICONS` feature)
|
/// the role's icon image (if the guild has the `ROLE_ICONS` feature)
|
||||||
icon: ?[]const u8,
|
icon: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/guild#modify-guild-role
|
/// https://discord.com/developers/docs/resources/guild#modify-guild-role
|
||||||
pub const ModifyGuildRole = struct {
|
pub const ModifyGuildRole = struct {
|
||||||
/// Name of the role, max 100 characters, default: "new role"
|
/// Name of the role, max 100 characters, default: "new role"
|
||||||
name: ?[]const u8,
|
name: ?[]const u8 = null,
|
||||||
/// Bitwise value of the enabled/disabled permissions, default: everyone permissions in guild
|
/// Bitwise value of the enabled/disabled permissions, default: everyone permissions in guild
|
||||||
permissions: ?[][]const u8,
|
permissions: ?[][]const u8 = null,
|
||||||
/// RGB color value, default: 0
|
/// RGB color value, default: 0
|
||||||
color: ?isize,
|
color: ?isize = null,
|
||||||
/// Whether the role should be displayed separately in the sidebar, default: false
|
/// Whether the role should be displayed separately in the sidebar, default: false
|
||||||
hoist: ?bool,
|
hoist: ?bool = null,
|
||||||
/// Whether the role should be mentionable, default: false
|
/// Whether the role should be mentionable, default: false
|
||||||
mentionable: ?bool,
|
mentionable: ?bool = null,
|
||||||
/// The role's unicode emoji (if the guild has the `ROLE_ICONS` feature)
|
/// The role's unicode emoji (if the guild has the `ROLE_ICONS` feature)
|
||||||
unicodeEmoji: ?[]const u8,
|
unicodeEmoji: ?[]const u8 = null,
|
||||||
/// the role's icon image (if the guild has the `ROLE_ICONS` feature)
|
/// the role's icon image (if the guild has the `ROLE_ICONS` feature)
|
||||||
icon: ?[]const u8,
|
icon: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
@ -1,88 +1,88 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const ScheduledEventPrivacyLevel = @import("shared.zig").ScheduledEventPrivacyLevel;
|
const ScheduledEventPrivacyLevel = @import("shared.zig").ScheduledEventPrivacyLevel;
|
||||||
const ScheduledEventStatus = @import("shared.zig").ScheduledEventStatus;
|
const ScheduledEventStatus = @import("shared.zig").ScheduledEventStatus;
|
||||||
const ScheduledEventEntityType = @import("shared.zig").ScheduledEventEntityType;
|
const ScheduledEventEntityType = @import("shared.zig").ScheduledEventEntityType;
|
||||||
const User = @import("user.zig").User;
|
const User = @import("user.zig").User;
|
||||||
|
|
||||||
pub const ScheduledEvent = struct {
|
pub const ScheduledEvent = struct {
|
||||||
/// the id of the scheduled event
|
/// the id of the scheduled event
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// the guild id which the scheduled event belongs to
|
/// the guild id which the scheduled event belongs to
|
||||||
guild_id: Snowflake,
|
guild_id: Snowflake,
|
||||||
/// the channel id in which the scheduled event will be hosted if specified
|
/// the channel id in which the scheduled event will be hosted if specified
|
||||||
channel_id: ?Snowflake,
|
channel_id: ?Snowflake = null,
|
||||||
/// the id of the user that created the scheduled event
|
/// the id of the user that created the scheduled event
|
||||||
creator_id: ?Snowflake,
|
creator_id: ?Snowflake = null,
|
||||||
/// the name of the scheduled event
|
/// the name of the scheduled event
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// the description of the scheduled event
|
/// the description of the scheduled event
|
||||||
description: ?[]const u8,
|
description: ?[]const u8 = null,
|
||||||
/// the time the scheduled event will start
|
/// the time the scheduled event will start
|
||||||
scheduled_start_time: []const u8,
|
scheduled_start_time: []const u8,
|
||||||
/// the time the scheduled event will end if it does end.
|
/// the time the scheduled event will end if it does end.
|
||||||
scheduled_end_time: ?[]const u8,
|
scheduled_end_time: ?[]const u8 = null,
|
||||||
/// the privacy level of the scheduled event
|
/// the privacy level of the scheduled event
|
||||||
privacy_level: ScheduledEventPrivacyLevel,
|
privacy_level: ScheduledEventPrivacyLevel,
|
||||||
/// the status of the scheduled event
|
/// the status of the scheduled event
|
||||||
status: ScheduledEventStatus,
|
status: ScheduledEventStatus,
|
||||||
/// the type of hosting entity associated with a scheduled event
|
/// the type of hosting entity associated with a scheduled event
|
||||||
entity_type: ScheduledEventEntityType,
|
entity_type: ScheduledEventEntityType,
|
||||||
/// any additional id of the hosting entity associated with event
|
/// any additional id of the hosting entity associated with event
|
||||||
entity_id: ?Snowflake,
|
entity_id: ?Snowflake = null,
|
||||||
/// the entity metadata for the scheduled event
|
/// the entity metadata for the scheduled event
|
||||||
entity_metadata: ?ScheduledEventEntityMetadata,
|
entity_metadata: ?ScheduledEventEntityMetadata = null,
|
||||||
/// the user that created the scheduled event
|
/// the user that created the scheduled event
|
||||||
creator: ?User,
|
creator: ?User = null,
|
||||||
/// the isize of users subscribed to the scheduled event
|
/// the isize of users subscribed to the scheduled event
|
||||||
user_count: ?isize,
|
user_count: ?isize = null,
|
||||||
/// the cover image hash of the scheduled event
|
/// the cover image hash of the scheduled event
|
||||||
image: ?[]const u8,
|
image: ?[]const u8 = null,
|
||||||
/// the definition for how often this event should recur
|
/// the definition for how often this event should recur
|
||||||
recurrence_rule: ?ScheduledEventRecurrenceRule,
|
recurrence_rule: ?ScheduledEventRecurrenceRule = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const ScheduledEventEntityMetadata = struct {
|
pub const ScheduledEventEntityMetadata = struct {
|
||||||
/// location of the event
|
/// location of the event
|
||||||
location: ?[]const u8,
|
location: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const ScheduledEventRecurrenceRule = struct {
|
pub const ScheduledEventRecurrenceRule = struct {
|
||||||
/// Starting time of the recurrence interval
|
/// Starting time of the recurrence interval
|
||||||
start: []const u8,
|
start: []const u8,
|
||||||
/// Ending time of the recurrence interval
|
/// Ending time of the recurrence interval
|
||||||
end: ?[]const u8,
|
end: ?[]const u8 = null,
|
||||||
/// How often the event occurs
|
/// How often the event occurs
|
||||||
frequency: ScheduledEventRecurrenceRuleFrequency,
|
frequency: ScheduledEventRecurrenceRuleFrequency,
|
||||||
/// The spacing between the events, defined by `frequency`. For example, `frequency` of `Weekly` and an `interval` of `2` would be "every-other week"
|
/// The spacing between the events, defined by `frequency`. For example, `frequency` of `Weekly` and an `interval` of `2` would be "every-other week"
|
||||||
interval: isize,
|
interval: isize,
|
||||||
/// Set of specific days within a week for the event to recur on
|
/// Set of specific days within a week for the event to recur on
|
||||||
by_weekday: ?[]ScheduledEventRecurrenceRuleWeekday,
|
by_weekday: ?[]ScheduledEventRecurrenceRuleWeekday = null,
|
||||||
/// List of specific days within a specific week (1-5) to recur on
|
/// List of specific days within a specific week (1-5) to recur on
|
||||||
by_n_weekday: ?[]ScheduledEventRecurrenceRuleNWeekday,
|
by_n_weekday: ?[]ScheduledEventRecurrenceRuleNWeekday = null,
|
||||||
/// Set of specific months to recur on
|
/// Set of specific months to recur on
|
||||||
by_month: ?[]ScheduledEventRecurrenceRuleMonth,
|
by_month: ?[]ScheduledEventRecurrenceRuleMonth = null,
|
||||||
/// Set of specific dates within a month to recur on
|
/// Set of specific dates within a month to recur on
|
||||||
by_month_day: ?[]isize,
|
by_month_day: ?[]isize = null,
|
||||||
/// Set of days within a year to recur on (1-364)
|
/// Set of days within a year to recur on (1-364)
|
||||||
by_year_day: ?[]isize,
|
by_year_day: ?[]isize = null,
|
||||||
/// The total amount of times that the event is allowed to recur before stopping
|
/// The total amount of times that the event is allowed to recur before stopping
|
||||||
count: ?isize,
|
count: ?isize = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const ScheduledEventRecurrenceRuleFrequency = enum {
|
pub const ScheduledEventRecurrenceRuleFrequency = enum {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -61,10 +61,11 @@ pub const Snowflake = enum(u64) {
|
|||||||
/// std.json parse
|
/// std.json parse
|
||||||
pub fn jsonParse(allocator: std.mem.Allocator, src: anytype, _: std.json.ParseOptions) !@This() {
|
pub fn jsonParse(allocator: std.mem.Allocator, src: anytype, _: std.json.ParseOptions) !@This() {
|
||||||
const value = try std.json.innerParse(std.json.Value, allocator, src, .{
|
const value = try std.json.innerParse(std.json.Value, allocator, src, .{
|
||||||
.max_value_len = 0x100
|
.ignore_unknown_fields = true,
|
||||||
});
|
.max_value_len = 0x1000,
|
||||||
|
});
|
||||||
|
|
||||||
if (value != .string)
|
if (value == .string)
|
||||||
return Snowflake.fromRaw(value.string) catch
|
return Snowflake.fromRaw(value.string) catch
|
||||||
std.debug.panic("invalid snowflake: {s}\n", .{value.string});
|
std.debug.panic("invalid snowflake: {s}\n", .{value.string});
|
||||||
unreachable;
|
unreachable;
|
||||||
|
@ -1,67 +1,67 @@
|
|||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const User = @import("user.zig").User;
|
const User = @import("user.zig").User;
|
||||||
const StickerTypes = @import("shared.zig").StickerTypes;
|
const StickerTypes = @import("shared.zig").StickerTypes;
|
||||||
const StickerFormatTypes = @import("shared.zig").StickerFormatTypes;
|
const StickerFormatTypes = @import("shared.zig").StickerFormatTypes;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-structure
|
/// https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-structure
|
||||||
pub const Sticker = struct {
|
pub const Sticker = struct {
|
||||||
/// [Id of the sticker](https://discord.com/developers/docs/reference#image-formatting)
|
/// [Id of the sticker](https://discord.com/developers/docs/reference#image-formatting)
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// Id of the pack the sticker is from
|
/// Id of the pack the sticker is from
|
||||||
pack_id: ?Snowflake,
|
pack_id: ?Snowflake = null,
|
||||||
/// Name of the sticker
|
/// Name of the sticker
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// Description of the sticker
|
/// Description of the sticker
|
||||||
description: []const u8,
|
description: []const u8,
|
||||||
/// a unicode emoji representing the sticker's expression
|
/// a unicode emoji representing the sticker's expression
|
||||||
tags: []const u8,
|
tags: []const u8,
|
||||||
/// [type of sticker](https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types)
|
/// [type of sticker](https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types)
|
||||||
type: StickerTypes,
|
type: StickerTypes,
|
||||||
/// [Type of sticker format](https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types)
|
/// [Type of sticker format](https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types)
|
||||||
format_type: StickerFormatTypes,
|
format_type: StickerFormatTypes,
|
||||||
/// Whether or not the sticker is available
|
/// Whether or not the sticker is available
|
||||||
available: ?bool,
|
available: ?bool = null,
|
||||||
/// Id of the guild that owns this sticker
|
/// Id of the guild that owns this sticker
|
||||||
guild_id: ?Snowflake,
|
guild_id: ?Snowflake = null,
|
||||||
/// The user that uploaded the sticker
|
/// The user that uploaded the sticker
|
||||||
user: ?User,
|
user: ?User = null,
|
||||||
/// A sticker's sort order within a pack
|
/// A sticker's sort order within a pack
|
||||||
sort_value: ?isize,
|
sort_value: ?isize = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/sticker#sticker-item-object-sticker-item-structure
|
/// https://discord.com/developers/docs/resources/sticker#sticker-item-object-sticker-item-structure
|
||||||
pub const StickerItem = struct {
|
pub const StickerItem = struct {
|
||||||
/// Id of the sticker
|
/// Id of the sticker
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// Name of the sticker
|
/// Name of the sticker
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// [Type of sticker format](https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types)
|
/// [Type of sticker format](https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types)
|
||||||
format_type: StickerFormatTypes,
|
format_type: StickerFormatTypes,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/sticker#sticker-pack-object-sticker-pack-structure
|
/// https://discord.com/developers/docs/resources/sticker#sticker-pack-object-sticker-pack-structure
|
||||||
pub const StickerPack = struct {
|
pub const StickerPack = struct {
|
||||||
/// id of the sticker pack
|
/// id of the sticker pack
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// the stickers in the pack
|
/// the stickers in the pack
|
||||||
stickers: []Sticker,
|
stickers: []Sticker,
|
||||||
/// name of the sticker pack
|
/// name of the sticker pack
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// id of the pack's SKU
|
/// id of the pack's SKU
|
||||||
sku_id: Snowflake,
|
sku_id: Snowflake,
|
||||||
/// id of a sticker in the pack which is shown as the pack's icon
|
/// id of a sticker in the pack which is shown as the pack's icon
|
||||||
cover_sticker_id: ?Snowflake,
|
cover_sticker_id: ?Snowflake = null,
|
||||||
/// description of the sticker pack
|
/// description of the sticker pack
|
||||||
description: []const u8,
|
description: []const u8,
|
||||||
/// id of the sticker pack's [banner image](https://discord.com/developers/docs/reference#image-formatting)
|
/// id of the sticker pack's [banner image](https://discord.com/developers/docs/reference#image-formatting)
|
||||||
banner_asset_id: ?Snowflake,
|
banner_asset_id: ?Snowflake = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const CreateModifyGuildSticker = struct {
|
pub const CreateModifyGuildSticker = struct {
|
||||||
/// name of the sticker (2-30 characters)
|
/// name of the sticker (2-30 characters)
|
||||||
name: ?[]const u8,
|
name: ?[]const u8 = null,
|
||||||
/// description of the sticker (2-100 characters)
|
/// description of the sticker (2-100 characters)
|
||||||
description: ?[]const u8,
|
description: ?[]const u8 = null,
|
||||||
/// autocomplete/suggestion tags for the sticker (max 200 characters)
|
/// autocomplete/suggestion tags for the sticker (max 200 characters)
|
||||||
tags: ?[]const u8,
|
tags: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const TeamMembershipStates = @import("shared.zig").TeamMembershipStates;
|
const TeamMembershipStates = @import("shared.zig").TeamMembershipStates;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/teams#data-models-team-object
|
/// https://discord.com/developers/docs/topics/teams#data-models-team-object
|
||||||
pub const Team = struct {
|
pub const Team = struct {
|
||||||
/// Hash of the image of the team's icon
|
/// Hash of the image of the team's icon
|
||||||
icon: ?[]const u8,
|
icon: ?[]const u8 = null,
|
||||||
/// Unique ID of the team
|
/// Unique ID of the team
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// Members of the team
|
/// Members of the team
|
||||||
|
@ -1,134 +1,134 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const Channel = @import("channel.zig").Channel;
|
const Channel = @import("channel.zig").Channel;
|
||||||
const ChannelTypes = @import("shared.zig").ChannelTypes;
|
const ChannelTypes = @import("shared.zig").ChannelTypes;
|
||||||
const MessageFlags = @import("shared.zig").MessageFlags;
|
const MessageFlags = @import("shared.zig").MessageFlags;
|
||||||
const Embed = @import("embed.zig").Embed;
|
const Embed = @import("embed.zig").Embed;
|
||||||
const Partial = @import("partial.zig").Partial;
|
const Partial = @import("partial.zig").Partial;
|
||||||
const Attachment = @import("attachment.zig").Attachment;
|
const Attachment = @import("attachment.zig").Attachment;
|
||||||
const AllowedMentions = @import("message.zig").AllowedMentions;
|
const AllowedMentions = @import("message.zig").AllowedMentions;
|
||||||
const MessageComponent = @import("message.zig").MessageComponent;
|
const MessageComponent = @import("message.zig").MessageComponent;
|
||||||
|
|
||||||
pub const ThreadMetadata = struct {
|
pub const ThreadMetadata = struct {
|
||||||
/// Whether the thread is archived
|
/// Whether the thread is archived
|
||||||
archived: bool,
|
archived: bool,
|
||||||
/// Duration in minutes to automatically archive the thread after recent activity
|
/// Duration in minutes to automatically archive the thread after recent activity
|
||||||
auto_archive_duration: isize,
|
auto_archive_duration: isize,
|
||||||
/// When a thread is locked, only users with `MANAGE_THREADS` can unarchive it
|
/// When a thread is locked, only users with `MANAGE_THREADS` can unarchive it
|
||||||
locked: bool,
|
locked: bool,
|
||||||
/// whether non-moderators can add other non-moderators to a thread; only available on private threads
|
/// whether non-moderators can add other non-moderators to a thread; only available on private threads
|
||||||
invitable: ?bool,
|
invitable: ?bool = null,
|
||||||
/// Timestamp when the thread's archive status was last changed, used for calculating recent activity
|
/// Timestamp when the thread's archive status was last changed, used for calculating recent activity
|
||||||
archive_timestamp: []const u8,
|
archive_timestamp: []const u8,
|
||||||
/// Timestamp when the thread was created; only populated for threads created after 2022-01-09
|
/// Timestamp when the thread was created; only populated for threads created after 2022-01-09
|
||||||
create_timestamp: ?[]const u8,
|
create_timestamp: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const ThreadMember = struct {
|
pub const ThreadMember = struct {
|
||||||
/// Any user-thread settings, currently only used for notifications
|
/// Any user-thread settings, currently only used for notifications
|
||||||
flags: isize,
|
flags: isize,
|
||||||
/// The id of the thread
|
/// The id of the thread
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// The id of the user
|
/// The id of the user
|
||||||
user_id: Snowflake,
|
user_id: Snowflake,
|
||||||
/// The time the current user last joined the thread
|
/// The time the current user last joined the thread
|
||||||
join_timestamp: []const u8,
|
join_timestamp: []const u8,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const ListActiveThreads = struct {
|
pub const ListActiveThreads = struct {
|
||||||
/// The active threads
|
/// The active threads
|
||||||
threads: []Channel,
|
threads: []Channel,
|
||||||
/// A thread member object for each returned thread the current user has joined
|
/// A thread member object for each returned thread the current user has joined
|
||||||
members: []ThreadMember,
|
members: []ThreadMember,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const ListArchivedThreads = struct {
|
pub const ListArchivedThreads = struct {
|
||||||
/// The active threads
|
/// The active threads
|
||||||
threads: []Channel,
|
threads: []Channel,
|
||||||
/// A thread member object for each returned thread the current user has joined
|
/// A thread member object for each returned thread the current user has joined
|
||||||
members: []ThreadMember,
|
members: []ThreadMember,
|
||||||
/// Whether there are potentially additional threads that could be returned on a subsequent call
|
/// Whether there are potentially additional threads that could be returned on a subsequent call
|
||||||
has_more: bool,
|
has_more: bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const ThreadListSync = struct {
|
pub const ThreadListSync = struct {
|
||||||
/// The id of the guild
|
/// The id of the guild
|
||||||
guild_id: Snowflake,
|
guild_id: Snowflake,
|
||||||
/// The parent channel ids whose threads are being synced. If omitted, then threads were synced for the entire guild. This array may contain channelIds that have no active threads as well, so you know to clear that data
|
/// The parent channel ids whose threads are being synced. If omitted, then threads were synced for the entire guild. This array may contain channelIds that have no active threads as well, so you know to clear that data
|
||||||
channel_ids: ?[][]const u8,
|
channel_ids: ?[][]const u8 = null,
|
||||||
/// All active threads in the given channels that the current user can access
|
/// All active threads in the given channels that the current user can access
|
||||||
threads: []Channel,
|
threads: []Channel,
|
||||||
/// All thread member objects from the synced threads for the current user, indicating which threads the current user has been added to
|
/// All thread member objects from the synced threads for the current user, indicating which threads the current user has been added to
|
||||||
members: []ThreadMember,
|
members: []ThreadMember,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#start-thread-from-message
|
/// https://discord.com/developers/docs/resources/channel#start-thread-from-message
|
||||||
pub const StartThreadFromMessage = struct {
|
pub const StartThreadFromMessage = struct {
|
||||||
/// 1-100 character thread name
|
/// 1-100 character thread name
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// Duration in minutes to automatically archive the thread after recent activity
|
/// Duration in minutes to automatically archive the thread after recent activity
|
||||||
auto_archive_duration: ?isize,
|
auto_archive_duration: ?isize = null,
|
||||||
/// Amount of seconds a user has to wait before sending another message (0-21600)
|
/// Amount of seconds a user has to wait before sending another message (0-21600)
|
||||||
rate_limit_per_user: ?isize,
|
rate_limit_per_user: ?isize = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#start-thread-without-message
|
/// https://discord.com/developers/docs/resources/channel#start-thread-without-message
|
||||||
pub const StartThreadWithoutMessage = struct {
|
pub const StartThreadWithoutMessage = struct {
|
||||||
/// 1-100 character thread name,
|
/// 1-100 character thread name,
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// Duration in minutes to automatically archive the thread after recent activity,
|
/// Duration in minutes to automatically archive the thread after recent activity,
|
||||||
auto_archive_duration: isize,
|
auto_archive_duration: isize,
|
||||||
/// Amount of seconds a user has to wait before sending another message (0-21600),
|
/// Amount of seconds a user has to wait before sending another message (0-21600),
|
||||||
rateLimitPerUser: ?isize,
|
rateLimitPerUser: ?isize = null,
|
||||||
/// the type of thread to create,
|
/// the type of thread to create,
|
||||||
/// may only be AnnouncementThread, PublicThread, or PrivateThread
|
/// may only be AnnouncementThread, PublicThread, or PrivateThread
|
||||||
type: ChannelTypes,
|
type: ChannelTypes,
|
||||||
/// whether non-moderators can add other non-moderators to a thread; only available when creating a private thread,
|
/// whether non-moderators can add other non-moderators to a thread; only available when creating a private thread,
|
||||||
invitable: ?bool,
|
invitable: ?bool = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel-forum-and-media-thread-message-params-object
|
/// https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel-forum-and-media-thread-message-params-object
|
||||||
pub const CreateForumAndMediaThreadMessage = struct {
|
pub const CreateForumAndMediaThreadMessage = struct {
|
||||||
/// Message contents (up to 2000 characters)
|
/// Message contents (up to 2000 characters)
|
||||||
content: ?[]const u8,
|
content: ?[]const u8 = null,
|
||||||
/// Up to 10 rich embeds (up to 6000 characters)
|
/// Up to 10 rich embeds (up to 6000 characters)
|
||||||
embeds: ?[]Embed,
|
embeds: ?[]Embed = null,
|
||||||
/// Allowed mentions for the message
|
/// Allowed mentions for the message
|
||||||
allowed_mentions: ?AllowedMentions,
|
allowed_mentions: ?AllowedMentions = null,
|
||||||
/// Components to include with the message
|
/// Components to include with the message
|
||||||
components: ?[]MessageComponent,
|
components: ?[]MessageComponent = null,
|
||||||
/// IDs of up to 3 stickers in the server to send in the message
|
/// IDs of up to 3 stickers in the server to send in the message
|
||||||
sticker_ids: ?[]Snowflake,
|
sticker_ids: ?[]Snowflake = null,
|
||||||
/// Attachment objects with filename and description. See Uploading Files
|
/// Attachment objects with filename and description. See Uploading Files
|
||||||
attachments: ?[]Partial(Attachment),
|
attachments: ?[]Partial(Attachment) = null,
|
||||||
/// Message flags combined as a bitfield (only SUPPRESS_EMBEDS and SUPPRESS_NOTIFICATIONS can be set)
|
/// Message flags combined as a bitfield (only SUPPRESS_EMBEDS and SUPPRESS_NOTIFICATIONS can be set)
|
||||||
flags: ?MessageFlags,
|
flags: ?MessageFlags = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const StartThreadInForumOrMediaChannel = struct {
|
pub const StartThreadInForumOrMediaChannel = struct {
|
||||||
/// 1-100 character channel name
|
/// 1-100 character channel name
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// Duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
|
/// Duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
|
||||||
auto_archive_duration: ?isize,
|
auto_archive_duration: ?isize = null,
|
||||||
/// Amount of seconds a user has to wait before sending another message (0-21600)
|
/// Amount of seconds a user has to wait before sending another message (0-21600)
|
||||||
rate_limit_per_user: ?isize,
|
rate_limit_per_user: ?isize = null,
|
||||||
/// Contents of the first message in the forum/media thread
|
/// Contents of the first message in the forum/media thread
|
||||||
message: CreateForumAndMediaThreadMessage,
|
message: CreateForumAndMediaThreadMessage,
|
||||||
/// The IDs of the set of tags that have been applied to a thread in a GUILD_FORUM or a GUILD_MEDIA channel
|
/// The IDs of the set of tags that have been applied to a thread in a GUILD_FORUM or a GUILD_MEDIA channel
|
||||||
applied_tags: ?[]Snowflake,
|
applied_tags: ?[]Snowflake = null,
|
||||||
};
|
};
|
||||||
|
@ -1,351 +1,352 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
// shared.zig
|
// shared.zig
|
||||||
pub const PresenceStatus = @import("shared.zig").PresenceStatus;
|
pub const PresenceStatus = @import("shared.zig").PresenceStatus;
|
||||||
pub const PremiumTypes = @import("shared.zig").PremiumTypes;
|
pub const PremiumTypes = @import("shared.zig").PremiumTypes;
|
||||||
pub const UserFlags = @import("shared.zig").UserFlags;
|
pub const UserFlags = @import("shared.zig").UserFlags;
|
||||||
pub const PremiumUsageFlags = @import("shared.zig").PremiumUsageFlags;
|
pub const PremiumUsageFlags = @import("shared.zig").PremiumUsageFlags;
|
||||||
pub const PurchasedFlags = @import("shared.zig").PurchasedFlags;
|
pub const PurchasedFlags = @import("shared.zig").PurchasedFlags;
|
||||||
pub const MemberFlags = @import("shared.zig").MemberFlags;
|
pub const MemberFlags = @import("shared.zig").MemberFlags;
|
||||||
pub const ChannelFlags = @import("shared.zig").ChannelFlags;
|
pub const ChannelFlags = @import("shared.zig").ChannelFlags;
|
||||||
pub const RoleFlags = @import("shared.zig").RoleFlags;
|
pub const RoleFlags = @import("shared.zig").RoleFlags;
|
||||||
pub const AttachmentFlags = @import("shared.zig").AttachmentFlags;
|
pub const AttachmentFlags = @import("shared.zig").AttachmentFlags;
|
||||||
pub const SkuFlags = @import("shared.zig").SkuFlags;
|
pub const SkuFlags = @import("shared.zig").SkuFlags;
|
||||||
pub const MessageFlags = @import("shared.zig").MessageFlags;
|
pub const MessageFlags = @import("shared.zig").MessageFlags;
|
||||||
pub const ActivityFlags = @import("shared.zig").ActivityFlags;
|
pub const ActivityFlags = @import("shared.zig").ActivityFlags;
|
||||||
pub const IntegrationExpireBehaviors = @import("shared.zig").IntegrationExpireBehaviors;
|
pub const IntegrationExpireBehaviors = @import("shared.zig").IntegrationExpireBehaviors;
|
||||||
pub const TeamMembershipStates = @import("shared.zig").TeamMembershipStates;
|
pub const TeamMembershipStates = @import("shared.zig").TeamMembershipStates;
|
||||||
pub const ApplicationFlags = @import("shared.zig").ApplicationFlags;
|
pub const ApplicationFlags = @import("shared.zig").ApplicationFlags;
|
||||||
pub const MessageComponentTypes = @import("shared.zig").MessageComponentTypes;
|
pub const MessageComponentTypes = @import("shared.zig").MessageComponentTypes;
|
||||||
pub const TextStyles = @import("shared.zig").TextStyles;
|
pub const TextStyles = @import("shared.zig").TextStyles;
|
||||||
pub const ButtonStyles = @import("shared.zig").ButtonStyles;
|
pub const ButtonStyles = @import("shared.zig").ButtonStyles;
|
||||||
pub const AllowedMentionsTypes = @import("shared.zig").AllowedMentionsTypes;
|
pub const AllowedMentionsTypes = @import("shared.zig").AllowedMentionsTypes;
|
||||||
pub const WebhookTypes = @import("shared.zig").WebhookTypes;
|
pub const WebhookTypes = @import("shared.zig").WebhookTypes;
|
||||||
pub const EmbedTypes = @import("shared.zig").EmbedTypes;
|
pub const EmbedTypes = @import("shared.zig").EmbedTypes;
|
||||||
pub const DefaultMessageNotificationLevels = @import("shared.zig").DefaultMessageNotificationLevels;
|
pub const DefaultMessageNotificationLevels = @import("shared.zig").DefaultMessageNotificationLevels;
|
||||||
pub const ExplicitContentFilterLevels = @import("shared.zig").ExplicitContentFilterLevels;
|
pub const ExplicitContentFilterLevels = @import("shared.zig").ExplicitContentFilterLevels;
|
||||||
pub const VerificationLevels = @import("shared.zig").VerificationLevels;
|
pub const VerificationLevels = @import("shared.zig").VerificationLevels;
|
||||||
pub const GuildFeatures = @import("shared.zig").GuildFeatures;
|
pub const GuildFeatures = @import("shared.zig").GuildFeatures;
|
||||||
pub const MfaLevels = @import("shared.zig").MfaLevels;
|
pub const MfaLevels = @import("shared.zig").MfaLevels;
|
||||||
pub const SystemChannelFlags = @import("shared.zig").SystemChannelFlags;
|
pub const SystemChannelFlags = @import("shared.zig").SystemChannelFlags;
|
||||||
pub const PremiumTiers = @import("shared.zig").PremiumTiers;
|
pub const PremiumTiers = @import("shared.zig").PremiumTiers;
|
||||||
pub const GuildNsfwLevel = @import("shared.zig").GuildNsfwLevel;
|
pub const GuildNsfwLevel = @import("shared.zig").GuildNsfwLevel;
|
||||||
pub const ChannelTypes = @import("shared.zig").ChannelTypes;
|
pub const ChannelTypes = @import("shared.zig").ChannelTypes;
|
||||||
pub const OverwriteTypes = @import("shared.zig").OverwriteTypes;
|
pub const OverwriteTypes = @import("shared.zig").OverwriteTypes;
|
||||||
pub const VideoQualityModes = @import("shared.zig").VideoQualityModes;
|
pub const VideoQualityModes = @import("shared.zig").VideoQualityModes;
|
||||||
pub const ActivityTypes = @import("shared.zig").ActivityTypes;
|
pub const ActivityTypes = @import("shared.zig").ActivityTypes;
|
||||||
pub const MessageTypes = @import("shared.zig").MessageTypes;
|
pub const MessageTypes = @import("shared.zig").MessageTypes;
|
||||||
pub const MessageActivityTypes = @import("shared.zig").MessageActivityTypes;
|
pub const MessageActivityTypes = @import("shared.zig").MessageActivityTypes;
|
||||||
pub const StickerTypes = @import("shared.zig").StickerTypes;
|
pub const StickerTypes = @import("shared.zig").StickerTypes;
|
||||||
pub const StickerFormatTypes = @import("shared.zig").StickerFormatTypes;
|
pub const StickerFormatTypes = @import("shared.zig").StickerFormatTypes;
|
||||||
pub const InteractionTypes = @import("shared.zig").InteractionTypes;
|
pub const InteractionTypes = @import("shared.zig").InteractionTypes;
|
||||||
pub const ApplicationCommandOptionTypes = @import("shared.zig").ApplicationCommandOptionTypes;
|
pub const ApplicationCommandOptionTypes = @import("shared.zig").ApplicationCommandOptionTypes;
|
||||||
pub const AuditLogEvents = @import("shared.zig").AuditLogEvents;
|
pub const AuditLogEvents = @import("shared.zig").AuditLogEvents;
|
||||||
pub const ScheduledEventPrivacyLevel = @import("shared.zig").ScheduledEventPrivacyLevel;
|
pub const ScheduledEventPrivacyLevel = @import("shared.zig").ScheduledEventPrivacyLevel;
|
||||||
pub const ScheduledEventEntityType = @import("shared.zig").ScheduledEventEntityType;
|
pub const ScheduledEventEntityType = @import("shared.zig").ScheduledEventEntityType;
|
||||||
pub const ScheduledEventStatus = @import("shared.zig").ScheduledEventStatus;
|
pub const ScheduledEventStatus = @import("shared.zig").ScheduledEventStatus;
|
||||||
pub const TargetTypes = @import("shared.zig").TargetTypes;
|
pub const TargetTypes = @import("shared.zig").TargetTypes;
|
||||||
pub const ApplicationCommandTypes = @import("shared.zig").ApplicationCommandTypes;
|
pub const ApplicationCommandTypes = @import("shared.zig").ApplicationCommandTypes;
|
||||||
pub const ApplicationCommandPermissionTypes = @import("shared.zig").ApplicationCommandPermissionTypes;
|
pub const ApplicationCommandPermissionTypes = @import("shared.zig").ApplicationCommandPermissionTypes;
|
||||||
pub const BitwisePermissionFlags = @import("shared.zig").BitwisePermissionFlags;
|
pub const BitwisePermissionFlags = @import("shared.zig").BitwisePermissionFlags;
|
||||||
pub const PermissionStrings = @import("shared.zig").PermissionStrings;
|
pub const PermissionStrings = @import("shared.zig").PermissionStrings;
|
||||||
pub const GatewayCloseEventCodes = @import("shared.zig").GatewayCloseEventCodes;
|
pub const GatewayCloseEventCodes = @import("shared.zig").GatewayCloseEventCodes;
|
||||||
pub const GatewayOpcodes = @import("shared.zig").GatewayOpcodes;
|
pub const GatewayOpcodes = @import("shared.zig").GatewayOpcodes;
|
||||||
pub const GatewayDispatchEventNames = @import("shared.zig").GatewayDispatchEventNames;
|
pub const GatewayDispatchEventNames = @import("shared.zig").GatewayDispatchEventNames;
|
||||||
pub const GatewayIntents = @import("shared.zig").GatewayIntents;
|
pub const GatewayIntents = @import("shared.zig").GatewayIntents;
|
||||||
pub const Intents = @import("shared.zig").Intents;
|
pub const Intents = @import("shared.zig").Intents;
|
||||||
pub const InteractionResponseTypes = @import("shared.zig").InteractionResponseTypes;
|
pub const InteractionResponseTypes = @import("shared.zig").InteractionResponseTypes;
|
||||||
pub const SortOrderTypes = @import("shared.zig").SortOrderTypes;
|
pub const SortOrderTypes = @import("shared.zig").SortOrderTypes;
|
||||||
pub const ForumLayout = @import("shared.zig").ForumLayout;
|
pub const ForumLayout = @import("shared.zig").ForumLayout;
|
||||||
pub const ImageFormat = @import("shared.zig").ImageFormat;
|
pub const ImageFormat = @import("shared.zig").ImageFormat;
|
||||||
pub const ImageSize = @import("shared.zig").ImageSize;
|
pub const ImageSize = @import("shared.zig").ImageSize;
|
||||||
pub const Locales = @import("shared.zig").Locales;
|
pub const Locales = @import("shared.zig").Locales;
|
||||||
pub const OAuth2Scope = @import("shared.zig").OAuth2Scope;
|
pub const OAuth2Scope = @import("shared.zig").OAuth2Scope;
|
||||||
// partial.zig
|
// partial.zig
|
||||||
pub const Partial = @import("partial.zig").Partial;
|
pub const Partial = @import("partial.zig").Partial;
|
||||||
// snowflake.zig
|
// snowflake.zig
|
||||||
pub const discord_epoch = @import("snowflake.zig").discord_epoch;
|
pub const discord_epoch = @import("snowflake.zig").discord_epoch;
|
||||||
pub const Snowflake = @import("snowflake.zig").Snowflake;
|
pub const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
// events.zig
|
// events.zig
|
||||||
pub const GuildMembersChunk = @import("events.zig").GuildMembersChunk;
|
pub const GuildMembersChunk = @import("events.zig").GuildMembersChunk;
|
||||||
pub const ChannelPinsUpdate = @import("events.zig").ChannelPinsUpdate;
|
pub const ChannelPinsUpdate = @import("events.zig").ChannelPinsUpdate;
|
||||||
pub const GuildRoleDelete = @import("events.zig").GuildRoleDelete;
|
pub const GuildRoleDelete = @import("events.zig").GuildRoleDelete;
|
||||||
pub const GuildBanAddRemove = @import("events.zig").GuildBanAddRemove;
|
pub const GuildBanAddRemove = @import("events.zig").GuildBanAddRemove;
|
||||||
pub const MessageReactionRemove = @import("events.zig").MessageReactionRemove;
|
pub const MessageReactionRemove = @import("events.zig").MessageReactionRemove;
|
||||||
pub const MessageReactionAdd = @import("events.zig").MessageReactionAdd;
|
pub const MessageReactionAdd = @import("events.zig").MessageReactionAdd;
|
||||||
pub const VoiceServerUpdate = @import("events.zig").VoiceServerUpdate;
|
pub const VoiceServerUpdate = @import("events.zig").VoiceServerUpdate;
|
||||||
pub const VoiceChannelEffectSend = @import("events.zig").VoiceChannelEffectSend;
|
pub const VoiceChannelEffectSend = @import("events.zig").VoiceChannelEffectSend;
|
||||||
pub const VoiceChannelEffectAnimationType = @import("events.zig").VoiceChannelEffectAnimationType;
|
pub const VoiceChannelEffectAnimationType = @import("events.zig").VoiceChannelEffectAnimationType;
|
||||||
pub const InviteCreate = @import("events.zig").InviteCreate;
|
pub const InviteCreate = @import("events.zig").InviteCreate;
|
||||||
pub const Hello = @import("events.zig").Hello;
|
pub const Hello = @import("events.zig").Hello;
|
||||||
pub const Ready = @import("events.zig").Ready;
|
pub const Ready = @import("events.zig").Ready;
|
||||||
pub const UnavailableGuild = @import("events.zig").UnavailableGuild;
|
pub const UnavailableGuild = @import("events.zig").UnavailableGuild;
|
||||||
pub const MessageDeleteBulk = @import("events.zig").MessageDeleteBulk;
|
pub const MessageDeleteBulk = @import("events.zig").MessageDeleteBulk;
|
||||||
pub const Template = @import("events.zig").Template;
|
pub const Template = @import("events.zig").Template;
|
||||||
pub const TemplateSerializedSourceGuild = @import("events.zig").TemplateSerializedSourceGuild;
|
pub const TemplateSerializedSourceGuild = @import("events.zig").TemplateSerializedSourceGuild;
|
||||||
pub const GuildMemberAdd = @import("events.zig").GuildMemberAdd;
|
pub const GuildMemberAdd = @import("events.zig").GuildMemberAdd;
|
||||||
pub const MessageDelete = @import("events.zig").MessageDelete;
|
pub const MessageDelete = @import("events.zig").MessageDelete;
|
||||||
pub const ThreadMembersUpdate = @import("events.zig").ThreadMembersUpdate;
|
pub const ThreadMembersUpdate = @import("events.zig").ThreadMembersUpdate;
|
||||||
pub const ThreadMemberUpdate = @import("events.zig").ThreadMemberUpdate;
|
pub const ThreadMemberUpdate = @import("events.zig").ThreadMemberUpdate;
|
||||||
pub const GuildRoleCreate = @import("events.zig").GuildRoleCreate;
|
pub const GuildRoleCreate = @import("events.zig").GuildRoleCreate;
|
||||||
pub const GuildEmojisUpdate = @import("events.zig").GuildEmojisUpdate;
|
pub const GuildEmojisUpdate = @import("events.zig").GuildEmojisUpdate;
|
||||||
pub const GuildStickersUpdate = @import("events.zig").GuildStickersUpdate;
|
pub const GuildStickersUpdate = @import("events.zig").GuildStickersUpdate;
|
||||||
pub const GuildMemberUpdate = @import("events.zig").GuildMemberUpdate;
|
pub const GuildMemberUpdate = @import("events.zig").GuildMemberUpdate;
|
||||||
pub const MessageReactionRemoveAll = @import("events.zig").MessageReactionRemoveAll;
|
pub const MessageReactionRemoveAll = @import("events.zig").MessageReactionRemoveAll;
|
||||||
pub const GuildRoleUpdate = @import("events.zig").GuildRoleUpdate;
|
pub const GuildRoleUpdate = @import("events.zig").GuildRoleUpdate;
|
||||||
pub const ScheduledEventUserAdd = @import("events.zig").ScheduledEventUserAdd;
|
pub const ScheduledEventUserAdd = @import("events.zig").ScheduledEventUserAdd;
|
||||||
pub const MessageReactionRemoveEmoji = @import("events.zig").MessageReactionRemoveEmoji;
|
pub const MessageReactionRemoveEmoji = @import("events.zig").MessageReactionRemoveEmoji;
|
||||||
pub const GuildMemberRemove = @import("events.zig").GuildMemberRemove;
|
pub const GuildMemberRemove = @import("events.zig").GuildMemberRemove;
|
||||||
pub const Ban = @import("events.zig").Ban;
|
pub const Ban = @import("events.zig").Ban;
|
||||||
pub const ScheduledEventUserRemove = @import("events.zig").ScheduledEventUserRemove;
|
pub const ScheduledEventUserRemove = @import("events.zig").ScheduledEventUserRemove;
|
||||||
pub const InviteDelete = @import("events.zig").InviteDelete;
|
pub const InviteDelete = @import("events.zig").InviteDelete;
|
||||||
pub const VoiceRegion = @import("events.zig").VoiceRegion;
|
pub const VoiceRegion = @import("events.zig").VoiceRegion;
|
||||||
pub const GuildWidgetSettings = @import("events.zig").GuildWidgetSettings;
|
pub const GuildWidgetSettings = @import("events.zig").GuildWidgetSettings;
|
||||||
pub const ModifyChannel = @import("events.zig").ModifyChannel;
|
pub const ModifyChannel = @import("events.zig").ModifyChannel;
|
||||||
pub const CreateGuildEmoji = @import("events.zig").CreateGuildEmoji;
|
pub const CreateGuildEmoji = @import("events.zig").CreateGuildEmoji;
|
||||||
pub const ModifyGuildEmoji = @import("events.zig").ModifyGuildEmoji;
|
pub const ModifyGuildEmoji = @import("events.zig").ModifyGuildEmoji;
|
||||||
pub const CreateGuildChannel = @import("events.zig").CreateGuildChannel;
|
pub const CreateGuildChannel = @import("events.zig").CreateGuildChannel;
|
||||||
pub const CreateMessage = @import("events.zig").CreateMessage;
|
pub const CreateMessage = @import("events.zig").CreateMessage;
|
||||||
pub const ModifyGuildWelcomeScreen = @import("events.zig").ModifyGuildWelcomeScreen;
|
pub const ModifyGuildWelcomeScreen = @import("events.zig").ModifyGuildWelcomeScreen;
|
||||||
pub const FollowAnnouncementChannel = @import("events.zig").FollowAnnouncementChannel;
|
pub const FollowAnnouncementChannel = @import("events.zig").FollowAnnouncementChannel;
|
||||||
pub const EditChannelPermissionOverridesOptions = @import("events.zig").EditChannelPermissionOverridesOptions;
|
pub const EditChannelPermissionOverridesOptions = @import("events.zig").EditChannelPermissionOverridesOptions;
|
||||||
pub const CreateWebhook = @import("events.zig").CreateWebhook;
|
pub const CreateWebhook = @import("events.zig").CreateWebhook;
|
||||||
pub const CreateForumPostWithMessage = @import("events.zig").CreateForumPostWithMessage;
|
pub const CreateForumPostWithMessage = @import("events.zig").CreateForumPostWithMessage;
|
||||||
pub const ArchivedThreads = @import("events.zig").ArchivedThreads;
|
pub const ArchivedThreads = @import("events.zig").ArchivedThreads;
|
||||||
pub const ActiveThreads = @import("events.zig").ActiveThreads;
|
pub const ActiveThreads = @import("events.zig").ActiveThreads;
|
||||||
pub const VanityUrl = @import("events.zig").VanityUrl;
|
pub const VanityUrl = @import("events.zig").VanityUrl;
|
||||||
pub const PrunedCount = @import("events.zig").PrunedCount;
|
pub const PrunedCount = @import("events.zig").PrunedCount;
|
||||||
pub const TeamMemberRole = @import("events.zig").TeamMemberRole;
|
pub const TeamMemberRole = @import("events.zig").TeamMemberRole;
|
||||||
pub const BulkBan = @import("events.zig").BulkBan;
|
pub const BulkBan = @import("events.zig").BulkBan;
|
||||||
|
|
||||||
// application.zig
|
// application.zig
|
||||||
pub const Application = @import("application.zig").Application;
|
pub const Application = @import("application.zig").Application;
|
||||||
pub const ApplicationIntegrationTypeConfiguration = @import("application.zig").ApplicationIntegrationTypeConfiguration;
|
pub const ApplicationIntegrationTypeConfiguration = @import("application.zig").ApplicationIntegrationTypeConfiguration;
|
||||||
pub const ApplicationIntegrationType = @import("application.zig").ApplicationIntegrationType;
|
pub const ApplicationIntegrationType = @import("application.zig").ApplicationIntegrationType;
|
||||||
pub const InstallParams = @import("application.zig").InstallParams;
|
pub const InstallParams = @import("application.zig").InstallParams;
|
||||||
pub const ModifyApplication = @import("application.zig").ModifyApplication;
|
pub const ModifyApplication = @import("application.zig").ModifyApplication;
|
||||||
pub const ApplicationEventWebhookStatus = @import("application.zig").ApplicationEventWebhookStatus;
|
pub const ApplicationEventWebhookStatus = @import("application.zig").ApplicationEventWebhookStatus;
|
||||||
pub const WebhookEventType = @import("application.zig").WebhookEventType;
|
pub const WebhookEventType = @import("application.zig").WebhookEventType;
|
||||||
// attachment.zig
|
// attachment.zig
|
||||||
pub const Attachment = @import("attachment.zig").Attachment;
|
pub const Attachment = @import("attachment.zig").Attachment;
|
||||||
// auditlog.zig
|
// auditlog.zig
|
||||||
pub const AuditLog = @import("auditlog.zig").AuditLog;
|
pub const AuditLog = @import("auditlog.zig").AuditLog;
|
||||||
pub const AuditLogEntry = @import("auditlog.zig").AuditLogEntry;
|
pub const AuditLogEntry = @import("auditlog.zig").AuditLogEntry;
|
||||||
pub const OptionalAuditEntryInfo = @import("auditlog.zig").OptionalAuditEntryInfo;
|
pub const OptionalAuditEntryInfo = @import("auditlog.zig").OptionalAuditEntryInfo;
|
||||||
pub const AuditLogChange = @import("auditlog.zig").AuditLogChange;
|
pub const AuditLogChange = @import("auditlog.zig").AuditLogChange;
|
||||||
// automod.zig
|
// automod.zig
|
||||||
pub const AutoModerationRule = @import("automod.zig").AutoModerationRule;
|
pub const AutoModerationRule = @import("automod.zig").AutoModerationRule;
|
||||||
pub const AutoModerationEventTypes = @import("automod.zig").AutoModerationEventTypes;
|
pub const AutoModerationEventTypes = @import("automod.zig").AutoModerationEventTypes;
|
||||||
pub const AutoModerationTriggerTypes = @import("automod.zig").AutoModerationTriggerTypes;
|
pub const AutoModerationTriggerTypes = @import("automod.zig").AutoModerationTriggerTypes;
|
||||||
pub const AutoModerationRuleTriggerMetadata = @import("automod.zig").AutoModerationRuleTriggerMetadata;
|
pub const AutoModerationRuleTriggerMetadata = @import("automod.zig").AutoModerationRuleTriggerMetadata;
|
||||||
pub const AutoModerationRuleTriggerMetadataPresets = @import("automod.zig").AutoModerationRuleTriggerMetadataPresets;
|
pub const AutoModerationRuleTriggerMetadataPresets = @import("automod.zig").AutoModerationRuleTriggerMetadataPresets;
|
||||||
pub const AutoModerationAction = @import("automod.zig").AutoModerationAction;
|
pub const AutoModerationAction = @import("automod.zig").AutoModerationAction;
|
||||||
pub const AutoModerationActionType = @import("automod.zig").AutoModerationActionType;
|
pub const AutoModerationActionType = @import("automod.zig").AutoModerationActionType;
|
||||||
pub const AutoModerationActionMetadata = @import("automod.zig").AutoModerationActionMetadata;
|
pub const AutoModerationActionMetadata = @import("automod.zig").AutoModerationActionMetadata;
|
||||||
pub const AutoModerationActionExecution = @import("automod.zig").AutoModerationActionExecution;
|
pub const AutoModerationActionExecution = @import("automod.zig").AutoModerationActionExecution;
|
||||||
// channel.zig
|
// channel.zig
|
||||||
pub const TypingStart = @import("channel.zig").TypingStart;
|
pub const TypingStart = @import("channel.zig").TypingStart;
|
||||||
pub const Channel = @import("channel.zig").Channel;
|
pub const Channel = @import("channel.zig").Channel;
|
||||||
pub const WelcomeScreen = @import("channel.zig").WelcomeScreen;
|
pub const WelcomeScreen = @import("channel.zig").WelcomeScreen;
|
||||||
pub const WelcomeScreenChannel = @import("channel.zig").WelcomeScreenChannel;
|
pub const WelcomeScreenChannel = @import("channel.zig").WelcomeScreenChannel;
|
||||||
pub const StageInstance = @import("channel.zig").StageInstance;
|
pub const StageInstance = @import("channel.zig").StageInstance;
|
||||||
pub const Overwrite = @import("channel.zig").Overwrite;
|
pub const Overwrite = @import("channel.zig").Overwrite;
|
||||||
pub const FollowedChannel = @import("channel.zig").FollowedChannel;
|
pub const FollowedChannel = @import("channel.zig").FollowedChannel;
|
||||||
pub const ForumTag = @import("channel.zig").ForumTag;
|
pub const ForumTag = @import("channel.zig").ForumTag;
|
||||||
pub const DefaultReactionEmoji = @import("channel.zig").DefaultReactionEmoji;
|
pub const DefaultReactionEmoji = @import("channel.zig").DefaultReactionEmoji;
|
||||||
pub const ModifyGuildChannelPositions = @import("channel.zig").ModifyGuildChannelPositions;
|
pub const ModifyGuildChannelPositions = @import("channel.zig").ModifyGuildChannelPositions;
|
||||||
pub const CreateChannelInvite = @import("channel.zig").CreateChannelInvite;
|
pub const CreateChannelInvite = @import("channel.zig").CreateChannelInvite;
|
||||||
// command.zig
|
// command.zig
|
||||||
pub const ApplicationCommand = @import("command.zig").ApplicationCommand;
|
pub const ApplicationCommand = @import("command.zig").ApplicationCommand;
|
||||||
pub const CreateApplicationCommand = @import("command.zig").CreateApplicationCommand;
|
pub const CreateApplicationCommand = @import("command.zig").CreateApplicationCommand;
|
||||||
pub const LocaleMap = @import("command.zig").LocaleMap;
|
pub const LocaleMap = @import("command.zig").LocaleMap;
|
||||||
pub const InteractionEntryPointCommandHandlerType = @import("command.zig").InteractionEntryPointCommandHandlerType;
|
pub const InteractionEntryPointCommandHandlerType = @import("command.zig").InteractionEntryPointCommandHandlerType;
|
||||||
pub const ApplicationCommandOption = @import("command.zig").ApplicationCommandOption;
|
pub const ApplicationCommandOption = @import("command.zig").ApplicationCommandOption;
|
||||||
pub const ApplicationCommandOptionChoice = @import("command.zig").ApplicationCommandOptionChoice;
|
pub const ApplicationCommandOptionChoice = @import("command.zig").ApplicationCommandOptionChoice;
|
||||||
pub const GuildApplicationCommandPermissions = @import("command.zig").GuildApplicationCommandPermissions;
|
pub const GuildApplicationCommandPermissions = @import("command.zig").GuildApplicationCommandPermissions;
|
||||||
pub const ApplicationCommandPermissions = @import("command.zig").ApplicationCommandPermissions;
|
pub const ApplicationCommandPermissions = @import("command.zig").ApplicationCommandPermissions;
|
||||||
// component.zig
|
// component.zig
|
||||||
pub const Button = @import("component.zig").Button;
|
pub const Button = @import("component.zig").Button;
|
||||||
pub const SelectOption = @import("component.zig").SelectOption;
|
pub const SelectOption = @import("component.zig").SelectOption;
|
||||||
pub const DefaultValue = @import("component.zig").DefaultValue;
|
pub const DefaultValue = @import("component.zig").DefaultValue;
|
||||||
pub const SelectMenuString = @import("component.zig").SelectMenuString;
|
pub const SelectMenuString = @import("component.zig").SelectMenuString;
|
||||||
pub const SelectMenuUsers = @import("component.zig").SelectMenuUsers;
|
pub const SelectMenuUsers = @import("component.zig").SelectMenuUsers;
|
||||||
pub const SelectMenuRoles = @import("component.zig").SelectMenuRoles;
|
pub const SelectMenuRoles = @import("component.zig").SelectMenuRoles;
|
||||||
pub const SelectMenuUsersAndRoles = @import("component.zig").SelectMenuUsersAndRoles;
|
pub const SelectMenuUsersAndRoles = @import("component.zig").SelectMenuUsersAndRoles;
|
||||||
pub const SelectMenuChannels = @import("component.zig").SelectMenuChannels;
|
pub const SelectMenuChannels = @import("component.zig").SelectMenuChannels;
|
||||||
pub const SelectMenu = @import("component.zig").SelectMenu;
|
pub const SelectMenu = @import("component.zig").SelectMenu;
|
||||||
pub const InputTextStyles = @import("component.zig").InputTextStyles;
|
pub const InputTextStyles = @import("component.zig").InputTextStyles;
|
||||||
pub const InputText = @import("component.zig").InputText;
|
pub const InputText = @import("component.zig").InputText;
|
||||||
pub const MessageComponent = @import("component.zig").MessageComponent;
|
pub const MessageComponent = @import("component.zig").MessageComponent;
|
||||||
// embed.zig
|
// embed.zig
|
||||||
pub const Embed = @import("embed.zig").Embed;
|
pub const Embed = @import("embed.zig").Embed;
|
||||||
pub const EmbedAuthor = @import("embed.zig").EmbedAuthor;
|
pub const EmbedAuthor = @import("embed.zig").EmbedAuthor;
|
||||||
pub const EmbedField = @import("embed.zig").EmbedField;
|
pub const EmbedField = @import("embed.zig").EmbedField;
|
||||||
pub const EmbedFooter = @import("embed.zig").EmbedFooter;
|
pub const EmbedFooter = @import("embed.zig").EmbedFooter;
|
||||||
pub const EmbedImage = @import("embed.zig").EmbedImage;
|
pub const EmbedImage = @import("embed.zig").EmbedImage;
|
||||||
pub const EmbedProvider = @import("embed.zig").EmbedProvider;
|
pub const EmbedProvider = @import("embed.zig").EmbedProvider;
|
||||||
pub const EmbedThumbnail = @import("embed.zig").EmbedThumbnail;
|
pub const EmbedThumbnail = @import("embed.zig").EmbedThumbnail;
|
||||||
pub const EmbedVideo = @import("embed.zig").EmbedVideo;
|
pub const EmbedVideo = @import("embed.zig").EmbedVideo;
|
||||||
// emoji.zig
|
// emoji.zig
|
||||||
pub const Emoji = @import("emoji.zig").Emoji;
|
pub const Emoji = @import("emoji.zig").Emoji;
|
||||||
// gateway.zig
|
// gateway.zig
|
||||||
pub const GetGatewayBot = @import("gateway.zig").GetGatewayBot;
|
pub const GetGatewayBot = @import("gateway.zig").GetGatewayBot;
|
||||||
pub const SessionStartLimit = @import("gateway.zig").SessionStartLimit;
|
pub const SessionStartLimit = @import("gateway.zig").SessionStartLimit;
|
||||||
pub const PresenceUpdate = @import("gateway.zig").PresenceUpdate;
|
pub const PresenceUpdate = @import("gateway.zig").PresenceUpdate;
|
||||||
pub const Activity = @import("gateway.zig").Activity;
|
pub const Activity = @import("gateway.zig").Activity;
|
||||||
pub const ActivityInstance = @import("gateway.zig").ActivityInstance;
|
pub const ActivityInstance = @import("gateway.zig").ActivityInstance;
|
||||||
pub const ActivityLocation = @import("gateway.zig").ActivityLocation;
|
pub const ActivityLocation = @import("gateway.zig").ActivityLocation;
|
||||||
pub const ActivityLocationKind = @import("gateway.zig").ActivityLocationKind;
|
pub const ActivityLocationKind = @import("gateway.zig").ActivityLocationKind;
|
||||||
pub const ClientStatus = @import("gateway.zig").ClientStatus;
|
pub const ClientStatus = @import("gateway.zig").ClientStatus;
|
||||||
pub const ActivityTimestamps = @import("gateway.zig").ActivityTimestamps;
|
pub const ActivityTimestamps = @import("gateway.zig").ActivityTimestamps;
|
||||||
pub const ActivityEmoji = @import("gateway.zig").ActivityEmoji;
|
pub const ActivityEmoji = @import("gateway.zig").ActivityEmoji;
|
||||||
pub const ActivityParty = @import("gateway.zig").ActivityParty;
|
pub const ActivityParty = @import("gateway.zig").ActivityParty;
|
||||||
pub const ActivityAssets = @import("gateway.zig").ActivityAssets;
|
pub const ActivityAssets = @import("gateway.zig").ActivityAssets;
|
||||||
pub const ActivitySecrets = @import("gateway.zig").ActivitySecrets;
|
pub const ActivitySecrets = @import("gateway.zig").ActivitySecrets;
|
||||||
pub const ActivityButton = @import("gateway.zig").ActivityButton;
|
pub const ActivityButton = @import("gateway.zig").ActivityButton;
|
||||||
// guild.zig
|
// guild.zig
|
||||||
pub const Guild = @import("guild.zig").Guild;
|
pub const Guild = @import("guild.zig").Guild;
|
||||||
pub const VoiceState = @import("guild.zig").VoiceState;
|
pub const VoiceState = @import("guild.zig").VoiceState;
|
||||||
pub const GuildWidget = @import("guild.zig").GuildWidget;
|
pub const GuildWidget = @import("guild.zig").GuildWidget;
|
||||||
pub const GuildPreview = @import("guild.zig").GuildPreview;
|
pub const GuildPreview = @import("guild.zig").GuildPreview;
|
||||||
pub const CreateGuild = @import("guild.zig").CreateGuild;
|
pub const CreateGuild = @import("guild.zig").CreateGuild;
|
||||||
pub const ModifyGuild = @import("guild.zig").ModifyGuild;
|
pub const ModifyGuild = @import("guild.zig").ModifyGuild;
|
||||||
pub const CreateGuildBan = @import("guild.zig").CreateGuildBan;
|
pub const CreateGuildBan = @import("guild.zig").CreateGuildBan;
|
||||||
pub const GetGuildPruneCountQuery = @import("guild.zig").GetGuildPruneCountQuery;
|
pub const GetGuildPruneCountQuery = @import("guild.zig").GetGuildPruneCountQuery;
|
||||||
pub const BeginGuildPrune = @import("guild.zig").BeginGuildPrune;
|
pub const BeginGuildPrune = @import("guild.zig").BeginGuildPrune;
|
||||||
pub const ModifyGuildOnboarding = @import("guild.zig").ModifyGuildOnboarding;
|
pub const ModifyGuildOnboarding = @import("guild.zig").ModifyGuildOnboarding;
|
||||||
pub const GuildOnboarding = @import("guild.zig").GuildOnboarding;
|
pub const GuildOnboarding = @import("guild.zig").GuildOnboarding;
|
||||||
pub const GuildOnboardingPrompt = @import("guild.zig").GuildOnboardingPrompt;
|
pub const GuildOnboardingPrompt = @import("guild.zig").GuildOnboardingPrompt;
|
||||||
pub const GuildOnboardingPromptOption = @import("guild.zig").GuildOnboardingPromptOption;
|
pub const GuildOnboardingPromptOption = @import("guild.zig").GuildOnboardingPromptOption;
|
||||||
pub const GuildOnboardingPromptType = @import("guild.zig").GuildOnboardingPromptType;
|
pub const GuildOnboardingPromptType = @import("guild.zig").GuildOnboardingPromptType;
|
||||||
pub const GuildOnboardingMode = @import("guild.zig").GuildOnboardingMode;
|
pub const GuildOnboardingMode = @import("guild.zig").GuildOnboardingMode;
|
||||||
// integration.zig
|
// integration.zig
|
||||||
pub const Integration = @import("integration.zig").Integration;
|
pub const Integration = @import("integration.zig").Integration;
|
||||||
pub const IntegrationAccount = @import("integration.zig").IntegrationAccount;
|
pub const IntegrationAccount = @import("integration.zig").IntegrationAccount;
|
||||||
pub const IntegrationApplication = @import("integration.zig").IntegrationApplication;
|
pub const IntegrationApplication = @import("integration.zig").IntegrationApplication;
|
||||||
pub const IntegrationCreateUpdate = @import("integration.zig").IntegrationCreateUpdate;
|
pub const IntegrationCreateUpdate = @import("integration.zig").IntegrationCreateUpdate;
|
||||||
pub const IntegrationDelete = @import("integration.zig").IntegrationDelete;
|
pub const IntegrationDelete = @import("integration.zig").IntegrationDelete;
|
||||||
pub const GuildIntegrationsUpdate = @import("integration.zig").GuildIntegrationsUpdate;
|
pub const GuildIntegrationsUpdate = @import("integration.zig").GuildIntegrationsUpdate;
|
||||||
pub const InteractionContextType = @import("integration.zig").InteractionContextType;
|
pub const InteractionContextType = @import("integration.zig").InteractionContextType;
|
||||||
// invite.zig
|
// invite.zig
|
||||||
pub const InviteMetadata = @import("invite.zig").InviteMetadata;
|
pub const InviteMetadata = @import("invite.zig").InviteMetadata;
|
||||||
pub const Invite = @import("invite.zig").Invite;
|
pub const Invite = @import("invite.zig").Invite;
|
||||||
pub const InviteType = @import("invite.zig").InviteType;
|
pub const InviteType = @import("invite.zig").InviteType;
|
||||||
pub const InviteStageInstance = @import("invite.zig").InviteStageInstance;
|
pub const InviteStageInstance = @import("invite.zig").InviteStageInstance;
|
||||||
// member.zig
|
// member.zig
|
||||||
pub const Member = @import("member.zig").Member;
|
pub const Member = @import("member.zig").Member;
|
||||||
pub const MemberWithUser = @import("member.zig").MemberWithUser;
|
pub const MemberWithUser = @import("member.zig").MemberWithUser;
|
||||||
pub const AddGuildMember = @import("member.zig").AddGuildMember;
|
pub const AddGuildMember = @import("member.zig").AddGuildMember;
|
||||||
pub const ModifyGuildMember = @import("member.zig").ModifyGuildMember;
|
pub const ModifyGuildMember = @import("member.zig").ModifyGuildMember;
|
||||||
// message.zig
|
// message.zig
|
||||||
pub const Message = @import("message.zig").Message;
|
pub const Message = @import("message.zig").Message;
|
||||||
pub const MessageCall = @import("message.zig").MessageCall;
|
pub const MessageCall = @import("message.zig").MessageCall;
|
||||||
pub const ChannelMention = @import("message.zig").ChannelMention;
|
pub const ChannelMention = @import("message.zig").ChannelMention;
|
||||||
pub const Reaction = @import("message.zig").Reaction;
|
pub const Reaction = @import("message.zig").Reaction;
|
||||||
pub const ReactionType = @import("message.zig").ReactionType;
|
pub const ReactionType = @import("message.zig").ReactionType;
|
||||||
pub const ReactionCountDetails = @import("message.zig").ReactionCountDetails;
|
pub const ReactionCountDetails = @import("message.zig").ReactionCountDetails;
|
||||||
pub const MessageActivity = @import("message.zig").MessageActivity;
|
pub const MessageActivity = @import("message.zig").MessageActivity;
|
||||||
pub const MessageReference = @import("message.zig").MessageReference;
|
pub const MessageReference = @import("message.zig").MessageReference;
|
||||||
pub const MessageReferenceType = @import("message.zig").MessageReferenceType;
|
pub const MessageReferenceType = @import("message.zig").MessageReferenceType;
|
||||||
pub const MessageSnapshot = @import("message.zig").MessageSnapshot;
|
pub const MessageSnapshot = @import("message.zig").MessageSnapshot;
|
||||||
pub const MessageInteraction = @import("message.zig").MessageInteraction;
|
pub const MessageInteraction = @import("message.zig").MessageInteraction;
|
||||||
pub const MessageInteractionMetadata = @import("message.zig").MessageInteractionMetadata;
|
pub const MessageInteractionMetadata = @import("message.zig").MessageInteractionMetadata;
|
||||||
pub const AllowedMentions = @import("message.zig").AllowedMentions;
|
pub const AllowedMentions = @import("message.zig").AllowedMentions;
|
||||||
pub const GetMessagesQuery = @import("message.zig").GetMessagesQuery;
|
pub const GetMessagesQuery = @import("message.zig").GetMessagesQuery;
|
||||||
// monetization.zig
|
// monetization.zig
|
||||||
pub const Entitlement = @import("monetization.zig").Entitlement;
|
pub const Entitlement = @import("monetization.zig").Entitlement;
|
||||||
pub const EntitlementType = @import("monetization.zig").EntitlementType;
|
pub const EntitlementType = @import("monetization.zig").EntitlementType;
|
||||||
pub const Sku = @import("monetization.zig").Sku;
|
pub const Sku = @import("monetization.zig").Sku;
|
||||||
pub const SkuType = @import("monetization.zig").SkuType;
|
pub const SkuType = @import("monetization.zig").SkuType;
|
||||||
pub const CreateTestEntitlement = @import("monetization.zig").CreateTestEntitlement;
|
pub const CreateTestEntitlement = @import("monetization.zig").CreateTestEntitlement;
|
||||||
// oauth.zig
|
// oauth.zig
|
||||||
pub const TokenExchangeAuthorizationCode = @import("oauth.zig").TokenExchangeAuthorizationCode;
|
pub const TokenExchangeAuthorizationCode = @import("oauth.zig").TokenExchangeAuthorizationCode;
|
||||||
pub const TokenExchangeRefreshToken = @import("oauth.zig").TokenExchangeRefreshToken;
|
pub const TokenExchangeRefreshToken = @import("oauth.zig").TokenExchangeRefreshToken;
|
||||||
pub const TokenExchangeClientCredentials = @import("oauth.zig").TokenExchangeClientCredentials;
|
pub const TokenExchangeClientCredentials = @import("oauth.zig").TokenExchangeClientCredentials;
|
||||||
pub const AccessTokenResponse = @import("oauth.zig").AccessTokenResponse;
|
pub const AccessTokenResponse = @import("oauth.zig").AccessTokenResponse;
|
||||||
// poll.zig
|
// poll.zig
|
||||||
pub const Poll = @import("poll.zig").Poll;
|
pub const Poll = @import("poll.zig").Poll;
|
||||||
pub const PollLayoutType = @import("poll.zig").PollLayoutType;
|
pub const PollLayoutType = @import("poll.zig").PollLayoutType;
|
||||||
pub const PollMedia = @import("poll.zig").PollMedia;
|
pub const PollMedia = @import("poll.zig").PollMedia;
|
||||||
pub const PollAnswer = @import("poll.zig").PollAnswer;
|
pub const PollAnswer = @import("poll.zig").PollAnswer;
|
||||||
pub const PollAnswerCount = @import("poll.zig").PollAnswerCount;
|
pub const PollAnswerCount = @import("poll.zig").PollAnswerCount;
|
||||||
pub const PollResult = @import("poll.zig").PollResult;
|
pub const PollResult = @import("poll.zig").PollResult;
|
||||||
pub const GetAnswerVotesResponse = @import("poll.zig").GetAnswerVotesResponse;
|
pub const GetAnswerVotesResponse = @import("poll.zig").GetAnswerVotesResponse;
|
||||||
pub const PollVoteAdd = @import("poll.zig").PollVoteAdd;
|
pub const PollVoteAdd = @import("poll.zig").PollVoteAdd;
|
||||||
pub const PollVoteRemove = @import("poll.zig").PollVoteRemove;
|
pub const PollVoteRemove = @import("poll.zig").PollVoteRemove;
|
||||||
// role.zig
|
// role.zig
|
||||||
pub const Role = @import("role.zig").Role;
|
pub const Role = @import("role.zig").Role;
|
||||||
pub const RoleTags = @import("role.zig").RoleTags;
|
pub const RoleTags = @import("role.zig").RoleTags;
|
||||||
pub const CreateGuildRole = @import("role.zig").CreateGuildRole;
|
pub const CreateGuildRole = @import("role.zig").CreateGuildRole;
|
||||||
pub const ModifyGuildRole = @import("role.zig").ModifyGuildRole;
|
pub const ModifyGuildRole = @import("role.zig").ModifyGuildRole;
|
||||||
// scheduled_event.zig
|
// scheduled_event.zig
|
||||||
pub const ScheduledEvent = @import("scheduled_event.zig").ScheduledEvent;
|
pub const ScheduledEvent = @import("scheduled_event.zig").ScheduledEvent;
|
||||||
pub const ScheduledEventEntityMetadata = @import("scheduled_event.zig").ScheduledEventEntityMetadata;
|
pub const ScheduledEventEntityMetadata = @import("scheduled_event.zig").ScheduledEventEntityMetadata;
|
||||||
pub const ScheduledEventRecurrenceRule = @import("scheduled_event.zig").ScheduledEventRecurrenceRule;
|
pub const ScheduledEventRecurrenceRule = @import("scheduled_event.zig").ScheduledEventRecurrenceRule;
|
||||||
pub const ScheduledEventRecurrenceRuleFrequency = @import("scheduled_event.zig").ScheduledEventRecurrenceRuleFrequency;
|
pub const ScheduledEventRecurrenceRuleFrequency = @import("scheduled_event.zig").ScheduledEventRecurrenceRuleFrequency;
|
||||||
pub const ScheduledEventRecurrenceRuleWeekday = @import("scheduled_event.zig").ScheduledEventRecurrenceRuleWeekday;
|
pub const ScheduledEventRecurrenceRuleWeekday = @import("scheduled_event.zig").ScheduledEventRecurrenceRuleWeekday;
|
||||||
pub const ScheduledEventRecurrenceRuleNWeekday = @import("scheduled_event.zig").ScheduledEventRecurrenceRuleNWeekday;
|
pub const ScheduledEventRecurrenceRuleNWeekday = @import("scheduled_event.zig").ScheduledEventRecurrenceRuleNWeekday;
|
||||||
pub const ScheduledEventRecurrenceRuleMonth = @import("scheduled_event.zig").ScheduledEventRecurrenceRuleMonth;
|
pub const ScheduledEventRecurrenceRuleMonth = @import("scheduled_event.zig").ScheduledEventRecurrenceRuleMonth;
|
||||||
// sticker.zig
|
// sticker.zig
|
||||||
pub const Sticker = @import("sticker.zig").Sticker;
|
pub const Sticker = @import("sticker.zig").Sticker;
|
||||||
pub const StickerItem = @import("sticker.zig").StickerItem;
|
pub const StickerItem = @import("sticker.zig").StickerItem;
|
||||||
pub const StickerPack = @import("sticker.zig").StickerPack;
|
pub const StickerPack = @import("sticker.zig").StickerPack;
|
||||||
pub const CreateModifyGuildSticker = @import("sticker.zig").CreateModifyGuildSticker;
|
pub const CreateModifyGuildSticker = @import("sticker.zig").CreateModifyGuildSticker;
|
||||||
// team.zig
|
// team.zig
|
||||||
pub const Team = @import("team.zig").Team;
|
pub const Team = @import("team.zig").Team;
|
||||||
pub const TeamMember = @import("team.zig").TeamMember;
|
pub const TeamMember = @import("team.zig").TeamMember;
|
||||||
// thread.zig
|
// thread.zig
|
||||||
pub const ThreadMetadata = @import("thread.zig").ThreadMetadata;
|
pub const ThreadMetadata = @import("thread.zig").ThreadMetadata;
|
||||||
pub const ThreadMember = @import("thread.zig").ThreadMember;
|
pub const ThreadMember = @import("thread.zig").ThreadMember;
|
||||||
pub const ListActiveThreads = @import("thread.zig").ListActiveThreads;
|
pub const ListActiveThreads = @import("thread.zig").ListActiveThreads;
|
||||||
pub const ListArchivedThreads = @import("thread.zig").ListArchivedThreads;
|
pub const ListArchivedThreads = @import("thread.zig").ListArchivedThreads;
|
||||||
pub const ThreadListSync = @import("thread.zig").ThreadListSync;
|
pub const ThreadListSync = @import("thread.zig").ThreadListSync;
|
||||||
pub const StartThreadFromMessage = @import("thread.zig").StartThreadFromMessage;
|
pub const StartThreadFromMessage = @import("thread.zig").StartThreadFromMessage;
|
||||||
pub const StartThreadWithoutMessage = @import("thread.zig").StartThreadWithoutMessage;
|
pub const StartThreadWithoutMessage = @import("thread.zig").StartThreadWithoutMessage;
|
||||||
pub const CreateForumAndMediaThreadMessage = @import("thread.zig").CreateForumAndMediaThreadMessage;
|
pub const CreateForumAndMediaThreadMessage = @import("thread.zig").CreateForumAndMediaThreadMessage;
|
||||||
pub const StartThreadInForumOrMediaChannel = @import("thread.zig").StartThreadInForumOrMediaChannel;
|
pub const StartThreadInForumOrMediaChannel = @import("thread.zig").StartThreadInForumOrMediaChannel;
|
||||||
// user.zig
|
// user.zig
|
||||||
pub const User = @import("user.zig").User;
|
pub const User = @import("user.zig").User;
|
||||||
pub const AvatarDecorationData = @import("user.zig").AvatarDecorationData;
|
pub const AvatarDecorationData = @import("user.zig").AvatarDecorationData;
|
||||||
pub const TokenExchange = @import("user.zig").TokenExchange;
|
pub const TokenExchange = @import("user.zig").TokenExchange;
|
||||||
pub const TokenRevocation = @import("user.zig").TokenRevocation;
|
pub const TokenRevocation = @import("user.zig").TokenRevocation;
|
||||||
pub const CurrentAuthorization = @import("user.zig").CurrentAuthorization;
|
pub const CurrentAuthorization = @import("user.zig").CurrentAuthorization;
|
||||||
pub const Connection = @import("user.zig").Connection;
|
pub const Connection = @import("user.zig").Connection;
|
||||||
pub const ConnectionServiceType = @import("user.zig").ConnectionServiceType;
|
pub const ConnectionServiceType = @import("user.zig").ConnectionServiceType;
|
||||||
pub const ConnectionVisibility = @import("user.zig").ConnectionVisibility;
|
pub const ConnectionVisibility = @import("user.zig").ConnectionVisibility;
|
||||||
pub const ApplicationRoleConnection = @import("user.zig").ApplicationRoleConnection;
|
pub const ApplicationRoleConnection = @import("user.zig").ApplicationRoleConnection;
|
||||||
pub const ModifyCurrentUser = @import("user.zig").ModifyCurrentUser;
|
pub const ModifyCurrentUser = @import("user.zig").ModifyCurrentUser;
|
||||||
// webhook.zig
|
// webhook.zig
|
||||||
pub const WebhookUpdate = @import("webhook.zig").WebhookUpdate;
|
pub const WebhookUpdate = @import("webhook.zig").WebhookUpdate;
|
||||||
pub const Webhook = @import("webhook.zig").Webhook;
|
pub const Webhook = @import("webhook.zig").Webhook;
|
||||||
pub const IncomingWebhook = @import("webhook.zig").IncomingWebhook;
|
pub const IncomingWebhook = @import("webhook.zig").IncomingWebhook;
|
||||||
pub const ApplicationWebhook = @import("webhook.zig").ApplicationWebhook;
|
pub const ApplicationWebhook = @import("webhook.zig").ApplicationWebhook;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway#payloads-gateway-payload-structure
|
/// https://discord.com/developers/docs/topics/gateway#payloads-gateway-payload-structure
|
||||||
pub fn GatewayPayload(comptime T: type) type {
|
|
||||||
return struct {
|
pub fn GatewayPayload(comptime T: type) type {
|
||||||
/// opcode for the payload
|
return struct {
|
||||||
op: isize,
|
/// opcode for the payload
|
||||||
/// Event data
|
op: isize,
|
||||||
d: ?T,
|
/// Event data
|
||||||
/// Sequence isize, used for resuming sessions and heartbeats
|
d: ?T = null,
|
||||||
s: ?isize,
|
/// Sequence isize, used for resuming sessions and heartbeats
|
||||||
/// The event name for this payload
|
s: ?isize = null,
|
||||||
t: ?[]const u8,
|
/// The event name for this payload
|
||||||
// t: ?GatewayDispatchEventNames,
|
t: ?[]const u8 = null,
|
||||||
};
|
// t: ?GatewayDispatchEventNames = null,
|
||||||
}
|
};
|
||||||
|
}
|
||||||
|
@ -1,169 +1,169 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const PremiumTypes = @import("shared.zig").PremiumTypes;
|
const PremiumTypes = @import("shared.zig").PremiumTypes;
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const Application = @import("application.zig").Application;
|
const Application = @import("application.zig").Application;
|
||||||
const OAuth2Scope = @import("shared.zig").OAuth2Scope;
|
const OAuth2Scope = @import("shared.zig").OAuth2Scope;
|
||||||
const Integration = @import("integration.zig").Integration;
|
const Integration = @import("integration.zig").Integration;
|
||||||
const Partial = @import("partial.zig").Partial;
|
const Partial = @import("partial.zig").Partial;
|
||||||
const Record = @import("../json-helper.zig").Record;
|
const Record = @import("../json-helper.zig").Record;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/user#user-object
|
/// https://discord.com/developers/docs/resources/user#user-object
|
||||||
pub const User = struct {
|
pub const User = struct {
|
||||||
/// The user's username, not unique across the platform
|
/// The user's username, not unique across the platform
|
||||||
username: []const u8,
|
username: []const u8,
|
||||||
/// The user's display name, if it is set. For bots, this is the application name
|
/// The user's display name, if it is set. For bots, this is the application name
|
||||||
global_name: ?[]const u8,
|
global_name: ?[]const u8 = null,
|
||||||
/// The user's chosen language option
|
/// The user's chosen language option
|
||||||
locale: ?[]const u8,
|
locale: ?[]const u8 = null,
|
||||||
/// The flags on a user's account
|
/// The flags on a user's account
|
||||||
flags: ?isize,
|
flags: ?isize = null,
|
||||||
/// The type of Nitro subscription on a user's account
|
/// The type of Nitro subscription on a user's account
|
||||||
premium_type: ?PremiumTypes,
|
premium_type: ?PremiumTypes = null,
|
||||||
/// The public flags on a user's account
|
/// The public flags on a user's account
|
||||||
public_flags: ?isize,
|
public_flags: ?isize = null,
|
||||||
/// the user's banner color encoded as an integer representation of hexadecimal color code
|
/// the user's banner color encoded as an integer representation of hexadecimal color code
|
||||||
accent_color: ?isize,
|
accent_color: ?isize = null,
|
||||||
/// The user's id
|
/// The user's id
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// The user's discord-tag
|
/// The user's discord-tag
|
||||||
discriminator: []const u8,
|
discriminator: []const u8,
|
||||||
/// The user's avatar hash
|
/// The user's avatar hash
|
||||||
avatar: ?[]const u8,
|
avatar: ?[]const u8 = null,
|
||||||
/// Whether the user belongs to an OAuth2 application
|
/// Whether the user belongs to an OAuth2 application
|
||||||
bot: ?bool,
|
bot: ?bool = null,
|
||||||
///Whether the user is an Official System user (part of the urgent message system)
|
///Whether the user is an Official System user (part of the urgent message system)
|
||||||
system: ?bool,
|
system: ?bool = null,
|
||||||
/// Whether the user has two factor enabled on their account
|
/// Whether the user has two factor enabled on their account
|
||||||
mfa_enabled: ?bool,
|
mfa_enabled: ?bool = null,
|
||||||
/// Whether the email on this account has been verified
|
/// Whether the email on this account has been verified
|
||||||
verified: ?bool,
|
verified: ?bool = null,
|
||||||
/// The user's email
|
/// The user's email
|
||||||
email: ?[]const u8,
|
email: ?[]const u8 = null,
|
||||||
/// the user's banner, or null if unset
|
/// the user's banner, or null if unset
|
||||||
banner: ?[]const u8,
|
banner: ?[]const u8 = null,
|
||||||
/// data for the user's avatar decoration
|
/// data for the user's avatar decoration
|
||||||
avatar_decoration_data: ?AvatarDecorationData,
|
avatar_decoration_data: ?AvatarDecorationData = null,
|
||||||
clan: ?[]const u8,
|
clan: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/user#avatar-decoration-data-object
|
/// https://discord.com/developers/docs/resources/user#avatar-decoration-data-object
|
||||||
pub const AvatarDecorationData = struct {
|
pub const AvatarDecorationData = struct {
|
||||||
/// the avatar decoration hash
|
/// the avatar decoration hash
|
||||||
asset: []const u8,
|
asset: []const u8,
|
||||||
/// id of the avatar decoration's SKU
|
/// id of the avatar decoration's SKU
|
||||||
sku_id: Snowflake,
|
sku_id: Snowflake,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// TODO: implement
|
/// TODO: implement
|
||||||
pub const TokenExchange = null;
|
pub const TokenExchange = null;
|
||||||
|
|
||||||
pub const TokenRevocation = struct {
|
pub const TokenRevocation = struct {
|
||||||
/// The access token to revoke
|
/// The access token to revoke
|
||||||
token: []const u8,
|
token: []const u8,
|
||||||
/// Optional, the type of token you are using for the revocation
|
/// Optional, the type of token you are using for the revocation
|
||||||
token_type_hint: ?"access_token' | 'refresh_token",
|
token_type_hint: ?"access_token' | 'refresh_token" = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information-response-structure
|
/// https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information-response-structure
|
||||||
pub const CurrentAuthorization = struct {
|
pub const CurrentAuthorization = struct {
|
||||||
application: Application,
|
application: Application,
|
||||||
/// the scopes the user has authorized the application for
|
/// the scopes the user has authorized the application for
|
||||||
scopes: []OAuth2Scope,
|
scopes: []OAuth2Scope,
|
||||||
/// when the access token expires
|
/// when the access token expires
|
||||||
expires: []const u8,
|
expires: []const u8,
|
||||||
/// the user who has authorized, if the user has authorized with the `identify` scope
|
/// the user who has authorized, if the user has authorized with the `identify` scope
|
||||||
user: ?User,
|
user: ?User = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/user#connection-object-connection-structure
|
/// https://discord.com/developers/docs/resources/user#connection-object-connection-structure
|
||||||
pub const Connection = struct {
|
pub const Connection = struct {
|
||||||
/// id of the connection account
|
/// id of the connection account
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// the username of the connection account
|
/// the username of the connection account
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
/// the service of this connection
|
/// the service of this connection
|
||||||
type: ConnectionServiceType,
|
type: ConnectionServiceType,
|
||||||
/// whether the connection is revoked
|
/// whether the connection is revoked
|
||||||
revoked: ?bool,
|
revoked: ?bool = null,
|
||||||
/// an array of partial server integrations
|
/// an array of partial server integrations
|
||||||
integrations: ?[]Partial(Integration),
|
integrations: ?[]Partial(Integration) = null,
|
||||||
/// whether the connection is verified
|
/// whether the connection is verified
|
||||||
verified: bool,
|
verified: bool,
|
||||||
/// whether friend sync is enabled for this connection
|
/// whether friend sync is enabled for this connection
|
||||||
friend_sync: bool,
|
friend_sync: bool,
|
||||||
/// whether activities related to this connection will be shown in presence updates
|
/// whether activities related to this connection will be shown in presence updates
|
||||||
show_activity: bool,
|
show_activity: bool,
|
||||||
/// whether this connection has a corresponding third party OAuth2 token
|
/// whether this connection has a corresponding third party OAuth2 token
|
||||||
two_way_link: bool,
|
two_way_link: bool,
|
||||||
/// visibility of this connection
|
/// visibility of this connection
|
||||||
visibility: ConnectionVisibility,
|
visibility: ConnectionVisibility,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/user#connection-object-services
|
/// https://discord.com/developers/docs/resources/user#connection-object-services
|
||||||
pub const ConnectionServiceType = union(enum) {
|
pub const ConnectionServiceType = union(enum) {
|
||||||
@"amazon-music",
|
@"amazon-music",
|
||||||
battlenet,
|
battlenet,
|
||||||
@"Bungie.net",
|
@"Bungie.net",
|
||||||
domain,
|
domain,
|
||||||
ebay,
|
ebay,
|
||||||
epicgames,
|
epicgames,
|
||||||
facebook,
|
facebook,
|
||||||
github,
|
github,
|
||||||
instagram,
|
instagram,
|
||||||
leagueoflegends,
|
leagueoflegends,
|
||||||
paypal,
|
paypal,
|
||||||
playstation,
|
playstation,
|
||||||
reddit,
|
reddit,
|
||||||
riotgames,
|
riotgames,
|
||||||
roblox,
|
roblox,
|
||||||
spotify,
|
spotify,
|
||||||
skype,
|
skype,
|
||||||
steam,
|
steam,
|
||||||
tiktok,
|
tiktok,
|
||||||
twitch,
|
twitch,
|
||||||
twitter,
|
twitter,
|
||||||
xbox,
|
xbox,
|
||||||
youtube,
|
youtube,
|
||||||
};
|
};
|
||||||
|
|
||||||
//https://discord.com/developers/docs/resources/user#connection-object-visibility-types
|
//https://discord.com/developers/docs/resources/user#connection-object-visibility-types
|
||||||
pub const ConnectionVisibility = enum(u4) {
|
pub const ConnectionVisibility = enum(u4) {
|
||||||
/// invisible to everyone except the user themselves
|
/// invisible to everyone except the user themselves
|
||||||
None = 0,
|
None = 0,
|
||||||
/// visible to everyone
|
/// visible to everyone
|
||||||
Everyone = 1,
|
Everyone = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/user#application-role-connection-object-application-role-connection-structure
|
/// https://discord.com/developers/docs/resources/user#application-role-connection-object-application-role-connection-structure
|
||||||
pub const ApplicationRoleConnection = struct {
|
pub const ApplicationRoleConnection = struct {
|
||||||
/// the vanity name of the platform a bot has connected (max 50 characters)
|
/// the vanity name of the platform a bot has connected (max 50 characters)
|
||||||
platform_name: ?[]const u8,
|
platform_name: ?[]const u8 = null,
|
||||||
/// the username on the platform a bot has connected (max 100 characters)
|
/// the username on the platform a bot has connected (max 100 characters)
|
||||||
platform_username: ?[]const u8,
|
platform_username: ?[]const u8 = null,
|
||||||
/// object mapping application role connection metadata keys to their stringified value (max 100 characters) for the user on the platform a bot has connected
|
/// object mapping application role connection metadata keys to their stringified value (max 100 characters) for the user on the platform a bot has connected
|
||||||
metadata: []Record([]const u8),
|
metadata: []Record([]const u8),
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const ModifyCurrentUser = struct {
|
pub const ModifyCurrentUser = struct {
|
||||||
/// user's username, if changed may cause the user's discriminator to be randomized.
|
/// user's username, if changed may cause the user's discriminator to be randomized.
|
||||||
username: ?[]const u8,
|
username: ?[]const u8 = null,
|
||||||
/// if passed, modifies the user's avatar
|
/// if passed, modifies the user's avatar
|
||||||
avatar: ?[]const u8,
|
avatar: ?[]const u8 = null,
|
||||||
/// if passed, modifies the user's banner
|
/// if passed, modifies the user's banner
|
||||||
banner: ?[]const u8,
|
banner: ?[]const u8 = null,
|
||||||
};
|
};
|
||||||
|
@ -1,89 +1,89 @@
|
|||||||
//! ISC License
|
//! ISC License
|
||||||
//!
|
//!
|
||||||
//! Copyright (c) 2024-2025 Yuzu
|
//! Copyright (c) 2024-2025 Yuzu
|
||||||
//!
|
//!
|
||||||
//! Permission to use, copy, modify, and/or distribute this software for any
|
//! Permission to use, copy, modify, and/or distribute this software for any
|
||||||
//! purpose with or without fee is hereby granted, provided that the above
|
//! purpose with or without fee is hereby granted, provided that the above
|
||||||
//! copyright notice and this permission notice appear in all copies.
|
//! copyright notice and this permission notice appear in all copies.
|
||||||
//!
|
//!
|
||||||
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
//! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
//! REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
//! AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
//! INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
//! LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
//! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
//! PERFORMANCE OF THIS SOFTWARE.
|
//! PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
const Snowflake = @import("snowflake.zig").Snowflake;
|
const Snowflake = @import("snowflake.zig").Snowflake;
|
||||||
const WebhookTypes = @import("shared.zig").WebhookTypes;
|
const WebhookTypes = @import("shared.zig").WebhookTypes;
|
||||||
const User = @import("user.zig").User;
|
const User = @import("user.zig").User;
|
||||||
const Guild = @import("guild.zig").Guild;
|
const Guild = @import("guild.zig").Guild;
|
||||||
const Channel = @import("channel.zig").Channel;
|
const Channel = @import("channel.zig").Channel;
|
||||||
const Partial = @import("partial.zig").Partial;
|
const Partial = @import("partial.zig").Partial;
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/topics/gateway#webhooks-update-webhook-update-event-fields
|
/// https://discord.com/developers/docs/topics/gateway#webhooks-update-webhook-update-event-fields
|
||||||
pub const WebhookUpdate = struct {
|
pub const WebhookUpdate = struct {
|
||||||
/// id of the guild
|
/// id of the guild
|
||||||
guild_id: Snowflake,
|
guild_id: Snowflake,
|
||||||
/// id of the channel
|
/// id of the channel
|
||||||
channel_id: Snowflake,
|
channel_id: Snowflake,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-structure
|
/// https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-structure
|
||||||
/// TODO: implement
|
/// TODO: implement
|
||||||
pub const Webhook = null;
|
pub const Webhook = null;
|
||||||
|
|
||||||
pub const IncomingWebhook = struct {
|
pub const IncomingWebhook = struct {
|
||||||
/// The type of the webhook
|
/// The type of the webhook
|
||||||
type: WebhookTypes,
|
type: WebhookTypes,
|
||||||
/// The secure token of the webhook (returned for Incoming Webhooks)
|
/// The secure token of the webhook (returned for Incoming Webhooks)
|
||||||
token: ?[]const u8,
|
token: ?[]const u8 = null,
|
||||||
/// The url used for executing the webhook (returned by the webhooks OAuth2 flow)
|
/// The url used for executing the webhook (returned by the webhooks OAuth2 flow)
|
||||||
url: ?[]const u8,
|
url: ?[]const u8 = null,
|
||||||
|
|
||||||
/// The id of the webhook
|
/// The id of the webhook
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// The guild id this webhook is for
|
/// The guild id this webhook is for
|
||||||
guild_id: ?Snowflake,
|
guild_id: ?Snowflake = null,
|
||||||
/// The channel id this webhook is for
|
/// The channel id this webhook is for
|
||||||
channel_id: Snowflake,
|
channel_id: Snowflake,
|
||||||
/// The user this webhook was created by (not returned when getting a webhook with its token)
|
/// The user this webhook was created by (not returned when getting a webhook with its token)
|
||||||
user: ?User,
|
user: ?User = null,
|
||||||
/// The default name of the webhook
|
/// The default name of the webhook
|
||||||
name: ?[]const u8,
|
name: ?[]const u8 = null,
|
||||||
/// The default user avatar hash of the webhook
|
/// The default user avatar hash of the webhook
|
||||||
avatar: ?[]const u8,
|
avatar: ?[]const u8 = null,
|
||||||
/// The bot/OAuth2 application that created this webhook
|
/// The bot/OAuth2 application that created this webhook
|
||||||
application_id: ?Snowflake,
|
application_id: ?Snowflake = null,
|
||||||
/// The guild of the channel that this webhook is following (returned for Channel Follower Webhooks)
|
/// The guild of the channel that this webhook is following (returned for Channel Follower Webhooks)
|
||||||
source_guild: ?Partial(Guild),
|
source_guild: ?Partial(Guild) = null,
|
||||||
/// The channel that this webhook is following (returned for Channel Follower Webhooks)
|
/// The channel that this webhook is following (returned for Channel Follower Webhooks)
|
||||||
source_channel: ?Partial(Channel),
|
source_channel: ?Partial(Channel) = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const ApplicationWebhook = struct {
|
pub const ApplicationWebhook = struct {
|
||||||
/// The type of the webhook
|
/// The type of the webhook
|
||||||
type: WebhookTypes.Application,
|
type: WebhookTypes.Application,
|
||||||
/// The secure token of the webhook (returned for Incoming Webhooks)
|
/// The secure token of the webhook (returned for Incoming Webhooks)
|
||||||
token: ?[]const u8,
|
token: ?[]const u8 = null,
|
||||||
/// The url used for executing the webhook (returned by the webhooks OAuth2 flow)
|
/// The url used for executing the webhook (returned by the webhooks OAuth2 flow)
|
||||||
url: ?[]const u8,
|
url: ?[]const u8 = null,
|
||||||
/// The id of the webhook
|
/// The id of the webhook
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
/// The guild id this webhook is for
|
/// The guild id this webhook is for
|
||||||
guild_id: ?Snowflake,
|
guild_id: ?Snowflake = null,
|
||||||
/// The channel id this webhook is for
|
/// The channel id this webhook is for
|
||||||
channel_id: ?Snowflake,
|
channel_id: ?Snowflake = null,
|
||||||
/// The user this webhook was created by (not returned when getting a webhook with its token)
|
/// The user this webhook was created by (not returned when getting a webhook with its token)
|
||||||
user: ?User,
|
user: ?User = null,
|
||||||
/// The default name of the webhook
|
/// The default name of the webhook
|
||||||
name: ?[]const u8,
|
name: ?[]const u8 = null,
|
||||||
/// The default user avatar hash of the webhook
|
/// The default user avatar hash of the webhook
|
||||||
avatar: ?[]const u8,
|
avatar: ?[]const u8 = null,
|
||||||
/// The bot/OAuth2 application that created this webhook
|
/// The bot/OAuth2 application that created this webhook
|
||||||
application_id: ?Snowflake,
|
application_id: ?Snowflake = null,
|
||||||
/// The guild of the channel that this webhook is following (returned for Channel Follower Webhooks), field will be absent if the webhook creator has since lost access to the guild where the followed channel resides
|
/// The guild of the channel that this webhook is following (returned for Channel Follower Webhooks), field will be absent if the webhook creator has since lost access to the guild where the followed channel resides
|
||||||
source_guild: ?Partial(Guild),
|
source_guild: ?Partial(Guild) = null,
|
||||||
/// The channel that this webhook is following (returned for Channel Follower Webhooks), field will be absent if the webhook creator has since lost access to the guild where the followed channel resides
|
/// The channel that this webhook is following (returned for Channel Follower Webhooks), field will be absent if the webhook creator has since lost access to the guild where the followed channel resides
|
||||||
source_channel: ?Partial(Channel),
|
source_channel: ?Partial(Channel) = null,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user