-
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 events; update example
- Loading branch information
Xminent
committed
Oct 28, 2023
1 parent
aa92d8e
commit eba040c
Showing
40 changed files
with
1,540 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef EKIZU_ACTIVITY_FLAGS_HPP | ||
#define EKIZU_ACTIVITY_FLAGS_HPP | ||
|
||
#include <cstdint> | ||
#include <type_traits> | ||
|
||
namespace ekizu | ||
{ | ||
enum class ActivityFlags : uint64_t { | ||
Instance = 1 << 0, | ||
Join = 1 << 1, | ||
Spectate = 1 << 2, | ||
JoinRequest = 1 << 3, | ||
Sync = 1 << 4, | ||
Play = 1 << 5, | ||
PartyPrivacyFriends = 1 << 6, | ||
PartyPrivacyVoiceChannel = 1 << 7, | ||
Embedded = 1 << 8, | ||
}; | ||
|
||
constexpr ActivityFlags operator|(ActivityFlags lhs, ActivityFlags rhs) | ||
{ | ||
return static_cast<ActivityFlags>( | ||
static_cast<std::underlying_type_t<ActivityFlags> >(lhs) | | ||
static_cast<std::underlying_type_t<ActivityFlags> >(rhs)); | ||
} | ||
|
||
constexpr ActivityFlags operator&(ActivityFlags lhs, ActivityFlags rhs) | ||
{ | ||
return static_cast<ActivityFlags>( | ||
static_cast<std::underlying_type_t<ActivityFlags> >(lhs) & | ||
static_cast<std::underlying_type_t<ActivityFlags> >(rhs)); | ||
} | ||
} // namespace ekizu | ||
|
||
#endif // EKIZU_ACTIVITY_FLAGS_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,41 @@ | ||
#ifndef EKIZU_MODELS_COMMAND_DATA_HPP | ||
#define EKIZU_MODELS_COMMAND_DATA_HPP | ||
|
||
#include <ekizu/command_data_resolved.hpp> | ||
|
||
namespace ekizu | ||
{ | ||
struct CommandDataOption { | ||
/// Name of the option. | ||
std::string name; | ||
/// Value of the option. | ||
std::string value; | ||
}; | ||
|
||
EKIZU_EXPORT void to_json(nlohmann::json &j, const CommandDataOption &c); | ||
EKIZU_EXPORT void from_json(const nlohmann::json &j, CommandDataOption &c); | ||
|
||
enum class CommandType : uint8_t { ChatInput, User, Message, Unknown }; | ||
|
||
struct CommandData { | ||
/// ID of the guild the command is registered to. | ||
std::optional<Snowflake> guild_id; | ||
/// ID of the command. | ||
Snowflake id; | ||
/// Name of the command. | ||
std::string name; | ||
/// Type of the command. | ||
CommandType kind; | ||
/// List of options specified by the user. | ||
std::vector<CommandDataOption> options; | ||
/// Resolved data from the interaction's options. | ||
std::optional<CommandInteractionDataResolved> resolved; | ||
/// If this is a user or message command, the ID of the targeted user/message. | ||
std::optional<Snowflake> target_id; | ||
}; | ||
|
||
EKIZU_EXPORT void to_json(nlohmann::json &j, const CommandData &c); | ||
EKIZU_EXPORT void from_json(const nlohmann::json &j, CommandData &c); | ||
} // namespace ekizu | ||
|
||
#endif // EKIZU_MODELS_COMMAND_DATA_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,67 @@ | ||
#ifndef EKIZU_MODELS_COMMAND_INTERACTION_DATA_RESOLVED_HPP | ||
#define EKIZU_MODELS_COMMAND_INTERACTION_DATA_RESOLVED_HPP | ||
|
||
#include <ekizu/member_flags.hpp> | ||
#include <ekizu/message.hpp> | ||
|
||
namespace ekizu | ||
{ | ||
struct InteractionChannel { | ||
/// ID of the channel. | ||
Snowflake id; | ||
/// Type of the channel. | ||
ChannelType kind; | ||
/// Name of the channel. | ||
std::string name; | ||
/// ID of the channel the thread was created in. | ||
std::optional<Snowflake> parent_id; | ||
/// Computed permissions, including overwrites, for the invoking user in the channel. | ||
Permissions permissions; | ||
/// Metadata about a thread. | ||
std::optional<ThreadMetadata> thread_metadata; | ||
}; | ||
|
||
struct InteractionMember { | ||
/// Member's guild avatar. | ||
std::optional<std::string> avatar; | ||
/// If the member is timed out, when the timeout will expire. | ||
std::optional<std::string> communication_disabled_until; | ||
/// Flags for the member. | ||
MemberFlags flags; | ||
/// Member guild join date. | ||
std::string joined_at; | ||
/// Member nickname. | ||
std::optional<std::string> nick; | ||
/// Whether the user has yet to pass the guild's Membership Screening requirements. | ||
bool pending; | ||
/// Total permissions of the member in this channel, including overwrites. | ||
Permissions permissions; | ||
std::optional<std::string> premium_since; | ||
/// Member roles. | ||
std::vector<Snowflake> roles; | ||
}; | ||
|
||
struct CommandInteractionDataResolved { | ||
/// Map of resolved attachments. | ||
std::unordered_map<Snowflake, Attachment> attachments; | ||
/// Map of resolved channels. | ||
std::unordered_map<Snowflake, InteractionChannel> channels; | ||
/// Map of resolved members. | ||
/// | ||
/// Resolved members' ID will map to a resolved user as well. | ||
std::unordered_map<Snowflake, InteractionMember> members; | ||
/// Map of resolved messages. | ||
std::unordered_map<Snowflake, Message> messages; | ||
/// Map of resolved roles. | ||
std::unordered_map<Snowflake, Role> roles; | ||
/// Map of resolved users. | ||
std::unordered_map<Snowflake, User> users; | ||
}; | ||
|
||
EKIZU_EXPORT void to_json(nlohmann::json &j, | ||
const CommandInteractionDataResolved &r); | ||
EKIZU_EXPORT void from_json(const nlohmann::json &j, | ||
CommandInteractionDataResolved &r); | ||
} // namespace ekizu | ||
|
||
#endif // EKIZU_MODELS_COMMAND_INTERACTION_DATA_RESOLVED_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
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,17 @@ | ||
#ifndef EKIZU_GATEWAY_GUILD_MEMBER_ADD_HPP | ||
#define EKIZU_GATEWAY_GUILD_MEMBER_ADD_HPP | ||
|
||
#include <ekizu/guild_member.hpp> | ||
|
||
namespace ekizu | ||
{ | ||
struct GuildMemberAdd { | ||
Snowflake guild_id; | ||
GuildMember member; | ||
}; | ||
|
||
EKIZU_EXPORT void to_json(nlohmann::json &j, const GuildMemberAdd &m); | ||
EKIZU_EXPORT void from_json(const nlohmann::json &j, GuildMemberAdd &m); | ||
} // namespace ekizu | ||
|
||
#endif // EKIZU_GATEWAY_GUILD_MEMBER_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,17 @@ | ||
#ifndef EKIZU_GATEWAY_GUILD_MEMBER_REMOVE_HPP | ||
#define EKIZU_GATEWAY_GUILD_MEMBER_REMOVE_HPP | ||
|
||
#include <ekizu/guild_member.hpp> | ||
|
||
namespace ekizu | ||
{ | ||
struct GuildMemberRemove { | ||
Snowflake guild_id; | ||
GuildMember member; | ||
}; | ||
|
||
EKIZU_EXPORT void to_json(nlohmann::json &j, const GuildMemberRemove &m); | ||
EKIZU_EXPORT void from_json(const nlohmann::json &j, GuildMemberRemove &m); | ||
} // namespace ekizu | ||
|
||
#endif // EKIZU_GATEWAY_GUILD_MEMBER_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,26 @@ | ||
#ifndef EKIZU_GATEWAY_GUILD_MEMBER_UPDATE_HPP | ||
#define EKIZU_GATEWAY_GUILD_MEMBER_UPDATE_HPP | ||
|
||
#include <ekizu/guild_member.hpp> | ||
|
||
namespace ekizu | ||
{ | ||
struct GuildMemberUpdate { | ||
Snowflake guild_id; | ||
std::vector<Snowflake> roles; | ||
User user; | ||
std::optional<std::string> nick; | ||
std::optional<std::string> avatar; | ||
std::optional<std::string> joined_at; | ||
std::optional<std::string> premium_since; | ||
std::optional<bool> deaf; | ||
std::optional<bool> mute; | ||
bool pending{}; | ||
std::optional<std::string> communication_disabled_until; | ||
}; | ||
|
||
EKIZU_EXPORT void to_json(nlohmann::json &j, const GuildMemberUpdate &m); | ||
EKIZU_EXPORT void from_json(const nlohmann::json &j, GuildMemberUpdate &m); | ||
} // namespace ekizu | ||
|
||
#endif // EKIZU_GATEWAY_GUILD_MEMBER_UPDATE_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_INTEGRATION_CREATE_HPP | ||
#define EKIZU_GATEWAY_INTEGRATION_CREATE_HPP | ||
|
||
#include <ekizu/guild_interaction.hpp> | ||
|
||
namespace ekizu | ||
{ | ||
struct IntegrationCreate { | ||
GuildIntegration integration; | ||
}; | ||
|
||
EKIZU_EXPORT void to_json(nlohmann::json &j, const IntegrationCreate &i); | ||
EKIZU_EXPORT void from_json(const nlohmann::json &j, IntegrationCreate &i); | ||
} // namespace ekizu | ||
|
||
#endif // EKIZU_GATEWAY_INTEGRATION_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_INTEGRATION_DELETE_HPP | ||
#define EKIZU_GATEWAY_INTEGRATION_DELETE_HPP | ||
|
||
#include <ekizu/guild_interaction.hpp> | ||
|
||
namespace ekizu | ||
{ | ||
struct IntegrationDelete { | ||
GuildIntegration integration; | ||
}; | ||
|
||
EKIZU_EXPORT void to_json(nlohmann::json &j, const IntegrationDelete &i); | ||
EKIZU_EXPORT void from_json(const nlohmann::json &j, IntegrationDelete &i); | ||
} // namespace ekizu | ||
|
||
#endif // EKIZU_GATEWAY_INTEGRATION_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_INTEGRATION_UPDATE_HPP | ||
#define EKIZU_GATEWAY_INTEGRATION_UPDATE_HPP | ||
|
||
#include <ekizu/guild_interaction.hpp> | ||
|
||
namespace ekizu | ||
{ | ||
struct IntegrationUpdate { | ||
GuildIntegration integration; | ||
}; | ||
|
||
EKIZU_EXPORT void to_json(nlohmann::json &j, const IntegrationUpdate &i); | ||
EKIZU_EXPORT void from_json(const nlohmann::json &j, IntegrationUpdate &i); | ||
} // namespace ekizu | ||
|
||
#endif // EKIZU_GATEWAY_INTEGRATION_UPDATE_HPP |
Empty file.
Oops, something went wrong.