1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Expose role type.

This commit is contained in:
Sandu Liviu Catalin 2021-09-11 23:16:14 +03:00
parent 19102a9334
commit 4e27ba4a4f
2 changed files with 396 additions and 14 deletions

View File

@ -14,6 +14,7 @@ SQMOD_DECL_TYPENAME(SqDppUptime, _SC("SqDppUptime"))
SQMOD_DECL_TYPENAME(SqDppActivity, _SC("SqDppActivity")) SQMOD_DECL_TYPENAME(SqDppActivity, _SC("SqDppActivity"))
SQMOD_DECL_TYPENAME(SqDppPresence, _SC("SqDppPresence")) SQMOD_DECL_TYPENAME(SqDppPresence, _SC("SqDppPresence"))
SQMOD_DECL_TYPENAME(SqDppVoiceState, _SC("SqDppVoiceState")) SQMOD_DECL_TYPENAME(SqDppVoiceState, _SC("SqDppVoiceState"))
SQMOD_DECL_TYPENAME(SqDppRole, _SC("SqDppRole"))
SQMOD_DECL_TYPENAME(SqDppUser, _SC("SqDppUser")) SQMOD_DECL_TYPENAME(SqDppUser, _SC("SqDppUser"))
SQMOD_DECL_TYPENAME(SqDppGuildMember, _SC("SqDppGuildMember")) SQMOD_DECL_TYPENAME(SqDppGuildMember, _SC("SqDppGuildMember"))
SQMOD_DECL_TYPENAME(SqDppGuild, _SC("SqDppGuild")) SQMOD_DECL_TYPENAME(SqDppGuild, _SC("SqDppGuild"))
@ -147,6 +148,66 @@ void Register_DPPTy(HSQUIRRELVM vm, Table & ns)
.Prop(_SC("IsSupressed"), &DpVoiceState::IsSupressed) .Prop(_SC("IsSupressed"), &DpVoiceState::IsSupressed)
); );
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
ns.Bind(_SC("Role"),
Class< DpRole, NoConstructor< DpRole > >(vm, SqDppRole::Str)
// Meta-methods
.SquirrelFunc(_SC("_typename"), &SqDppRole::Fn)
.Func(_SC("_tojson"), &DpRole::BuildJSON)
// Member Properties
.Prop(_SC("Valid"), &DpRole::IsValid)
.Prop(_SC("JSON"), &DpRole::BuildJSON)
.Prop(_SC("Name"), &DpRole::GetName)
.Prop(_SC("GuildID"), &DpRole::GetGuildID)
.Prop(_SC("Color"), &DpRole::GetColour)
.Prop(_SC("Colour"), &DpRole::GetColour)
.Prop(_SC("Position"), &DpRole::GetPosition)
.Prop(_SC("Permissions"), &DpRole::GetPermissions)
.Prop(_SC("Flags"), &DpRole::GetFlags)
.Prop(_SC("IntegrationID"), &DpRole::GetIntegrationID)
.Prop(_SC("BotID"), &DpRole::GetBotID)
.Prop(_SC("IsHoisted"), &DpRole::IsHoisted)
.Prop(_SC("IsMentionable"), &DpRole::IsMentionable)
.Prop(_SC("IsManaged"), &DpRole::IsManaged)
.Prop(_SC("CanCreateInstantInvite"), &DpRole::CanCreateInstantInvite)
.Prop(_SC("CanKickMembers"), &DpRole::CanKickMembers)
.Prop(_SC("CanBanMembers"), &DpRole::CanBanMembers)
.Prop(_SC("IsAdministrator"), &DpRole::IsAdministrator)
.Prop(_SC("CanManageChannels"), &DpRole::CanManageChannels)
.Prop(_SC("CanManageGuild"), &DpRole::CanManageGuild)
.Prop(_SC("CanAddReactions"), &DpRole::CanAddReactions)
.Prop(_SC("CanViewAuditLog"), &DpRole::CanViewAuditLog)
.Prop(_SC("IsPrioritySpeaker"), &DpRole::IsPrioritySpeaker)
.Prop(_SC("CanStream"), &DpRole::CanStream)
.Prop(_SC("CanViewChannel"), &DpRole::CanViewChannel)
.Prop(_SC("CanSendMessages"), &DpRole::CanSendMessages)
.Prop(_SC("CanSendTtsMessages"), &DpRole::CanSendTtsMessages)
.Prop(_SC("CanManageMessages"), &DpRole::CanManageMessages)
.Prop(_SC("CanEmbedLinks"), &DpRole::CanEmbedLinks)
.Prop(_SC("CanAttachFiles"), &DpRole::CanAttachFiles)
.Prop(_SC("CanReadMessageHistory"), &DpRole::CanReadMessageHistory)
.Prop(_SC("CanMentionEveryone"), &DpRole::CanMentionEveryone)
.Prop(_SC("CanUseExternalEmojis"), &DpRole::CanUseExternalEmojis)
.Prop(_SC("CanViewGuildInsights"), &DpRole::CanViewGuildInsights)
.Prop(_SC("CanConnect"), &DpRole::CanConnect)
.Prop(_SC("CanSpeak"), &DpRole::CanSpeak)
.Prop(_SC("CanMuteMembers"), &DpRole::CanMuteMembers)
.Prop(_SC("CanDeafenMembers"), &DpRole::CanDeafenMembers)
.Prop(_SC("CanMoveMembers"), &DpRole::CanMoveMembers)
.Prop(_SC("CanUseVAT"), &DpRole::CanUseVAT)
.Prop(_SC("CanChangeNickname"), &DpRole::CanChangeNickname)
.Prop(_SC("CanManageNicknames"), &DpRole::CanManageNicknames)
.Prop(_SC("CanManageRoles"), &DpRole::CanManageRoles)
.Prop(_SC("CanManageWebhooks"), &DpRole::CanManageWebhooks)
.Prop(_SC("CanManageEmojis"), &DpRole::CanManageEmojis)
.Prop(_SC("CanUseSlashCommands"), &DpRole::CanUseSlashCommands)
.Prop(_SC("HasRequestToSpeak"), &DpRole::HasRequestToSpeak)
.Prop(_SC("CanManageThreads"), &DpRole::CanManageThreads)
.Prop(_SC("HasUsePublicThreads"), &DpRole::HasUsePublicThreads)
.Prop(_SC("HasUsePrivateThreads"), &DpRole::HasUsePrivateThreads)
// Member Methods
.Func(_SC("BuildJSON"), &DpRole::BuildJSON_)
);
// --------------------------------------------------------------------------------------------
ns.Bind(_SC("User"), ns.Bind(_SC("User"),
Class< DpUser, NoConstructor< DpUser > >(vm, SqDppUser::Str) Class< DpUser, NoConstructor< DpUser > >(vm, SqDppUser::Str)
// Meta-methods // Meta-methods
@ -391,6 +452,54 @@ static const EnumElement g_DpVoiceStateFlagsEnum[] = {
{_SC("Supress"), static_cast< SQInteger >(dpp::vs_supress)}, {_SC("Supress"), static_cast< SQInteger >(dpp::vs_supress)},
}; };
// ------------------------------------------------------------------------------------------------
static const EnumElement g_DpRoleFlagsEnum[] = {
{_SC("Hoist"), static_cast< SQInteger >(dpp::r_hoist)},
{_SC("Managed"), static_cast< SQInteger >(dpp::r_managed)},
{_SC("Mentionable"), static_cast< SQInteger >(dpp::r_mentionable)},
{_SC("PremiumSubscriber"), static_cast< SQInteger >(dpp::r_premium_subscriber)}
};
// ------------------------------------------------------------------------------------------------
static const EnumElement g_DpRolePermissionsEnum[] = {
{_SC("CreateInstantInvite"), static_cast< SQInteger >(dpp::p_create_instant_invite)},
{_SC("KickMembers"), static_cast< SQInteger >(dpp::p_kick_members)},
{_SC("BanMembers"), static_cast< SQInteger >(dpp::p_ban_members)},
{_SC("Administrator"), static_cast< SQInteger >(dpp::p_administrator)},
{_SC("ManageChannels"), static_cast< SQInteger >(dpp::p_manage_channels)},
{_SC("ManageGuild"), static_cast< SQInteger >(dpp::p_manage_guild)},
{_SC("AddReactions"), static_cast< SQInteger >(dpp::p_add_reactions)},
{_SC("ViewAuditLog"), static_cast< SQInteger >(dpp::p_view_audit_log)},
{_SC("PrioritySpeaker"), static_cast< SQInteger >(dpp::p_priority_speaker)},
{_SC("Stream"), static_cast< SQInteger >(dpp::p_stream)},
{_SC("ViewChannel"), static_cast< SQInteger >(dpp::p_view_channel)},
{_SC("SendMessages"), static_cast< SQInteger >(dpp::p_send_messages)},
{_SC("SendTtsMessages"), static_cast< SQInteger >(dpp::p_send_tts_messages)},
{_SC("ManageMessages"), static_cast< SQInteger >(dpp::p_manage_messages)},
{_SC("EmbedLinks"), static_cast< SQInteger >(dpp::p_embed_links)},
{_SC("AttachFiles"), static_cast< SQInteger >(dpp::p_attach_files)},
{_SC("ReadMessageHistory"), static_cast< SQInteger >(dpp::p_read_message_history)},
{_SC("MentionEveryone"), static_cast< SQInteger >(dpp::p_mention_everyone)},
{_SC("UseExternalEmojis"), static_cast< SQInteger >(dpp::p_use_external_emojis)},
{_SC("ViewGuildInsights"), static_cast< SQInteger >(dpp::p_view_guild_insights)},
{_SC("Connect"), static_cast< SQInteger >(dpp::p_connect)},
{_SC("Speak"), static_cast< SQInteger >(dpp::p_speak)},
{_SC("MuteMembers"), static_cast< SQInteger >(dpp::p_mute_members)},
{_SC("DeafenMembers"), static_cast< SQInteger >(dpp::p_deafen_members)},
{_SC("MoveMembers"), static_cast< SQInteger >(dpp::p_move_members)},
{_SC("UseVAD"), static_cast< SQInteger >(dpp::p_use_vad)},
{_SC("ChangeNickname"), static_cast< SQInteger >(dpp::p_change_nickname)},
{_SC("ManageNicknames"), static_cast< SQInteger >(dpp::p_manage_nicknames)},
{_SC("ManageRoles"), static_cast< SQInteger >(dpp::p_manage_roles)},
{_SC("ManageWebHooks"), static_cast< SQInteger >(dpp::p_manage_webhooks)},
{_SC("ManageEmojis"), static_cast< SQInteger >(dpp::p_manage_emojis)},
{_SC("UseSlashCommands"), static_cast< SQInteger >(dpp::p_use_slash_commands)},
{_SC("RequestToSpeak"), static_cast< SQInteger >(dpp::p_request_to_speak)},
{_SC("ManageThreads"), static_cast< SQInteger >(dpp::p_manage_threads)},
{_SC("UsePublicThreads"), static_cast< SQInteger >(dpp::p_use_public_threads)},
{_SC("UsePrivateThreads"), static_cast< SQInteger >(dpp::p_use_private_threads)}
};
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
static const EnumElement g_DpUserFlagsEnum[] = { static const EnumElement g_DpUserFlagsEnum[] = {
{_SC("Bot"), static_cast< SQInteger >(dpp::u_bot)}, {_SC("Bot"), static_cast< SQInteger >(dpp::u_bot)},
@ -464,17 +573,7 @@ static const EnumElement g_DpGuildMemberFlagsEnum[] = {
{_SC("Mute"), static_cast< SQInteger >(dpp::gm_mute)}, {_SC("Mute"), static_cast< SQInteger >(dpp::gm_mute)},
{_SC("Pending"), static_cast< SQInteger >(dpp::gm_pending)} {_SC("Pending"), static_cast< SQInteger >(dpp::gm_pending)}
}; };
/*
// ------------------------------------------------------------------------------------------------
static const EnumElement g_DpEnum[] = {
};
// ------------------------------------------------------------------------------------------------
static const EnumElement g_DpEnum[] = {
};
*/
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
static const EnumElements g_EnumList[] = { static const EnumElements g_EnumList[] = {
{_SC("SqDiscordLogLevel"), g_DpLogLevelEnum}, {_SC("SqDiscordLogLevel"), g_DpLogLevelEnum},
@ -487,6 +586,8 @@ static const EnumElements g_EnumList[] = {
{_SC("SqDiscordActivityType"), g_DpActivityTypeEnum}, {_SC("SqDiscordActivityType"), g_DpActivityTypeEnum},
{_SC("SqDiscordActivityFlags"), g_DpActivityFlagsEnum}, {_SC("SqDiscordActivityFlags"), g_DpActivityFlagsEnum},
{_SC("SqDiscordVoiceStateFlags"), g_DpVoiceStateFlagsEnum}, {_SC("SqDiscordVoiceStateFlags"), g_DpVoiceStateFlagsEnum},
{_SC("SqDiscordRoleFlags"), g_DpRoleFlagsEnum},
{_SC("SqDiscordRolePermissions"), g_DpRolePermissionsEnum},
{_SC("SqDiscordUserFlags"), g_DpUserFlagsEnum}, {_SC("SqDiscordUserFlags"), g_DpUserFlagsEnum},
{_SC("SqDiscordRegion"), g_DpRegionEnum}, {_SC("SqDiscordRegion"), g_DpRegionEnum},
{_SC("SqDiscordGuildFlags"), g_DpGuildFlagsEnum}, {_SC("SqDiscordGuildFlags"), g_DpGuildFlagsEnum},

View File

@ -66,7 +66,7 @@ struct DpActivity
{ {
using Ptr = std::unique_ptr< dpp::activity >; using Ptr = std::unique_ptr< dpp::activity >;
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Referenced voice state instance. * Referenced activity instance.
*/ */
Ptr mPtr{nullptr}; Ptr mPtr{nullptr};
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -260,7 +260,7 @@ struct DpPresence
{ {
using Ptr = std::unique_ptr< dpp::presence >; using Ptr = std::unique_ptr< dpp::presence >;
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Referenced voice state instance. * Referenced presence instance.
*/ */
Ptr mPtr{nullptr}; Ptr mPtr{nullptr};
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -440,6 +440,7 @@ struct DpPresence
*/ */
SQMOD_NODISCARD SQInteger GetStatus() const { return static_cast< SQInteger >(Valid().status()); } SQMOD_NODISCARD SQInteger GetStatus() const { return static_cast< SQInteger >(Valid().status()); }
}; };
/* ------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------
* Represents the voice state of a user on a guild. * Represents the voice state of a user on a guild.
* These are stored in the DpGuild object, and accessible there, or via DpChannel::GetVoiceMembers. * These are stored in the DpGuild object, and accessible there, or via DpChannel::GetVoiceMembers.
@ -581,6 +582,286 @@ struct DpVoiceState
SQMOD_NODISCARD bool IsSupressed() const { return Valid().is_supressed(); } SQMOD_NODISCARD bool IsSupressed() const { return Valid().is_supressed(); }
}; };
/* ------------------------------------------------------------------------------------------------
* Represents a role within a DpGuild.
*/
struct DpRole
{
using Ptr = std::unique_ptr< dpp::role >;
/* --------------------------------------------------------------------------------------------
* Referenced role instance.
*/
Ptr mPtr{nullptr};
/* --------------------------------------------------------------------------------------------
* Wether the referenced pointer is owned.
*/
bool mOwned{false};
/* --------------------------------------------------------------------------------------------
* Default constructor.
*/
DpRole() noexcept = default;
/* --------------------------------------------------------------------------------------------
* Explicit constructor.
*/
explicit DpRole(Ptr::pointer ptr, bool owned = false) noexcept
: mPtr(ptr), mOwned(owned)
{ }
/* --------------------------------------------------------------------------------------------
* Explicit constructor.
*/
explicit DpRole(const Ptr::element_type & o) noexcept
: DpRole(new Ptr::element_type(o), true)
{ }
/* --------------------------------------------------------------------------------------------
* Move constructor.
*/
explicit DpRole(Ptr::element_type && o) noexcept
: DpRole(new Ptr::element_type(std::forward< Ptr::element_type >(o)), true)
{ }
/* --------------------------------------------------------------------------------------------
* Copy constructor (disabled).
*/
DpRole(const DpRole & o) = delete;
/* --------------------------------------------------------------------------------------------
* Move constructor.
*/
DpRole(DpRole && o) noexcept = default;
/* --------------------------------------------------------------------------------------------
* Destructor.
*/
~DpRole() noexcept
{
// Do we own this to try delete it?
if (!mOwned && mPtr) [[maybe_unused]] auto p = mPtr.release();
}
/* --------------------------------------------------------------------------------------------
* Copy assignment operator (disabled).
*/
DpRole & operator = (const DpRole & o) = delete;
/* --------------------------------------------------------------------------------------------
* Move assignment operator.
*/
DpRole & operator = (DpRole && o) noexcept
{
if (this != &o) {
// Do we own this to try delete it?
if (!mOwned && mPtr) [[maybe_unused]] auto p = mPtr.release();
// Transfer members values
mPtr = std::move(o.mPtr);
mOwned = o.mOwned;
}
return *this;
}
/* --------------------------------------------------------------------------------------------
* Validate the managed handle.
*/
void Validate() const { if (!mPtr) STHROWF("Invalid discord role handle"); }
/* --------------------------------------------------------------------------------------------
* Validate the managed handle and retrieve a const reference to it.
*/
SQMOD_NODISCARD Ptr::element_type & Valid() const { Validate(); return *mPtr; }
/* --------------------------------------------------------------------------------------------
* Check wether a valid instance is managed.
*/
SQMOD_NODISCARD bool IsValid() const { return static_cast< bool >(mPtr); }
/* --------------------------------------------------------------------------------------------
* Retrieve role name.
*/
SQMOD_NODISCARD const std::string & GetName() const { return Valid().name; }
/* --------------------------------------------------------------------------------------------
* Retrieve the role guild id.
*/
SQMOD_NODISCARD dpp::snowflake GetGuildID() const { return Valid().guild_id; }
/* --------------------------------------------------------------------------------------------
* Retrieve the role colour.
*/
SQMOD_NODISCARD SQInteger GetColour() const { return static_cast< SQInteger >(Valid().colour); }
/* --------------------------------------------------------------------------------------------
* Retrieve the role position.
*/
SQMOD_NODISCARD SQInteger GetPosition() const { return static_cast< SQInteger >(Valid().position); }
/* --------------------------------------------------------------------------------------------
* Retrieve the role permissions bitmask values from SqDiscordRolePermissions.
*/
SQMOD_NODISCARD SQInteger GetPermissions() const { return static_cast< SQInteger >(Valid().permissions); }
/* --------------------------------------------------------------------------------------------
* Retrieve the role flags from SqDiscordRoleFlags.
*/
SQMOD_NODISCARD SQInteger GetFlags() const { return static_cast< SQInteger >(Valid().flags); }
/* --------------------------------------------------------------------------------------------
* Retrieve the role integration id if any (e.g. role is a bot's role created when it was invited).
*/
SQMOD_NODISCARD dpp::snowflake GetIntegrationID() const { return Valid().integration_id; }
/* --------------------------------------------------------------------------------------------
* Retrieve the role bot id if any (e.g. role is a bot's role created when it was invited).
*/
SQMOD_NODISCARD dpp::snowflake GetBotID() const { return Valid().bot_id; }
/* --------------------------------------------------------------------------------------------
* Build a JSON string from this object.
*/
SQMOD_NODISCARD std::string BuildJSON() const { return Valid().build_json(); }
/* --------------------------------------------------------------------------------------------
* Build a JSON string from this object. If [with_id] is True then ID is to be included in the JSON.
*/
SQMOD_NODISCARD std::string BuildJSON_(bool with_id) const { return Valid().build_json(with_id); }
/* --------------------------------------------------------------------------------------------
* Check wether the role is hoisted.
*/
SQMOD_NODISCARD bool IsHoisted() const { return Valid().is_hoisted(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role is mentionable.
*/
SQMOD_NODISCARD bool IsMentionable() const { return Valid().is_mentionable(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role is managed (belongs to a bot or application).
*/
SQMOD_NODISCARD bool IsManaged() const { return Valid().is_managed(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has create instant invite permission.
*/
SQMOD_NODISCARD bool CanCreateInstantInvite() const { return Valid().has_create_instant_invite(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the kick members permission.
*/
SQMOD_NODISCARD bool CanKickMembers() const { return Valid().has_kick_members(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the ban members permission.
*/
SQMOD_NODISCARD bool CanBanMembers() const { return Valid().has_ban_members(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the administrator permission.
*/
SQMOD_NODISCARD bool IsAdministrator() const { return Valid().has_administrator(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the manage channels permission.
*/
SQMOD_NODISCARD bool CanManageChannels() const { return Valid().has_manage_channels(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the manage guild permission.
*/
SQMOD_NODISCARD bool CanManageGuild() const { return Valid().has_manage_guild(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the add reactions permission.
*/
SQMOD_NODISCARD bool CanAddReactions() const { return Valid().has_add_reactions(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the view audit log permission.
*/
SQMOD_NODISCARD bool CanViewAuditLog() const { return Valid().has_view_audit_log(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the priority speaker permission.
*/
SQMOD_NODISCARD bool IsPrioritySpeaker() const { return Valid().has_priority_speaker(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the stream permission.
*/
SQMOD_NODISCARD bool CanStream() const { return Valid().has_stream(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the view channel permission.
*/
SQMOD_NODISCARD bool CanViewChannel() const { return Valid().has_view_channel(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the send messages permission.
*/
SQMOD_NODISCARD bool CanSendMessages() const { return Valid().has_send_messages(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the send TTS messages permission.
*/
SQMOD_NODISCARD bool CanSendTtsMessages() const { return Valid().has_send_tts_messages(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the manage messages permission.
*/
SQMOD_NODISCARD bool CanManageMessages() const { return Valid().has_manage_messages(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the embed links permission.
*/
SQMOD_NODISCARD bool CanEmbedLinks() const { return Valid().has_embed_links(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the attach files permission.
*/
SQMOD_NODISCARD bool CanAttachFiles() const { return Valid().has_attach_files(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the read message history permission.
*/
SQMOD_NODISCARD bool CanReadMessageHistory() const { return Valid().has_read_message_history(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the mention \@everyone and \@here permission.
*/
SQMOD_NODISCARD bool CanMentionEveryone() const { return Valid().has_mention_everyone(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the use external emojis permission.
*/
SQMOD_NODISCARD bool CanUseExternalEmojis() const { return Valid().has_use_external_emojis(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the view guild insights permission.
*/
SQMOD_NODISCARD bool CanViewGuildInsights() const { return Valid().has_view_guild_insights(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the connect voice permission.
*/
SQMOD_NODISCARD bool CanConnect() const { return Valid().has_connect(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the speak permission.
*/
SQMOD_NODISCARD bool CanSpeak() const { return Valid().has_speak(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the mute members permission.
*/
SQMOD_NODISCARD bool CanMuteMembers() const { return Valid().has_mute_members(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the deafen members permission.
*/
SQMOD_NODISCARD bool CanDeafenMembers() const { return Valid().has_deafen_members(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the move members permission.
*/
SQMOD_NODISCARD bool CanMoveMembers() const { return Valid().has_move_members(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has use voice activity detection permission.
*/
SQMOD_NODISCARD bool CanUseVAT() const { return Valid().has_use_vad(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the change nickname permission.
*/
SQMOD_NODISCARD bool CanChangeNickname() const { return Valid().has_change_nickname(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the manage nicknames permission.
*/
SQMOD_NODISCARD bool CanManageNicknames() const { return Valid().has_manage_nicknames(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the manage roles permission.
*/
SQMOD_NODISCARD bool CanManageRoles() const { return Valid().has_manage_roles(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the manage webhooks permission.
*/
SQMOD_NODISCARD bool CanManageWebhooks() const { return Valid().has_manage_webhooks(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the manage emojis permission.
*/
SQMOD_NODISCARD bool CanManageEmojis() const { return Valid().has_manage_emojis(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the use slash commands permission.
*/
SQMOD_NODISCARD bool CanUseSlashCommands() const { return Valid().has_use_slash_commands(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the request to speak permission.
*/
SQMOD_NODISCARD bool HasRequestToSpeak() const { return Valid().has_request_to_speak(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the manage threads permission.
*/
SQMOD_NODISCARD bool CanManageThreads() const { return Valid().has_manage_threads(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the use public threads permission.
*/
SQMOD_NODISCARD bool HasUsePublicThreads() const { return Valid().has_use_public_threads(); }
/* --------------------------------------------------------------------------------------------
* Check wether the role has the use private threads permission.
*/
SQMOD_NODISCARD bool HasUsePrivateThreads() const { return Valid().has_use_private_threads(); }
};
/* ------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------
* Represents a user on discord. May or may not be a member of a DpGuild. * Represents a user on discord. May or may not be a member of a DpGuild.
*/ */
@ -588,7 +869,7 @@ struct DpUser
{ {
using Ptr = std::unique_ptr< dpp::user >; using Ptr = std::unique_ptr< dpp::user >;
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Referenced voice state instance. * Referenced user instance.
*/ */
Ptr mPtr{nullptr}; Ptr mPtr{nullptr};
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -918,7 +1199,7 @@ struct DpGuild
{ {
using Ptr = std::unique_ptr< dpp::guild >; using Ptr = std::unique_ptr< dpp::guild >;
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Referenced voice state instance. * Referenced guild instance.
*/ */
Ptr mPtr{nullptr}; Ptr mPtr{nullptr};
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------