-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ✨ add more gateway events; update examples; update deserialize …
…function Removed a lot of the safe type-checking which caused problems with the addition of the variant deserializer. They have been removed to ensure struct deserialization.
- Loading branch information
Xminent
committed
Nov 2, 2023
1 parent
3e3c31c
commit 26d5fd4
Showing
61 changed files
with
1,266 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef EKIZU_GATEWAY_GUILD_MEMBERS_CHUNK_HPP | ||
#define EKIZU_GATEWAY_GUILD_MEMBERS_CHUNK_HPP | ||
|
||
#include <ekizu/guild_member.hpp> | ||
#include <ekizu/presence.hpp> | ||
|
||
namespace ekizu | ||
{ | ||
struct GuildMembersChunk { | ||
/// ID of the guild. | ||
Snowflake guild_id; | ||
/// Set of guild members. | ||
std::vector<GuildMember> members; | ||
/// Chunk index in the expected chunks for this response (0 <= chunk_index < chunk_count). | ||
int chunk_index; | ||
/// Total number of expected chunks for this response. | ||
int chunk_count; | ||
/// When passing an invalid ID to REQUEST_GUILD_MEMBERS, it will be returned here. | ||
std::optional<std::vector<Snowflake> > not_found; | ||
/// When passing true to REQUEST_GUILD_MEMBERS, presences of the returned members will be here. | ||
std::optional<std::vector<Presence> > presences; | ||
/// Nonce used in the Guild Members Request. | ||
std::optional<std::string> nonce; | ||
}; | ||
|
||
EKIZU_EXPORT void to_json(nlohmann::json &j, const GuildMembersChunk &c); | ||
EKIZU_EXPORT void from_json(const nlohmann::json &j, GuildMembersChunk &c); | ||
} // namespace ekizu | ||
|
||
#endif // EKIZU_GATEWAY_GUILD_MEMBERS_CHUNK_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <ekizu/interaction.hpp> | ||
|
||
namespace ekizu | ||
{ | ||
struct InteractionCreate { | ||
Interaction interaction; | ||
}; | ||
|
||
EKIZU_EXPORT void to_json(nlohmann::json &j, const InteractionCreate &c); | ||
EKIZU_EXPORT void from_json(const nlohmann::json &j, InteractionCreate &c); | ||
} // namespace ekizu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef EKIZU_GATEWAY_MESSAGE_REACTION_ADD_HPP | ||
#define EKIZU_GATEWAY_MESSAGE_REACTION_ADD_HPP | ||
|
||
#include <ekizu/emoji.hpp> | ||
#include <ekizu/guild_member.hpp> | ||
|
||
namespace ekizu | ||
{ | ||
struct MessageReactionAdd { | ||
/// ID of the user. | ||
Snowflake user_id; | ||
/// ID of the channel. | ||
Snowflake channel_id; | ||
/// ID of the message. | ||
Snowflake message_id; | ||
/// ID of the guild (if applicable). | ||
std::optional<Snowflake> guild_id; | ||
/// Member who reacted (if it happened in a guild). | ||
std::optional<GuildMember> member; | ||
/// Emoji used to react. | ||
PartialEmoji emoji; | ||
/// ID of the user who authored the reacted message. | ||
Snowflake message_author_id; | ||
}; | ||
|
||
EKIZU_EXPORT void to_json(nlohmann::json &j, const MessageReactionAdd &e); | ||
EKIZU_EXPORT void from_json(const nlohmann::json &j, MessageReactionAdd &e); | ||
} // namespace ekizu | ||
|
||
#endif // EKIZU_GATEWAY_MESSAGE_REACTION_ADD_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef EKIZU_GATEWAY_MESSAGE_REACTION_REMOVE_HPP | ||
#define EKIZU_GATEWAY_MESSAGE_REACTION_REMOVE_HPP | ||
|
||
#include <ekizu/emoji.hpp> | ||
|
||
namespace ekizu | ||
{ | ||
struct MessageReactionRemove { | ||
/// ID of the user. | ||
Snowflake user_id; | ||
/// ID of the channel. | ||
Snowflake channel_id; | ||
/// ID of the message. | ||
Snowflake message_id; | ||
/// ID of the guild (if applicable). | ||
std::optional<Snowflake> guild_id; | ||
/// Emoji used to react. | ||
PartialEmoji emoji; | ||
}; | ||
|
||
EKIZU_EXPORT void to_json(nlohmann::json &j, const MessageReactionRemove &e); | ||
EKIZU_EXPORT void from_json(const nlohmann::json &j, MessageReactionRemove &e); | ||
} // namespace ekizu | ||
|
||
#endif // EKIZU_GATEWAY_MESSAGE_REACTION_REMOVE_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef EKIZU_GATEWAY_STAGE_INSTANCE_CREATE_HPP | ||
#define EKIZU_GATEWAY_STAGE_INSTANCE_CREATE_HPP | ||
|
||
#include <ekizu/stage_instance.hpp> | ||
|
||
namespace ekizu | ||
{ | ||
struct StageInstanceCreate { | ||
StageInstance stage_instance; | ||
}; | ||
|
||
EKIZU_EXPORT void to_json(nlohmann::json &j, const StageInstanceCreate &s); | ||
EKIZU_EXPORT void from_json(const nlohmann::json &j, StageInstanceCreate &s); | ||
} // namespace ekizu | ||
|
||
#endif // EKIZU_GATEWAY_STAGE_INSTANCE_CREATE_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef EKIZU_GATEWAY_STAGE_INSTANCE_DELETE_HPP | ||
#define EKIZU_GATEWAY_STAGE_INSTANCE_DELETE_HPP | ||
|
||
#include <ekizu/stage_instance.hpp> | ||
|
||
namespace ekizu | ||
{ | ||
struct StageInstanceDelete { | ||
StageInstance stage_instance; | ||
}; | ||
|
||
EKIZU_EXPORT void to_json(nlohmann::json &j, const StageInstanceDelete &s); | ||
EKIZU_EXPORT void from_json(const nlohmann::json &j, StageInstanceDelete &s); | ||
} // namespace ekizu | ||
|
||
#endif // EKIZU_GATEWAY_STAGE_INSTANCE_DELETE_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef EKIZU_GATEWAY_STAGE_INSTANCE_UPDATE_HPP | ||
#define EKIZU_GATEWAY_STAGE_INSTANCE_UPDATE_HPP | ||
|
||
#include <ekizu/stage_instance.hpp> | ||
|
||
namespace ekizu | ||
{ | ||
struct StageInstanceUpdate { | ||
StageInstance stage_instance; | ||
}; | ||
|
||
EKIZU_EXPORT void to_json(nlohmann::json &j, const StageInstanceUpdate &s); | ||
EKIZU_EXPORT void from_json(const nlohmann::json &j, StageInstanceUpdate &s); | ||
} // namespace ekizu | ||
|
||
#endif // EKIZU_GATEWAY_STAGE_INSTANCE_UPDATE_HPP |
Oops, something went wrong.