2#ifndef DISCORD_HEADER_DISCORDPP_H_
3#define DISCORD_HEADER_DISCORDPP_H_
12#include <unordered_map>
31 Discord_RunCallbacks();
647class ActivityTimestamps;
649class ActivitySecrets;
653class AuthorizationCodeChallenge;
654class AuthorizationCodeVerifier;
655class AuthorizationArgs;
656class DeviceAuthorizationArgs;
657class VoiceStateHandle;
658class VADThresholdSettings;
665class RelationshipHandle;
667class LobbyMemberHandle;
669class AdditionalContent;
672class UserMessageSummary;
673class ClientCreateOptions;
682 mutable Discord_ActivityInvite instance_{};
688 Discord_ActivityInvite* instance()
const {
return &instance_; }
780 mutable Discord_ActivityAssets instance_{};
786 Discord_ActivityAssets* instance()
const {
return &instance_; }
859 mutable Discord_ActivityTimestamps instance_{};
865 Discord_ActivityTimestamps* instance()
const {
return &instance_; }
913 mutable Discord_ActivityParty instance_{};
919 Discord_ActivityParty* instance()
const {
return &instance_; }
951 std::string
Id()
const;
975 mutable Discord_ActivitySecrets instance_{};
981 Discord_ActivitySecrets* instance()
const {
return &instance_; }
1019 mutable Discord_ActivityButton instance_{};
1025 Discord_ActivityButton* instance()
const {
return &instance_; }
1244 mutable Discord_Activity instance_{};
1250 Discord_Activity* instance()
const {
return &instance_; }
1310 std::optional<std::string>
State()
const;
1356 std::optional<discordpp::ActivityAssets>
Assets()
const;
1369 std::optional<discordpp::ActivityParty>
Party()
const;
1375 std::optional<discordpp::ActivitySecrets>
Secrets()
const;
1400 mutable Discord_ClientResult instance_{};
1406 Discord_ClientResult* instance()
const {
return &instance_; }
1493 mutable Discord_AuthorizationCodeChallenge instance_{};
1499 Discord_AuthorizationCodeChallenge* instance()
const {
return &instance_; }
1540 mutable Discord_AuthorizationCodeVerifier instance_{};
1546 Discord_AuthorizationCodeVerifier* instance()
const {
return &instance_; }
1585 mutable Discord_AuthorizationArgs instance_{};
1591 Discord_AuthorizationArgs* instance()
const {
return &instance_; }
1644 std::optional<std::string>
State()
const;
1652 std::optional<std::string>
Nonce()
const;
1691 mutable Discord_DeviceAuthorizationArgs instance_{};
1697 Discord_DeviceAuthorizationArgs* instance()
const {
return &instance_; }
1759 mutable Discord_VoiceStateHandle instance_{};
1765 Discord_VoiceStateHandle* instance()
const {
return &instance_; }
1801 mutable Discord_VADThresholdSettings instance_{};
1807 Discord_VADThresholdSettings* instance()
const {
return &instance_; }
1845 mutable Discord_Call instance_{};
1910 Discord_Call* instance()
const {
return &instance_; }
2072 mutable Discord_ChannelHandle instance_{};
2078 Discord_ChannelHandle* instance()
const {
return &instance_; }
2123 mutable Discord_GuildMinimal instance_{};
2129 Discord_GuildMinimal* instance()
const {
return &instance_; }
2168 mutable Discord_GuildChannel instance_{};
2174 Discord_GuildChannel* instance()
const {
return &instance_; }
2249 mutable Discord_LinkedLobby instance_{};
2255 Discord_LinkedLobby* instance()
const {
return &instance_; }
2295 mutable Discord_LinkedChannel instance_{};
2301 Discord_LinkedChannel* instance()
const {
return &instance_; }
2377 mutable Discord_RelationshipHandle instance_{};
2383 Discord_RelationshipHandle* instance()
const {
return &instance_; }
2421 std::optional<discordpp::UserHandle>
User()
const;
2436 mutable Discord_UserHandle instance_{};
2457 Discord_UserHandle* instance()
const {
return &instance_; }
2561 mutable Discord_LobbyMemberHandle instance_{};
2567 Discord_LobbyMemberHandle* instance()
const {
return &instance_; }
2610 std::unordered_map<std::string, std::string>
Metadata()
const;
2613 std::optional<discordpp::UserHandle>
User()
const;
2704 mutable Discord_LobbyHandle instance_{};
2710 Discord_LobbyHandle* instance()
const {
return &instance_; }
2761 std::unordered_map<std::string, std::string>
Metadata()
const;
2768 mutable Discord_AdditionalContent instance_{};
2774 Discord_AdditionalContent* instance()
const {
return &instance_; }
2813 std::optional<std::string>
Title()
const;
2880 mutable Discord_MessageHandle instance_{};
2886 Discord_MessageHandle* instance()
const {
return &instance_; }
2923 std::optional<discordpp::UserHandle>
Author()
const;
2929 std::optional<discordpp::ChannelHandle>
Channel()
const;
2954 std::optional<discordpp::LobbyHandle>
Lobby()
const;
2961 std::unordered_map<std::string, std::string>
Metadata()
const;
2993 mutable Discord_AudioDevice instance_{};
2999 Discord_AudioDevice* instance()
const {
return &instance_; }
3045 mutable Discord_UserMessageSummary instance_{};
3051 Discord_UserMessageSummary* instance()
const {
return &instance_; }
3087 mutable Discord_ClientCreateOptions instance_{};
3093 Discord_ClientCreateOptions* instance()
const {
return &instance_; }
3161 mutable Discord_Client instance_{};
3253 std::function<void(std::vector<discordpp::AudioDevice> devices)>;
3257 std::function<void(std::vector<discordpp::AudioDevice> devices)>;
3261 std::function<void(std::vector<discordpp::AudioDevice> inputDevices,
3262 std::vector<discordpp::AudioDevice> outputDevices)>;
3275 std::function<void(uint64_t lobbyId, uint64_t memberId,
bool added)>;
3282 uint64_t samplesPerChannel,
3285 bool& outShouldMute)>;
3291 void(int16_t* data, uint64_t samplesPerChannel, int32_t sampleRate, uint64_t channels)>;
3305 std::string accessToken,
3308 std::string scopes)>;
3316 std::string accessToken,
3317 std::string refreshToken,
3320 std::string scopes)>;
3352 std::vector<discordpp::MessageHandle> messages)>;
3357 std::vector<discordpp::UserMessageSummary> summaries)>;
3362 std::vector<discordpp::MessageHandle> messages)>;
3407 std::vector<discordpp::GuildChannel> guildChannels)>;
3411 std::vector<discordpp::GuildMinimal> guilds)>;
3458 std::function<void(uint64_t applicationId, std::string joinSecret)>;
3479 std::function<void(uint64_t userId,
bool isDiscordRelationshipUpdate)>;
3486 std::function<void(uint64_t userId,
bool isDiscordRelationshipUpdate)>;
3491 std::optional<discordpp::UserHandle> user)>;
3499 Discord_Client* instance()
const {
return &instance_; }
3521 explicit Client(std::string apiBase, std::string webBase);
3743 [[deprecated(
"Calling Client::SetSpeakerMode is DEPRECATED.")]]
3937 uint64_t childApplicationId,
3946 std::string
const& token,
3984 std::string
const& externalAuthToken,
4011 std::string
const& code,
4012 std::string
const& codeVerifier,
4013 std::string
const& redirectUri,
4083 std::string
const& externalAuthToken,
4117 std::string
const& code,
4118 std::string
const& codeVerifier,
4119 std::string
const& redirectUri,
4121 std::string
const& externalAuthToken,
4157 std::string
const& refreshToken,
4173 std::string
const& token,
4219 uint64_t applicationId,
4221 std::string
const& externalAuthToken,
4230 std::string
const& name,
4264 std::string
const& content,
4340 std::string
const& content,
4350 std::string
const& content,
4351 std::unordered_map<std::string, std::string>
const& metadata,
4367 std::string
const& content,
4377 std::string
const& content,
4378 std::unordered_map<std::string, std::string>
const& metadata,
4545 std::string
const& secret,
4546 std::unordered_map<std::string, std::string>
const& lobbyMetadata,
4547 std::unordered_map<std::string, std::string>
const& memberMetadata,
4718 std::string
const& content,
4998 uint64_t applicationId,
5006 std::optional<discordpp::UserHandle>
GetUser(uint64_t userId)
const;
5026 mutable Discord_CallInfoHandle instance_{};
5032 Discord_CallInfoHandle* instance()
const {
return &instance_; }
5076 return "JoinRequest";
5106 return "CustomStatus";
5110 return "HangStatus";
5160 return "NetworkError";
5164 return "ClientNotReady";
5168 return "ClientDestroyed";
5170 return "ValidationError";
5174 return "AuthorizationFailed";
5190 return "SwitchingProtocols";
5192 return "Processing";
5194 return "EarlyHints";
5202 return "NonAuthoritativeInfo";
5206 return "ResetContent";
5208 return "PartialContent";
5210 return "MultiStatus";
5212 return "AlreadyReported";
5216 return "MultipleChoices";
5218 return "MovedPermanently";
5224 return "NotModified";
5226 return "TemporaryRedirect";
5228 return "PermanentRedirect";
5230 return "BadRequest";
5232 return "Unauthorized";
5234 return "PaymentRequired";
5240 return "MethodNotAllowed";
5242 return "NotAcceptable";
5244 return "ProxyAuthRequired";
5246 return "RequestTimeout";
5252 return "LengthRequired";
5254 return "PreconditionFailed";
5256 return "PayloadTooLarge";
5258 return "UriTooLong";
5260 return "UnsupportedMediaType";
5262 return "RangeNotSatisfiable";
5264 return "ExpectationFailed";
5266 return "MisdirectedRequest";
5268 return "UnprocessableEntity";
5272 return "FailedDependency";
5276 return "UpgradeRequired";
5278 return "PreconditionRequired";
5280 return "TooManyRequests";
5282 return "RequestHeaderFieldsTooLarge";
5284 return "InternalServerError";
5286 return "NotImplemented";
5288 return "BadGateway";
5290 return "ServiceUnavailable";
5292 return "GatewayTimeout";
5294 return "HttpVersionNotSupported";
5296 return "VariantAlsoNegotiates";
5298 return "InsufficientStorage";
5300 return "LoopDetected";
5302 return "NotExtended";
5304 return "NetworkAuthorizationRequired";
5324 return "GuildInstall";
5326 return "UserInstall";
5338 return "Attachment";
5342 return "VoiceMessage";
5372 return "SignalingConnectionFailed";
5374 return "SignalingUnexpectedClose";
5376 return "VoiceConnectionFailed";
5378 return "JoinTimeout";
5390 return "MODE_UNINIT";
5404 return "Disconnected";
5408 return "Connecting";
5410 return "SignalingConnected";
5414 return "Reconnecting";
5416 return "Disconnecting";
5430 return "GuildVoice";
5434 return "GuildCategory";
5438 return "GuildStore";
5440 return "GuildNewsThread";
5442 return "GuildPublicThread";
5444 return "GuildPrivateThread";
5446 return "GuildStageVoice";
5448 return "GuildDirectory";
5450 return "GuildForum";
5452 return "GuildMedia";
5456 return "EphemeralDm";
5472 return "PendingIncoming";
5474 return "PendingOutgoing";
5478 return "Suggestion";
5528 return "MessageDataVisibleOnDiscord";
5540 return "ConnectionFailed";
5542 return "UnexpectedClose";
5544 return "ConnectionCanceled";
5554 return "Disconnected";
5556 return "Connecting";
5562 return "Reconnecting";
5564 return "Disconnecting";
5604 return "EpicOnlineServicesAccessToken";
5606 return "EpicOnlineServicesIdToken";
5608 return "SteamSessionTicket";
5610 return "UnityServicesIdToken";
5638 return "OnlinePlayingGame";
5640 return "OnlineElsewhere";
5649#ifdef DISCORDPP_IMPLEMENTATION
5650#undef DISCORDPP_IMPLEMENTATION
5652#pragma clang diagnostic push
5653#pragma clang diagnostic ignored "-Wunused-parameter"
5656std::function<void(std::function<
void()>)> s_synchronizationContext;
5658inline bool HasSynchronizationContext()
5660 return !!s_synchronizationContext;
5663inline void PostTask(std::function<
void()> task)
5665 assert(s_synchronizationContext);
5666 s_synchronizationContext(std::move(task));
5669void SetSynchronizationContext(std::function<
void(std::function<
void()>)> executor)
5671 s_synchronizationContext = std::move(executor);
5674template <
typename T>
5675struct TDelegateUserData {
5677 TDelegateUserData(T delegate)
5678 : delegate{delegate}
5682 static void Free(
void* ptr) {
delete reinterpret_cast<TDelegateUserData*
>(ptr); }
5684 static T& Get(
void* userData)
5686 return reinterpret_cast<TDelegateUserData*
>(userData)->delegate;
5690struct ConvertedProperties {
5691 ConvertedProperties(std::unordered_map<std::string, std::string>
const& PropertyMap)
5693 Properties.size = PropertyMap.size();
5694 Properties.keys =
reinterpret_cast<Discord_String*
>(
5695 Discord_Alloc(Properties.size *
sizeof(Discord_String)));
5696 Properties.values =
reinterpret_cast<Discord_String*
>(
5697 Discord_Alloc(Properties.size *
sizeof(Discord_String)));
5699 for (
auto& pair : PropertyMap) {
5700 Properties.keys[i] = AllocateString(pair.first);
5701 Properties.values[i] = AllocateString(pair.second);
5705 ~ConvertedProperties() { Discord_FreeProperties(Properties); }
5706 Discord_Properties Properties{};
5709 Discord_String AllocateString(std::string
const& str)
5711 Discord_String result;
5712 result.ptr =
reinterpret_cast<uint8_t*
>(Discord_Alloc(str.size()));
5713 result.size = str.size();
5714 std::memcpy(result.ptr, str.data(), result.size);
5719std::unordered_map<std::string, std::string> ConvertReturnedProperties(
5720 Discord_Properties
const& Properties)
5722 std::unordered_map<std::string, std::string> result;
5723 for (
size_t i = 0; i < Properties.size; ++i) {
5724 std::string key(
reinterpret_cast<char*
>(Properties.keys[i].ptr), Properties.keys[i].size);
5725 std::string value(
reinterpret_cast<char*
>(Properties.values[i].ptr),
5726 Properties.values[i].size);
5727 result.emplace(std::move(key), std::move(value));
5732ActivityInvite::~ActivityInvite()
5740 : instance_(other.instance_)
5741 , state_(other.state_)
5747 if (
this != &other) {
5751 instance_ = other.instance_;
5752 state_ = other.state_;
5762 Discord_ActivityInvite_Clone(&instance_, rhs.instance());
5764 state_ = DiscordObjectState::Owned;
5767ActivityInvite& ActivityInvite::operator=(
const ActivityInvite& rhs)
5770 if (state_ == DiscordObjectState::Owned) {
5772 state_ = DiscordObjectState::Invalid;
5774 if (rhs.state_ == DiscordObjectState::Owned) {
5775 Discord_ActivityInvite_Clone(&instance_, rhs.instance());
5777 state_ = DiscordObjectState::Owned;
5782ActivityInvite::ActivityInvite(Discord_ActivityInvite instance, DiscordObjectState state)
5783 : instance_(instance)
5787ActivityInvite::ActivityInvite()
5789 assert(state_ == DiscordObjectState::Invalid);
5790 Discord_ActivityInvite_Init(&instance_);
5791 state_ = DiscordObjectState::Owned;
5793void ActivityInvite::Drop()
5795 if (state_ != DiscordObjectState::Owned) {
5798 Discord_ActivityInvite_Drop(&instance_);
5799 state_ = DiscordObjectState::Invalid;
5801uint64_t ActivityInvite::SenderId()
const
5803 assert(state_ == DiscordObjectState::Owned);
5804 uint64_t returnValue__;
5805 returnValue__ = Discord_ActivityInvite_SenderId(&instance_);
5806 return returnValue__;
5808void ActivityInvite::SetSenderId(uint64_t SenderId)
5810 assert(state_ == DiscordObjectState::Owned);
5811 Discord_ActivityInvite_SetSenderId(&instance_, SenderId);
5813uint64_t ActivityInvite::ChannelId()
const
5815 assert(state_ == DiscordObjectState::Owned);
5816 uint64_t returnValue__;
5817 returnValue__ = Discord_ActivityInvite_ChannelId(&instance_);
5818 return returnValue__;
5820void ActivityInvite::SetChannelId(uint64_t ChannelId)
5822 assert(state_ == DiscordObjectState::Owned);
5823 Discord_ActivityInvite_SetChannelId(&instance_, ChannelId);
5825uint64_t ActivityInvite::MessageId()
const
5827 assert(state_ == DiscordObjectState::Owned);
5828 uint64_t returnValue__;
5829 returnValue__ = Discord_ActivityInvite_MessageId(&instance_);
5830 return returnValue__;
5832void ActivityInvite::SetMessageId(uint64_t MessageId)
5834 assert(state_ == DiscordObjectState::Owned);
5835 Discord_ActivityInvite_SetMessageId(&instance_, MessageId);
5839 assert(state_ == DiscordObjectState::Owned);
5840 Discord_ActivityActionTypes returnValue__;
5841 returnValue__ = Discord_ActivityInvite_Type(&instance_);
5846 assert(state_ == DiscordObjectState::Owned);
5847 Discord_ActivityInvite_SetType(&instance_,
static_cast<Discord_ActivityActionTypes
>(Type));
5849uint64_t ActivityInvite::ApplicationId()
const
5851 assert(state_ == DiscordObjectState::Owned);
5852 uint64_t returnValue__;
5853 returnValue__ = Discord_ActivityInvite_ApplicationId(&instance_);
5854 return returnValue__;
5856void ActivityInvite::SetApplicationId(uint64_t ApplicationId)
5858 assert(state_ == DiscordObjectState::Owned);
5859 Discord_ActivityInvite_SetApplicationId(&instance_, ApplicationId);
5861uint64_t ActivityInvite::ParentApplicationId()
const
5863 assert(state_ == DiscordObjectState::Owned);
5864 uint64_t returnValue__;
5865 returnValue__ = Discord_ActivityInvite_ParentApplicationId(&instance_);
5866 return returnValue__;
5868void ActivityInvite::SetParentApplicationId(uint64_t ParentApplicationId)
5870 assert(state_ == DiscordObjectState::Owned);
5871 Discord_ActivityInvite_SetParentApplicationId(&instance_, ParentApplicationId);
5873std::string ActivityInvite::PartyId()
const
5875 assert(state_ == DiscordObjectState::Owned);
5876 Discord_String returnValueNative__;
5877 Discord_ActivityInvite_PartyId(&instance_, &returnValueNative__);
5878 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
5879 returnValueNative__.size);
5880 Discord_Free(returnValueNative__.ptr);
5881 return returnValue__;
5883void ActivityInvite::SetPartyId(std::string PartyId)
5885 assert(state_ == DiscordObjectState::Owned);
5886 Discord_String PartyId__str{(uint8_t*)(PartyId.data()), PartyId.size()};
5887 Discord_ActivityInvite_SetPartyId(&instance_, PartyId__str);
5889std::string ActivityInvite::SessionId()
const
5891 assert(state_ == DiscordObjectState::Owned);
5892 Discord_String returnValueNative__;
5893 Discord_ActivityInvite_SessionId(&instance_, &returnValueNative__);
5894 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
5895 returnValueNative__.size);
5896 Discord_Free(returnValueNative__.ptr);
5897 return returnValue__;
5899void ActivityInvite::SetSessionId(std::string SessionId)
5901 assert(state_ == DiscordObjectState::Owned);
5902 Discord_String SessionId__str{(uint8_t*)(SessionId.data()), SessionId.size()};
5903 Discord_ActivityInvite_SetSessionId(&instance_, SessionId__str);
5905bool ActivityInvite::IsValid()
const
5907 assert(state_ == DiscordObjectState::Owned);
5909 returnValue__ = Discord_ActivityInvite_IsValid(&instance_);
5910 return returnValue__;
5912void ActivityInvite::SetIsValid(
bool IsValid)
5914 assert(state_ == DiscordObjectState::Owned);
5915 Discord_ActivityInvite_SetIsValid(&instance_, IsValid);
5917const ActivityAssets ActivityAssets::nullobj{{}, DiscordObjectState::Invalid};
5918ActivityAssets::~ActivityAssets()
5920 if (state_ == DiscordObjectState::Owned) {
5922 state_ = DiscordObjectState::Invalid;
5925ActivityAssets::ActivityAssets(ActivityAssets&& other) noexcept
5926 : instance_(other.instance_)
5927 , state_(other.state_)
5929 other.state_ = DiscordObjectState::Invalid;
5931ActivityAssets& ActivityAssets::operator=(ActivityAssets&& other)
noexcept
5933 if (
this != &other) {
5934 if (state_ == DiscordObjectState::Owned) {
5937 instance_ = other.instance_;
5938 state_ = other.state_;
5939 other.state_ = DiscordObjectState::Invalid;
5943ActivityAssets::ActivityAssets(
const ActivityAssets& arg0)
5948 Discord_ActivityAssets_Clone(&instance_, arg0.instance());
5950 state_ = DiscordObjectState::Owned;
5953ActivityAssets& ActivityAssets::operator=(
const ActivityAssets& arg0)
5955 if (
this != &arg0) {
5956 if (state_ == DiscordObjectState::Owned) {
5958 state_ = DiscordObjectState::Invalid;
5960 if (arg0.state_ == DiscordObjectState::Owned) {
5961 Discord_ActivityAssets_Clone(&instance_, arg0.instance());
5963 state_ = DiscordObjectState::Owned;
5968ActivityAssets::ActivityAssets(Discord_ActivityAssets instance, DiscordObjectState state)
5969 : instance_(instance)
5973ActivityAssets::ActivityAssets()
5975 assert(state_ == DiscordObjectState::Invalid);
5976 Discord_ActivityAssets_Init(&instance_);
5977 state_ = DiscordObjectState::Owned;
5979void ActivityAssets::Drop()
5981 if (state_ != DiscordObjectState::Owned) {
5984 Discord_ActivityAssets_Drop(&instance_);
5985 state_ = DiscordObjectState::Invalid;
5987std::optional<std::string> ActivityAssets::LargeImage()
const
5989 assert(state_ == DiscordObjectState::Owned);
5990 bool returnIsNonNull__;
5991 Discord_String returnValueNative__;
5992 returnIsNonNull__ = Discord_ActivityAssets_LargeImage(&instance_, &returnValueNative__);
5993 if (!returnIsNonNull__) {
5996 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
5997 returnValueNative__.size);
5998 Discord_Free(returnValueNative__.ptr);
5999 return returnValue__;
6001void ActivityAssets::SetLargeImage(std::optional<std::string> LargeImage)
6003 assert(state_ == DiscordObjectState::Owned);
6004 Discord_String LargeImage__str{};
6005 if (LargeImage.has_value()) {
6006 LargeImage__str.ptr =
reinterpret_cast<uint8_t*
>(LargeImage->data());
6007 LargeImage__str.size = LargeImage->size();
6009 Discord_ActivityAssets_SetLargeImage(&instance_,
6010 (LargeImage.has_value() ? &LargeImage__str :
nullptr));
6012std::optional<std::string> ActivityAssets::LargeText()
const
6014 assert(state_ == DiscordObjectState::Owned);
6015 bool returnIsNonNull__;
6016 Discord_String returnValueNative__;
6017 returnIsNonNull__ = Discord_ActivityAssets_LargeText(&instance_, &returnValueNative__);
6018 if (!returnIsNonNull__) {
6021 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
6022 returnValueNative__.size);
6023 Discord_Free(returnValueNative__.ptr);
6024 return returnValue__;
6026void ActivityAssets::SetLargeText(std::optional<std::string> LargeText)
6028 assert(state_ == DiscordObjectState::Owned);
6029 Discord_String LargeText__str{};
6030 if (LargeText.has_value()) {
6031 LargeText__str.ptr =
reinterpret_cast<uint8_t*
>(LargeText->data());
6032 LargeText__str.size = LargeText->size();
6034 Discord_ActivityAssets_SetLargeText(&instance_,
6035 (LargeText.has_value() ? &LargeText__str :
nullptr));
6037std::optional<std::string> ActivityAssets::LargeUrl()
const
6039 assert(state_ == DiscordObjectState::Owned);
6040 bool returnIsNonNull__;
6041 Discord_String returnValueNative__;
6042 returnIsNonNull__ = Discord_ActivityAssets_LargeUrl(&instance_, &returnValueNative__);
6043 if (!returnIsNonNull__) {
6046 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
6047 returnValueNative__.size);
6048 Discord_Free(returnValueNative__.ptr);
6049 return returnValue__;
6051void ActivityAssets::SetLargeUrl(std::optional<std::string> LargeUrl)
6053 assert(state_ == DiscordObjectState::Owned);
6054 Discord_String LargeUrl__str{};
6055 if (LargeUrl.has_value()) {
6056 LargeUrl__str.ptr =
reinterpret_cast<uint8_t*
>(LargeUrl->data());
6057 LargeUrl__str.size = LargeUrl->size();
6059 Discord_ActivityAssets_SetLargeUrl(&instance_,
6060 (LargeUrl.has_value() ? &LargeUrl__str :
nullptr));
6062std::optional<std::string> ActivityAssets::SmallImage()
const
6064 assert(state_ == DiscordObjectState::Owned);
6065 bool returnIsNonNull__;
6066 Discord_String returnValueNative__;
6067 returnIsNonNull__ = Discord_ActivityAssets_SmallImage(&instance_, &returnValueNative__);
6068 if (!returnIsNonNull__) {
6071 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
6072 returnValueNative__.size);
6073 Discord_Free(returnValueNative__.ptr);
6074 return returnValue__;
6076void ActivityAssets::SetSmallImage(std::optional<std::string> SmallImage)
6078 assert(state_ == DiscordObjectState::Owned);
6079 Discord_String SmallImage__str{};
6080 if (SmallImage.has_value()) {
6081 SmallImage__str.ptr =
reinterpret_cast<uint8_t*
>(SmallImage->data());
6082 SmallImage__str.size = SmallImage->size();
6084 Discord_ActivityAssets_SetSmallImage(&instance_,
6085 (SmallImage.has_value() ? &SmallImage__str :
nullptr));
6087std::optional<std::string> ActivityAssets::SmallText()
const
6089 assert(state_ == DiscordObjectState::Owned);
6090 bool returnIsNonNull__;
6091 Discord_String returnValueNative__;
6092 returnIsNonNull__ = Discord_ActivityAssets_SmallText(&instance_, &returnValueNative__);
6093 if (!returnIsNonNull__) {
6096 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
6097 returnValueNative__.size);
6098 Discord_Free(returnValueNative__.ptr);
6099 return returnValue__;
6101void ActivityAssets::SetSmallText(std::optional<std::string> SmallText)
6103 assert(state_ == DiscordObjectState::Owned);
6104 Discord_String SmallText__str{};
6105 if (SmallText.has_value()) {
6106 SmallText__str.ptr =
reinterpret_cast<uint8_t*
>(SmallText->data());
6107 SmallText__str.size = SmallText->size();
6109 Discord_ActivityAssets_SetSmallText(&instance_,
6110 (SmallText.has_value() ? &SmallText__str :
nullptr));
6112std::optional<std::string> ActivityAssets::SmallUrl()
const
6114 assert(state_ == DiscordObjectState::Owned);
6115 bool returnIsNonNull__;
6116 Discord_String returnValueNative__;
6117 returnIsNonNull__ = Discord_ActivityAssets_SmallUrl(&instance_, &returnValueNative__);
6118 if (!returnIsNonNull__) {
6121 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
6122 returnValueNative__.size);
6123 Discord_Free(returnValueNative__.ptr);
6124 return returnValue__;
6126void ActivityAssets::SetSmallUrl(std::optional<std::string> SmallUrl)
6128 assert(state_ == DiscordObjectState::Owned);
6129 Discord_String SmallUrl__str{};
6130 if (SmallUrl.has_value()) {
6131 SmallUrl__str.ptr =
reinterpret_cast<uint8_t*
>(SmallUrl->data());
6132 SmallUrl__str.size = SmallUrl->size();
6134 Discord_ActivityAssets_SetSmallUrl(&instance_,
6135 (SmallUrl.has_value() ? &SmallUrl__str :
nullptr));
6137const ActivityTimestamps ActivityTimestamps::nullobj{{}, DiscordObjectState::Invalid};
6138ActivityTimestamps::~ActivityTimestamps()
6140 if (state_ == DiscordObjectState::Owned) {
6142 state_ = DiscordObjectState::Invalid;
6145ActivityTimestamps::ActivityTimestamps(ActivityTimestamps&& other) noexcept
6146 : instance_(other.instance_)
6147 , state_(other.state_)
6149 other.state_ = DiscordObjectState::Invalid;
6151ActivityTimestamps& ActivityTimestamps::operator=(ActivityTimestamps&& other)
noexcept
6153 if (
this != &other) {
6154 if (state_ == DiscordObjectState::Owned) {
6157 instance_ = other.instance_;
6158 state_ = other.state_;
6159 other.state_ = DiscordObjectState::Invalid;
6163ActivityTimestamps::ActivityTimestamps(
const ActivityTimestamps& arg0)
6168 Discord_ActivityTimestamps_Clone(&instance_, arg0.instance());
6170 state_ = DiscordObjectState::Owned;
6173ActivityTimestamps& ActivityTimestamps::operator=(
const ActivityTimestamps& arg0)
6175 if (
this != &arg0) {
6176 if (state_ == DiscordObjectState::Owned) {
6178 state_ = DiscordObjectState::Invalid;
6180 if (arg0.state_ == DiscordObjectState::Owned) {
6181 Discord_ActivityTimestamps_Clone(&instance_, arg0.instance());
6183 state_ = DiscordObjectState::Owned;
6188ActivityTimestamps::ActivityTimestamps(Discord_ActivityTimestamps instance,
6189 DiscordObjectState state)
6190 : instance_(instance)
6194ActivityTimestamps::ActivityTimestamps()
6196 assert(state_ == DiscordObjectState::Invalid);
6197 Discord_ActivityTimestamps_Init(&instance_);
6198 state_ = DiscordObjectState::Owned;
6200void ActivityTimestamps::Drop()
6202 if (state_ != DiscordObjectState::Owned) {
6205 Discord_ActivityTimestamps_Drop(&instance_);
6206 state_ = DiscordObjectState::Invalid;
6208uint64_t ActivityTimestamps::Start()
const
6210 assert(state_ == DiscordObjectState::Owned);
6211 uint64_t returnValue__;
6212 returnValue__ = Discord_ActivityTimestamps_Start(&instance_);
6213 return returnValue__;
6215void ActivityTimestamps::SetStart(uint64_t Start)
6217 assert(state_ == DiscordObjectState::Owned);
6218 Discord_ActivityTimestamps_SetStart(&instance_, Start);
6220uint64_t ActivityTimestamps::End()
const
6222 assert(state_ == DiscordObjectState::Owned);
6223 uint64_t returnValue__;
6224 returnValue__ = Discord_ActivityTimestamps_End(&instance_);
6225 return returnValue__;
6227void ActivityTimestamps::SetEnd(uint64_t End)
6229 assert(state_ == DiscordObjectState::Owned);
6230 Discord_ActivityTimestamps_SetEnd(&instance_, End);
6232const ActivityParty ActivityParty::nullobj{{}, DiscordObjectState::Invalid};
6233ActivityParty::~ActivityParty()
6235 if (state_ == DiscordObjectState::Owned) {
6237 state_ = DiscordObjectState::Invalid;
6240ActivityParty::ActivityParty(ActivityParty&& other) noexcept
6241 : instance_(other.instance_)
6242 , state_(other.state_)
6244 other.state_ = DiscordObjectState::Invalid;
6246ActivityParty& ActivityParty::operator=(ActivityParty&& other)
noexcept
6248 if (
this != &other) {
6249 if (state_ == DiscordObjectState::Owned) {
6252 instance_ = other.instance_;
6253 state_ = other.state_;
6254 other.state_ = DiscordObjectState::Invalid;
6258ActivityParty::ActivityParty(
const ActivityParty& arg0)
6263 Discord_ActivityParty_Clone(&instance_, arg0.instance());
6265 state_ = DiscordObjectState::Owned;
6268ActivityParty& ActivityParty::operator=(
const ActivityParty& arg0)
6270 if (
this != &arg0) {
6271 if (state_ == DiscordObjectState::Owned) {
6273 state_ = DiscordObjectState::Invalid;
6275 if (arg0.state_ == DiscordObjectState::Owned) {
6276 Discord_ActivityParty_Clone(&instance_, arg0.instance());
6278 state_ = DiscordObjectState::Owned;
6283ActivityParty::ActivityParty(Discord_ActivityParty instance, DiscordObjectState state)
6284 : instance_(instance)
6288ActivityParty::ActivityParty()
6290 assert(state_ == DiscordObjectState::Invalid);
6291 Discord_ActivityParty_Init(&instance_);
6292 state_ = DiscordObjectState::Owned;
6294void ActivityParty::Drop()
6296 if (state_ != DiscordObjectState::Owned) {
6299 Discord_ActivityParty_Drop(&instance_);
6300 state_ = DiscordObjectState::Invalid;
6302std::string ActivityParty::Id()
const
6304 assert(state_ == DiscordObjectState::Owned);
6305 Discord_String returnValueNative__;
6306 Discord_ActivityParty_Id(&instance_, &returnValueNative__);
6307 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
6308 returnValueNative__.size);
6309 Discord_Free(returnValueNative__.ptr);
6310 return returnValue__;
6312void ActivityParty::SetId(std::string Id)
6314 assert(state_ == DiscordObjectState::Owned);
6315 Discord_String Id__str{(uint8_t*)(Id.data()), Id.size()};
6316 Discord_ActivityParty_SetId(&instance_, Id__str);
6318int32_t ActivityParty::CurrentSize()
const
6320 assert(state_ == DiscordObjectState::Owned);
6321 int32_t returnValue__;
6322 returnValue__ = Discord_ActivityParty_CurrentSize(&instance_);
6323 return returnValue__;
6325void ActivityParty::SetCurrentSize(int32_t CurrentSize)
6327 assert(state_ == DiscordObjectState::Owned);
6328 Discord_ActivityParty_SetCurrentSize(&instance_, CurrentSize);
6330int32_t ActivityParty::MaxSize()
const
6332 assert(state_ == DiscordObjectState::Owned);
6333 int32_t returnValue__;
6334 returnValue__ = Discord_ActivityParty_MaxSize(&instance_);
6335 return returnValue__;
6337void ActivityParty::SetMaxSize(int32_t MaxSize)
6339 assert(state_ == DiscordObjectState::Owned);
6340 Discord_ActivityParty_SetMaxSize(&instance_, MaxSize);
6344 assert(state_ == DiscordObjectState::Owned);
6345 Discord_ActivityPartyPrivacy returnValue__;
6346 returnValue__ = Discord_ActivityParty_Privacy(&instance_);
6351 assert(state_ == DiscordObjectState::Owned);
6352 Discord_ActivityParty_SetPrivacy(&instance_,
6353 static_cast<Discord_ActivityPartyPrivacy
>(Privacy));
6355const ActivitySecrets ActivitySecrets::nullobj{{}, DiscordObjectState::Invalid};
6356ActivitySecrets::~ActivitySecrets()
6358 if (state_ == DiscordObjectState::Owned) {
6360 state_ = DiscordObjectState::Invalid;
6363ActivitySecrets::ActivitySecrets(ActivitySecrets&& other) noexcept
6364 : instance_(other.instance_)
6365 , state_(other.state_)
6367 other.state_ = DiscordObjectState::Invalid;
6369ActivitySecrets& ActivitySecrets::operator=(ActivitySecrets&& other)
noexcept
6371 if (
this != &other) {
6372 if (state_ == DiscordObjectState::Owned) {
6375 instance_ = other.instance_;
6376 state_ = other.state_;
6377 other.state_ = DiscordObjectState::Invalid;
6381ActivitySecrets::ActivitySecrets(
const ActivitySecrets& arg0)
6386 Discord_ActivitySecrets_Clone(&instance_, arg0.instance());
6388 state_ = DiscordObjectState::Owned;
6391ActivitySecrets& ActivitySecrets::operator=(
const ActivitySecrets& arg0)
6393 if (
this != &arg0) {
6394 if (state_ == DiscordObjectState::Owned) {
6396 state_ = DiscordObjectState::Invalid;
6398 if (arg0.state_ == DiscordObjectState::Owned) {
6399 Discord_ActivitySecrets_Clone(&instance_, arg0.instance());
6401 state_ = DiscordObjectState::Owned;
6406ActivitySecrets::ActivitySecrets(Discord_ActivitySecrets instance, DiscordObjectState state)
6407 : instance_(instance)
6411ActivitySecrets::ActivitySecrets()
6413 assert(state_ == DiscordObjectState::Invalid);
6414 Discord_ActivitySecrets_Init(&instance_);
6415 state_ = DiscordObjectState::Owned;
6417void ActivitySecrets::Drop()
6419 if (state_ != DiscordObjectState::Owned) {
6422 Discord_ActivitySecrets_Drop(&instance_);
6423 state_ = DiscordObjectState::Invalid;
6425std::string ActivitySecrets::Join()
const
6427 assert(state_ == DiscordObjectState::Owned);
6428 Discord_String returnValueNative__;
6429 Discord_ActivitySecrets_Join(&instance_, &returnValueNative__);
6430 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
6431 returnValueNative__.size);
6432 Discord_Free(returnValueNative__.ptr);
6433 return returnValue__;
6435void ActivitySecrets::SetJoin(std::string Join)
6437 assert(state_ == DiscordObjectState::Owned);
6438 Discord_String Join__str{(uint8_t*)(
Join.data()),
Join.size()};
6439 Discord_ActivitySecrets_SetJoin(&instance_, Join__str);
6441const ActivityButton ActivityButton::nullobj{{}, DiscordObjectState::Invalid};
6442ActivityButton::~ActivityButton()
6444 if (state_ == DiscordObjectState::Owned) {
6446 state_ = DiscordObjectState::Invalid;
6449ActivityButton::ActivityButton(ActivityButton&& other) noexcept
6450 : instance_(other.instance_)
6451 , state_(other.state_)
6453 other.state_ = DiscordObjectState::Invalid;
6455ActivityButton& ActivityButton::operator=(ActivityButton&& other)
noexcept
6457 if (
this != &other) {
6458 if (state_ == DiscordObjectState::Owned) {
6461 instance_ = other.instance_;
6462 state_ = other.state_;
6463 other.state_ = DiscordObjectState::Invalid;
6467ActivityButton::ActivityButton(
const ActivityButton& arg0)
6472 Discord_ActivityButton_Clone(&instance_, arg0.instance());
6474 state_ = DiscordObjectState::Owned;
6477ActivityButton& ActivityButton::operator=(
const ActivityButton& arg0)
6479 if (
this != &arg0) {
6480 if (state_ == DiscordObjectState::Owned) {
6482 state_ = DiscordObjectState::Invalid;
6484 if (arg0.state_ == DiscordObjectState::Owned) {
6485 Discord_ActivityButton_Clone(&instance_, arg0.instance());
6487 state_ = DiscordObjectState::Owned;
6492ActivityButton::ActivityButton(Discord_ActivityButton instance, DiscordObjectState state)
6493 : instance_(instance)
6497ActivityButton::ActivityButton()
6499 assert(state_ == DiscordObjectState::Invalid);
6500 Discord_ActivityButton_Init(&instance_);
6501 state_ = DiscordObjectState::Owned;
6503void ActivityButton::Drop()
6505 if (state_ != DiscordObjectState::Owned) {
6508 Discord_ActivityButton_Drop(&instance_);
6509 state_ = DiscordObjectState::Invalid;
6511std::string ActivityButton::Label()
const
6513 assert(state_ == DiscordObjectState::Owned);
6514 Discord_String returnValueNative__;
6515 Discord_ActivityButton_Label(&instance_, &returnValueNative__);
6516 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
6517 returnValueNative__.size);
6518 Discord_Free(returnValueNative__.ptr);
6519 return returnValue__;
6521void ActivityButton::SetLabel(std::string Label)
6523 assert(state_ == DiscordObjectState::Owned);
6524 Discord_String Label__str{(uint8_t*)(Label.data()), Label.size()};
6525 Discord_ActivityButton_SetLabel(&instance_, Label__str);
6527std::string ActivityButton::Url()
const
6529 assert(state_ == DiscordObjectState::Owned);
6530 Discord_String returnValueNative__;
6531 Discord_ActivityButton_Url(&instance_, &returnValueNative__);
6532 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
6533 returnValueNative__.size);
6534 Discord_Free(returnValueNative__.ptr);
6535 return returnValue__;
6537void ActivityButton::SetUrl(std::string Url)
6539 assert(state_ == DiscordObjectState::Owned);
6540 Discord_String Url__str{(uint8_t*)(Url.data()), Url.size()};
6541 Discord_ActivityButton_SetUrl(&instance_, Url__str);
6543const Activity Activity::nullobj{{}, DiscordObjectState::Invalid};
6544Activity::~Activity()
6546 if (state_ == DiscordObjectState::Owned) {
6548 state_ = DiscordObjectState::Invalid;
6551Activity::Activity(Activity&& other) noexcept
6552 : instance_(other.instance_)
6553 , state_(other.state_)
6555 other.state_ = DiscordObjectState::Invalid;
6557Activity& Activity::operator=(Activity&& other)
noexcept
6559 if (
this != &other) {
6560 if (state_ == DiscordObjectState::Owned) {
6563 instance_ = other.instance_;
6564 state_ = other.state_;
6565 other.state_ = DiscordObjectState::Invalid;
6569Activity::Activity(
const Activity& arg0)
6574 Discord_Activity_Clone(&instance_, arg0.instance());
6576 state_ = DiscordObjectState::Owned;
6579Activity& Activity::operator=(
const Activity& arg0)
6581 if (
this != &arg0) {
6582 if (state_ == DiscordObjectState::Owned) {
6584 state_ = DiscordObjectState::Invalid;
6586 if (arg0.state_ == DiscordObjectState::Owned) {
6587 Discord_Activity_Clone(&instance_, arg0.instance());
6589 state_ = DiscordObjectState::Owned;
6594Activity::Activity(Discord_Activity instance, DiscordObjectState state)
6595 : instance_(instance)
6601 assert(state_ == DiscordObjectState::Invalid);
6602 Discord_Activity_Init(&instance_);
6603 state_ = DiscordObjectState::Owned;
6605void Activity::Drop()
6607 if (state_ != DiscordObjectState::Owned) {
6610 Discord_Activity_Drop(&instance_);
6611 state_ = DiscordObjectState::Invalid;
6615 assert(state_ == DiscordObjectState::Owned);
6616 Discord_Activity_AddButton(&instance_, button.instance());
6620 assert(state_ == DiscordObjectState::Owned);
6622 returnValue__ = Discord_Activity_Equals(&instance_, other.instance());
6623 return returnValue__;
6625std::vector<discordpp::ActivityButton> Activity::GetButtons()
const
6627 assert(state_ == DiscordObjectState::Owned);
6628 Discord_ActivityButtonSpan returnValueNative__;
6629 Discord_Activity_GetButtons(&instance_, &returnValueNative__);
6630 std::vector<discordpp::ActivityButton> returnValue__;
6631 returnValue__.reserve(returnValueNative__.size);
6632 for (
size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
6633 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
6635 Discord_Free(returnValueNative__.ptr);
6636 return returnValue__;
6638std::string Activity::Name()
const
6640 assert(state_ == DiscordObjectState::Owned);
6641 Discord_String returnValueNative__;
6642 Discord_Activity_Name(&instance_, &returnValueNative__);
6643 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
6644 returnValueNative__.size);
6645 Discord_Free(returnValueNative__.ptr);
6646 return returnValue__;
6648void Activity::SetName(std::string Name)
6650 assert(state_ == DiscordObjectState::Owned);
6651 Discord_String Name__str{(uint8_t*)(
Name.data()),
Name.size()};
6652 Discord_Activity_SetName(&instance_, Name__str);
6656 assert(state_ == DiscordObjectState::Owned);
6657 Discord_ActivityTypes returnValue__;
6658 returnValue__ = Discord_Activity_Type(&instance_);
6663 assert(state_ == DiscordObjectState::Owned);
6664 Discord_Activity_SetType(&instance_,
static_cast<Discord_ActivityTypes
>(Type));
6666std::optional<discordpp::StatusDisplayTypes> Activity::StatusDisplayType()
const
6668 assert(state_ == DiscordObjectState::Owned);
6669 bool returnIsNonNull__;
6670 Discord_StatusDisplayTypes returnValueNative__;
6671 returnIsNonNull__ = Discord_Activity_StatusDisplayType(&instance_, &returnValueNative__);
6672 if (!returnIsNonNull__) {
6676 return returnValue__;
6678void Activity::SetStatusDisplayType(std::optional<discordpp::StatusDisplayTypes> StatusDisplayType)
6680 assert(state_ == DiscordObjectState::Owned);
6681 Discord_Activity_SetStatusDisplayType(
6683 (StatusDisplayType.has_value()
6684 ?
reinterpret_cast<Discord_StatusDisplayTypes*
>(&*StatusDisplayType)
6687std::optional<std::string> Activity::State()
const
6689 assert(state_ == DiscordObjectState::Owned);
6690 bool returnIsNonNull__;
6691 Discord_String returnValueNative__;
6692 returnIsNonNull__ = Discord_Activity_State(&instance_, &returnValueNative__);
6693 if (!returnIsNonNull__) {
6696 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
6697 returnValueNative__.size);
6698 Discord_Free(returnValueNative__.ptr);
6699 return returnValue__;
6701void Activity::SetState(std::optional<std::string> State)
6703 assert(state_ == DiscordObjectState::Owned);
6704 Discord_String State__str{};
6705 if (
State.has_value()) {
6706 State__str.ptr =
reinterpret_cast<uint8_t*
>(
State->data());
6707 State__str.size =
State->size();
6709 Discord_Activity_SetState(&instance_, (
State.has_value() ? &State__str :
nullptr));
6711std::optional<std::string> Activity::StateUrl()
const
6713 assert(state_ == DiscordObjectState::Owned);
6714 bool returnIsNonNull__;
6715 Discord_String returnValueNative__;
6716 returnIsNonNull__ = Discord_Activity_StateUrl(&instance_, &returnValueNative__);
6717 if (!returnIsNonNull__) {
6720 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
6721 returnValueNative__.size);
6722 Discord_Free(returnValueNative__.ptr);
6723 return returnValue__;
6725void Activity::SetStateUrl(std::optional<std::string> StateUrl)
6727 assert(state_ == DiscordObjectState::Owned);
6728 Discord_String StateUrl__str{};
6729 if (StateUrl.has_value()) {
6730 StateUrl__str.ptr =
reinterpret_cast<uint8_t*
>(StateUrl->data());
6731 StateUrl__str.size = StateUrl->size();
6733 Discord_Activity_SetStateUrl(&instance_, (StateUrl.has_value() ? &StateUrl__str :
nullptr));
6735std::optional<std::string> Activity::Details()
const
6737 assert(state_ == DiscordObjectState::Owned);
6738 bool returnIsNonNull__;
6739 Discord_String returnValueNative__;
6740 returnIsNonNull__ = Discord_Activity_Details(&instance_, &returnValueNative__);
6741 if (!returnIsNonNull__) {
6744 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
6745 returnValueNative__.size);
6746 Discord_Free(returnValueNative__.ptr);
6747 return returnValue__;
6749void Activity::SetDetails(std::optional<std::string> Details)
6751 assert(state_ == DiscordObjectState::Owned);
6752 Discord_String Details__str{};
6754 Details__str.ptr =
reinterpret_cast<uint8_t*
>(
Details->data());
6755 Details__str.size =
Details->size();
6757 Discord_Activity_SetDetails(&instance_, (
Details.has_value() ? &Details__str :
nullptr));
6759std::optional<std::string> Activity::DetailsUrl()
const
6761 assert(state_ == DiscordObjectState::Owned);
6762 bool returnIsNonNull__;
6763 Discord_String returnValueNative__;
6764 returnIsNonNull__ = Discord_Activity_DetailsUrl(&instance_, &returnValueNative__);
6765 if (!returnIsNonNull__) {
6768 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
6769 returnValueNative__.size);
6770 Discord_Free(returnValueNative__.ptr);
6771 return returnValue__;
6773void Activity::SetDetailsUrl(std::optional<std::string> DetailsUrl)
6775 assert(state_ == DiscordObjectState::Owned);
6776 Discord_String DetailsUrl__str{};
6777 if (DetailsUrl.has_value()) {
6778 DetailsUrl__str.ptr =
reinterpret_cast<uint8_t*
>(DetailsUrl->data());
6779 DetailsUrl__str.size = DetailsUrl->size();
6781 Discord_Activity_SetDetailsUrl(&instance_,
6782 (DetailsUrl.has_value() ? &DetailsUrl__str :
nullptr));
6784std::optional<uint64_t> Activity::ApplicationId()
const
6786 assert(state_ == DiscordObjectState::Owned);
6787 bool returnIsNonNull__;
6788 uint64_t returnValue__;
6789 returnIsNonNull__ = Discord_Activity_ApplicationId(&instance_, &returnValue__);
6790 if (!returnIsNonNull__) {
6791 return std::nullopt;
6793 return returnValue__;
6795void Activity::SetApplicationId(std::optional<uint64_t> ApplicationId)
6797 assert(state_ == DiscordObjectState::Owned);
6798 Discord_Activity_SetApplicationId(&instance_,
6799 (ApplicationId.has_value() ? &*ApplicationId :
nullptr));
6801std::optional<uint64_t> Activity::ParentApplicationId()
const
6803 assert(state_ == DiscordObjectState::Owned);
6804 bool returnIsNonNull__;
6805 uint64_t returnValue__;
6806 returnIsNonNull__ = Discord_Activity_ParentApplicationId(&instance_, &returnValue__);
6807 if (!returnIsNonNull__) {
6808 return std::nullopt;
6810 return returnValue__;
6812void Activity::SetParentApplicationId(std::optional<uint64_t> ParentApplicationId)
6814 assert(state_ == DiscordObjectState::Owned);
6815 Discord_Activity_SetParentApplicationId(
6816 &instance_, (ParentApplicationId.has_value() ? &*ParentApplicationId :
nullptr));
6818std::optional<discordpp::ActivityAssets> Activity::Assets()
const
6820 assert(state_ == DiscordObjectState::Owned);
6821 bool returnIsNonNull__;
6822 Discord_ActivityAssets returnValueNative__;
6823 returnIsNonNull__ = Discord_Activity_Assets(&instance_, &returnValueNative__);
6824 if (!returnIsNonNull__) {
6828 return returnValue__;
6830void Activity::SetAssets(std::optional<discordpp::ActivityAssets> Assets)
6832 assert(state_ == DiscordObjectState::Owned);
6833 Discord_Activity_SetAssets(&instance_, (Assets.has_value() ? Assets->instance() :
nullptr));
6835std::optional<discordpp::ActivityTimestamps> Activity::Timestamps()
const
6837 assert(state_ == DiscordObjectState::Owned);
6838 bool returnIsNonNull__;
6839 Discord_ActivityTimestamps returnValueNative__;
6840 returnIsNonNull__ = Discord_Activity_Timestamps(&instance_, &returnValueNative__);
6841 if (!returnIsNonNull__) {
6845 return returnValue__;
6847void Activity::SetTimestamps(std::optional<discordpp::ActivityTimestamps> Timestamps)
6849 assert(state_ == DiscordObjectState::Owned);
6850 Discord_Activity_SetTimestamps(&instance_,
6851 (Timestamps.has_value() ? Timestamps->instance() :
nullptr));
6853std::optional<discordpp::ActivityParty> Activity::Party()
const
6855 assert(state_ == DiscordObjectState::Owned);
6856 bool returnIsNonNull__;
6857 Discord_ActivityParty returnValueNative__;
6858 returnIsNonNull__ = Discord_Activity_Party(&instance_, &returnValueNative__);
6859 if (!returnIsNonNull__) {
6863 return returnValue__;
6865void Activity::SetParty(std::optional<discordpp::ActivityParty> Party)
6867 assert(state_ == DiscordObjectState::Owned);
6868 Discord_Activity_SetParty(&instance_, (Party.has_value() ? Party->instance() :
nullptr));
6870std::optional<discordpp::ActivitySecrets> Activity::Secrets()
const
6872 assert(state_ == DiscordObjectState::Owned);
6873 bool returnIsNonNull__;
6874 Discord_ActivitySecrets returnValueNative__;
6875 returnIsNonNull__ = Discord_Activity_Secrets(&instance_, &returnValueNative__);
6876 if (!returnIsNonNull__) {
6880 return returnValue__;
6882void Activity::SetSecrets(std::optional<discordpp::ActivitySecrets> Secrets)
6884 assert(state_ == DiscordObjectState::Owned);
6885 Discord_Activity_SetSecrets(&instance_, (Secrets.has_value() ? Secrets->instance() :
nullptr));
6889 assert(state_ == DiscordObjectState::Owned);
6890 Discord_ActivityGamePlatforms returnValue__;
6891 returnValue__ = Discord_Activity_SupportedPlatforms(&instance_);
6896 assert(state_ == DiscordObjectState::Owned);
6897 Discord_Activity_SetSupportedPlatforms(
6898 &instance_,
static_cast<Discord_ActivityGamePlatforms
>(SupportedPlatforms));
6900const ClientResult ClientResult::nullobj{{}, DiscordObjectState::Invalid};
6901ClientResult::~ClientResult()
6903 if (state_ == DiscordObjectState::Owned) {
6905 state_ = DiscordObjectState::Invalid;
6908ClientResult::ClientResult(ClientResult&& other) noexcept
6909 : instance_(other.instance_)
6910 , state_(other.state_)
6912 other.state_ = DiscordObjectState::Invalid;
6914ClientResult& ClientResult::operator=(ClientResult&& other)
noexcept
6916 if (
this != &other) {
6917 if (state_ == DiscordObjectState::Owned) {
6920 instance_ = other.instance_;
6921 state_ = other.state_;
6922 other.state_ = DiscordObjectState::Invalid;
6926ClientResult::ClientResult(
const ClientResult& arg0)
6931 Discord_ClientResult_Clone(&instance_, arg0.instance());
6933 state_ = DiscordObjectState::Owned;
6936ClientResult& ClientResult::operator=(
const ClientResult& arg0)
6938 if (
this != &arg0) {
6939 if (state_ == DiscordObjectState::Owned) {
6941 state_ = DiscordObjectState::Invalid;
6943 if (arg0.state_ == DiscordObjectState::Owned) {
6944 Discord_ClientResult_Clone(&instance_, arg0.instance());
6946 state_ = DiscordObjectState::Owned;
6951ClientResult::ClientResult(Discord_ClientResult instance, DiscordObjectState state)
6952 : instance_(instance)
6956void ClientResult::Drop()
6958 if (state_ != DiscordObjectState::Owned) {
6961 Discord_ClientResult_Drop(&instance_);
6962 state_ = DiscordObjectState::Invalid;
6964std::string ClientResult::ToString()
const
6966 assert(state_ == DiscordObjectState::Owned);
6967 Discord_String returnValueNative__;
6968 Discord_ClientResult_ToString(&instance_, &returnValueNative__);
6969 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
6970 returnValueNative__.size);
6971 Discord_Free(returnValueNative__.ptr);
6972 return returnValue__;
6976 assert(state_ == DiscordObjectState::Owned);
6977 Discord_ErrorType returnValue__;
6978 returnValue__ = Discord_ClientResult_Type(&instance_);
6983 assert(state_ == DiscordObjectState::Owned);
6984 Discord_ClientResult_SetType(&instance_,
static_cast<Discord_ErrorType
>(Type));
6986std::string ClientResult::Error()
const
6988 assert(state_ == DiscordObjectState::Owned);
6989 Discord_String returnValueNative__;
6990 Discord_ClientResult_Error(&instance_, &returnValueNative__);
6991 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
6992 returnValueNative__.size);
6993 Discord_Free(returnValueNative__.ptr);
6994 return returnValue__;
6996void ClientResult::SetError(std::string Error)
6998 assert(state_ == DiscordObjectState::Owned);
6999 Discord_String Error__str{(uint8_t*)(
Error.data()),
Error.size()};
7000 Discord_ClientResult_SetError(&instance_, Error__str);
7002int32_t ClientResult::ErrorCode()
const
7004 assert(state_ == DiscordObjectState::Owned);
7005 int32_t returnValue__;
7006 returnValue__ = Discord_ClientResult_ErrorCode(&instance_);
7007 return returnValue__;
7009void ClientResult::SetErrorCode(int32_t ErrorCode)
7011 assert(state_ == DiscordObjectState::Owned);
7012 Discord_ClientResult_SetErrorCode(&instance_, ErrorCode);
7016 assert(state_ == DiscordObjectState::Owned);
7017 Discord_HttpStatusCode returnValue__;
7018 returnValue__ = Discord_ClientResult_Status(&instance_);
7023 assert(state_ == DiscordObjectState::Owned);
7024 Discord_ClientResult_SetStatus(&instance_,
static_cast<Discord_HttpStatusCode
>(Status));
7026std::string ClientResult::ResponseBody()
const
7028 assert(state_ == DiscordObjectState::Owned);
7029 Discord_String returnValueNative__;
7030 Discord_ClientResult_ResponseBody(&instance_, &returnValueNative__);
7031 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
7032 returnValueNative__.size);
7033 Discord_Free(returnValueNative__.ptr);
7034 return returnValue__;
7036void ClientResult::SetResponseBody(std::string ResponseBody)
7038 assert(state_ == DiscordObjectState::Owned);
7039 Discord_String ResponseBody__str{(uint8_t*)(ResponseBody.data()), ResponseBody.size()};
7040 Discord_ClientResult_SetResponseBody(&instance_, ResponseBody__str);
7042bool ClientResult::Successful()
const
7044 assert(state_ == DiscordObjectState::Owned);
7046 returnValue__ = Discord_ClientResult_Successful(&instance_);
7047 return returnValue__;
7049void ClientResult::SetSuccessful(
bool Successful)
7051 assert(state_ == DiscordObjectState::Owned);
7052 Discord_ClientResult_SetSuccessful(&instance_, Successful);
7054bool ClientResult::Retryable()
const
7056 assert(state_ == DiscordObjectState::Owned);
7058 returnValue__ = Discord_ClientResult_Retryable(&instance_);
7059 return returnValue__;
7061void ClientResult::SetRetryable(
bool Retryable)
7063 assert(state_ == DiscordObjectState::Owned);
7064 Discord_ClientResult_SetRetryable(&instance_, Retryable);
7066float ClientResult::RetryAfter()
const
7068 assert(state_ == DiscordObjectState::Owned);
7069 float returnValue__;
7070 returnValue__ = Discord_ClientResult_RetryAfter(&instance_);
7071 return returnValue__;
7073void ClientResult::SetRetryAfter(
float RetryAfter)
7075 assert(state_ == DiscordObjectState::Owned);
7076 Discord_ClientResult_SetRetryAfter(&instance_, RetryAfter);
7078const AuthorizationCodeChallenge AuthorizationCodeChallenge::nullobj{{},
7079 DiscordObjectState::Invalid};
7080AuthorizationCodeChallenge::~AuthorizationCodeChallenge()
7082 if (state_ == DiscordObjectState::Owned) {
7084 state_ = DiscordObjectState::Invalid;
7087AuthorizationCodeChallenge::AuthorizationCodeChallenge(AuthorizationCodeChallenge&& other) noexcept
7088 : instance_(other.instance_)
7089 , state_(other.state_)
7091 other.state_ = DiscordObjectState::Invalid;
7093AuthorizationCodeChallenge& AuthorizationCodeChallenge::operator=(
7094 AuthorizationCodeChallenge&& other)
noexcept
7096 if (
this != &other) {
7097 if (state_ == DiscordObjectState::Owned) {
7100 instance_ = other.instance_;
7101 state_ = other.state_;
7102 other.state_ = DiscordObjectState::Invalid;
7106AuthorizationCodeChallenge::AuthorizationCodeChallenge(
const AuthorizationCodeChallenge& arg0)
7111 Discord_AuthorizationCodeChallenge_Clone(&instance_, arg0.instance());
7113 state_ = DiscordObjectState::Owned;
7116AuthorizationCodeChallenge& AuthorizationCodeChallenge::operator=(
7117 const AuthorizationCodeChallenge& arg0)
7119 if (
this != &arg0) {
7120 if (state_ == DiscordObjectState::Owned) {
7122 state_ = DiscordObjectState::Invalid;
7124 if (arg0.state_ == DiscordObjectState::Owned) {
7125 Discord_AuthorizationCodeChallenge_Clone(&instance_, arg0.instance());
7127 state_ = DiscordObjectState::Owned;
7132AuthorizationCodeChallenge::AuthorizationCodeChallenge(Discord_AuthorizationCodeChallenge instance,
7133 DiscordObjectState state)
7134 : instance_(instance)
7138AuthorizationCodeChallenge::AuthorizationCodeChallenge()
7140 assert(state_ == DiscordObjectState::Invalid);
7141 Discord_AuthorizationCodeChallenge_Init(&instance_);
7142 state_ = DiscordObjectState::Owned;
7144void AuthorizationCodeChallenge::Drop()
7146 if (state_ != DiscordObjectState::Owned) {
7149 Discord_AuthorizationCodeChallenge_Drop(&instance_);
7150 state_ = DiscordObjectState::Invalid;
7154 assert(state_ == DiscordObjectState::Owned);
7155 Discord_AuthenticationCodeChallengeMethod returnValue__;
7156 returnValue__ = Discord_AuthorizationCodeChallenge_Method(&instance_);
7161 assert(state_ == DiscordObjectState::Owned);
7162 Discord_AuthorizationCodeChallenge_SetMethod(
7163 &instance_,
static_cast<Discord_AuthenticationCodeChallengeMethod
>(Method));
7165std::string AuthorizationCodeChallenge::Challenge()
const
7167 assert(state_ == DiscordObjectState::Owned);
7168 Discord_String returnValueNative__;
7169 Discord_AuthorizationCodeChallenge_Challenge(&instance_, &returnValueNative__);
7170 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
7171 returnValueNative__.size);
7172 Discord_Free(returnValueNative__.ptr);
7173 return returnValue__;
7175void AuthorizationCodeChallenge::SetChallenge(std::string Challenge)
7177 assert(state_ == DiscordObjectState::Owned);
7178 Discord_String Challenge__str{(uint8_t*)(Challenge.data()), Challenge.size()};
7179 Discord_AuthorizationCodeChallenge_SetChallenge(&instance_, Challenge__str);
7181const AuthorizationCodeVerifier AuthorizationCodeVerifier::nullobj{{}, DiscordObjectState::Invalid};
7182AuthorizationCodeVerifier::~AuthorizationCodeVerifier()
7184 if (state_ == DiscordObjectState::Owned) {
7186 state_ = DiscordObjectState::Invalid;
7189AuthorizationCodeVerifier::AuthorizationCodeVerifier(AuthorizationCodeVerifier&& other) noexcept
7190 : instance_(other.instance_)
7191 , state_(other.state_)
7193 other.state_ = DiscordObjectState::Invalid;
7195AuthorizationCodeVerifier& AuthorizationCodeVerifier::operator=(
7196 AuthorizationCodeVerifier&& other)
noexcept
7198 if (
this != &other) {
7199 if (state_ == DiscordObjectState::Owned) {
7202 instance_ = other.instance_;
7203 state_ = other.state_;
7204 other.state_ = DiscordObjectState::Invalid;
7208AuthorizationCodeVerifier::AuthorizationCodeVerifier(
const AuthorizationCodeVerifier& arg0)
7213 Discord_AuthorizationCodeVerifier_Clone(&instance_, arg0.instance());
7215 state_ = DiscordObjectState::Owned;
7218AuthorizationCodeVerifier& AuthorizationCodeVerifier::operator=(
7219 const AuthorizationCodeVerifier& arg0)
7221 if (
this != &arg0) {
7222 if (state_ == DiscordObjectState::Owned) {
7224 state_ = DiscordObjectState::Invalid;
7226 if (arg0.state_ == DiscordObjectState::Owned) {
7227 Discord_AuthorizationCodeVerifier_Clone(&instance_, arg0.instance());
7229 state_ = DiscordObjectState::Owned;
7234AuthorizationCodeVerifier::AuthorizationCodeVerifier(Discord_AuthorizationCodeVerifier instance,
7235 DiscordObjectState state)
7236 : instance_(instance)
7240void AuthorizationCodeVerifier::Drop()
7242 if (state_ != DiscordObjectState::Owned) {
7245 Discord_AuthorizationCodeVerifier_Drop(&instance_);
7246 state_ = DiscordObjectState::Invalid;
7250 assert(state_ == DiscordObjectState::Owned);
7251 Discord_AuthorizationCodeChallenge returnValueNative__{};
7252 Discord_AuthorizationCodeVerifier_Challenge(&instance_, &returnValueNative__);
7254 DiscordObjectState::Owned);
7255 return returnValue__;
7259 assert(state_ == DiscordObjectState::Owned);
7260 Discord_AuthorizationCodeVerifier_SetChallenge(&instance_, Challenge.instance());
7262std::string AuthorizationCodeVerifier::Verifier()
const
7264 assert(state_ == DiscordObjectState::Owned);
7265 Discord_String returnValueNative__;
7266 Discord_AuthorizationCodeVerifier_Verifier(&instance_, &returnValueNative__);
7267 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
7268 returnValueNative__.size);
7269 Discord_Free(returnValueNative__.ptr);
7270 return returnValue__;
7272void AuthorizationCodeVerifier::SetVerifier(std::string Verifier)
7274 assert(state_ == DiscordObjectState::Owned);
7275 Discord_String Verifier__str{(uint8_t*)(Verifier.data()), Verifier.size()};
7276 Discord_AuthorizationCodeVerifier_SetVerifier(&instance_, Verifier__str);
7278const AuthorizationArgs AuthorizationArgs::nullobj{{}, DiscordObjectState::Invalid};
7279AuthorizationArgs::~AuthorizationArgs()
7281 if (state_ == DiscordObjectState::Owned) {
7283 state_ = DiscordObjectState::Invalid;
7286AuthorizationArgs::AuthorizationArgs(AuthorizationArgs&& other) noexcept
7287 : instance_(other.instance_)
7288 , state_(other.state_)
7290 other.state_ = DiscordObjectState::Invalid;
7292AuthorizationArgs& AuthorizationArgs::operator=(AuthorizationArgs&& other)
noexcept
7294 if (
this != &other) {
7295 if (state_ == DiscordObjectState::Owned) {
7298 instance_ = other.instance_;
7299 state_ = other.state_;
7300 other.state_ = DiscordObjectState::Invalid;
7304AuthorizationArgs::AuthorizationArgs(
const AuthorizationArgs& arg0)
7309 Discord_AuthorizationArgs_Clone(&instance_, arg0.instance());
7311 state_ = DiscordObjectState::Owned;
7314AuthorizationArgs& AuthorizationArgs::operator=(
const AuthorizationArgs& arg0)
7316 if (
this != &arg0) {
7317 if (state_ == DiscordObjectState::Owned) {
7319 state_ = DiscordObjectState::Invalid;
7321 if (arg0.state_ == DiscordObjectState::Owned) {
7322 Discord_AuthorizationArgs_Clone(&instance_, arg0.instance());
7324 state_ = DiscordObjectState::Owned;
7329AuthorizationArgs::AuthorizationArgs(Discord_AuthorizationArgs instance, DiscordObjectState state)
7330 : instance_(instance)
7334AuthorizationArgs::AuthorizationArgs()
7336 assert(state_ == DiscordObjectState::Invalid);
7337 Discord_AuthorizationArgs_Init(&instance_);
7338 state_ = DiscordObjectState::Owned;
7340void AuthorizationArgs::Drop()
7342 if (state_ != DiscordObjectState::Owned) {
7345 Discord_AuthorizationArgs_Drop(&instance_);
7346 state_ = DiscordObjectState::Invalid;
7348uint64_t AuthorizationArgs::ClientId()
const
7350 assert(state_ == DiscordObjectState::Owned);
7351 uint64_t returnValue__;
7352 returnValue__ = Discord_AuthorizationArgs_ClientId(&instance_);
7353 return returnValue__;
7355void AuthorizationArgs::SetClientId(uint64_t ClientId)
7357 assert(state_ == DiscordObjectState::Owned);
7358 Discord_AuthorizationArgs_SetClientId(&instance_, ClientId);
7360std::string AuthorizationArgs::Scopes()
const
7362 assert(state_ == DiscordObjectState::Owned);
7363 Discord_String returnValueNative__;
7364 Discord_AuthorizationArgs_Scopes(&instance_, &returnValueNative__);
7365 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
7366 returnValueNative__.size);
7367 Discord_Free(returnValueNative__.ptr);
7368 return returnValue__;
7370void AuthorizationArgs::SetScopes(std::string Scopes)
7372 assert(state_ == DiscordObjectState::Owned);
7373 Discord_String Scopes__str{(uint8_t*)(Scopes.data()), Scopes.size()};
7374 Discord_AuthorizationArgs_SetScopes(&instance_, Scopes__str);
7376std::optional<std::string> AuthorizationArgs::State()
const
7378 assert(state_ == DiscordObjectState::Owned);
7379 bool returnIsNonNull__;
7380 Discord_String returnValueNative__;
7381 returnIsNonNull__ = Discord_AuthorizationArgs_State(&instance_, &returnValueNative__);
7382 if (!returnIsNonNull__) {
7385 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
7386 returnValueNative__.size);
7387 Discord_Free(returnValueNative__.ptr);
7388 return returnValue__;
7390void AuthorizationArgs::SetState(std::optional<std::string> State)
7392 assert(state_ == DiscordObjectState::Owned);
7393 Discord_String State__str{};
7394 if (
State.has_value()) {
7395 State__str.ptr =
reinterpret_cast<uint8_t*
>(
State->data());
7396 State__str.size =
State->size();
7398 Discord_AuthorizationArgs_SetState(&instance_, (
State.has_value() ? &State__str :
nullptr));
7400std::optional<std::string> AuthorizationArgs::Nonce()
const
7402 assert(state_ == DiscordObjectState::Owned);
7403 bool returnIsNonNull__;
7404 Discord_String returnValueNative__;
7405 returnIsNonNull__ = Discord_AuthorizationArgs_Nonce(&instance_, &returnValueNative__);
7406 if (!returnIsNonNull__) {
7409 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
7410 returnValueNative__.size);
7411 Discord_Free(returnValueNative__.ptr);
7412 return returnValue__;
7414void AuthorizationArgs::SetNonce(std::optional<std::string> Nonce)
7416 assert(state_ == DiscordObjectState::Owned);
7417 Discord_String Nonce__str{};
7418 if (Nonce.has_value()) {
7419 Nonce__str.ptr =
reinterpret_cast<uint8_t*
>(Nonce->data());
7420 Nonce__str.size = Nonce->size();
7422 Discord_AuthorizationArgs_SetNonce(&instance_, (Nonce.has_value() ? &Nonce__str :
nullptr));
7424std::optional<discordpp::AuthorizationCodeChallenge> AuthorizationArgs::CodeChallenge()
const
7426 assert(state_ == DiscordObjectState::Owned);
7427 bool returnIsNonNull__;
7428 Discord_AuthorizationCodeChallenge returnValueNative__;
7429 returnIsNonNull__ = Discord_AuthorizationArgs_CodeChallenge(&instance_, &returnValueNative__);
7430 if (!returnIsNonNull__) {
7434 DiscordObjectState::Owned);
7435 return returnValue__;
7437void AuthorizationArgs::SetCodeChallenge(
7438 std::optional<discordpp::AuthorizationCodeChallenge> CodeChallenge)
7440 assert(state_ == DiscordObjectState::Owned);
7441 Discord_AuthorizationArgs_SetCodeChallenge(
7442 &instance_, (CodeChallenge.has_value() ? CodeChallenge->instance() :
nullptr));
7444std::optional<discordpp::IntegrationType> AuthorizationArgs::IntegrationType()
const
7446 assert(state_ == DiscordObjectState::Owned);
7447 bool returnIsNonNull__;
7448 Discord_IntegrationType returnValueNative__;
7449 returnIsNonNull__ = Discord_AuthorizationArgs_IntegrationType(&instance_, &returnValueNative__);
7450 if (!returnIsNonNull__) {
7454 return returnValue__;
7456void AuthorizationArgs::SetIntegrationType(
7457 std::optional<discordpp::IntegrationType> IntegrationType)
7459 assert(state_ == DiscordObjectState::Owned);
7460 Discord_AuthorizationArgs_SetIntegrationType(
7462 (
IntegrationType.has_value() ?
reinterpret_cast<Discord_IntegrationType*
>(&*IntegrationType)
7465std::optional<std::string> AuthorizationArgs::CustomSchemeParam()
const
7467 assert(state_ == DiscordObjectState::Owned);
7468 bool returnIsNonNull__;
7469 Discord_String returnValueNative__;
7471 Discord_AuthorizationArgs_CustomSchemeParam(&instance_, &returnValueNative__);
7472 if (!returnIsNonNull__) {
7475 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
7476 returnValueNative__.size);
7477 Discord_Free(returnValueNative__.ptr);
7478 return returnValue__;
7480void AuthorizationArgs::SetCustomSchemeParam(std::optional<std::string> CustomSchemeParam)
7482 assert(state_ == DiscordObjectState::Owned);
7483 Discord_String CustomSchemeParam__str{};
7484 if (CustomSchemeParam.has_value()) {
7485 CustomSchemeParam__str.ptr =
reinterpret_cast<uint8_t*
>(CustomSchemeParam->data());
7486 CustomSchemeParam__str.size = CustomSchemeParam->size();
7488 Discord_AuthorizationArgs_SetCustomSchemeParam(
7489 &instance_, (CustomSchemeParam.has_value() ? &CustomSchemeParam__str :
nullptr));
7491const DeviceAuthorizationArgs DeviceAuthorizationArgs::nullobj{{}, DiscordObjectState::Invalid};
7492DeviceAuthorizationArgs::~DeviceAuthorizationArgs()
7494 if (state_ == DiscordObjectState::Owned) {
7496 state_ = DiscordObjectState::Invalid;
7499DeviceAuthorizationArgs::DeviceAuthorizationArgs(DeviceAuthorizationArgs&& other) noexcept
7500 : instance_(other.instance_)
7501 , state_(other.state_)
7503 other.state_ = DiscordObjectState::Invalid;
7505DeviceAuthorizationArgs& DeviceAuthorizationArgs::operator=(
7506 DeviceAuthorizationArgs&& other)
noexcept
7508 if (
this != &other) {
7509 if (state_ == DiscordObjectState::Owned) {
7512 instance_ = other.instance_;
7513 state_ = other.state_;
7514 other.state_ = DiscordObjectState::Invalid;
7518DeviceAuthorizationArgs::DeviceAuthorizationArgs(
const DeviceAuthorizationArgs& arg0)
7523 Discord_DeviceAuthorizationArgs_Clone(&instance_, arg0.instance());
7525 state_ = DiscordObjectState::Owned;
7528DeviceAuthorizationArgs& DeviceAuthorizationArgs::operator=(
const DeviceAuthorizationArgs& arg0)
7530 if (
this != &arg0) {
7531 if (state_ == DiscordObjectState::Owned) {
7533 state_ = DiscordObjectState::Invalid;
7535 if (arg0.state_ == DiscordObjectState::Owned) {
7536 Discord_DeviceAuthorizationArgs_Clone(&instance_, arg0.instance());
7538 state_ = DiscordObjectState::Owned;
7543DeviceAuthorizationArgs::DeviceAuthorizationArgs(Discord_DeviceAuthorizationArgs instance,
7544 DiscordObjectState state)
7545 : instance_(instance)
7549DeviceAuthorizationArgs::DeviceAuthorizationArgs()
7551 assert(state_ == DiscordObjectState::Invalid);
7552 Discord_DeviceAuthorizationArgs_Init(&instance_);
7553 state_ = DiscordObjectState::Owned;
7555void DeviceAuthorizationArgs::Drop()
7557 if (state_ != DiscordObjectState::Owned) {
7560 Discord_DeviceAuthorizationArgs_Drop(&instance_);
7561 state_ = DiscordObjectState::Invalid;
7563uint64_t DeviceAuthorizationArgs::ClientId()
const
7565 assert(state_ == DiscordObjectState::Owned);
7566 uint64_t returnValue__;
7567 returnValue__ = Discord_DeviceAuthorizationArgs_ClientId(&instance_);
7568 return returnValue__;
7570void DeviceAuthorizationArgs::SetClientId(uint64_t ClientId)
7572 assert(state_ == DiscordObjectState::Owned);
7573 Discord_DeviceAuthorizationArgs_SetClientId(&instance_, ClientId);
7575std::string DeviceAuthorizationArgs::Scopes()
const
7577 assert(state_ == DiscordObjectState::Owned);
7578 Discord_String returnValueNative__;
7579 Discord_DeviceAuthorizationArgs_Scopes(&instance_, &returnValueNative__);
7580 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
7581 returnValueNative__.size);
7582 Discord_Free(returnValueNative__.ptr);
7583 return returnValue__;
7585void DeviceAuthorizationArgs::SetScopes(std::string Scopes)
7587 assert(state_ == DiscordObjectState::Owned);
7588 Discord_String Scopes__str{(uint8_t*)(Scopes.data()), Scopes.size()};
7589 Discord_DeviceAuthorizationArgs_SetScopes(&instance_, Scopes__str);
7591const VoiceStateHandle VoiceStateHandle::nullobj{{}, DiscordObjectState::Invalid};
7592VoiceStateHandle::~VoiceStateHandle()
7594 if (state_ == DiscordObjectState::Owned) {
7596 state_ = DiscordObjectState::Invalid;
7599VoiceStateHandle::VoiceStateHandle(VoiceStateHandle&& other) noexcept
7600 : instance_(other.instance_)
7601 , state_(other.state_)
7603 other.state_ = DiscordObjectState::Invalid;
7605VoiceStateHandle& VoiceStateHandle::operator=(VoiceStateHandle&& other)
noexcept
7607 if (
this != &other) {
7608 if (state_ == DiscordObjectState::Owned) {
7611 instance_ = other.instance_;
7612 state_ = other.state_;
7613 other.state_ = DiscordObjectState::Invalid;
7617VoiceStateHandle::VoiceStateHandle(
const VoiceStateHandle& other)
7622 Discord_VoiceStateHandle_Clone(&instance_, other.instance());
7624 state_ = DiscordObjectState::Owned;
7627VoiceStateHandle& VoiceStateHandle::operator=(
const VoiceStateHandle& other)
7629 if (
this != &other) {
7630 if (state_ == DiscordObjectState::Owned) {
7632 state_ = DiscordObjectState::Invalid;
7634 if (other.state_ == DiscordObjectState::Owned) {
7635 Discord_VoiceStateHandle_Clone(&instance_, other.instance());
7637 state_ = DiscordObjectState::Owned;
7642VoiceStateHandle::VoiceStateHandle(Discord_VoiceStateHandle instance, DiscordObjectState state)
7643 : instance_(instance)
7647void VoiceStateHandle::Drop()
7649 if (state_ != DiscordObjectState::Owned) {
7652 Discord_VoiceStateHandle_Drop(&instance_);
7653 state_ = DiscordObjectState::Invalid;
7655bool VoiceStateHandle::SelfDeaf()
const
7657 assert(state_ == DiscordObjectState::Owned);
7659 returnValue__ = Discord_VoiceStateHandle_SelfDeaf(&instance_);
7660 return returnValue__;
7662bool VoiceStateHandle::SelfMute()
const
7664 assert(state_ == DiscordObjectState::Owned);
7666 returnValue__ = Discord_VoiceStateHandle_SelfMute(&instance_);
7667 return returnValue__;
7669const VADThresholdSettings VADThresholdSettings::nullobj{{}, DiscordObjectState::Invalid};
7670VADThresholdSettings::~VADThresholdSettings()
7672 if (state_ == DiscordObjectState::Owned) {
7674 state_ = DiscordObjectState::Invalid;
7677VADThresholdSettings::VADThresholdSettings(VADThresholdSettings&& other) noexcept
7678 : instance_(other.instance_)
7679 , state_(other.state_)
7681 other.state_ = DiscordObjectState::Invalid;
7683VADThresholdSettings& VADThresholdSettings::operator=(VADThresholdSettings&& other)
noexcept
7685 if (
this != &other) {
7686 if (state_ == DiscordObjectState::Owned) {
7689 instance_ = other.instance_;
7690 state_ = other.state_;
7691 other.state_ = DiscordObjectState::Invalid;
7695VADThresholdSettings::VADThresholdSettings(Discord_VADThresholdSettings instance,
7696 DiscordObjectState state)
7697 : instance_(instance)
7701void VADThresholdSettings::Drop()
7703 if (state_ != DiscordObjectState::Owned) {
7706 Discord_VADThresholdSettings_Drop(&instance_);
7707 state_ = DiscordObjectState::Invalid;
7709float VADThresholdSettings::VadThreshold()
const
7711 assert(state_ == DiscordObjectState::Owned);
7712 float returnValue__;
7713 returnValue__ = Discord_VADThresholdSettings_VadThreshold(&instance_);
7714 return returnValue__;
7716void VADThresholdSettings::SetVadThreshold(
float VadThreshold)
7718 assert(state_ == DiscordObjectState::Owned);
7719 Discord_VADThresholdSettings_SetVadThreshold(&instance_, VadThreshold);
7721bool VADThresholdSettings::Automatic()
const
7723 assert(state_ == DiscordObjectState::Owned);
7725 returnValue__ = Discord_VADThresholdSettings_Automatic(&instance_);
7726 return returnValue__;
7728void VADThresholdSettings::SetAutomatic(
bool Automatic)
7730 assert(state_ == DiscordObjectState::Owned);
7731 Discord_VADThresholdSettings_SetAutomatic(&instance_, Automatic);
7733const Call Call::nullobj{{}, DiscordObjectState::Invalid};
7736 if (state_ == DiscordObjectState::Owned) {
7738 state_ = DiscordObjectState::Invalid;
7741Call::Call(Call&& other) noexcept
7742 : instance_(other.instance_)
7743 , state_(other.state_)
7745 other.state_ = DiscordObjectState::Invalid;
7747Call& Call::operator=(Call&& other)
noexcept
7749 if (
this != &other) {
7750 if (state_ == DiscordObjectState::Owned) {
7753 instance_ = other.instance_;
7754 state_ = other.state_;
7755 other.state_ = DiscordObjectState::Invalid;
7759Call::Call(
const Call& other)
7764 Discord_Call_Clone(&instance_, other.instance());
7766 state_ = DiscordObjectState::Owned;
7769Call& Call::operator=(
const Call& other)
7771 if (
this != &other) {
7772 if (state_ == DiscordObjectState::Owned) {
7774 state_ = DiscordObjectState::Invalid;
7776 if (other.state_ == DiscordObjectState::Owned) {
7777 Discord_Call_Clone(&instance_, other.instance());
7779 state_ = DiscordObjectState::Owned;
7784Call::Call(Discord_Call instance, DiscordObjectState state)
7785 : instance_(instance)
7791 if (state_ != DiscordObjectState::Owned) {
7794 Discord_Call_Drop(&instance_);
7795 state_ = DiscordObjectState::Invalid;
7799 Discord_String returnValueNative__;
7800 Discord_Call_ErrorToString(
static_cast<Discord_Call_Error
>(type), &returnValueNative__);
7801 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
7802 returnValueNative__.size);
7803 Discord_Free(returnValueNative__.ptr);
7804 return returnValue__;
7808 assert(state_ == DiscordObjectState::Owned);
7809 Discord_AudioModeType returnValue__;
7810 returnValue__ = Discord_Call_GetAudioMode(&instance_);
7813uint64_t Call::GetChannelId()
const
7815 assert(state_ == DiscordObjectState::Owned);
7816 uint64_t returnValue__;
7817 returnValue__ = Discord_Call_GetChannelId(&instance_);
7818 return returnValue__;
7820uint64_t Call::GetGuildId()
const
7822 assert(state_ == DiscordObjectState::Owned);
7823 uint64_t returnValue__;
7824 returnValue__ = Discord_Call_GetGuildId(&instance_);
7825 return returnValue__;
7827bool Call::GetLocalMute(uint64_t userId)
7829 assert(state_ == DiscordObjectState::Owned);
7831 returnValue__ = Discord_Call_GetLocalMute(&instance_, userId);
7832 return returnValue__;
7834std::vector<uint64_t> Call::GetParticipants()
const
7836 assert(state_ == DiscordObjectState::Owned);
7837 Discord_UInt64Span returnValueNative__;
7838 Discord_Call_GetParticipants(&instance_, &returnValueNative__);
7839 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
7840 returnValueNative__.ptr + returnValueNative__.size);
7841 Discord_Free(returnValueNative__.ptr);
7842 return returnValue__;
7844float Call::GetParticipantVolume(uint64_t userId)
7846 assert(state_ == DiscordObjectState::Owned);
7847 float returnValue__;
7848 returnValue__ = Discord_Call_GetParticipantVolume(&instance_, userId);
7849 return returnValue__;
7851bool Call::GetPTTActive()
7853 assert(state_ == DiscordObjectState::Owned);
7855 returnValue__ = Discord_Call_GetPTTActive(&instance_);
7856 return returnValue__;
7858uint32_t Call::GetPTTReleaseDelay()
7860 assert(state_ == DiscordObjectState::Owned);
7861 uint32_t returnValue__;
7862 returnValue__ = Discord_Call_GetPTTReleaseDelay(&instance_);
7863 return returnValue__;
7865bool Call::GetSelfDeaf()
7867 assert(state_ == DiscordObjectState::Owned);
7869 returnValue__ = Discord_Call_GetSelfDeaf(&instance_);
7870 return returnValue__;
7872bool Call::GetSelfMute()
7874 assert(state_ == DiscordObjectState::Owned);
7876 returnValue__ = Discord_Call_GetSelfMute(&instance_);
7877 return returnValue__;
7881 assert(state_ == DiscordObjectState::Owned);
7882 Discord_Call_Status returnValue__;
7883 returnValue__ = Discord_Call_GetStatus(&instance_);
7888 assert(state_ == DiscordObjectState::Owned);
7889 Discord_VADThresholdSettings returnValueNative__{};
7890 Discord_Call_GetVADThreshold(&instance_, &returnValueNative__);
7892 return returnValue__;
7894std::optional<discordpp::VoiceStateHandle> Call::GetVoiceStateHandle(uint64_t userId)
const
7896 assert(state_ == DiscordObjectState::Owned);
7897 bool returnIsNonNull__;
7898 Discord_VoiceStateHandle returnValueNative__;
7899 returnIsNonNull__ = Discord_Call_GetVoiceStateHandle(&instance_, userId, &returnValueNative__);
7900 if (!returnIsNonNull__) {
7904 return returnValue__;
7908 assert(state_ == DiscordObjectState::Owned);
7909 Discord_Call_SetAudioMode(&instance_,
static_cast<Discord_AudioModeType
>(audioMode));
7911void Call::SetLocalMute(uint64_t userId,
bool mute)
7913 assert(state_ == DiscordObjectState::Owned);
7914 Discord_Call_SetLocalMute(&instance_, userId, mute);
7918 assert(state_ == DiscordObjectState::Owned);
7919 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
7920 auto cb__userData =
new Tcb__UserData(cb);
7921 Discord_Call_OnVoiceStateChanged cb__native = [](
auto userId,
void* userData__) {
7922 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
7923 userData__typed->delegate(userId);
7925 Discord_Call_SetOnVoiceStateChangedCallback(
7926 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
7930 assert(state_ == DiscordObjectState::Owned);
7931 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
7932 auto cb__userData =
new Tcb__UserData(cb);
7933 Discord_Call_OnParticipantChanged cb__native = [](
auto userId,
auto added,
void* userData__) {
7934 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
7935 userData__typed->delegate(userId, added);
7937 Discord_Call_SetParticipantChangedCallback(
7938 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
7940void Call::SetParticipantVolume(uint64_t userId,
float volume)
7942 assert(state_ == DiscordObjectState::Owned);
7943 Discord_Call_SetParticipantVolume(&instance_, userId, volume);
7945void Call::SetPTTActive(
bool active)
7947 assert(state_ == DiscordObjectState::Owned);
7948 Discord_Call_SetPTTActive(&instance_, active);
7950void Call::SetPTTReleaseDelay(uint32_t releaseDelayMs)
7952 assert(state_ == DiscordObjectState::Owned);
7953 Discord_Call_SetPTTReleaseDelay(&instance_, releaseDelayMs);
7955void Call::SetSelfDeaf(
bool deaf)
7957 assert(state_ == DiscordObjectState::Owned);
7958 Discord_Call_SetSelfDeaf(&instance_, deaf);
7960void Call::SetSelfMute(
bool mute)
7962 assert(state_ == DiscordObjectState::Owned);
7963 Discord_Call_SetSelfMute(&instance_, mute);
7967 assert(state_ == DiscordObjectState::Owned);
7968 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
7969 auto cb__userData =
new Tcb__UserData(cb);
7970 Discord_Call_OnSpeakingStatusChanged cb__native =
7971 [](
auto userId,
auto isPlayingSound,
void* userData__) {
7972 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
7973 userData__typed->delegate(userId, isPlayingSound);
7975 Discord_Call_SetSpeakingStatusChangedCallback(
7976 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
7980 assert(state_ == DiscordObjectState::Owned);
7981 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
7982 auto cb__userData =
new Tcb__UserData(cb);
7983 Discord_Call_OnStatusChanged cb__native =
7984 [](
auto status,
auto error,
auto errorDetail,
void* userData__) {
7985 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
7990 Discord_Call_SetStatusChangedCallback(
7991 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
7993void Call::SetVADThreshold(
bool automatic,
float threshold)
7995 assert(state_ == DiscordObjectState::Owned);
7996 Discord_Call_SetVADThreshold(&instance_, automatic, threshold);
8000 Discord_String returnValueNative__;
8001 Discord_Call_StatusToString(
static_cast<Discord_Call_Status
>(type), &returnValueNative__);
8002 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
8003 returnValueNative__.size);
8004 Discord_Free(returnValueNative__.ptr);
8005 return returnValue__;
8007const ChannelHandle ChannelHandle::nullobj{{}, DiscordObjectState::Invalid};
8008ChannelHandle::~ChannelHandle()
8010 if (state_ == DiscordObjectState::Owned) {
8012 state_ = DiscordObjectState::Invalid;
8015ChannelHandle::ChannelHandle(ChannelHandle&& other) noexcept
8016 : instance_(other.instance_)
8017 , state_(other.state_)
8019 other.state_ = DiscordObjectState::Invalid;
8021ChannelHandle& ChannelHandle::operator=(ChannelHandle&& other)
noexcept
8023 if (
this != &other) {
8024 if (state_ == DiscordObjectState::Owned) {
8027 instance_ = other.instance_;
8028 state_ = other.state_;
8029 other.state_ = DiscordObjectState::Invalid;
8033ChannelHandle::ChannelHandle(
const ChannelHandle& other)
8038 Discord_ChannelHandle_Clone(&instance_, other.instance());
8040 state_ = DiscordObjectState::Owned;
8043ChannelHandle& ChannelHandle::operator=(
const ChannelHandle& other)
8045 if (
this != &other) {
8046 if (state_ == DiscordObjectState::Owned) {
8048 state_ = DiscordObjectState::Invalid;
8050 if (other.state_ == DiscordObjectState::Owned) {
8051 Discord_ChannelHandle_Clone(&instance_, other.instance());
8053 state_ = DiscordObjectState::Owned;
8058ChannelHandle::ChannelHandle(Discord_ChannelHandle instance, DiscordObjectState state)
8059 : instance_(instance)
8063void ChannelHandle::Drop()
8065 if (state_ != DiscordObjectState::Owned) {
8068 Discord_ChannelHandle_Drop(&instance_);
8069 state_ = DiscordObjectState::Invalid;
8071uint64_t ChannelHandle::Id()
const
8073 assert(state_ == DiscordObjectState::Owned);
8074 uint64_t returnValue__;
8075 returnValue__ = Discord_ChannelHandle_Id(&instance_);
8076 return returnValue__;
8078std::string ChannelHandle::Name()
const
8080 assert(state_ == DiscordObjectState::Owned);
8081 Discord_String returnValueNative__;
8082 Discord_ChannelHandle_Name(&instance_, &returnValueNative__);
8083 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
8084 returnValueNative__.size);
8085 Discord_Free(returnValueNative__.ptr);
8086 return returnValue__;
8088std::vector<uint64_t> ChannelHandle::Recipients()
const
8090 assert(state_ == DiscordObjectState::Owned);
8091 Discord_UInt64Span returnValueNative__;
8092 Discord_ChannelHandle_Recipients(&instance_, &returnValueNative__);
8093 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
8094 returnValueNative__.ptr + returnValueNative__.size);
8095 Discord_Free(returnValueNative__.ptr);
8096 return returnValue__;
8100 assert(state_ == DiscordObjectState::Owned);
8101 Discord_ChannelType returnValue__;
8102 returnValue__ = Discord_ChannelHandle_Type(&instance_);
8105const GuildMinimal GuildMinimal::nullobj{{}, DiscordObjectState::Invalid};
8106GuildMinimal::~GuildMinimal()
8108 if (state_ == DiscordObjectState::Owned) {
8110 state_ = DiscordObjectState::Invalid;
8113GuildMinimal::GuildMinimal(GuildMinimal&& other) noexcept
8114 : instance_(other.instance_)
8115 , state_(other.state_)
8117 other.state_ = DiscordObjectState::Invalid;
8119GuildMinimal& GuildMinimal::operator=(GuildMinimal&& other)
noexcept
8121 if (
this != &other) {
8122 if (state_ == DiscordObjectState::Owned) {
8125 instance_ = other.instance_;
8126 state_ = other.state_;
8127 other.state_ = DiscordObjectState::Invalid;
8131GuildMinimal::GuildMinimal(
const GuildMinimal& arg0)
8136 Discord_GuildMinimal_Clone(&instance_, arg0.instance());
8138 state_ = DiscordObjectState::Owned;
8141GuildMinimal& GuildMinimal::operator=(
const GuildMinimal& arg0)
8143 if (
this != &arg0) {
8144 if (state_ == DiscordObjectState::Owned) {
8146 state_ = DiscordObjectState::Invalid;
8148 if (arg0.state_ == DiscordObjectState::Owned) {
8149 Discord_GuildMinimal_Clone(&instance_, arg0.instance());
8151 state_ = DiscordObjectState::Owned;
8156GuildMinimal::GuildMinimal(Discord_GuildMinimal instance, DiscordObjectState state)
8157 : instance_(instance)
8161void GuildMinimal::Drop()
8163 if (state_ != DiscordObjectState::Owned) {
8166 Discord_GuildMinimal_Drop(&instance_);
8167 state_ = DiscordObjectState::Invalid;
8169uint64_t GuildMinimal::Id()
const
8171 assert(state_ == DiscordObjectState::Owned);
8172 uint64_t returnValue__;
8173 returnValue__ = Discord_GuildMinimal_Id(&instance_);
8174 return returnValue__;
8176void GuildMinimal::SetId(uint64_t Id)
8178 assert(state_ == DiscordObjectState::Owned);
8179 Discord_GuildMinimal_SetId(&instance_, Id);
8181std::string GuildMinimal::Name()
const
8183 assert(state_ == DiscordObjectState::Owned);
8184 Discord_String returnValueNative__;
8185 Discord_GuildMinimal_Name(&instance_, &returnValueNative__);
8186 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
8187 returnValueNative__.size);
8188 Discord_Free(returnValueNative__.ptr);
8189 return returnValue__;
8191void GuildMinimal::SetName(std::string Name)
8193 assert(state_ == DiscordObjectState::Owned);
8194 Discord_String Name__str{(uint8_t*)(
Name.data()),
Name.size()};
8195 Discord_GuildMinimal_SetName(&instance_, Name__str);
8197const GuildChannel GuildChannel::nullobj{{}, DiscordObjectState::Invalid};
8198GuildChannel::~GuildChannel()
8200 if (state_ == DiscordObjectState::Owned) {
8202 state_ = DiscordObjectState::Invalid;
8205GuildChannel::GuildChannel(GuildChannel&& other) noexcept
8206 : instance_(other.instance_)
8207 , state_(other.state_)
8209 other.state_ = DiscordObjectState::Invalid;
8211GuildChannel& GuildChannel::operator=(GuildChannel&& other)
noexcept
8213 if (
this != &other) {
8214 if (state_ == DiscordObjectState::Owned) {
8217 instance_ = other.instance_;
8218 state_ = other.state_;
8219 other.state_ = DiscordObjectState::Invalid;
8223GuildChannel::GuildChannel(
const GuildChannel& arg0)
8228 Discord_GuildChannel_Clone(&instance_, arg0.instance());
8230 state_ = DiscordObjectState::Owned;
8233GuildChannel& GuildChannel::operator=(
const GuildChannel& arg0)
8235 if (
this != &arg0) {
8236 if (state_ == DiscordObjectState::Owned) {
8238 state_ = DiscordObjectState::Invalid;
8240 if (arg0.state_ == DiscordObjectState::Owned) {
8241 Discord_GuildChannel_Clone(&instance_, arg0.instance());
8243 state_ = DiscordObjectState::Owned;
8248GuildChannel::GuildChannel(Discord_GuildChannel instance, DiscordObjectState state)
8249 : instance_(instance)
8253void GuildChannel::Drop()
8255 if (state_ != DiscordObjectState::Owned) {
8258 Discord_GuildChannel_Drop(&instance_);
8259 state_ = DiscordObjectState::Invalid;
8261uint64_t GuildChannel::Id()
const
8263 assert(state_ == DiscordObjectState::Owned);
8264 uint64_t returnValue__;
8265 returnValue__ = Discord_GuildChannel_Id(&instance_);
8266 return returnValue__;
8268void GuildChannel::SetId(uint64_t Id)
8270 assert(state_ == DiscordObjectState::Owned);
8271 Discord_GuildChannel_SetId(&instance_, Id);
8273std::string GuildChannel::Name()
const
8275 assert(state_ == DiscordObjectState::Owned);
8276 Discord_String returnValueNative__;
8277 Discord_GuildChannel_Name(&instance_, &returnValueNative__);
8278 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
8279 returnValueNative__.size);
8280 Discord_Free(returnValueNative__.ptr);
8281 return returnValue__;
8283void GuildChannel::SetName(std::string Name)
8285 assert(state_ == DiscordObjectState::Owned);
8286 Discord_String Name__str{(uint8_t*)(
Name.data()),
Name.size()};
8287 Discord_GuildChannel_SetName(&instance_, Name__str);
8289bool GuildChannel::IsLinkable()
const
8291 assert(state_ == DiscordObjectState::Owned);
8293 returnValue__ = Discord_GuildChannel_IsLinkable(&instance_);
8294 return returnValue__;
8296void GuildChannel::SetIsLinkable(
bool IsLinkable)
8298 assert(state_ == DiscordObjectState::Owned);
8299 Discord_GuildChannel_SetIsLinkable(&instance_, IsLinkable);
8301bool GuildChannel::IsViewableAndWriteableByAllMembers()
const
8303 assert(state_ == DiscordObjectState::Owned);
8305 returnValue__ = Discord_GuildChannel_IsViewableAndWriteableByAllMembers(&instance_);
8306 return returnValue__;
8308void GuildChannel::SetIsViewableAndWriteableByAllMembers(
bool IsViewableAndWriteableByAllMembers)
8310 assert(state_ == DiscordObjectState::Owned);
8311 Discord_GuildChannel_SetIsViewableAndWriteableByAllMembers(&instance_,
8312 IsViewableAndWriteableByAllMembers);
8314std::optional<discordpp::LinkedLobby> GuildChannel::LinkedLobby()
const
8316 assert(state_ == DiscordObjectState::Owned);
8317 bool returnIsNonNull__;
8318 Discord_LinkedLobby returnValueNative__;
8319 returnIsNonNull__ = Discord_GuildChannel_LinkedLobby(&instance_, &returnValueNative__);
8320 if (!returnIsNonNull__) {
8324 return returnValue__;
8326void GuildChannel::SetLinkedLobby(std::optional<discordpp::LinkedLobby> LinkedLobby)
8328 assert(state_ == DiscordObjectState::Owned);
8329 Discord_GuildChannel_SetLinkedLobby(
8330 &instance_, (LinkedLobby.has_value() ? LinkedLobby->instance() :
nullptr));
8332const LinkedLobby LinkedLobby::nullobj{{}, DiscordObjectState::Invalid};
8333LinkedLobby::~LinkedLobby()
8335 if (state_ == DiscordObjectState::Owned) {
8337 state_ = DiscordObjectState::Invalid;
8340LinkedLobby::LinkedLobby(LinkedLobby&& other) noexcept
8341 : instance_(other.instance_)
8342 , state_(other.state_)
8344 other.state_ = DiscordObjectState::Invalid;
8346LinkedLobby& LinkedLobby::operator=(LinkedLobby&& other)
noexcept
8348 if (
this != &other) {
8349 if (state_ == DiscordObjectState::Owned) {
8352 instance_ = other.instance_;
8353 state_ = other.state_;
8354 other.state_ = DiscordObjectState::Invalid;
8358LinkedLobby::LinkedLobby(
const LinkedLobby& arg0)
8363 Discord_LinkedLobby_Clone(&instance_, arg0.instance());
8365 state_ = DiscordObjectState::Owned;
8368LinkedLobby& LinkedLobby::operator=(
const LinkedLobby& arg0)
8370 if (
this != &arg0) {
8371 if (state_ == DiscordObjectState::Owned) {
8373 state_ = DiscordObjectState::Invalid;
8375 if (arg0.state_ == DiscordObjectState::Owned) {
8376 Discord_LinkedLobby_Clone(&instance_, arg0.instance());
8378 state_ = DiscordObjectState::Owned;
8383LinkedLobby::LinkedLobby(Discord_LinkedLobby instance, DiscordObjectState state)
8384 : instance_(instance)
8388LinkedLobby::LinkedLobby()
8390 assert(state_ == DiscordObjectState::Invalid);
8391 Discord_LinkedLobby_Init(&instance_);
8392 state_ = DiscordObjectState::Owned;
8394void LinkedLobby::Drop()
8396 if (state_ != DiscordObjectState::Owned) {
8399 Discord_LinkedLobby_Drop(&instance_);
8400 state_ = DiscordObjectState::Invalid;
8402uint64_t LinkedLobby::ApplicationId()
const
8404 assert(state_ == DiscordObjectState::Owned);
8405 uint64_t returnValue__;
8406 returnValue__ = Discord_LinkedLobby_ApplicationId(&instance_);
8407 return returnValue__;
8409void LinkedLobby::SetApplicationId(uint64_t ApplicationId)
8411 assert(state_ == DiscordObjectState::Owned);
8412 Discord_LinkedLobby_SetApplicationId(&instance_, ApplicationId);
8414uint64_t LinkedLobby::LobbyId()
const
8416 assert(state_ == DiscordObjectState::Owned);
8417 uint64_t returnValue__;
8418 returnValue__ = Discord_LinkedLobby_LobbyId(&instance_);
8419 return returnValue__;
8421void LinkedLobby::SetLobbyId(uint64_t LobbyId)
8423 assert(state_ == DiscordObjectState::Owned);
8424 Discord_LinkedLobby_SetLobbyId(&instance_, LobbyId);
8426const LinkedChannel LinkedChannel::nullobj{{}, DiscordObjectState::Invalid};
8427LinkedChannel::~LinkedChannel()
8429 if (state_ == DiscordObjectState::Owned) {
8431 state_ = DiscordObjectState::Invalid;
8434LinkedChannel::LinkedChannel(LinkedChannel&& other) noexcept
8435 : instance_(other.instance_)
8436 , state_(other.state_)
8438 other.state_ = DiscordObjectState::Invalid;
8440LinkedChannel& LinkedChannel::operator=(LinkedChannel&& other)
noexcept
8442 if (
this != &other) {
8443 if (state_ == DiscordObjectState::Owned) {
8446 instance_ = other.instance_;
8447 state_ = other.state_;
8448 other.state_ = DiscordObjectState::Invalid;
8452LinkedChannel::LinkedChannel(
const LinkedChannel& arg0)
8457 Discord_LinkedChannel_Clone(&instance_, arg0.instance());
8459 state_ = DiscordObjectState::Owned;
8462LinkedChannel& LinkedChannel::operator=(
const LinkedChannel& arg0)
8464 if (
this != &arg0) {
8465 if (state_ == DiscordObjectState::Owned) {
8467 state_ = DiscordObjectState::Invalid;
8469 if (arg0.state_ == DiscordObjectState::Owned) {
8470 Discord_LinkedChannel_Clone(&instance_, arg0.instance());
8472 state_ = DiscordObjectState::Owned;
8477LinkedChannel::LinkedChannel(Discord_LinkedChannel instance, DiscordObjectState state)
8478 : instance_(instance)
8482void LinkedChannel::Drop()
8484 if (state_ != DiscordObjectState::Owned) {
8487 Discord_LinkedChannel_Drop(&instance_);
8488 state_ = DiscordObjectState::Invalid;
8490uint64_t LinkedChannel::Id()
const
8492 assert(state_ == DiscordObjectState::Owned);
8493 uint64_t returnValue__;
8494 returnValue__ = Discord_LinkedChannel_Id(&instance_);
8495 return returnValue__;
8497void LinkedChannel::SetId(uint64_t Id)
8499 assert(state_ == DiscordObjectState::Owned);
8500 Discord_LinkedChannel_SetId(&instance_, Id);
8502std::string LinkedChannel::Name()
const
8504 assert(state_ == DiscordObjectState::Owned);
8505 Discord_String returnValueNative__;
8506 Discord_LinkedChannel_Name(&instance_, &returnValueNative__);
8507 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
8508 returnValueNative__.size);
8509 Discord_Free(returnValueNative__.ptr);
8510 return returnValue__;
8512void LinkedChannel::SetName(std::string Name)
8514 assert(state_ == DiscordObjectState::Owned);
8515 Discord_String Name__str{(uint8_t*)(
Name.data()),
Name.size()};
8516 Discord_LinkedChannel_SetName(&instance_, Name__str);
8518uint64_t LinkedChannel::GuildId()
const
8520 assert(state_ == DiscordObjectState::Owned);
8521 uint64_t returnValue__;
8522 returnValue__ = Discord_LinkedChannel_GuildId(&instance_);
8523 return returnValue__;
8525void LinkedChannel::SetGuildId(uint64_t GuildId)
8527 assert(state_ == DiscordObjectState::Owned);
8528 Discord_LinkedChannel_SetGuildId(&instance_, GuildId);
8530const RelationshipHandle RelationshipHandle::nullobj{{}, DiscordObjectState::Invalid};
8531RelationshipHandle::~RelationshipHandle()
8533 if (state_ == DiscordObjectState::Owned) {
8535 state_ = DiscordObjectState::Invalid;
8538RelationshipHandle::RelationshipHandle(RelationshipHandle&& other) noexcept
8539 : instance_(other.instance_)
8540 , state_(other.state_)
8542 other.state_ = DiscordObjectState::Invalid;
8544RelationshipHandle& RelationshipHandle::operator=(RelationshipHandle&& other)
noexcept
8546 if (
this != &other) {
8547 if (state_ == DiscordObjectState::Owned) {
8550 instance_ = other.instance_;
8551 state_ = other.state_;
8552 other.state_ = DiscordObjectState::Invalid;
8556RelationshipHandle::RelationshipHandle(
const RelationshipHandle& other)
8561 Discord_RelationshipHandle_Clone(&instance_, other.instance());
8563 state_ = DiscordObjectState::Owned;
8566RelationshipHandle& RelationshipHandle::operator=(
const RelationshipHandle& other)
8568 if (
this != &other) {
8569 if (state_ == DiscordObjectState::Owned) {
8571 state_ = DiscordObjectState::Invalid;
8573 if (other.state_ == DiscordObjectState::Owned) {
8574 Discord_RelationshipHandle_Clone(&instance_, other.instance());
8576 state_ = DiscordObjectState::Owned;
8581RelationshipHandle::RelationshipHandle(Discord_RelationshipHandle instance,
8582 DiscordObjectState state)
8583 : instance_(instance)
8587void RelationshipHandle::Drop()
8589 if (state_ != DiscordObjectState::Owned) {
8592 Discord_RelationshipHandle_Drop(&instance_);
8593 state_ = DiscordObjectState::Invalid;
8597 assert(state_ == DiscordObjectState::Owned);
8598 Discord_RelationshipType returnValue__;
8599 returnValue__ = Discord_RelationshipHandle_DiscordRelationshipType(&instance_);
8604 assert(state_ == DiscordObjectState::Owned);
8605 Discord_RelationshipType returnValue__;
8606 returnValue__ = Discord_RelationshipHandle_GameRelationshipType(&instance_);
8609uint64_t RelationshipHandle::Id()
const
8611 assert(state_ == DiscordObjectState::Owned);
8612 uint64_t returnValue__;
8613 returnValue__ = Discord_RelationshipHandle_Id(&instance_);
8614 return returnValue__;
8616bool RelationshipHandle::IsSpamRequest()
const
8618 assert(state_ == DiscordObjectState::Owned);
8620 returnValue__ = Discord_RelationshipHandle_IsSpamRequest(&instance_);
8621 return returnValue__;
8623std::optional<discordpp::UserHandle> RelationshipHandle::User()
const
8625 assert(state_ == DiscordObjectState::Owned);
8626 bool returnIsNonNull__;
8627 Discord_UserHandle returnValueNative__;
8628 returnIsNonNull__ = Discord_RelationshipHandle_User(&instance_, &returnValueNative__);
8629 if (!returnIsNonNull__) {
8633 return returnValue__;
8635const UserHandle UserHandle::nullobj{{}, DiscordObjectState::Invalid};
8636UserHandle::~UserHandle()
8638 if (state_ == DiscordObjectState::Owned) {
8640 state_ = DiscordObjectState::Invalid;
8643UserHandle::UserHandle(UserHandle&& other) noexcept
8644 : instance_(other.instance_)
8645 , state_(other.state_)
8647 other.state_ = DiscordObjectState::Invalid;
8649UserHandle& UserHandle::operator=(UserHandle&& other)
noexcept
8651 if (
this != &other) {
8652 if (state_ == DiscordObjectState::Owned) {
8655 instance_ = other.instance_;
8656 state_ = other.state_;
8657 other.state_ = DiscordObjectState::Invalid;
8661UserHandle::UserHandle(
const UserHandle& arg0)
8666 Discord_UserHandle_Clone(&instance_, arg0.instance());
8668 state_ = DiscordObjectState::Owned;
8671UserHandle& UserHandle::operator=(
const UserHandle& arg0)
8673 if (
this != &arg0) {
8674 if (state_ == DiscordObjectState::Owned) {
8676 state_ = DiscordObjectState::Invalid;
8678 if (arg0.state_ == DiscordObjectState::Owned) {
8679 Discord_UserHandle_Clone(&instance_, arg0.instance());
8681 state_ = DiscordObjectState::Owned;
8686UserHandle::UserHandle(Discord_UserHandle instance, DiscordObjectState state)
8687 : instance_(instance)
8691void UserHandle::Drop()
8693 if (state_ != DiscordObjectState::Owned) {
8696 Discord_UserHandle_Drop(&instance_);
8697 state_ = DiscordObjectState::Invalid;
8699std::optional<std::string> UserHandle::Avatar()
const
8701 assert(state_ == DiscordObjectState::Owned);
8702 bool returnIsNonNull__;
8703 Discord_String returnValueNative__;
8704 returnIsNonNull__ = Discord_UserHandle_Avatar(&instance_, &returnValueNative__);
8705 if (!returnIsNonNull__) {
8708 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
8709 returnValueNative__.size);
8710 Discord_Free(returnValueNative__.ptr);
8711 return returnValue__;
8715 Discord_String returnValueNative__;
8716 Discord_UserHandle_AvatarTypeToString(
static_cast<Discord_UserHandle_AvatarType
>(type),
8717 &returnValueNative__);
8718 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
8719 returnValueNative__.size);
8720 Discord_Free(returnValueNative__.ptr);
8721 return returnValue__;
8726 assert(state_ == DiscordObjectState::Owned);
8727 Discord_String returnValueNative__;
8728 Discord_UserHandle_AvatarUrl(&instance_,
8729 static_cast<Discord_UserHandle_AvatarType
>(animatedType),
8730 static_cast<Discord_UserHandle_AvatarType
>(staticType),
8731 &returnValueNative__);
8732 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
8733 returnValueNative__.size);
8734 Discord_Free(returnValueNative__.ptr);
8735 return returnValue__;
8737std::string UserHandle::DisplayName()
const
8739 assert(state_ == DiscordObjectState::Owned);
8740 Discord_String returnValueNative__;
8741 Discord_UserHandle_DisplayName(&instance_, &returnValueNative__);
8742 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
8743 returnValueNative__.size);
8744 Discord_Free(returnValueNative__.ptr);
8745 return returnValue__;
8747std::optional<discordpp::Activity> UserHandle::GameActivity()
const
8749 assert(state_ == DiscordObjectState::Owned);
8750 bool returnIsNonNull__;
8751 Discord_Activity returnValueNative__;
8752 returnIsNonNull__ = Discord_UserHandle_GameActivity(&instance_, &returnValueNative__);
8753 if (!returnIsNonNull__) {
8757 return returnValue__;
8759std::optional<std::string> UserHandle::GlobalName()
const
8761 assert(state_ == DiscordObjectState::Owned);
8762 bool returnIsNonNull__;
8763 Discord_String returnValueNative__;
8764 returnIsNonNull__ = Discord_UserHandle_GlobalName(&instance_, &returnValueNative__);
8765 if (!returnIsNonNull__) {
8768 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
8769 returnValueNative__.size);
8770 Discord_Free(returnValueNative__.ptr);
8771 return returnValue__;
8773uint64_t UserHandle::Id()
const
8775 assert(state_ == DiscordObjectState::Owned);
8776 uint64_t returnValue__;
8777 returnValue__ = Discord_UserHandle_Id(&instance_);
8778 return returnValue__;
8780bool UserHandle::IsProvisional()
const
8782 assert(state_ == DiscordObjectState::Owned);
8784 returnValue__ = Discord_UserHandle_IsProvisional(&instance_);
8785 return returnValue__;
8789 assert(state_ == DiscordObjectState::Owned);
8790 Discord_RelationshipHandle returnValueNative__{};
8791 Discord_UserHandle_Relationship(&instance_, &returnValueNative__);
8793 return returnValue__;
8797 assert(state_ == DiscordObjectState::Owned);
8798 Discord_StatusType returnValue__;
8799 returnValue__ = Discord_UserHandle_Status(&instance_);
8802std::string UserHandle::Username()
const
8804 assert(state_ == DiscordObjectState::Owned);
8805 Discord_String returnValueNative__;
8806 Discord_UserHandle_Username(&instance_, &returnValueNative__);
8807 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
8808 returnValueNative__.size);
8809 Discord_Free(returnValueNative__.ptr);
8810 return returnValue__;
8812const LobbyMemberHandle LobbyMemberHandle::nullobj{{}, DiscordObjectState::Invalid};
8813LobbyMemberHandle::~LobbyMemberHandle()
8815 if (state_ == DiscordObjectState::Owned) {
8817 state_ = DiscordObjectState::Invalid;
8820LobbyMemberHandle::LobbyMemberHandle(LobbyMemberHandle&& other) noexcept
8821 : instance_(other.instance_)
8822 , state_(other.state_)
8824 other.state_ = DiscordObjectState::Invalid;
8826LobbyMemberHandle& LobbyMemberHandle::operator=(LobbyMemberHandle&& other)
noexcept
8828 if (
this != &other) {
8829 if (state_ == DiscordObjectState::Owned) {
8832 instance_ = other.instance_;
8833 state_ = other.state_;
8834 other.state_ = DiscordObjectState::Invalid;
8838LobbyMemberHandle::LobbyMemberHandle(
const LobbyMemberHandle& other)
8843 Discord_LobbyMemberHandle_Clone(&instance_, other.instance());
8845 state_ = DiscordObjectState::Owned;
8848LobbyMemberHandle& LobbyMemberHandle::operator=(
const LobbyMemberHandle& other)
8850 if (
this != &other) {
8851 if (state_ == DiscordObjectState::Owned) {
8853 state_ = DiscordObjectState::Invalid;
8855 if (other.state_ == DiscordObjectState::Owned) {
8856 Discord_LobbyMemberHandle_Clone(&instance_, other.instance());
8858 state_ = DiscordObjectState::Owned;
8863LobbyMemberHandle::LobbyMemberHandle(Discord_LobbyMemberHandle instance, DiscordObjectState state)
8864 : instance_(instance)
8868void LobbyMemberHandle::Drop()
8870 if (state_ != DiscordObjectState::Owned) {
8873 Discord_LobbyMemberHandle_Drop(&instance_);
8874 state_ = DiscordObjectState::Invalid;
8876bool LobbyMemberHandle::CanLinkLobby()
const
8878 assert(state_ == DiscordObjectState::Owned);
8880 returnValue__ = Discord_LobbyMemberHandle_CanLinkLobby(&instance_);
8881 return returnValue__;
8883bool LobbyMemberHandle::Connected()
const
8885 assert(state_ == DiscordObjectState::Owned);
8887 returnValue__ = Discord_LobbyMemberHandle_Connected(&instance_);
8888 return returnValue__;
8890uint64_t LobbyMemberHandle::Id()
const
8892 assert(state_ == DiscordObjectState::Owned);
8893 uint64_t returnValue__;
8894 returnValue__ = Discord_LobbyMemberHandle_Id(&instance_);
8895 return returnValue__;
8897std::unordered_map<std::string, std::string> LobbyMemberHandle::Metadata()
const
8899 assert(state_ == DiscordObjectState::Owned);
8900 Discord_Properties returnValueNative__;
8901 Discord_LobbyMemberHandle_Metadata(&instance_, &returnValueNative__);
8902 std::unordered_map<std::string, std::string> returnValue__ =
8903 ConvertReturnedProperties(returnValueNative__);
8904 Discord_FreeProperties(returnValueNative__);
8905 return returnValue__;
8907std::optional<discordpp::UserHandle> LobbyMemberHandle::User()
const
8909 assert(state_ == DiscordObjectState::Owned);
8910 bool returnIsNonNull__;
8911 Discord_UserHandle returnValueNative__;
8912 returnIsNonNull__ = Discord_LobbyMemberHandle_User(&instance_, &returnValueNative__);
8913 if (!returnIsNonNull__) {
8917 return returnValue__;
8919const LobbyHandle LobbyHandle::nullobj{{}, DiscordObjectState::Invalid};
8920LobbyHandle::~LobbyHandle()
8922 if (state_ == DiscordObjectState::Owned) {
8924 state_ = DiscordObjectState::Invalid;
8927LobbyHandle::LobbyHandle(LobbyHandle&& other) noexcept
8928 : instance_(other.instance_)
8929 , state_(other.state_)
8931 other.state_ = DiscordObjectState::Invalid;
8933LobbyHandle& LobbyHandle::operator=(LobbyHandle&& other)
noexcept
8935 if (
this != &other) {
8936 if (state_ == DiscordObjectState::Owned) {
8939 instance_ = other.instance_;
8940 state_ = other.state_;
8941 other.state_ = DiscordObjectState::Invalid;
8945LobbyHandle::LobbyHandle(
const LobbyHandle& other)
8950 Discord_LobbyHandle_Clone(&instance_, other.instance());
8952 state_ = DiscordObjectState::Owned;
8955LobbyHandle& LobbyHandle::operator=(
const LobbyHandle& other)
8957 if (
this != &other) {
8958 if (state_ == DiscordObjectState::Owned) {
8960 state_ = DiscordObjectState::Invalid;
8962 if (other.state_ == DiscordObjectState::Owned) {
8963 Discord_LobbyHandle_Clone(&instance_, other.instance());
8965 state_ = DiscordObjectState::Owned;
8970LobbyHandle::LobbyHandle(Discord_LobbyHandle instance, DiscordObjectState state)
8971 : instance_(instance)
8975void LobbyHandle::Drop()
8977 if (state_ != DiscordObjectState::Owned) {
8980 Discord_LobbyHandle_Drop(&instance_);
8981 state_ = DiscordObjectState::Invalid;
8983std::optional<discordpp::CallInfoHandle> LobbyHandle::GetCallInfoHandle()
const
8985 assert(state_ == DiscordObjectState::Owned);
8986 bool returnIsNonNull__;
8987 Discord_CallInfoHandle returnValueNative__;
8988 returnIsNonNull__ = Discord_LobbyHandle_GetCallInfoHandle(&instance_, &returnValueNative__);
8989 if (!returnIsNonNull__) {
8993 return returnValue__;
8995std::optional<discordpp::LobbyMemberHandle> LobbyHandle::GetLobbyMemberHandle(
8996 uint64_t memberId)
const
8998 assert(state_ == DiscordObjectState::Owned);
8999 bool returnIsNonNull__;
9000 Discord_LobbyMemberHandle returnValueNative__;
9002 Discord_LobbyHandle_GetLobbyMemberHandle(&instance_, memberId, &returnValueNative__);
9003 if (!returnIsNonNull__) {
9007 return returnValue__;
9009uint64_t LobbyHandle::Id()
const
9011 assert(state_ == DiscordObjectState::Owned);
9012 uint64_t returnValue__;
9013 returnValue__ = Discord_LobbyHandle_Id(&instance_);
9014 return returnValue__;
9016std::optional<discordpp::LinkedChannel> LobbyHandle::LinkedChannel()
const
9018 assert(state_ == DiscordObjectState::Owned);
9019 bool returnIsNonNull__;
9020 Discord_LinkedChannel returnValueNative__;
9021 returnIsNonNull__ = Discord_LobbyHandle_LinkedChannel(&instance_, &returnValueNative__);
9022 if (!returnIsNonNull__) {
9026 return returnValue__;
9028std::vector<uint64_t> LobbyHandle::LobbyMemberIds()
const
9030 assert(state_ == DiscordObjectState::Owned);
9031 Discord_UInt64Span returnValueNative__;
9032 Discord_LobbyHandle_LobbyMemberIds(&instance_, &returnValueNative__);
9033 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
9034 returnValueNative__.ptr + returnValueNative__.size);
9035 Discord_Free(returnValueNative__.ptr);
9036 return returnValue__;
9038std::vector<discordpp::LobbyMemberHandle> LobbyHandle::LobbyMembers()
const
9040 assert(state_ == DiscordObjectState::Owned);
9041 Discord_LobbyMemberHandleSpan returnValueNative__;
9042 Discord_LobbyHandle_LobbyMembers(&instance_, &returnValueNative__);
9043 std::vector<discordpp::LobbyMemberHandle> returnValue__;
9044 returnValue__.reserve(returnValueNative__.size);
9045 for (
size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
9046 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
9048 Discord_Free(returnValueNative__.ptr);
9049 return returnValue__;
9051std::unordered_map<std::string, std::string> LobbyHandle::Metadata()
const
9053 assert(state_ == DiscordObjectState::Owned);
9054 Discord_Properties returnValueNative__;
9055 Discord_LobbyHandle_Metadata(&instance_, &returnValueNative__);
9056 std::unordered_map<std::string, std::string> returnValue__ =
9057 ConvertReturnedProperties(returnValueNative__);
9058 Discord_FreeProperties(returnValueNative__);
9059 return returnValue__;
9061const AdditionalContent AdditionalContent::nullobj{{}, DiscordObjectState::Invalid};
9062AdditionalContent::~AdditionalContent()
9064 if (state_ == DiscordObjectState::Owned) {
9066 state_ = DiscordObjectState::Invalid;
9069AdditionalContent::AdditionalContent(AdditionalContent&& other) noexcept
9070 : instance_(other.instance_)
9071 , state_(other.state_)
9073 other.state_ = DiscordObjectState::Invalid;
9075AdditionalContent& AdditionalContent::operator=(AdditionalContent&& other)
noexcept
9077 if (
this != &other) {
9078 if (state_ == DiscordObjectState::Owned) {
9081 instance_ = other.instance_;
9082 state_ = other.state_;
9083 other.state_ = DiscordObjectState::Invalid;
9087AdditionalContent::AdditionalContent(
const AdditionalContent& arg0)
9092 Discord_AdditionalContent_Clone(&instance_, arg0.instance());
9094 state_ = DiscordObjectState::Owned;
9097AdditionalContent& AdditionalContent::operator=(
const AdditionalContent& arg0)
9099 if (
this != &arg0) {
9100 if (state_ == DiscordObjectState::Owned) {
9102 state_ = DiscordObjectState::Invalid;
9104 if (arg0.state_ == DiscordObjectState::Owned) {
9105 Discord_AdditionalContent_Clone(&instance_, arg0.instance());
9107 state_ = DiscordObjectState::Owned;
9112AdditionalContent::AdditionalContent(Discord_AdditionalContent instance, DiscordObjectState state)
9113 : instance_(instance)
9117AdditionalContent::AdditionalContent()
9119 assert(state_ == DiscordObjectState::Invalid);
9120 Discord_AdditionalContent_Init(&instance_);
9121 state_ = DiscordObjectState::Owned;
9123void AdditionalContent::Drop()
9125 if (state_ != DiscordObjectState::Owned) {
9128 Discord_AdditionalContent_Drop(&instance_);
9129 state_ = DiscordObjectState::Invalid;
9133 assert(state_ == DiscordObjectState::Owned);
9135 returnValue__ = Discord_AdditionalContent_Equals(&instance_, rhs.instance());
9136 return returnValue__;
9140 Discord_String returnValueNative__;
9141 Discord_AdditionalContent_TypeToString(
static_cast<Discord_AdditionalContentType
>(type),
9142 &returnValueNative__);
9143 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
9144 returnValueNative__.size);
9145 Discord_Free(returnValueNative__.ptr);
9146 return returnValue__;
9150 assert(state_ == DiscordObjectState::Owned);
9151 Discord_AdditionalContentType returnValue__;
9152 returnValue__ = Discord_AdditionalContent_Type(&instance_);
9157 assert(state_ == DiscordObjectState::Owned);
9158 Discord_AdditionalContent_SetType(&instance_,
static_cast<Discord_AdditionalContentType
>(Type));
9160std::optional<std::string> AdditionalContent::Title()
const
9162 assert(state_ == DiscordObjectState::Owned);
9163 bool returnIsNonNull__;
9164 Discord_String returnValueNative__;
9165 returnIsNonNull__ = Discord_AdditionalContent_Title(&instance_, &returnValueNative__);
9166 if (!returnIsNonNull__) {
9169 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
9170 returnValueNative__.size);
9171 Discord_Free(returnValueNative__.ptr);
9172 return returnValue__;
9174void AdditionalContent::SetTitle(std::optional<std::string> Title)
9176 assert(state_ == DiscordObjectState::Owned);
9177 Discord_String Title__str{};
9178 if (Title.has_value()) {
9179 Title__str.ptr =
reinterpret_cast<uint8_t*
>(Title->data());
9180 Title__str.size = Title->size();
9182 Discord_AdditionalContent_SetTitle(&instance_, (Title.has_value() ? &Title__str :
nullptr));
9184uint8_t AdditionalContent::Count()
const
9186 assert(state_ == DiscordObjectState::Owned);
9187 uint8_t returnValue__;
9188 returnValue__ = Discord_AdditionalContent_Count(&instance_);
9189 return returnValue__;
9191void AdditionalContent::SetCount(uint8_t Count)
9193 assert(state_ == DiscordObjectState::Owned);
9194 Discord_AdditionalContent_SetCount(&instance_, Count);
9196const MessageHandle MessageHandle::nullobj{{}, DiscordObjectState::Invalid};
9197MessageHandle::~MessageHandle()
9199 if (state_ == DiscordObjectState::Owned) {
9201 state_ = DiscordObjectState::Invalid;
9204MessageHandle::MessageHandle(MessageHandle&& other) noexcept
9205 : instance_(other.instance_)
9206 , state_(other.state_)
9208 other.state_ = DiscordObjectState::Invalid;
9210MessageHandle& MessageHandle::operator=(MessageHandle&& other)
noexcept
9212 if (
this != &other) {
9213 if (state_ == DiscordObjectState::Owned) {
9216 instance_ = other.instance_;
9217 state_ = other.state_;
9218 other.state_ = DiscordObjectState::Invalid;
9222MessageHandle::MessageHandle(
const MessageHandle& other)
9227 Discord_MessageHandle_Clone(&instance_, other.instance());
9229 state_ = DiscordObjectState::Owned;
9232MessageHandle& MessageHandle::operator=(
const MessageHandle& other)
9234 if (
this != &other) {
9235 if (state_ == DiscordObjectState::Owned) {
9237 state_ = DiscordObjectState::Invalid;
9239 if (other.state_ == DiscordObjectState::Owned) {
9240 Discord_MessageHandle_Clone(&instance_, other.instance());
9242 state_ = DiscordObjectState::Owned;
9247MessageHandle::MessageHandle(Discord_MessageHandle instance, DiscordObjectState state)
9248 : instance_(instance)
9252void MessageHandle::Drop()
9254 if (state_ != DiscordObjectState::Owned) {
9257 Discord_MessageHandle_Drop(&instance_);
9258 state_ = DiscordObjectState::Invalid;
9260std::optional<discordpp::AdditionalContent> MessageHandle::AdditionalContent()
const
9262 assert(state_ == DiscordObjectState::Owned);
9263 bool returnIsNonNull__;
9264 Discord_AdditionalContent returnValueNative__;
9265 returnIsNonNull__ = Discord_MessageHandle_AdditionalContent(&instance_, &returnValueNative__);
9266 if (!returnIsNonNull__) {
9270 return returnValue__;
9272std::optional<uint64_t> MessageHandle::ApplicationId()
const
9274 assert(state_ == DiscordObjectState::Owned);
9275 bool returnIsNonNull__;
9276 uint64_t returnValue__;
9277 returnIsNonNull__ = Discord_MessageHandle_ApplicationId(&instance_, &returnValue__);
9278 if (!returnIsNonNull__) {
9279 return std::nullopt;
9281 return returnValue__;
9283std::optional<discordpp::UserHandle> MessageHandle::Author()
const
9285 assert(state_ == DiscordObjectState::Owned);
9286 bool returnIsNonNull__;
9287 Discord_UserHandle returnValueNative__;
9288 returnIsNonNull__ = Discord_MessageHandle_Author(&instance_, &returnValueNative__);
9289 if (!returnIsNonNull__) {
9293 return returnValue__;
9295uint64_t MessageHandle::AuthorId()
const
9297 assert(state_ == DiscordObjectState::Owned);
9298 uint64_t returnValue__;
9299 returnValue__ = Discord_MessageHandle_AuthorId(&instance_);
9300 return returnValue__;
9302std::optional<discordpp::ChannelHandle> MessageHandle::Channel()
const
9304 assert(state_ == DiscordObjectState::Owned);
9305 bool returnIsNonNull__;
9306 Discord_ChannelHandle returnValueNative__;
9307 returnIsNonNull__ = Discord_MessageHandle_Channel(&instance_, &returnValueNative__);
9308 if (!returnIsNonNull__) {
9312 return returnValue__;
9314uint64_t MessageHandle::ChannelId()
const
9316 assert(state_ == DiscordObjectState::Owned);
9317 uint64_t returnValue__;
9318 returnValue__ = Discord_MessageHandle_ChannelId(&instance_);
9319 return returnValue__;
9321std::string MessageHandle::Content()
const
9323 assert(state_ == DiscordObjectState::Owned);
9324 Discord_String returnValueNative__;
9325 Discord_MessageHandle_Content(&instance_, &returnValueNative__);
9326 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
9327 returnValueNative__.size);
9328 Discord_Free(returnValueNative__.ptr);
9329 return returnValue__;
9331std::optional<discordpp::DisclosureTypes> MessageHandle::DisclosureType()
const
9333 assert(state_ == DiscordObjectState::Owned);
9334 bool returnIsNonNull__;
9335 Discord_DisclosureTypes returnValueNative__;
9336 returnIsNonNull__ = Discord_MessageHandle_DisclosureType(&instance_, &returnValueNative__);
9337 if (!returnIsNonNull__) {
9341 return returnValue__;
9343uint64_t MessageHandle::EditedTimestamp()
const
9345 assert(state_ == DiscordObjectState::Owned);
9346 uint64_t returnValue__;
9347 returnValue__ = Discord_MessageHandle_EditedTimestamp(&instance_);
9348 return returnValue__;
9350uint64_t MessageHandle::Id()
const
9352 assert(state_ == DiscordObjectState::Owned);
9353 uint64_t returnValue__;
9354 returnValue__ = Discord_MessageHandle_Id(&instance_);
9355 return returnValue__;
9357std::optional<discordpp::LobbyHandle> MessageHandle::Lobby()
const
9359 assert(state_ == DiscordObjectState::Owned);
9360 bool returnIsNonNull__;
9361 Discord_LobbyHandle returnValueNative__;
9362 returnIsNonNull__ = Discord_MessageHandle_Lobby(&instance_, &returnValueNative__);
9363 if (!returnIsNonNull__) {
9367 return returnValue__;
9369std::unordered_map<std::string, std::string> MessageHandle::Metadata()
const
9371 assert(state_ == DiscordObjectState::Owned);
9372 Discord_Properties returnValueNative__;
9373 Discord_MessageHandle_Metadata(&instance_, &returnValueNative__);
9374 std::unordered_map<std::string, std::string> returnValue__ =
9375 ConvertReturnedProperties(returnValueNative__);
9376 Discord_FreeProperties(returnValueNative__);
9377 return returnValue__;
9379std::string MessageHandle::RawContent()
const
9381 assert(state_ == DiscordObjectState::Owned);
9382 Discord_String returnValueNative__;
9383 Discord_MessageHandle_RawContent(&instance_, &returnValueNative__);
9384 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
9385 returnValueNative__.size);
9386 Discord_Free(returnValueNative__.ptr);
9387 return returnValue__;
9389std::optional<discordpp::UserHandle> MessageHandle::Recipient()
const
9391 assert(state_ == DiscordObjectState::Owned);
9392 bool returnIsNonNull__;
9393 Discord_UserHandle returnValueNative__;
9394 returnIsNonNull__ = Discord_MessageHandle_Recipient(&instance_, &returnValueNative__);
9395 if (!returnIsNonNull__) {
9399 return returnValue__;
9401uint64_t MessageHandle::RecipientId()
const
9403 assert(state_ == DiscordObjectState::Owned);
9404 uint64_t returnValue__;
9405 returnValue__ = Discord_MessageHandle_RecipientId(&instance_);
9406 return returnValue__;
9408bool MessageHandle::SentFromGame()
const
9410 assert(state_ == DiscordObjectState::Owned);
9412 returnValue__ = Discord_MessageHandle_SentFromGame(&instance_);
9413 return returnValue__;
9415uint64_t MessageHandle::SentTimestamp()
const
9417 assert(state_ == DiscordObjectState::Owned);
9418 uint64_t returnValue__;
9419 returnValue__ = Discord_MessageHandle_SentTimestamp(&instance_);
9420 return returnValue__;
9422const AudioDevice AudioDevice::nullobj{{}, DiscordObjectState::Invalid};
9423AudioDevice::~AudioDevice()
9425 if (state_ == DiscordObjectState::Owned) {
9427 state_ = DiscordObjectState::Invalid;
9430AudioDevice::AudioDevice(AudioDevice&& other) noexcept
9431 : instance_(other.instance_)
9432 , state_(other.state_)
9434 other.state_ = DiscordObjectState::Invalid;
9436AudioDevice& AudioDevice::operator=(AudioDevice&& other)
noexcept
9438 if (
this != &other) {
9439 if (state_ == DiscordObjectState::Owned) {
9442 instance_ = other.instance_;
9443 state_ = other.state_;
9444 other.state_ = DiscordObjectState::Invalid;
9448AudioDevice::AudioDevice(
const AudioDevice& arg0)
9453 Discord_AudioDevice_Clone(&instance_, arg0.instance());
9455 state_ = DiscordObjectState::Owned;
9458AudioDevice& AudioDevice::operator=(
const AudioDevice& arg0)
9460 if (
this != &arg0) {
9461 if (state_ == DiscordObjectState::Owned) {
9463 state_ = DiscordObjectState::Invalid;
9465 if (arg0.state_ == DiscordObjectState::Owned) {
9466 Discord_AudioDevice_Clone(&instance_, arg0.instance());
9468 state_ = DiscordObjectState::Owned;
9473AudioDevice::AudioDevice(Discord_AudioDevice instance, DiscordObjectState state)
9474 : instance_(instance)
9478void AudioDevice::Drop()
9480 if (state_ != DiscordObjectState::Owned) {
9483 Discord_AudioDevice_Drop(&instance_);
9484 state_ = DiscordObjectState::Invalid;
9488 assert(state_ == DiscordObjectState::Owned);
9490 returnValue__ = Discord_AudioDevice_Equals(&instance_, rhs.instance());
9491 return returnValue__;
9493std::string AudioDevice::Id()
const
9495 assert(state_ == DiscordObjectState::Owned);
9496 Discord_String returnValueNative__;
9497 Discord_AudioDevice_Id(&instance_, &returnValueNative__);
9498 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
9499 returnValueNative__.size);
9500 Discord_Free(returnValueNative__.ptr);
9501 return returnValue__;
9503void AudioDevice::SetId(std::string Id)
9505 assert(state_ == DiscordObjectState::Owned);
9506 Discord_String Id__str{(uint8_t*)(Id.data()), Id.size()};
9507 Discord_AudioDevice_SetId(&instance_, Id__str);
9509std::string AudioDevice::Name()
const
9511 assert(state_ == DiscordObjectState::Owned);
9512 Discord_String returnValueNative__;
9513 Discord_AudioDevice_Name(&instance_, &returnValueNative__);
9514 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
9515 returnValueNative__.size);
9516 Discord_Free(returnValueNative__.ptr);
9517 return returnValue__;
9519void AudioDevice::SetName(std::string Name)
9521 assert(state_ == DiscordObjectState::Owned);
9522 Discord_String Name__str{(uint8_t*)(
Name.data()),
Name.size()};
9523 Discord_AudioDevice_SetName(&instance_, Name__str);
9525bool AudioDevice::IsDefault()
const
9527 assert(state_ == DiscordObjectState::Owned);
9529 returnValue__ = Discord_AudioDevice_IsDefault(&instance_);
9530 return returnValue__;
9532void AudioDevice::SetIsDefault(
bool IsDefault)
9534 assert(state_ == DiscordObjectState::Owned);
9535 Discord_AudioDevice_SetIsDefault(&instance_, IsDefault);
9537const UserMessageSummary UserMessageSummary::nullobj{{}, DiscordObjectState::Invalid};
9538UserMessageSummary::~UserMessageSummary()
9540 if (state_ == DiscordObjectState::Owned) {
9542 state_ = DiscordObjectState::Invalid;
9545UserMessageSummary::UserMessageSummary(UserMessageSummary&& other) noexcept
9546 : instance_(other.instance_)
9547 , state_(other.state_)
9549 other.state_ = DiscordObjectState::Invalid;
9551UserMessageSummary& UserMessageSummary::operator=(UserMessageSummary&& other)
noexcept
9553 if (
this != &other) {
9554 if (state_ == DiscordObjectState::Owned) {
9557 instance_ = other.instance_;
9558 state_ = other.state_;
9559 other.state_ = DiscordObjectState::Invalid;
9563UserMessageSummary::UserMessageSummary(
const UserMessageSummary& arg0)
9568 Discord_UserMessageSummary_Clone(&instance_, arg0.instance());
9570 state_ = DiscordObjectState::Owned;
9573UserMessageSummary& UserMessageSummary::operator=(
const UserMessageSummary& arg0)
9575 if (
this != &arg0) {
9576 if (state_ == DiscordObjectState::Owned) {
9578 state_ = DiscordObjectState::Invalid;
9580 if (arg0.state_ == DiscordObjectState::Owned) {
9581 Discord_UserMessageSummary_Clone(&instance_, arg0.instance());
9583 state_ = DiscordObjectState::Owned;
9588UserMessageSummary::UserMessageSummary(Discord_UserMessageSummary instance,
9589 DiscordObjectState state)
9590 : instance_(instance)
9594void UserMessageSummary::Drop()
9596 if (state_ != DiscordObjectState::Owned) {
9599 Discord_UserMessageSummary_Drop(&instance_);
9600 state_ = DiscordObjectState::Invalid;
9602uint64_t UserMessageSummary::LastMessageId()
const
9604 assert(state_ == DiscordObjectState::Owned);
9605 uint64_t returnValue__;
9606 returnValue__ = Discord_UserMessageSummary_LastMessageId(&instance_);
9607 return returnValue__;
9609uint64_t UserMessageSummary::UserId()
const
9611 assert(state_ == DiscordObjectState::Owned);
9612 uint64_t returnValue__;
9613 returnValue__ = Discord_UserMessageSummary_UserId(&instance_);
9614 return returnValue__;
9616const ClientCreateOptions ClientCreateOptions::nullobj{{}, DiscordObjectState::Invalid};
9617ClientCreateOptions::~ClientCreateOptions()
9619 if (state_ == DiscordObjectState::Owned) {
9621 state_ = DiscordObjectState::Invalid;
9624ClientCreateOptions::ClientCreateOptions(ClientCreateOptions&& other) noexcept
9625 : instance_(other.instance_)
9626 , state_(other.state_)
9628 other.state_ = DiscordObjectState::Invalid;
9630ClientCreateOptions& ClientCreateOptions::operator=(ClientCreateOptions&& other)
noexcept
9632 if (
this != &other) {
9633 if (state_ == DiscordObjectState::Owned) {
9636 instance_ = other.instance_;
9637 state_ = other.state_;
9638 other.state_ = DiscordObjectState::Invalid;
9642ClientCreateOptions::ClientCreateOptions(
const ClientCreateOptions& arg0)
9647 Discord_ClientCreateOptions_Clone(&instance_, arg0.instance());
9649 state_ = DiscordObjectState::Owned;
9652ClientCreateOptions& ClientCreateOptions::operator=(
const ClientCreateOptions& arg0)
9654 if (
this != &arg0) {
9655 if (state_ == DiscordObjectState::Owned) {
9657 state_ = DiscordObjectState::Invalid;
9659 if (arg0.state_ == DiscordObjectState::Owned) {
9660 Discord_ClientCreateOptions_Clone(&instance_, arg0.instance());
9662 state_ = DiscordObjectState::Owned;
9667ClientCreateOptions::ClientCreateOptions(Discord_ClientCreateOptions instance,
9668 DiscordObjectState state)
9669 : instance_(instance)
9673ClientCreateOptions::ClientCreateOptions()
9675 assert(state_ == DiscordObjectState::Invalid);
9676 Discord_ClientCreateOptions_Init(&instance_);
9677 state_ = DiscordObjectState::Owned;
9679void ClientCreateOptions::Drop()
9681 if (state_ != DiscordObjectState::Owned) {
9684 Discord_ClientCreateOptions_Drop(&instance_);
9685 state_ = DiscordObjectState::Invalid;
9687std::string ClientCreateOptions::WebBase()
const
9689 assert(state_ == DiscordObjectState::Owned);
9690 Discord_String returnValueNative__;
9691 Discord_ClientCreateOptions_WebBase(&instance_, &returnValueNative__);
9692 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
9693 returnValueNative__.size);
9694 Discord_Free(returnValueNative__.ptr);
9695 return returnValue__;
9697void ClientCreateOptions::SetWebBase(std::string WebBase)
9699 assert(state_ == DiscordObjectState::Owned);
9700 Discord_String WebBase__str{(uint8_t*)(WebBase.data()), WebBase.size()};
9701 Discord_ClientCreateOptions_SetWebBase(&instance_, WebBase__str);
9703std::string ClientCreateOptions::ApiBase()
const
9705 assert(state_ == DiscordObjectState::Owned);
9706 Discord_String returnValueNative__;
9707 Discord_ClientCreateOptions_ApiBase(&instance_, &returnValueNative__);
9708 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
9709 returnValueNative__.size);
9710 Discord_Free(returnValueNative__.ptr);
9711 return returnValue__;
9713void ClientCreateOptions::SetApiBase(std::string ApiBase)
9715 assert(state_ == DiscordObjectState::Owned);
9716 Discord_String ApiBase__str{(uint8_t*)(ApiBase.data()), ApiBase.size()};
9717 Discord_ClientCreateOptions_SetApiBase(&instance_, ApiBase__str);
9721 assert(state_ == DiscordObjectState::Owned);
9722 Discord_AudioSystem returnValue__;
9723 returnValue__ = Discord_ClientCreateOptions_ExperimentalAudioSystem(&instance_);
9728 assert(state_ == DiscordObjectState::Owned);
9729 Discord_ClientCreateOptions_SetExperimentalAudioSystem(
9730 &instance_,
static_cast<Discord_AudioSystem
>(ExperimentalAudioSystem));
9732bool ClientCreateOptions::ExperimentalAndroidPreventCommsForBluetooth()
const
9734 assert(state_ == DiscordObjectState::Owned);
9737 Discord_ClientCreateOptions_ExperimentalAndroidPreventCommsForBluetooth(&instance_);
9738 return returnValue__;
9740void ClientCreateOptions::SetExperimentalAndroidPreventCommsForBluetooth(
9741 bool ExperimentalAndroidPreventCommsForBluetooth)
9743 assert(state_ == DiscordObjectState::Owned);
9744 Discord_ClientCreateOptions_SetExperimentalAndroidPreventCommsForBluetooth(
9745 &instance_, ExperimentalAndroidPreventCommsForBluetooth);
9747const Client Client::nullobj{{}, DiscordObjectState::Invalid};
9750 if (state_ == DiscordObjectState::Owned) {
9752 state_ = DiscordObjectState::Invalid;
9755Client::Client(Client&& other) noexcept
9756 : instance_(other.instance_)
9757 , state_(other.state_)
9759 other.state_ = DiscordObjectState::Invalid;
9761Client& Client::operator=(Client&& other)
noexcept
9763 if (
this != &other) {
9764 if (state_ == DiscordObjectState::Owned) {
9767 instance_ = other.instance_;
9768 state_ = other.state_;
9769 other.state_ = DiscordObjectState::Invalid;
9773Client::Client(Discord_Client instance, DiscordObjectState state)
9774 : instance_(instance)
9780 assert(state_ == DiscordObjectState::Invalid);
9781 Discord_Client_Init(&instance_);
9782 state_ = DiscordObjectState::Owned;
9784Client::Client(std::string apiBase, std::string webBase)
9786 assert(state_ == DiscordObjectState::Invalid);
9787 Discord_String apiBase__str{(uint8_t*)(apiBase.data()), apiBase.size()};
9788 Discord_String webBase__str{(uint8_t*)(webBase.data()), webBase.size()};
9789 Discord_Client_InitWithBases(&instance_, apiBase__str, webBase__str);
9790 state_ = DiscordObjectState::Owned;
9794 assert(state_ == DiscordObjectState::Invalid);
9795 Discord_Client_InitWithOptions(&instance_, options.instance());
9796 state_ = DiscordObjectState::Owned;
9800 if (state_ != DiscordObjectState::Owned) {
9803 Discord_Client_Drop(&instance_);
9804 state_ = DiscordObjectState::Invalid;
9808 Discord_String returnValueNative__;
9809 Discord_Client_ErrorToString(
static_cast<Discord_Client_Error
>(type), &returnValueNative__);
9810 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
9811 returnValueNative__.size);
9812 Discord_Free(returnValueNative__.ptr);
9813 return returnValue__;
9815uint64_t Client::GetApplicationId()
9817 assert(state_ == DiscordObjectState::Owned);
9818 uint64_t returnValue__;
9819 returnValue__ = Discord_Client_GetApplicationId(&instance_);
9820 return returnValue__;
9822std::string Client::GetDefaultAudioDeviceId()
9824 Discord_String returnValueNative__;
9825 Discord_Client_GetDefaultAudioDeviceId(&returnValueNative__);
9826 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
9827 returnValueNative__.size);
9828 Discord_Free(returnValueNative__.ptr);
9829 return returnValue__;
9831std::string Client::GetDefaultCommunicationScopes()
9833 Discord_String returnValueNative__;
9834 Discord_Client_GetDefaultCommunicationScopes(&returnValueNative__);
9835 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
9836 returnValueNative__.size);
9837 Discord_Free(returnValueNative__.ptr);
9838 return returnValue__;
9840std::string Client::GetDefaultPresenceScopes()
9842 Discord_String returnValueNative__;
9843 Discord_Client_GetDefaultPresenceScopes(&returnValueNative__);
9844 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
9845 returnValueNative__.size);
9846 Discord_Free(returnValueNative__.ptr);
9847 return returnValue__;
9849std::string Client::GetVersionHash()
9851 Discord_String returnValueNative__;
9852 Discord_Client_GetVersionHash(&returnValueNative__);
9853 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
9854 returnValueNative__.size);
9855 Discord_Free(returnValueNative__.ptr);
9856 return returnValue__;
9858int32_t Client::GetVersionMajor()
9860 int32_t returnValue__;
9861 returnValue__ = Discord_Client_GetVersionMajor();
9862 return returnValue__;
9864int32_t Client::GetVersionMinor()
9866 int32_t returnValue__;
9867 returnValue__ = Discord_Client_GetVersionMinor();
9868 return returnValue__;
9870int32_t Client::GetVersionPatch()
9872 int32_t returnValue__;
9873 returnValue__ = Discord_Client_GetVersionPatch();
9874 return returnValue__;
9876void Client::SetHttpRequestTimeout(int32_t httpTimeoutInMilliseconds)
9878 assert(state_ == DiscordObjectState::Owned);
9879 Discord_Client_SetHttpRequestTimeout(&instance_, httpTimeoutInMilliseconds);
9883 Discord_String returnValueNative__;
9884 Discord_Client_StatusToString(
static_cast<Discord_Client_Status
>(type), &returnValueNative__);
9885 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
9886 returnValueNative__.size);
9887 Discord_Free(returnValueNative__.ptr);
9888 return returnValue__;
9892 Discord_String returnValueNative__;
9893 Discord_Client_ThreadToString(
static_cast<Discord_Client_Thread
>(type), &returnValueNative__);
9894 std::string returnValue__(
reinterpret_cast<char*
>(returnValueNative__.ptr),
9895 returnValueNative__.size);
9896 Discord_Free(returnValueNative__.ptr);
9897 return returnValue__;
9901 assert(state_ == DiscordObjectState::Owned);
9902 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
9903 auto callback__userData =
new Tcallback__UserData(callback);
9904 Discord_Client_EndCallCallback callback__native = [](
void* userData__) {
9905 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
9906 userData__typed->delegate();
9908 Discord_Client_EndCall(
9909 &instance_, channelId, callback__native, Tcallback__UserData::Free, callback__userData);
9913 assert(state_ == DiscordObjectState::Owned);
9914 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
9915 auto callback__userData =
new Tcallback__UserData(callback);
9916 Discord_Client_EndCallsCallback callback__native = [](
void* userData__) {
9917 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
9918 userData__typed->delegate();
9920 Discord_Client_EndCalls(
9921 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
9925 assert(state_ == DiscordObjectState::Owned);
9926 bool returnIsNonNull__;
9927 Discord_Call returnValueNative__{};
9928 returnIsNonNull__ = Discord_Client_GetCall(&instance_, channelId, &returnValueNative__);
9930 returnValueNative__,
9931 returnIsNonNull__ ? DiscordObjectState::Owned : DiscordObjectState::Invalid);
9932 return returnValue__;
9934std::vector<discordpp::Call> Client::GetCalls()
9936 assert(state_ == DiscordObjectState::Owned);
9937 Discord_CallSpan returnValueNative__;
9938 Discord_Client_GetCalls(&instance_, &returnValueNative__);
9939 std::vector<discordpp::Call> returnValue__;
9940 returnValue__.reserve(returnValueNative__.size);
9941 for (
size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
9942 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
9944 Discord_Free(returnValueNative__.ptr);
9945 return returnValue__;
9949 assert(state_ == DiscordObjectState::Owned);
9950 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
9951 auto cb__userData =
new Tcb__UserData(cb);
9952 Discord_Client_GetCurrentInputDeviceCallback cb__native = [](
auto device,
void* userData__) {
9953 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
9955 userData__typed->delegate(std::move(device__obj));
9957 Discord_Client_GetCurrentInputDevice(&instance_, cb__native, Tcb__UserData::Free, cb__userData);
9961 assert(state_ == DiscordObjectState::Owned);
9962 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
9963 auto cb__userData =
new Tcb__UserData(cb);
9964 Discord_Client_GetCurrentOutputDeviceCallback cb__native = [](
auto device,
void* userData__) {
9965 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
9967 userData__typed->delegate(std::move(device__obj));
9969 Discord_Client_GetCurrentOutputDevice(
9970 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
9974 assert(state_ == DiscordObjectState::Owned);
9975 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
9976 auto cb__userData =
new Tcb__UserData(cb);
9977 Discord_Client_GetInputDevicesCallback cb__native = [](
auto devices,
void* userData__) {
9978 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
9979 std::vector<discordpp::AudioDevice> devices__vec;
9980 devices__vec.reserve(devices.size);
9981 for (
size_t i__ = 0; i__ < devices.size; ++i__) {
9982 devices__vec.emplace_back(devices.ptr[i__], DiscordObjectState::Owned);
9984 Discord_Free(devices.ptr);
9985 userData__typed->delegate(std::move(devices__vec));
9987 Discord_Client_GetInputDevices(&instance_, cb__native, Tcb__UserData::Free, cb__userData);
9989float Client::GetInputVolume()
9991 assert(state_ == DiscordObjectState::Owned);
9992 float returnValue__;
9993 returnValue__ = Discord_Client_GetInputVolume(&instance_);
9994 return returnValue__;
9998 assert(state_ == DiscordObjectState::Owned);
9999 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
10000 auto cb__userData =
new Tcb__UserData(cb);
10001 Discord_Client_GetOutputDevicesCallback cb__native = [](
auto devices,
void* userData__) {
10002 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
10003 std::vector<discordpp::AudioDevice> devices__vec;
10004 devices__vec.reserve(devices.size);
10005 for (
size_t i__ = 0; i__ < devices.size; ++i__) {
10006 devices__vec.emplace_back(devices.ptr[i__], DiscordObjectState::Owned);
10008 Discord_Free(devices.ptr);
10009 userData__typed->delegate(std::move(devices__vec));
10011 Discord_Client_GetOutputDevices(&instance_, cb__native, Tcb__UserData::Free, cb__userData);
10013float Client::GetOutputVolume()
10015 assert(state_ == DiscordObjectState::Owned);
10016 float returnValue__;
10017 returnValue__ = Discord_Client_GetOutputVolume(&instance_);
10018 return returnValue__;
10020bool Client::GetSelfDeafAll()
const
10022 assert(state_ == DiscordObjectState::Owned);
10023 bool returnValue__;
10024 returnValue__ = Discord_Client_GetSelfDeafAll(&instance_);
10025 return returnValue__;
10027bool Client::GetSelfMuteAll()
const
10029 assert(state_ == DiscordObjectState::Owned);
10030 bool returnValue__;
10031 returnValue__ = Discord_Client_GetSelfMuteAll(&instance_);
10032 return returnValue__;
10034void Client::SetAecDump(
bool on)
10036 assert(state_ == DiscordObjectState::Owned);
10037 Discord_Client_SetAecDump(&instance_, on);
10039void Client::SetAutomaticGainControl(
bool on)
10041 assert(state_ == DiscordObjectState::Owned);
10042 Discord_Client_SetAutomaticGainControl(&instance_, on);
10046 assert(state_ == DiscordObjectState::Owned);
10047 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
10048 auto callback__userData =
new Tcallback__UserData(callback);
10049 Discord_Client_DeviceChangeCallback callback__native =
10050 [](
auto inputDevices,
auto outputDevices,
void* userData__) {
10051 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
10052 std::vector<discordpp::AudioDevice> inputDevices__vec;
10053 inputDevices__vec.reserve(inputDevices.size);
10054 for (
size_t i__ = 0; i__ < inputDevices.size; ++i__) {
10055 inputDevices__vec.emplace_back(inputDevices.ptr[i__], DiscordObjectState::Owned);
10057 Discord_Free(inputDevices.ptr);
10058 std::vector<discordpp::AudioDevice> outputDevices__vec;
10059 outputDevices__vec.reserve(outputDevices.size);
10060 for (
size_t i__ = 0; i__ < outputDevices.size; ++i__) {
10061 outputDevices__vec.emplace_back(outputDevices.ptr[i__], DiscordObjectState::Owned);
10063 Discord_Free(outputDevices.ptr);
10064 userData__typed->delegate(std::move(inputDevices__vec), std::move(outputDevices__vec));
10066 Discord_Client_SetDeviceChangeCallback(
10067 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
10069void Client::SetEchoCancellation(
bool on)
10071 assert(state_ == DiscordObjectState::Owned);
10072 Discord_Client_SetEchoCancellation(&instance_, on);
10074void Client::SetEngineManagedAudioSession(
bool isEngineManaged)
10076 assert(state_ == DiscordObjectState::Owned);
10077 Discord_Client_SetEngineManagedAudioSession(&instance_, isEngineManaged);
10081 assert(state_ == DiscordObjectState::Owned);
10082 Discord_String deviceId__str{(uint8_t*)(deviceId.data()), deviceId.size()};
10083 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
10084 auto cb__userData =
new Tcb__UserData(cb);
10085 Discord_Client_SetInputDeviceCallback cb__native = [](
auto result,
void* userData__) {
10086 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
10088 userData__typed->delegate(std::move(result__obj));
10090 Discord_Client_SetInputDevice(
10091 &instance_, deviceId__str, cb__native, Tcb__UserData::Free, cb__userData);
10093void Client::SetInputVolume(
float inputVolume)
10095 assert(state_ == DiscordObjectState::Owned);
10096 Discord_Client_SetInputVolume(&instance_, inputVolume);
10100 assert(state_ == DiscordObjectState::Owned);
10101 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
10102 auto callback__userData =
new Tcallback__UserData(callback);
10103 Discord_Client_NoAudioInputCallback callback__native = [](
auto inputDetected,
10104 void* userData__) {
10105 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
10106 userData__typed->delegate(inputDetected);
10108 Discord_Client_SetNoAudioInputCallback(
10109 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
10111void Client::SetNoAudioInputThreshold(
float dBFSThreshold)
10113 assert(state_ == DiscordObjectState::Owned);
10114 Discord_Client_SetNoAudioInputThreshold(&instance_, dBFSThreshold);
10116void Client::SetNoiseSuppression(
bool on)
10118 assert(state_ == DiscordObjectState::Owned);
10119 Discord_Client_SetNoiseSuppression(&instance_, on);
10121void Client::SetOpusHardwareCoding(
bool encode,
bool decode)
10123 assert(state_ == DiscordObjectState::Owned);
10124 Discord_Client_SetOpusHardwareCoding(&instance_, encode, decode);
10128 assert(state_ == DiscordObjectState::Owned);
10129 Discord_String deviceId__str{(uint8_t*)(deviceId.data()), deviceId.size()};
10130 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
10131 auto cb__userData =
new Tcb__UserData(cb);
10132 Discord_Client_SetOutputDeviceCallback cb__native = [](
auto result,
void* userData__) {
10133 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
10135 userData__typed->delegate(std::move(result__obj));
10137 Discord_Client_SetOutputDevice(
10138 &instance_, deviceId__str, cb__native, Tcb__UserData::Free, cb__userData);
10140void Client::SetOutputVolume(
float outputVolume)
10142 assert(state_ == DiscordObjectState::Owned);
10143 Discord_Client_SetOutputVolume(&instance_, outputVolume);
10145void Client::SetSelfDeafAll(
bool deaf)
10147 assert(state_ == DiscordObjectState::Owned);
10148 Discord_Client_SetSelfDeafAll(&instance_, deaf);
10150void Client::SetSelfMuteAll(
bool mute)
10152 assert(state_ == DiscordObjectState::Owned);
10153 Discord_Client_SetSelfMuteAll(&instance_, mute);
10155bool Client::SetSpeakerMode(
bool speakerMode)
10157 assert(state_ == DiscordObjectState::Owned);
10158 bool returnValue__;
10159 returnValue__ = Discord_Client_SetSpeakerMode(&instance_, speakerMode);
10160 return returnValue__;
10164 assert(state_ == DiscordObjectState::Owned);
10165 Discord_Client_SetThreadPriority(
10166 &instance_,
static_cast<Discord_Client_Thread
>(thread), priority);
10168void Client::SetVoiceParticipantChangedCallback(
10171 assert(state_ == DiscordObjectState::Owned);
10172 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
10173 auto cb__userData =
new Tcb__UserData(cb);
10174 Discord_Client_VoiceParticipantChangedCallback cb__native =
10175 [](
auto lobbyId,
auto memberId,
auto added,
void* userData__) {
10176 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
10177 userData__typed->delegate(lobbyId, memberId, added);
10179 Discord_Client_SetVoiceParticipantChangedCallback(
10180 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10182bool Client::ShowAudioRoutePicker()
10184 assert(state_ == DiscordObjectState::Owned);
10185 bool returnValue__;
10186 returnValue__ = Discord_Client_ShowAudioRoutePicker(&instance_);
10187 return returnValue__;
10191 assert(state_ == DiscordObjectState::Owned);
10192 bool returnIsNonNull__;
10193 Discord_Call returnValueNative__{};
10194 returnIsNonNull__ = Discord_Client_StartCall(&instance_, channelId, &returnValueNative__);
10196 returnValueNative__,
10197 returnIsNonNull__ ? DiscordObjectState::Owned : DiscordObjectState::Invalid);
10198 return returnValue__;
10205 assert(state_ == DiscordObjectState::Owned);
10206 bool returnIsNonNull__;
10207 Discord_Call returnValueNative__{};
10208 using TreceivedCb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(receivedCb)>>;
10209 auto receivedCb__userData =
new TreceivedCb__UserData(receivedCb);
10210 Discord_Client_UserAudioReceivedCallback receivedCb__native = [](
auto userId,
10212 auto samplesPerChannel,
10215 auto outShouldMute,
10216 void* userData__) {
10217 auto userData__typed =
static_cast<TreceivedCb__UserData*
>(userData__);
10218 userData__typed->delegate(
10219 userId, data, samplesPerChannel, sampleRate, channels, *outShouldMute);
10221 using TcapturedCb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(capturedCb)>>;
10222 auto capturedCb__userData =
new TcapturedCb__UserData(capturedCb);
10223 Discord_Client_UserAudioCapturedCallback capturedCb__native =
10224 [](
auto data,
auto samplesPerChannel,
auto sampleRate,
auto channels,
void* userData__) {
10225 auto userData__typed =
static_cast<TcapturedCb__UserData*
>(userData__);
10226 userData__typed->delegate(data, samplesPerChannel, sampleRate, channels);
10228 returnIsNonNull__ = Discord_Client_StartCallWithAudioCallbacks(&instance_,
10230 receivedCb__native,
10231 TreceivedCb__UserData::Free,
10232 receivedCb__userData,
10233 capturedCb__native,
10234 TcapturedCb__UserData::Free,
10235 capturedCb__userData,
10236 &returnValueNative__);
10238 returnValueNative__,
10239 returnIsNonNull__ ? DiscordObjectState::Owned : DiscordObjectState::Invalid);
10240 return returnValue__;
10242void Client::AbortAuthorize()
10244 assert(state_ == DiscordObjectState::Owned);
10245 Discord_Client_AbortAuthorize(&instance_);
10247void Client::AbortGetTokenFromDevice()
10249 assert(state_ == DiscordObjectState::Owned);
10250 Discord_Client_AbortGetTokenFromDevice(&instance_);
10255 assert(state_ == DiscordObjectState::Owned);
10256 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
10257 auto callback__userData =
new Tcallback__UserData(callback);
10258 Discord_Client_AuthorizationCallback callback__native =
10259 [](
auto result,
auto code,
auto redirectUri,
void* userData__) {
10260 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
10262 std::string code__str(
reinterpret_cast<char*
>(code.ptr), code.size);
10263 std::string redirectUri__str(
reinterpret_cast<char*
>(redirectUri.ptr), redirectUri.size);
10264 userData__typed->delegate(
10265 std::move(result__obj), std::move(code__str), std::move(redirectUri__str));
10266 Discord_Free(redirectUri.ptr);
10267 Discord_Free(code.ptr);
10269 Discord_Client_Authorize(
10270 &instance_, args.instance(), callback__native, Tcallback__UserData::Free, callback__userData);
10272void Client::CloseAuthorizeDeviceScreen()
10274 assert(state_ == DiscordObjectState::Owned);
10275 Discord_Client_CloseAuthorizeDeviceScreen(&instance_);
10279 assert(state_ == DiscordObjectState::Owned);
10280 Discord_AuthorizationCodeVerifier returnValueNative__{};
10281 Discord_Client_CreateAuthorizationCodeVerifier(&instance_, &returnValueNative__);
10283 DiscordObjectState::Owned);
10284 return returnValue__;
10286void Client::ExchangeChildToken(std::string
const& parentApplicationToken,
10287 uint64_t childApplicationId,
10290 assert(state_ == DiscordObjectState::Owned);
10291 Discord_String parentApplicationToken__str{(uint8_t*)(parentApplicationToken.data()),
10292 parentApplicationToken.size()};
10293 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
10294 auto callback__userData =
new Tcallback__UserData(callback);
10295 Discord_Client_ExchangeChildTokenCallback callback__native = [](
auto result,
10300 void* userData__) {
10301 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
10303 std::string accessToken__str(
reinterpret_cast<char*
>(accessToken.ptr), accessToken.size);
10304 std::string scopes__str(
reinterpret_cast<char*
>(scopes.ptr), scopes.size);
10305 userData__typed->delegate(std::move(result__obj),
10306 std::move(accessToken__str),
10309 std::move(scopes__str));
10310 Discord_Free(scopes.ptr);
10311 Discord_Free(accessToken.ptr);
10313 Discord_Client_ExchangeChildToken(&instance_,
10314 parentApplicationToken__str,
10315 childApplicationId,
10317 Tcallback__UserData::Free,
10318 callback__userData);
10321 std::string
const& token,
10324 assert(state_ == DiscordObjectState::Owned);
10325 Discord_String token__str{(uint8_t*)(token.data()), token.size()};
10326 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
10327 auto callback__userData =
new Tcallback__UserData(callback);
10328 Discord_Client_FetchCurrentUserCallback callback__native =
10329 [](
auto result,
auto id,
auto name,
void* userData__) {
10330 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
10332 std::string name__str(
reinterpret_cast<char*
>(name.ptr), name.size);
10333 userData__typed->delegate(std::move(result__obj),
id, std::move(name__str));
10334 Discord_Free(name.ptr);
10336 Discord_Client_FetchCurrentUser(&instance_,
10337 static_cast<Discord_AuthorizationTokenType
>(tokenType),
10340 Tcallback__UserData::Free,
10341 callback__userData);
10343void Client::GetProvisionalToken(uint64_t applicationId,
10345 std::string
const& externalAuthToken,
10348 assert(state_ == DiscordObjectState::Owned);
10349 Discord_String externalAuthToken__str{(uint8_t*)(externalAuthToken.data()),
10350 externalAuthToken.size()};
10351 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
10352 auto callback__userData =
new Tcallback__UserData(callback);
10353 Discord_Client_TokenExchangeCallback callback__native = [](
auto result,
10359 void* userData__) {
10360 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
10362 std::string accessToken__str(
reinterpret_cast<char*
>(accessToken.ptr), accessToken.size);
10363 std::string refreshToken__str(
reinterpret_cast<char*
>(refreshToken.ptr), refreshToken.size);
10364 std::string scopes__str(
reinterpret_cast<char*
>(scopes.ptr), scopes.size);
10365 userData__typed->delegate(std::move(result__obj),
10366 std::move(accessToken__str),
10367 std::move(refreshToken__str),
10370 std::move(scopes__str));
10371 Discord_Free(scopes.ptr);
10372 Discord_Free(refreshToken.ptr);
10373 Discord_Free(accessToken.ptr);
10375 Discord_Client_GetProvisionalToken(
10378 static_cast<Discord_AuthenticationExternalAuthType
>(externalAuthType),
10379 externalAuthToken__str,
10381 Tcallback__UserData::Free,
10382 callback__userData);
10384void Client::GetToken(uint64_t applicationId,
10385 std::string
const& code,
10386 std::string
const& codeVerifier,
10387 std::string
const& redirectUri,
10390 assert(state_ == DiscordObjectState::Owned);
10391 Discord_String code__str{(uint8_t*)(code.data()), code.size()};
10392 Discord_String codeVerifier__str{(uint8_t*)(codeVerifier.data()), codeVerifier.size()};
10393 Discord_String redirectUri__str{(uint8_t*)(redirectUri.data()), redirectUri.size()};
10394 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
10395 auto callback__userData =
new Tcallback__UserData(callback);
10396 Discord_Client_TokenExchangeCallback callback__native = [](
auto result,
10402 void* userData__) {
10403 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
10405 std::string accessToken__str(
reinterpret_cast<char*
>(accessToken.ptr), accessToken.size);
10406 std::string refreshToken__str(
reinterpret_cast<char*
>(refreshToken.ptr), refreshToken.size);
10407 std::string scopes__str(
reinterpret_cast<char*
>(scopes.ptr), scopes.size);
10408 userData__typed->delegate(std::move(result__obj),
10409 std::move(accessToken__str),
10410 std::move(refreshToken__str),
10413 std::move(scopes__str));
10414 Discord_Free(scopes.ptr);
10415 Discord_Free(refreshToken.ptr);
10416 Discord_Free(accessToken.ptr);
10418 Discord_Client_GetToken(&instance_,
10424 Tcallback__UserData::Free,
10425 callback__userData);
10430 assert(state_ == DiscordObjectState::Owned);
10431 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
10432 auto callback__userData =
new Tcallback__UserData(callback);
10433 Discord_Client_TokenExchangeCallback callback__native = [](
auto result,
10439 void* userData__) {
10440 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
10442 std::string accessToken__str(
reinterpret_cast<char*
>(accessToken.ptr), accessToken.size);
10443 std::string refreshToken__str(
reinterpret_cast<char*
>(refreshToken.ptr), refreshToken.size);
10444 std::string scopes__str(
reinterpret_cast<char*
>(scopes.ptr), scopes.size);
10445 userData__typed->delegate(std::move(result__obj),
10446 std::move(accessToken__str),
10447 std::move(refreshToken__str),
10450 std::move(scopes__str));
10451 Discord_Free(scopes.ptr);
10452 Discord_Free(refreshToken.ptr);
10453 Discord_Free(accessToken.ptr);
10455 Discord_Client_GetTokenFromDevice(
10456 &instance_, args.instance(), callback__native, Tcallback__UserData::Free, callback__userData);
10458void Client::GetTokenFromDeviceProvisionalMerge(
10461 std::string
const& externalAuthToken,
10464 assert(state_ == DiscordObjectState::Owned);
10465 Discord_String externalAuthToken__str{(uint8_t*)(externalAuthToken.data()),
10466 externalAuthToken.size()};
10467 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
10468 auto callback__userData =
new Tcallback__UserData(callback);
10469 Discord_Client_TokenExchangeCallback callback__native = [](
auto result,
10475 void* userData__) {
10476 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
10478 std::string accessToken__str(
reinterpret_cast<char*
>(accessToken.ptr), accessToken.size);
10479 std::string refreshToken__str(
reinterpret_cast<char*
>(refreshToken.ptr), refreshToken.size);
10480 std::string scopes__str(
reinterpret_cast<char*
>(scopes.ptr), scopes.size);
10481 userData__typed->delegate(std::move(result__obj),
10482 std::move(accessToken__str),
10483 std::move(refreshToken__str),
10486 std::move(scopes__str));
10487 Discord_Free(scopes.ptr);
10488 Discord_Free(refreshToken.ptr);
10489 Discord_Free(accessToken.ptr);
10491 Discord_Client_GetTokenFromDeviceProvisionalMerge(
10494 static_cast<Discord_AuthenticationExternalAuthType
>(externalAuthType),
10495 externalAuthToken__str,
10497 Tcallback__UserData::Free,
10498 callback__userData);
10500void Client::GetTokenFromProvisionalMerge(
10501 uint64_t applicationId,
10502 std::string
const& code,
10503 std::string
const& codeVerifier,
10504 std::string
const& redirectUri,
10506 std::string
const& externalAuthToken,
10509 assert(state_ == DiscordObjectState::Owned);
10510 Discord_String code__str{(uint8_t*)(code.data()), code.size()};
10511 Discord_String codeVerifier__str{(uint8_t*)(codeVerifier.data()), codeVerifier.size()};
10512 Discord_String redirectUri__str{(uint8_t*)(redirectUri.data()), redirectUri.size()};
10513 Discord_String externalAuthToken__str{(uint8_t*)(externalAuthToken.data()),
10514 externalAuthToken.size()};
10515 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
10516 auto callback__userData =
new Tcallback__UserData(callback);
10517 Discord_Client_TokenExchangeCallback callback__native = [](
auto result,
10523 void* userData__) {
10524 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
10526 std::string accessToken__str(
reinterpret_cast<char*
>(accessToken.ptr), accessToken.size);
10527 std::string refreshToken__str(
reinterpret_cast<char*
>(refreshToken.ptr), refreshToken.size);
10528 std::string scopes__str(
reinterpret_cast<char*
>(scopes.ptr), scopes.size);
10529 userData__typed->delegate(std::move(result__obj),
10530 std::move(accessToken__str),
10531 std::move(refreshToken__str),
10534 std::move(scopes__str));
10535 Discord_Free(scopes.ptr);
10536 Discord_Free(refreshToken.ptr);
10537 Discord_Free(accessToken.ptr);
10539 Discord_Client_GetTokenFromProvisionalMerge(
10545 static_cast<Discord_AuthenticationExternalAuthType
>(externalAuthType),
10546 externalAuthToken__str,
10548 Tcallback__UserData::Free,
10549 callback__userData);
10551bool Client::IsAuthenticated()
10553 assert(state_ == DiscordObjectState::Owned);
10554 bool returnValue__;
10555 returnValue__ = Discord_Client_IsAuthenticated(&instance_);
10556 return returnValue__;
10558void Client::OpenAuthorizeDeviceScreen(uint64_t clientId, std::string
const& userCode)
10560 assert(state_ == DiscordObjectState::Owned);
10561 Discord_String userCode__str{(uint8_t*)(userCode.data()), userCode.size()};
10562 Discord_Client_OpenAuthorizeDeviceScreen(&instance_, clientId, userCode__str);
10564void Client::ProvisionalUserMergeCompleted(
bool success)
10566 assert(state_ == DiscordObjectState::Owned);
10567 Discord_Client_ProvisionalUserMergeCompleted(&instance_, success);
10569void Client::RefreshToken(uint64_t applicationId,
10570 std::string
const& refreshToken,
10573 assert(state_ == DiscordObjectState::Owned);
10574 Discord_String refreshToken__str{(uint8_t*)(refreshToken.data()), refreshToken.size()};
10575 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
10576 auto callback__userData =
new Tcallback__UserData(callback);
10577 Discord_Client_TokenExchangeCallback callback__native = [](
auto result,
10583 void* userData__) {
10584 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
10586 std::string accessToken__str(
reinterpret_cast<char*
>(accessToken.ptr), accessToken.size);
10587 std::string refreshToken__str(
reinterpret_cast<char*
>(refreshToken.ptr), refreshToken.size);
10588 std::string scopes__str(
reinterpret_cast<char*
>(scopes.ptr), scopes.size);
10589 userData__typed->delegate(std::move(result__obj),
10590 std::move(accessToken__str),
10591 std::move(refreshToken__str),
10594 std::move(scopes__str));
10595 Discord_Free(scopes.ptr);
10596 Discord_Free(refreshToken.ptr);
10597 Discord_Free(accessToken.ptr);
10599 Discord_Client_RefreshToken(&instance_,
10603 Tcallback__UserData::Free,
10604 callback__userData);
10606void Client::RevokeToken(uint64_t applicationId,
10607 std::string
const& token,
10610 assert(state_ == DiscordObjectState::Owned);
10611 Discord_String token__str{(uint8_t*)(token.data()), token.size()};
10612 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
10613 auto callback__userData =
new Tcallback__UserData(callback);
10614 Discord_Client_RevokeTokenCallback callback__native = [](
auto result,
void* userData__) {
10615 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
10617 userData__typed->delegate(std::move(result__obj));
10619 Discord_Client_RevokeToken(&instance_,
10623 Tcallback__UserData::Free,
10624 callback__userData);
10626void Client::SetAuthorizeDeviceScreenClosedCallback(
10629 assert(state_ == DiscordObjectState::Owned);
10630 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
10631 auto cb__userData =
new Tcb__UserData(cb);
10632 Discord_Client_AuthorizeDeviceScreenClosedCallback cb__native = [](
void* userData__) {
10633 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
10634 userData__typed->delegate();
10636 Discord_Client_SetAuthorizeDeviceScreenClosedCallback(
10637 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10639void Client::SetGameWindowPid(int32_t pid)
10641 assert(state_ == DiscordObjectState::Owned);
10642 Discord_Client_SetGameWindowPid(&instance_, pid);
10646 assert(state_ == DiscordObjectState::Owned);
10647 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
10648 auto callback__userData =
new Tcallback__UserData(callback);
10649 Discord_Client_TokenExpirationCallback callback__native = [](
void* userData__) {
10650 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
10651 userData__typed->delegate();
10653 Discord_Client_SetTokenExpirationCallback(
10654 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
10656void Client::UnmergeIntoProvisionalAccount(
10657 uint64_t applicationId,
10659 std::string
const& externalAuthToken,
10662 assert(state_ == DiscordObjectState::Owned);
10663 Discord_String externalAuthToken__str{(uint8_t*)(externalAuthToken.data()),
10664 externalAuthToken.size()};
10665 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
10666 auto callback__userData =
new Tcallback__UserData(callback);
10667 Discord_Client_UnmergeIntoProvisionalAccountCallback callback__native = [](
auto result,
10668 void* userData__) {
10669 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
10671 userData__typed->delegate(std::move(result__obj));
10673 Discord_Client_UnmergeIntoProvisionalAccount(
10676 static_cast<Discord_AuthenticationExternalAuthType
>(externalAuthType),
10677 externalAuthToken__str,
10679 Tcallback__UserData::Free,
10680 callback__userData);
10682void Client::UpdateProvisionalAccountDisplayName(
10683 std::string
const& name,
10686 assert(state_ == DiscordObjectState::Owned);
10687 Discord_String name__str{(uint8_t*)(name.data()), name.size()};
10688 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
10689 auto callback__userData =
new Tcallback__UserData(callback);
10690 Discord_Client_UpdateProvisionalAccountDisplayNameCallback callback__native =
10691 [](
auto result,
void* userData__) {
10692 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
10694 userData__typed->delegate(std::move(result__obj));
10696 Discord_Client_UpdateProvisionalAccountDisplayName(
10697 &instance_, name__str, callback__native, Tcallback__UserData::Free, callback__userData);
10703 assert(state_ == DiscordObjectState::Owned);
10704 Discord_String token__str{(uint8_t*)(token.data()), token.size()};
10705 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
10706 auto callback__userData =
new Tcallback__UserData(callback);
10707 Discord_Client_UpdateTokenCallback callback__native = [](
auto result,
void* userData__) {
10708 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
10710 userData__typed->delegate(std::move(result__obj));
10712 Discord_Client_UpdateToken(&instance_,
10713 static_cast<Discord_AuthorizationTokenType
>(tokenType),
10716 Tcallback__UserData::Free,
10717 callback__userData);
10719bool Client::CanOpenMessageInDiscord(uint64_t messageId)
10721 assert(state_ == DiscordObjectState::Owned);
10722 bool returnValue__;
10723 returnValue__ = Discord_Client_CanOpenMessageInDiscord(&instance_, messageId);
10724 return returnValue__;
10726void Client::DeleteUserMessage(uint64_t recipientId,
10727 uint64_t messageId,
10730 assert(state_ == DiscordObjectState::Owned);
10731 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
10732 auto cb__userData =
new Tcb__UserData(cb);
10733 Discord_Client_DeleteUserMessageCallback cb__native = [](
auto result,
void* userData__) {
10734 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
10736 userData__typed->delegate(std::move(result__obj));
10738 Discord_Client_DeleteUserMessage(
10739 &instance_, recipientId, messageId, cb__native, Tcb__UserData::Free, cb__userData);
10741void Client::EditUserMessage(uint64_t recipientId,
10742 uint64_t messageId,
10743 std::string
const& content,
10746 assert(state_ == DiscordObjectState::Owned);
10747 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
10748 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
10749 auto cb__userData =
new Tcb__UserData(cb);
10750 Discord_Client_EditUserMessageCallback cb__native = [](
auto result,
void* userData__) {
10751 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
10753 userData__typed->delegate(std::move(result__obj));
10755 Discord_Client_EditUserMessage(&instance_,
10760 Tcb__UserData::Free,
10763std::optional<discordpp::ChannelHandle> Client::GetChannelHandle(uint64_t channelId)
const
10765 assert(state_ == DiscordObjectState::Owned);
10766 bool returnIsNonNull__;
10767 Discord_ChannelHandle returnValueNative__;
10768 returnIsNonNull__ =
10769 Discord_Client_GetChannelHandle(&instance_, channelId, &returnValueNative__);
10770 if (!returnIsNonNull__) {
10774 return returnValue__;
10776void Client::GetLobbyMessagesWithLimit(uint64_t lobbyId,
10780 assert(state_ == DiscordObjectState::Owned);
10781 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
10782 auto cb__userData =
new Tcb__UserData(cb);
10783 Discord_Client_GetLobbyMessagesCallback cb__native =
10784 [](
auto result,
auto messages,
void* userData__) {
10785 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
10787 std::vector<discordpp::MessageHandle> messages__vec;
10788 messages__vec.reserve(messages.size);
10789 for (
size_t i__ = 0; i__ < messages.size; ++i__) {
10790 messages__vec.emplace_back(messages.ptr[i__], DiscordObjectState::Owned);
10792 Discord_Free(messages.ptr);
10793 userData__typed->delegate(std::move(result__obj), std::move(messages__vec));
10795 Discord_Client_GetLobbyMessagesWithLimit(
10796 &instance_, lobbyId, limit, cb__native, Tcb__UserData::Free, cb__userData);
10798std::optional<discordpp::MessageHandle> Client::GetMessageHandle(uint64_t messageId)
const
10800 assert(state_ == DiscordObjectState::Owned);
10801 bool returnIsNonNull__;
10802 Discord_MessageHandle returnValueNative__;
10803 returnIsNonNull__ =
10804 Discord_Client_GetMessageHandle(&instance_, messageId, &returnValueNative__);
10805 if (!returnIsNonNull__) {
10809 return returnValue__;
10813 assert(state_ == DiscordObjectState::Owned);
10814 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
10815 auto cb__userData =
new Tcb__UserData(cb);
10816 Discord_Client_UserMessageSummariesCallback cb__native =
10817 [](
auto result,
auto summaries,
void* userData__) {
10818 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
10820 std::vector<discordpp::UserMessageSummary> summaries__vec;
10821 summaries__vec.reserve(summaries.size);
10822 for (
size_t i__ = 0; i__ < summaries.size; ++i__) {
10823 summaries__vec.emplace_back(summaries.ptr[i__], DiscordObjectState::Owned);
10825 Discord_Free(summaries.ptr);
10826 userData__typed->delegate(std::move(result__obj), std::move(summaries__vec));
10828 Discord_Client_GetUserMessageSummaries(
10829 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10831void Client::GetUserMessagesWithLimit(uint64_t recipientId,
10835 assert(state_ == DiscordObjectState::Owned);
10836 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
10837 auto cb__userData =
new Tcb__UserData(cb);
10838 Discord_Client_UserMessagesWithLimitCallback cb__native =
10839 [](
auto result,
auto messages,
void* userData__) {
10840 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
10842 std::vector<discordpp::MessageHandle> messages__vec;
10843 messages__vec.reserve(messages.size);
10844 for (
size_t i__ = 0; i__ < messages.size; ++i__) {
10845 messages__vec.emplace_back(messages.ptr[i__], DiscordObjectState::Owned);
10847 Discord_Free(messages.ptr);
10848 userData__typed->delegate(std::move(result__obj), std::move(messages__vec));
10850 Discord_Client_GetUserMessagesWithLimit(
10851 &instance_, recipientId, limit, cb__native, Tcb__UserData::Free, cb__userData);
10853void Client::OpenMessageInDiscord(
10854 uint64_t messageId,
10858 assert(state_ == DiscordObjectState::Owned);
10859 using TprovisionalUserMergeRequiredCallback__UserData =
10860 TDelegateUserData<std::remove_reference_t<
decltype(provisionalUserMergeRequiredCallback)>>;
10861 auto provisionalUserMergeRequiredCallback__userData =
10862 new TprovisionalUserMergeRequiredCallback__UserData(provisionalUserMergeRequiredCallback);
10863 Discord_Client_ProvisionalUserMergeRequiredCallback
10864 provisionalUserMergeRequiredCallback__native = [](
void* userData__) {
10865 auto userData__typed =
10866 static_cast<TprovisionalUserMergeRequiredCallback__UserData*
>(userData__);
10867 userData__typed->delegate();
10869 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
10870 auto callback__userData =
new Tcallback__UserData(callback);
10871 Discord_Client_OpenMessageInDiscordCallback callback__native = [](
auto result,
10872 void* userData__) {
10873 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
10875 userData__typed->delegate(std::move(result__obj));
10877 Discord_Client_OpenMessageInDiscord(&instance_,
10879 provisionalUserMergeRequiredCallback__native,
10880 TprovisionalUserMergeRequiredCallback__UserData::Free,
10881 provisionalUserMergeRequiredCallback__userData,
10883 Tcallback__UserData::Free,
10884 callback__userData);
10886void Client::SendLobbyMessage(uint64_t lobbyId,
10887 std::string
const& content,
10890 assert(state_ == DiscordObjectState::Owned);
10891 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
10892 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
10893 auto cb__userData =
new Tcb__UserData(cb);
10894 Discord_Client_SendUserMessageCallback cb__native =
10895 [](
auto result,
auto messageId,
void* userData__) {
10896 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
10898 userData__typed->delegate(std::move(result__obj), messageId);
10900 Discord_Client_SendLobbyMessage(
10901 &instance_, lobbyId, content__str, cb__native, Tcb__UserData::Free, cb__userData);
10903void Client::SendLobbyMessageWithMetadata(
10905 std::string
const& content,
10906 std::unordered_map<std::string, std::string>
const& metadata,
10909 assert(state_ == DiscordObjectState::Owned);
10910 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
10911 ConvertedProperties metadata__convert(metadata);
10912 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
10913 auto cb__userData =
new Tcb__UserData(cb);
10914 Discord_Client_SendUserMessageCallback cb__native =
10915 [](
auto result,
auto messageId,
void* userData__) {
10916 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
10918 userData__typed->delegate(std::move(result__obj), messageId);
10920 Discord_Client_SendLobbyMessageWithMetadata(&instance_,
10923 metadata__convert.Properties,
10925 Tcb__UserData::Free,
10928void Client::SendUserMessage(uint64_t recipientId,
10929 std::string
const& content,
10932 assert(state_ == DiscordObjectState::Owned);
10933 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
10934 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
10935 auto cb__userData =
new Tcb__UserData(cb);
10936 Discord_Client_SendUserMessageCallback cb__native =
10937 [](
auto result,
auto messageId,
void* userData__) {
10938 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
10940 userData__typed->delegate(std::move(result__obj), messageId);
10942 Discord_Client_SendUserMessage(
10943 &instance_, recipientId, content__str, cb__native, Tcb__UserData::Free, cb__userData);
10945void Client::SendUserMessageWithMetadata(
10946 uint64_t recipientId,
10947 std::string
const& content,
10948 std::unordered_map<std::string, std::string>
const& metadata,
10951 assert(state_ == DiscordObjectState::Owned);
10952 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
10953 ConvertedProperties metadata__convert(metadata);
10954 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
10955 auto cb__userData =
new Tcb__UserData(cb);
10956 Discord_Client_SendUserMessageCallback cb__native =
10957 [](
auto result,
auto messageId,
void* userData__) {
10958 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
10960 userData__typed->delegate(std::move(result__obj), messageId);
10962 Discord_Client_SendUserMessageWithMetadata(&instance_,
10965 metadata__convert.Properties,
10967 Tcb__UserData::Free,
10972 assert(state_ == DiscordObjectState::Owned);
10973 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
10974 auto cb__userData =
new Tcb__UserData(cb);
10975 Discord_Client_MessageCreatedCallback cb__native = [](
auto messageId,
void* userData__) {
10976 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
10977 userData__typed->delegate(messageId);
10979 Discord_Client_SetMessageCreatedCallback(
10980 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10984 assert(state_ == DiscordObjectState::Owned);
10985 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
10986 auto cb__userData =
new Tcb__UserData(cb);
10987 Discord_Client_MessageDeletedCallback cb__native =
10988 [](
auto messageId,
auto channelId,
void* userData__) {
10989 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
10990 userData__typed->delegate(messageId, channelId);
10992 Discord_Client_SetMessageDeletedCallback(
10993 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10997 assert(state_ == DiscordObjectState::Owned);
10998 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
10999 auto cb__userData =
new Tcb__UserData(cb);
11000 Discord_Client_MessageUpdatedCallback cb__native = [](
auto messageId,
void* userData__) {
11001 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11002 userData__typed->delegate(messageId);
11004 Discord_Client_SetMessageUpdatedCallback(
11005 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11007void Client::SetShowingChat(
bool showingChat)
11009 assert(state_ == DiscordObjectState::Owned);
11010 Discord_Client_SetShowingChat(&instance_, showingChat);
11015 assert(state_ == DiscordObjectState::Owned);
11016 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
11017 auto callback__userData =
new Tcallback__UserData(callback);
11018 Discord_Client_LogCallback callback__native = [](
11019 auto message,
auto severity,
void* userData__) {
11020 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
11021 std::string message__str(
reinterpret_cast<char*
>(message.ptr), message.size);
11022 userData__typed->delegate(std::move(message__str),
11024 Discord_Free(message.ptr);
11026 Discord_Client_AddLogCallback(&instance_,
11028 Tcallback__UserData::Free,
11029 callback__userData,
11030 static_cast<Discord_LoggingSeverity
>(minSeverity));
11035 assert(state_ == DiscordObjectState::Owned);
11036 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
11037 auto callback__userData =
new Tcallback__UserData(callback);
11038 Discord_Client_LogCallback callback__native = [](
11039 auto message,
auto severity,
void* userData__) {
11040 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
11041 std::string message__str(
reinterpret_cast<char*
>(message.ptr), message.size);
11042 userData__typed->delegate(std::move(message__str),
11044 Discord_Free(message.ptr);
11046 Discord_Client_AddVoiceLogCallback(&instance_,
11048 Tcallback__UserData::Free,
11049 callback__userData,
11050 static_cast<Discord_LoggingSeverity
>(minSeverity));
11052void Client::Connect()
11054 assert(state_ == DiscordObjectState::Owned);
11055 Discord_Client_Connect(&instance_);
11057void Client::Disconnect()
11059 assert(state_ == DiscordObjectState::Owned);
11060 Discord_Client_Disconnect(&instance_);
11064 assert(state_ == DiscordObjectState::Owned);
11065 Discord_Client_Status returnValue__;
11066 returnValue__ = Discord_Client_GetStatus(&instance_);
11069void Client::OpenConnectedGamesSettingsInDiscord(
11072 assert(state_ == DiscordObjectState::Owned);
11073 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
11074 auto callback__userData =
new Tcallback__UserData(callback);
11075 Discord_Client_OpenConnectedGamesSettingsInDiscordCallback callback__native =
11076 [](
auto result,
void* userData__) {
11077 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
11079 userData__typed->delegate(std::move(result__obj));
11081 Discord_Client_OpenConnectedGamesSettingsInDiscord(
11082 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
11084void Client::SetApplicationId(uint64_t applicationId)
11086 assert(state_ == DiscordObjectState::Owned);
11087 Discord_Client_SetApplicationId(&instance_, applicationId);
11091 assert(state_ == DiscordObjectState::Owned);
11092 bool returnValue__;
11093 Discord_String path__str{(uint8_t*)(path.data()), path.size()};
11094 returnValue__ = Discord_Client_SetLogDir(
11095 &instance_, path__str,
static_cast<Discord_LoggingSeverity
>(minSeverity));
11096 return returnValue__;
11100 assert(state_ == DiscordObjectState::Owned);
11101 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11102 auto cb__userData =
new Tcb__UserData(cb);
11103 Discord_Client_OnStatusChanged cb__native =
11104 [](
auto status,
auto error,
auto errorDetail,
void* userData__) {
11105 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11110 Discord_Client_SetStatusChangedCallback(
11111 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11115 assert(state_ == DiscordObjectState::Owned);
11116 Discord_String path__str{(uint8_t*)(path.data()), path.size()};
11117 Discord_Client_SetVoiceLogDir(
11118 &instance_, path__str,
static_cast<Discord_LoggingSeverity
>(minSeverity));
11120void Client::CreateOrJoinLobby(std::string
const& secret,
11123 assert(state_ == DiscordObjectState::Owned);
11124 Discord_String secret__str{(uint8_t*)(secret.data()), secret.size()};
11125 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
11126 auto callback__userData =
new Tcallback__UserData(callback);
11127 Discord_Client_CreateOrJoinLobbyCallback callback__native =
11128 [](
auto result,
auto lobbyId,
void* userData__) {
11129 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
11131 userData__typed->delegate(std::move(result__obj), lobbyId);
11133 Discord_Client_CreateOrJoinLobby(
11134 &instance_, secret__str, callback__native, Tcallback__UserData::Free, callback__userData);
11136void Client::CreateOrJoinLobbyWithMetadata(
11137 std::string
const& secret,
11138 std::unordered_map<std::string, std::string>
const& lobbyMetadata,
11139 std::unordered_map<std::string, std::string>
const& memberMetadata,
11142 assert(state_ == DiscordObjectState::Owned);
11143 Discord_String secret__str{(uint8_t*)(secret.data()), secret.size()};
11144 ConvertedProperties lobbyMetadata__convert(lobbyMetadata);
11145 ConvertedProperties memberMetadata__convert(memberMetadata);
11146 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
11147 auto callback__userData =
new Tcallback__UserData(callback);
11148 Discord_Client_CreateOrJoinLobbyCallback callback__native =
11149 [](
auto result,
auto lobbyId,
void* userData__) {
11150 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
11152 userData__typed->delegate(std::move(result__obj), lobbyId);
11154 Discord_Client_CreateOrJoinLobbyWithMetadata(&instance_,
11156 lobbyMetadata__convert.Properties,
11157 memberMetadata__convert.Properties,
11159 Tcallback__UserData::Free,
11160 callback__userData);
11164 assert(state_ == DiscordObjectState::Owned);
11165 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11166 auto cb__userData =
new Tcb__UserData(cb);
11167 Discord_Client_GetGuildChannelsCallback cb__native =
11168 [](
auto result,
auto guildChannels,
void* userData__) {
11169 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11171 std::vector<discordpp::GuildChannel> guildChannels__vec;
11172 guildChannels__vec.reserve(guildChannels.size);
11173 for (
size_t i__ = 0; i__ < guildChannels.size; ++i__) {
11174 guildChannels__vec.emplace_back(guildChannels.ptr[i__], DiscordObjectState::Owned);
11176 Discord_Free(guildChannels.ptr);
11177 userData__typed->delegate(std::move(result__obj), std::move(guildChannels__vec));
11179 Discord_Client_GetGuildChannels(
11180 &instance_, guildId, cb__native, Tcb__UserData::Free, cb__userData);
11182std::optional<discordpp::LobbyHandle> Client::GetLobbyHandle(uint64_t lobbyId)
const
11184 assert(state_ == DiscordObjectState::Owned);
11185 bool returnIsNonNull__;
11186 Discord_LobbyHandle returnValueNative__;
11187 returnIsNonNull__ = Discord_Client_GetLobbyHandle(&instance_, lobbyId, &returnValueNative__);
11188 if (!returnIsNonNull__) {
11192 return returnValue__;
11194std::vector<uint64_t> Client::GetLobbyIds()
const
11196 assert(state_ == DiscordObjectState::Owned);
11197 Discord_UInt64Span returnValueNative__;
11198 Discord_Client_GetLobbyIds(&instance_, &returnValueNative__);
11199 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
11200 returnValueNative__.ptr + returnValueNative__.size);
11201 Discord_Free(returnValueNative__.ptr);
11202 return returnValue__;
11206 assert(state_ == DiscordObjectState::Owned);
11207 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11208 auto cb__userData =
new Tcb__UserData(cb);
11209 Discord_Client_GetUserGuildsCallback cb__native =
11210 [](
auto result,
auto guilds,
void* userData__) {
11211 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11213 std::vector<discordpp::GuildMinimal> guilds__vec;
11214 guilds__vec.reserve(guilds.size);
11215 for (
size_t i__ = 0; i__ < guilds.size; ++i__) {
11216 guilds__vec.emplace_back(guilds.ptr[i__], DiscordObjectState::Owned);
11218 Discord_Free(guilds.ptr);
11219 userData__typed->delegate(std::move(result__obj), std::move(guilds__vec));
11221 Discord_Client_GetUserGuilds(&instance_, cb__native, Tcb__UserData::Free, cb__userData);
11223void Client::JoinLinkedLobbyGuild(
11228 assert(state_ == DiscordObjectState::Owned);
11229 using TprovisionalUserMergeRequiredCallback__UserData =
11230 TDelegateUserData<std::remove_reference_t<
decltype(provisionalUserMergeRequiredCallback)>>;
11231 auto provisionalUserMergeRequiredCallback__userData =
11232 new TprovisionalUserMergeRequiredCallback__UserData(provisionalUserMergeRequiredCallback);
11233 Discord_Client_ProvisionalUserMergeRequiredCallback
11234 provisionalUserMergeRequiredCallback__native = [](
void* userData__) {
11235 auto userData__typed =
11236 static_cast<TprovisionalUserMergeRequiredCallback__UserData*
>(userData__);
11237 userData__typed->delegate();
11239 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
11240 auto callback__userData =
new Tcallback__UserData(callback);
11241 Discord_Client_JoinLinkedLobbyGuildCallback callback__native =
11242 [](
auto result,
auto inviteUrl,
void* userData__) {
11243 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
11245 std::string inviteUrl__str(
reinterpret_cast<char*
>(inviteUrl.ptr), inviteUrl.size);
11246 userData__typed->delegate(std::move(result__obj), std::move(inviteUrl__str));
11247 Discord_Free(inviteUrl.ptr);
11249 Discord_Client_JoinLinkedLobbyGuild(&instance_,
11251 provisionalUserMergeRequiredCallback__native,
11252 TprovisionalUserMergeRequiredCallback__UserData::Free,
11253 provisionalUserMergeRequiredCallback__userData,
11255 Tcallback__UserData::Free,
11256 callback__userData);
11260 assert(state_ == DiscordObjectState::Owned);
11261 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
11262 auto callback__userData =
new Tcallback__UserData(callback);
11263 Discord_Client_LeaveLobbyCallback callback__native = [](
auto result,
void* userData__) {
11264 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
11266 userData__typed->delegate(std::move(result__obj));
11268 Discord_Client_LeaveLobby(
11269 &instance_, lobbyId, callback__native, Tcallback__UserData::Free, callback__userData);
11271void Client::LinkChannelToLobby(uint64_t lobbyId,
11272 uint64_t channelId,
11275 assert(state_ == DiscordObjectState::Owned);
11276 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
11277 auto callback__userData =
new Tcallback__UserData(callback);
11278 Discord_Client_LinkOrUnlinkChannelCallback callback__native = [](
auto result,
11279 void* userData__) {
11280 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
11282 userData__typed->delegate(std::move(result__obj));
11284 Discord_Client_LinkChannelToLobby(&instance_,
11288 Tcallback__UserData::Free,
11289 callback__userData);
11293 assert(state_ == DiscordObjectState::Owned);
11294 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11295 auto cb__userData =
new Tcb__UserData(cb);
11296 Discord_Client_LobbyCreatedCallback cb__native = [](
auto lobbyId,
void* userData__) {
11297 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11298 userData__typed->delegate(lobbyId);
11300 Discord_Client_SetLobbyCreatedCallback(
11301 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11305 assert(state_ == DiscordObjectState::Owned);
11306 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11307 auto cb__userData =
new Tcb__UserData(cb);
11308 Discord_Client_LobbyDeletedCallback cb__native = [](
auto lobbyId,
void* userData__) {
11309 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11310 userData__typed->delegate(lobbyId);
11312 Discord_Client_SetLobbyDeletedCallback(
11313 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11317 assert(state_ == DiscordObjectState::Owned);
11318 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11319 auto cb__userData =
new Tcb__UserData(cb);
11320 Discord_Client_LobbyMemberAddedCallback cb__native =
11321 [](
auto lobbyId,
auto memberId,
void* userData__) {
11322 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11323 userData__typed->delegate(lobbyId, memberId);
11325 Discord_Client_SetLobbyMemberAddedCallback(
11326 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11330 assert(state_ == DiscordObjectState::Owned);
11331 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11332 auto cb__userData =
new Tcb__UserData(cb);
11333 Discord_Client_LobbyMemberRemovedCallback cb__native =
11334 [](
auto lobbyId,
auto memberId,
void* userData__) {
11335 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11336 userData__typed->delegate(lobbyId, memberId);
11338 Discord_Client_SetLobbyMemberRemovedCallback(
11339 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11343 assert(state_ == DiscordObjectState::Owned);
11344 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11345 auto cb__userData =
new Tcb__UserData(cb);
11346 Discord_Client_LobbyMemberUpdatedCallback cb__native =
11347 [](
auto lobbyId,
auto memberId,
void* userData__) {
11348 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11349 userData__typed->delegate(lobbyId, memberId);
11351 Discord_Client_SetLobbyMemberUpdatedCallback(
11352 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11356 assert(state_ == DiscordObjectState::Owned);
11357 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11358 auto cb__userData =
new Tcb__UserData(cb);
11359 Discord_Client_LobbyUpdatedCallback cb__native = [](
auto lobbyId,
void* userData__) {
11360 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11361 userData__typed->delegate(lobbyId);
11363 Discord_Client_SetLobbyUpdatedCallback(
11364 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11366void Client::UnlinkChannelFromLobby(uint64_t lobbyId,
11369 assert(state_ == DiscordObjectState::Owned);
11370 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
11371 auto callback__userData =
new Tcallback__UserData(callback);
11372 Discord_Client_LinkOrUnlinkChannelCallback callback__native = [](
auto result,
11373 void* userData__) {
11374 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
11376 userData__typed->delegate(std::move(result__obj));
11378 Discord_Client_UnlinkChannelFromLobby(
11379 &instance_, lobbyId, callback__native, Tcallback__UserData::Free, callback__userData);
11384 assert(state_ == DiscordObjectState::Owned);
11385 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11386 auto cb__userData =
new Tcb__UserData(cb);
11387 Discord_Client_AcceptActivityInviteCallback cb__native =
11388 [](
auto result,
auto joinSecret,
void* userData__) {
11389 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11391 std::string joinSecret__str(
reinterpret_cast<char*
>(joinSecret.ptr), joinSecret.size);
11392 userData__typed->delegate(std::move(result__obj), std::move(joinSecret__str));
11393 Discord_Free(joinSecret.ptr);
11395 Discord_Client_AcceptActivityInvite(
11396 &instance_, invite.instance(), cb__native, Tcb__UserData::Free, cb__userData);
11398void Client::ClearRichPresence()
11400 assert(state_ == DiscordObjectState::Owned);
11401 Discord_Client_ClearRichPresence(&instance_);
11403bool Client::RegisterLaunchCommand(uint64_t applicationId, std::string command)
11405 assert(state_ == DiscordObjectState::Owned);
11406 bool returnValue__;
11407 Discord_String command__str{(uint8_t*)(command.data()), command.size()};
11408 returnValue__ = Discord_Client_RegisterLaunchCommand(&instance_, applicationId, command__str);
11409 return returnValue__;
11411bool Client::RegisterLaunchSteamApplication(uint64_t applicationId, uint32_t steamAppId)
11413 assert(state_ == DiscordObjectState::Owned);
11414 bool returnValue__;
11416 Discord_Client_RegisterLaunchSteamApplication(&instance_, applicationId, steamAppId);
11417 return returnValue__;
11419void Client::SendActivityInvite(uint64_t userId,
11420 std::string
const& content,
11423 assert(state_ == DiscordObjectState::Owned);
11424 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
11425 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11426 auto cb__userData =
new Tcb__UserData(cb);
11427 Discord_Client_SendActivityInviteCallback cb__native = [](
auto result,
void* userData__) {
11428 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11430 userData__typed->delegate(std::move(result__obj));
11432 Discord_Client_SendActivityInvite(
11433 &instance_, userId, content__str, cb__native, Tcb__UserData::Free, cb__userData);
11435void Client::SendActivityJoinRequest(uint64_t userId,
11438 assert(state_ == DiscordObjectState::Owned);
11439 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11440 auto cb__userData =
new Tcb__UserData(cb);
11441 Discord_Client_SendActivityInviteCallback cb__native = [](
auto result,
void* userData__) {
11442 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11444 userData__typed->delegate(std::move(result__obj));
11446 Discord_Client_SendActivityJoinRequest(
11447 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11452 assert(state_ == DiscordObjectState::Owned);
11453 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11454 auto cb__userData =
new Tcb__UserData(cb);
11455 Discord_Client_SendActivityInviteCallback cb__native = [](
auto result,
void* userData__) {
11456 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11458 userData__typed->delegate(std::move(result__obj));
11460 Discord_Client_SendActivityJoinRequestReply(
11461 &instance_, invite.instance(), cb__native, Tcb__UserData::Free, cb__userData);
11465 assert(state_ == DiscordObjectState::Owned);
11466 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11467 auto cb__userData =
new Tcb__UserData(cb);
11468 Discord_Client_ActivityInviteCallback cb__native = [](
auto invite,
void* userData__) {
11469 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11471 userData__typed->delegate(std::move(invite__obj));
11473 Discord_Client_SetActivityInviteCreatedCallback(
11474 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11478 assert(state_ == DiscordObjectState::Owned);
11479 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11480 auto cb__userData =
new Tcb__UserData(cb);
11481 Discord_Client_ActivityInviteCallback cb__native = [](
auto invite,
void* userData__) {
11482 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11484 userData__typed->delegate(std::move(invite__obj));
11486 Discord_Client_SetActivityInviteUpdatedCallback(
11487 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11491 assert(state_ == DiscordObjectState::Owned);
11492 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11493 auto cb__userData =
new Tcb__UserData(cb);
11494 Discord_Client_ActivityJoinCallback cb__native = [](
auto joinSecret,
void* userData__) {
11495 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11496 std::string joinSecret__str(
reinterpret_cast<char*
>(joinSecret.ptr), joinSecret.size);
11497 userData__typed->delegate(std::move(joinSecret__str));
11498 Discord_Free(joinSecret.ptr);
11500 Discord_Client_SetActivityJoinCallback(
11501 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11503void Client::SetActivityJoinWithApplicationCallback(
11506 assert(state_ == DiscordObjectState::Owned);
11507 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11508 auto cb__userData =
new Tcb__UserData(cb);
11509 Discord_Client_ActivityJoinWithApplicationCallback cb__native =
11510 [](
auto applicationId,
auto joinSecret,
void* userData__) {
11511 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11512 std::string joinSecret__str(
reinterpret_cast<char*
>(joinSecret.ptr), joinSecret.size);
11513 userData__typed->delegate(applicationId, std::move(joinSecret__str));
11514 Discord_Free(joinSecret.ptr);
11516 Discord_Client_SetActivityJoinWithApplicationCallback(
11517 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11522 assert(state_ == DiscordObjectState::Owned);
11523 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
11524 auto callback__userData =
new Tcallback__UserData(callback);
11525 Discord_Client_UpdateStatusCallback callback__native = [](
auto result,
void* userData__) {
11526 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
11528 userData__typed->delegate(std::move(result__obj));
11530 Discord_Client_SetOnlineStatus(&instance_,
11531 static_cast<Discord_StatusType
>(status),
11533 Tcallback__UserData::Free,
11534 callback__userData);
11539 assert(state_ == DiscordObjectState::Owned);
11540 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11541 auto cb__userData =
new Tcb__UserData(cb);
11542 Discord_Client_UpdateRichPresenceCallback cb__native = [](
auto result,
void* userData__) {
11543 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11545 userData__typed->delegate(std::move(result__obj));
11547 Discord_Client_UpdateRichPresence(
11548 &instance_, activity.instance(), cb__native, Tcb__UserData::Free, cb__userData);
11550void Client::AcceptDiscordFriendRequest(uint64_t userId,
11553 assert(state_ == DiscordObjectState::Owned);
11554 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11555 auto cb__userData =
new Tcb__UserData(cb);
11556 Discord_Client_UpdateRelationshipCallback cb__native = [](
auto result,
void* userData__) {
11557 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11559 userData__typed->delegate(std::move(result__obj));
11561 Discord_Client_AcceptDiscordFriendRequest(
11562 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11564void Client::AcceptGameFriendRequest(uint64_t userId,
11567 assert(state_ == DiscordObjectState::Owned);
11568 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11569 auto cb__userData =
new Tcb__UserData(cb);
11570 Discord_Client_UpdateRelationshipCallback cb__native = [](
auto result,
void* userData__) {
11571 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11573 userData__typed->delegate(std::move(result__obj));
11575 Discord_Client_AcceptGameFriendRequest(
11576 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11580 assert(state_ == DiscordObjectState::Owned);
11581 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11582 auto cb__userData =
new Tcb__UserData(cb);
11583 Discord_Client_UpdateRelationshipCallback cb__native = [](
auto result,
void* userData__) {
11584 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11586 userData__typed->delegate(std::move(result__obj));
11588 Discord_Client_BlockUser(&instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11590void Client::CancelDiscordFriendRequest(uint64_t userId,
11593 assert(state_ == DiscordObjectState::Owned);
11594 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11595 auto cb__userData =
new Tcb__UserData(cb);
11596 Discord_Client_UpdateRelationshipCallback cb__native = [](
auto result,
void* userData__) {
11597 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11599 userData__typed->delegate(std::move(result__obj));
11601 Discord_Client_CancelDiscordFriendRequest(
11602 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11604void Client::CancelGameFriendRequest(uint64_t userId,
11607 assert(state_ == DiscordObjectState::Owned);
11608 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11609 auto cb__userData =
new Tcb__UserData(cb);
11610 Discord_Client_UpdateRelationshipCallback cb__native = [](
auto result,
void* userData__) {
11611 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11613 userData__typed->delegate(std::move(result__obj));
11615 Discord_Client_CancelGameFriendRequest(
11616 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11620 assert(state_ == DiscordObjectState::Owned);
11621 Discord_RelationshipHandle returnValueNative__{};
11622 Discord_Client_GetRelationshipHandle(&instance_, userId, &returnValueNative__);
11624 return returnValue__;
11626std::vector<discordpp::RelationshipHandle> Client::GetRelationships()
const
11628 assert(state_ == DiscordObjectState::Owned);
11629 Discord_RelationshipHandleSpan returnValueNative__;
11630 Discord_Client_GetRelationships(&instance_, &returnValueNative__);
11631 std::vector<discordpp::RelationshipHandle> returnValue__;
11632 returnValue__.reserve(returnValueNative__.size);
11633 for (
size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
11634 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
11636 Discord_Free(returnValueNative__.ptr);
11637 return returnValue__;
11639std::vector<discordpp::RelationshipHandle> Client::GetRelationshipsByGroup(
11642 assert(state_ == DiscordObjectState::Owned);
11643 Discord_RelationshipHandleSpan returnValueNative__;
11644 Discord_Client_GetRelationshipsByGroup(
11645 &instance_,
static_cast<Discord_RelationshipGroupType
>(groupType), &returnValueNative__);
11646 std::vector<discordpp::RelationshipHandle> returnValue__;
11647 returnValue__.reserve(returnValueNative__.size);
11648 for (
size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
11649 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
11651 Discord_Free(returnValueNative__.ptr);
11652 return returnValue__;
11654void Client::RejectDiscordFriendRequest(uint64_t userId,
11657 assert(state_ == DiscordObjectState::Owned);
11658 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11659 auto cb__userData =
new Tcb__UserData(cb);
11660 Discord_Client_UpdateRelationshipCallback cb__native = [](
auto result,
void* userData__) {
11661 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11663 userData__typed->delegate(std::move(result__obj));
11665 Discord_Client_RejectDiscordFriendRequest(
11666 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11668void Client::RejectGameFriendRequest(uint64_t userId,
11671 assert(state_ == DiscordObjectState::Owned);
11672 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11673 auto cb__userData =
new Tcb__UserData(cb);
11674 Discord_Client_UpdateRelationshipCallback cb__native = [](
auto result,
void* userData__) {
11675 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11677 userData__typed->delegate(std::move(result__obj));
11679 Discord_Client_RejectGameFriendRequest(
11680 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11682void Client::RemoveDiscordAndGameFriend(uint64_t userId,
11685 assert(state_ == DiscordObjectState::Owned);
11686 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11687 auto cb__userData =
new Tcb__UserData(cb);
11688 Discord_Client_UpdateRelationshipCallback cb__native = [](
auto result,
void* userData__) {
11689 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11691 userData__typed->delegate(std::move(result__obj));
11693 Discord_Client_RemoveDiscordAndGameFriend(
11694 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11698 assert(state_ == DiscordObjectState::Owned);
11699 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11700 auto cb__userData =
new Tcb__UserData(cb);
11701 Discord_Client_UpdateRelationshipCallback cb__native = [](
auto result,
void* userData__) {
11702 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11704 userData__typed->delegate(std::move(result__obj));
11706 Discord_Client_RemoveGameFriend(
11707 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11709std::vector<discordpp::UserHandle> Client::SearchFriendsByUsername(std::string searchStr)
const
11711 assert(state_ == DiscordObjectState::Owned);
11712 Discord_UserHandleSpan returnValueNative__;
11713 Discord_String searchStr__str{(uint8_t*)(searchStr.data()), searchStr.size()};
11714 Discord_Client_SearchFriendsByUsername(&instance_, searchStr__str, &returnValueNative__);
11715 std::vector<discordpp::UserHandle> returnValue__;
11716 returnValue__.reserve(returnValueNative__.size);
11717 for (
size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
11718 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
11720 Discord_Free(returnValueNative__.ptr);
11721 return returnValue__;
11723void Client::SendDiscordFriendRequest(std::string
const& username,
11726 assert(state_ == DiscordObjectState::Owned);
11727 Discord_String username__str{(uint8_t*)(username.data()), username.size()};
11728 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11729 auto cb__userData =
new Tcb__UserData(cb);
11730 Discord_Client_SendFriendRequestCallback cb__native = [](
auto result,
void* userData__) {
11731 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11733 userData__typed->delegate(std::move(result__obj));
11735 Discord_Client_SendDiscordFriendRequest(
11736 &instance_, username__str, cb__native, Tcb__UserData::Free, cb__userData);
11738void Client::SendDiscordFriendRequestById(uint64_t userId,
11741 assert(state_ == DiscordObjectState::Owned);
11742 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11743 auto cb__userData =
new Tcb__UserData(cb);
11744 Discord_Client_UpdateRelationshipCallback cb__native = [](
auto result,
void* userData__) {
11745 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11747 userData__typed->delegate(std::move(result__obj));
11749 Discord_Client_SendDiscordFriendRequestById(
11750 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11752void Client::SendGameFriendRequest(std::string
const& username,
11755 assert(state_ == DiscordObjectState::Owned);
11756 Discord_String username__str{(uint8_t*)(username.data()), username.size()};
11757 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11758 auto cb__userData =
new Tcb__UserData(cb);
11759 Discord_Client_SendFriendRequestCallback cb__native = [](
auto result,
void* userData__) {
11760 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11762 userData__typed->delegate(std::move(result__obj));
11764 Discord_Client_SendGameFriendRequest(
11765 &instance_, username__str, cb__native, Tcb__UserData::Free, cb__userData);
11767void Client::SendGameFriendRequestById(uint64_t userId,
11770 assert(state_ == DiscordObjectState::Owned);
11771 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11772 auto cb__userData =
new Tcb__UserData(cb);
11773 Discord_Client_UpdateRelationshipCallback cb__native = [](
auto result,
void* userData__) {
11774 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11776 userData__typed->delegate(std::move(result__obj));
11778 Discord_Client_SendGameFriendRequestById(
11779 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11783 assert(state_ == DiscordObjectState::Owned);
11784 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11785 auto cb__userData =
new Tcb__UserData(cb);
11786 Discord_Client_RelationshipCreatedCallback cb__native =
11787 [](
auto userId,
auto isDiscordRelationshipUpdate,
void* userData__) {
11788 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11789 userData__typed->delegate(userId, isDiscordRelationshipUpdate);
11791 Discord_Client_SetRelationshipCreatedCallback(
11792 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11796 assert(state_ == DiscordObjectState::Owned);
11797 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11798 auto cb__userData =
new Tcb__UserData(cb);
11799 Discord_Client_RelationshipDeletedCallback cb__native =
11800 [](
auto userId,
auto isDiscordRelationshipUpdate,
void* userData__) {
11801 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11802 userData__typed->delegate(userId, isDiscordRelationshipUpdate);
11804 Discord_Client_SetRelationshipDeletedCallback(
11805 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11809 assert(state_ == DiscordObjectState::Owned);
11810 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11811 auto cb__userData =
new Tcb__UserData(cb);
11812 Discord_Client_UpdateRelationshipCallback cb__native = [](
auto result,
void* userData__) {
11813 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11815 userData__typed->delegate(std::move(result__obj));
11817 Discord_Client_UnblockUser(&instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11821 assert(state_ == DiscordObjectState::Owned);
11822 Discord_UserHandle returnValueNative__{};
11823 Discord_Client_GetCurrentUser(&instance_, &returnValueNative__);
11825 return returnValue__;
11827std::optional<discordpp::UserHandle> Client::GetCurrentUserV2()
const
11829 assert(state_ == DiscordObjectState::Owned);
11830 bool returnIsNonNull__;
11831 Discord_UserHandle returnValueNative__;
11832 returnIsNonNull__ = Discord_Client_GetCurrentUserV2(&instance_, &returnValueNative__);
11833 if (!returnIsNonNull__) {
11837 return returnValue__;
11839void Client::GetDiscordClientConnectedUser(
11840 uint64_t applicationId,
11843 assert(state_ == DiscordObjectState::Owned);
11844 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<
decltype(callback)>>;
11845 auto callback__userData =
new Tcallback__UserData(callback);
11846 Discord_Client_GetDiscordClientConnectedUserCallback callback__native =
11847 [](
auto result,
auto user,
void* userData__) {
11848 auto userData__typed =
static_cast<Tcallback__UserData*
>(userData__);
11850 std::optional<discordpp::UserHandle> user__opt{};
11854 userData__typed->delegate(std::move(result__obj), std::move(user__opt));
11856 Discord_Client_GetDiscordClientConnectedUser(
11857 &instance_, applicationId, callback__native, Tcallback__UserData::Free, callback__userData);
11859std::optional<discordpp::UserHandle> Client::GetUser(uint64_t userId)
const
11861 assert(state_ == DiscordObjectState::Owned);
11862 bool returnIsNonNull__;
11863 Discord_UserHandle returnValueNative__;
11864 returnIsNonNull__ = Discord_Client_GetUser(&instance_, userId, &returnValueNative__);
11865 if (!returnIsNonNull__) {
11869 return returnValue__;
11871void Client::SetRelationshipGroupsUpdatedCallback(
11874 assert(state_ == DiscordObjectState::Owned);
11875 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11876 auto cb__userData =
new Tcb__UserData(cb);
11877 Discord_Client_RelationshipGroupsUpdatedCallback cb__native = [](
auto userId,
11878 void* userData__) {
11879 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11880 userData__typed->delegate(userId);
11882 Discord_Client_SetRelationshipGroupsUpdatedCallback(
11883 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11887 assert(state_ == DiscordObjectState::Owned);
11888 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<
decltype(cb)>>;
11889 auto cb__userData =
new Tcb__UserData(cb);
11890 Discord_Client_UserUpdatedCallback cb__native = [](
auto userId,
void* userData__) {
11891 auto userData__typed =
static_cast<Tcb__UserData*
>(userData__);
11892 userData__typed->delegate(userId);
11894 Discord_Client_SetUserUpdatedCallback(
11895 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11897const CallInfoHandle CallInfoHandle::nullobj{{}, DiscordObjectState::Invalid};
11898CallInfoHandle::~CallInfoHandle()
11900 if (state_ == DiscordObjectState::Owned) {
11902 state_ = DiscordObjectState::Invalid;
11905CallInfoHandle::CallInfoHandle(CallInfoHandle&& other) noexcept
11906 : instance_(other.instance_)
11907 , state_(other.state_)
11909 other.state_ = DiscordObjectState::Invalid;
11911CallInfoHandle& CallInfoHandle::operator=(CallInfoHandle&& other)
noexcept
11913 if (
this != &other) {
11914 if (state_ == DiscordObjectState::Owned) {
11917 instance_ = other.instance_;
11918 state_ = other.state_;
11919 other.state_ = DiscordObjectState::Invalid;
11923CallInfoHandle::CallInfoHandle(
const CallInfoHandle& other)
11928 Discord_CallInfoHandle_Clone(&instance_, other.instance());
11930 state_ = DiscordObjectState::Owned;
11933CallInfoHandle& CallInfoHandle::operator=(
const CallInfoHandle& other)
11935 if (
this != &other) {
11936 if (state_ == DiscordObjectState::Owned) {
11938 state_ = DiscordObjectState::Invalid;
11940 if (other.state_ == DiscordObjectState::Owned) {
11941 Discord_CallInfoHandle_Clone(&instance_, other.instance());
11943 state_ = DiscordObjectState::Owned;
11948CallInfoHandle::CallInfoHandle(Discord_CallInfoHandle instance, DiscordObjectState state)
11949 : instance_(instance)
11953void CallInfoHandle::Drop()
11955 if (state_ != DiscordObjectState::Owned) {
11958 Discord_CallInfoHandle_Drop(&instance_);
11959 state_ = DiscordObjectState::Invalid;
11961uint64_t CallInfoHandle::ChannelId()
const
11963 assert(state_ == DiscordObjectState::Owned);
11964 uint64_t returnValue__;
11965 returnValue__ = Discord_CallInfoHandle_ChannelId(&instance_);
11966 return returnValue__;
11968std::vector<uint64_t> CallInfoHandle::GetParticipants()
const
11970 assert(state_ == DiscordObjectState::Owned);
11971 Discord_UInt64Span returnValueNative__;
11972 Discord_CallInfoHandle_GetParticipants(&instance_, &returnValueNative__);
11973 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
11974 returnValueNative__.ptr + returnValueNative__.size);
11975 Discord_Free(returnValueNative__.ptr);
11976 return returnValue__;
11978std::optional<discordpp::VoiceStateHandle> CallInfoHandle::GetVoiceStateHandle(
11979 uint64_t userId)
const
11981 assert(state_ == DiscordObjectState::Owned);
11982 bool returnIsNonNull__;
11983 Discord_VoiceStateHandle returnValueNative__;
11984 returnIsNonNull__ =
11985 Discord_CallInfoHandle_GetVoiceStateHandle(&instance_, userId, &returnValueNative__);
11986 if (!returnIsNonNull__) {
11990 return returnValue__;
11992uint64_t CallInfoHandle::GuildId()
const
11994 assert(state_ == DiscordObjectState::Owned);
11995 uint64_t returnValue__;
11996 returnValue__ = Discord_CallInfoHandle_GuildId(&instance_);
11997 return returnValue__;
Struct which controls what your rich presence looks like in the Discord client. If you don't specify ...
Definition discordpp.h:778
void SetLargeImage(std::optional< std::string > LargeImage)
Setter for ActivityAssets::LargeImage.
std::optional< std::string > SmallText() const
A tooltip string that is shown when the user hovers over the small image.
void SetLargeText(std::optional< std::string > LargeText)
Setter for ActivityAssets::LargeText.
ActivityAssets(ActivityAssets &&other) noexcept
Move constructor for ActivityAssets.
std::optional< std::string > SmallImage() const
The secondary image, rendered as a small circle over the largeImage.
ActivityAssets(const ActivityAssets &arg0)
Copy constructor for ActivityAssets.
void SetLargeUrl(std::optional< std::string > LargeUrl)
Setter for ActivityAssets::LargeUrl.
std::optional< std::string > LargeText() const
A tooltip string that is shown when the user hovers over the large image.
void SetSmallImage(std::optional< std::string > SmallImage)
Setter for ActivityAssets::SmallImage.
std::optional< std::string > SmallUrl() const
A URL that opens when the user clicks/taps the small image.
ActivityAssets & operator=(const ActivityAssets &arg0)
Copy assignment operator for ActivityAssets.
static const ActivityAssets nullobj
Uninitialized instance of ActivityAssets.
Definition discordpp.h:797
std::optional< std::string > LargeImage() const
The primary image identifier or URL, rendered as a large square icon on a user's rich presence.
std::optional< std::string > LargeUrl() const
A URL that opens when the user clicks/taps the large image.
void SetSmallText(std::optional< std::string > SmallText)
Setter for ActivityAssets::SmallText.
ActivityAssets & operator=(ActivityAssets &&other) noexcept
Move assignment operator for ActivityAssets.
void SetSmallUrl(std::optional< std::string > SmallUrl)
Setter for ActivityAssets::SmallUrl.
When one user invites another to join their game on Discord, it will send a message to that user....
Definition discordpp.h:680
static const ActivityInvite nullobj
Uninitialized instance of ActivityInvite.
Definition discordpp.h:699
std::string SessionId() const
The session id of the user who sent the invite.
void SetIsValid(bool IsValid)
Setter for ActivityInvite::IsValid.
void SetSessionId(std::string SessionId)
Setter for ActivityInvite::SessionId.
uint64_t ApplicationId() const
The target application of the invite.
uint64_t MessageId() const
The id of the Discord message that contains the invite.
uint64_t SenderId() const
The user id of the user who sent the invite.
void SetApplicationId(uint64_t ApplicationId)
Setter for ActivityInvite::ApplicationId.
void SetSenderId(uint64_t SenderId)
Setter for ActivityInvite::SenderId.
void SetParentApplicationId(uint64_t ParentApplicationId)
Setter for ActivityInvite::ParentApplicationId.
bool IsValid() const
Whether or not this invite is currently joinable. An invite becomes invalid if it was sent more than ...
void SetChannelId(uint64_t ChannelId)
Setter for ActivityInvite::ChannelId.
uint64_t ChannelId() const
The id of the Discord channel in which the invite was sent.
void SetMessageId(uint64_t MessageId)
Setter for ActivityInvite::MessageId.
std::string PartyId() const
The id of the party the invite was sent for.
ActivityInvite & operator=(ActivityInvite &&other) noexcept
Move assignment operator for ActivityInvite.
ActivityInvite(const ActivityInvite &rhs)
Copy constructor for ActivityInvite.
void SetType(discordpp::ActivityActionTypes Type)
Setter for ActivityInvite::Type.
uint64_t ParentApplicationId() const
The application id of the parent - this is only applicable if there is a parent for a publisher's sui...
void SetPartyId(std::string PartyId)
Setter for ActivityInvite::PartyId.
ActivityInvite & operator=(const ActivityInvite &rhs)
Copy assignment operator for ActivityInvite.
discordpp::ActivityActionTypes Type() const
The type of invite that was sent.
ActivityInvite(ActivityInvite &&other) noexcept
Move constructor for ActivityInvite.
Definition discordpp.h:911
void SetMaxSize(int32_t MaxSize)
Setter for ActivityParty::MaxSize.
ActivityParty(ActivityParty &&other) noexcept
Move constructor for ActivityParty.
void SetCurrentSize(int32_t CurrentSize)
Setter for ActivityParty::CurrentSize.
void SetId(std::string Id)
Setter for ActivityParty::Id.
int32_t CurrentSize() const
The number of people currently in the party, must be at least 1.
int32_t MaxSize() const
The maximum number of people that can be in the party, must be at least 0. When 0,...
ActivityParty(const ActivityParty &arg0)
Copy constructor for ActivityParty.
ActivityParty & operator=(ActivityParty &&other) noexcept
Move assignment operator for ActivityParty.
void SetPrivacy(discordpp::ActivityPartyPrivacy Privacy)
Setter for ActivityParty::Privacy.
discordpp::ActivityPartyPrivacy Privacy() const
The privacy of the party.
std::string Id() const
Specifies the id of the party. "Party" is used colloquially to refer to a group of players in a share...
static const ActivityParty nullobj
Uninitialized instance of ActivityParty.
Definition discordpp.h:930
ActivityParty & operator=(const ActivityParty &arg0)
Copy assignment operator for ActivityParty.
Definition discordpp.h:973
ActivitySecrets & operator=(ActivitySecrets &&other) noexcept
Move assignment operator for ActivitySecrets.
std::string Join() const
A secret string that is shared with users who are accepted into the party so the game knows how to jo...
ActivitySecrets & operator=(const ActivitySecrets &arg0)
Copy assignment operator for ActivitySecrets.
ActivitySecrets(ActivitySecrets &&other) noexcept
Move constructor for ActivitySecrets.
ActivitySecrets(const ActivitySecrets &arg0)
Copy constructor for ActivitySecrets.
void SetJoin(std::string Join)
Setter for ActivitySecrets::Join.
static const ActivitySecrets nullobj
Uninitialized instance of ActivitySecrets.
Definition discordpp.h:992
Definition discordpp.h:857
ActivityTimestamps(ActivityTimestamps &&other) noexcept
Move constructor for ActivityTimestamps.
ActivityTimestamps(const ActivityTimestamps &arg0)
Copy constructor for ActivityTimestamps.
uint64_t Start() const
The time the activity started, in milliseconds since Unix epoch.
void SetStart(uint64_t Start)
Setter for ActivityTimestamps::Start.
static const ActivityTimestamps nullobj
Uninitialized instance of ActivityTimestamps.
Definition discordpp.h:876
ActivityTimestamps & operator=(ActivityTimestamps &&other) noexcept
Move assignment operator for ActivityTimestamps.
void SetEnd(uint64_t End)
Setter for ActivityTimestamps::End.
uint64_t End() const
The time the activity will end at, in milliseconds since Unix epoch.
ActivityTimestamps & operator=(const ActivityTimestamps &arg0)
Copy assignment operator for ActivityTimestamps.
An Activity represents one "thing" a user is doing on Discord and is part of their rich presence.
Definition discordpp.h:1242
std::vector< discordpp::ActivityButton > GetButtons() const
Returns the custom buttons for the rich presence.
void SetDetailsUrl(std::optional< std::string > DetailsUrl)
Setter for Activity::DetailsUrl.
std::optional< uint64_t > ParentApplicationId() const
The application ID of the parent application that the activity is associated with if it exists....
static const Activity nullobj
Uninitialized instance of Activity.
Definition discordpp.h:1261
std::optional< uint64_t > ApplicationId() const
The application ID of the game that the activity is associated with.
std::string Name() const
The name of the game or application that the activity is associated with.
void SetStateUrl(std::optional< std::string > StateUrl)
Setter for Activity::StateUrl.
void SetDetails(std::optional< std::string > Details)
Setter for Activity::Details.
Activity & operator=(Activity &&other) noexcept
Move assignment operator for Activity.
void SetParentApplicationId(std::optional< uint64_t > ParentApplicationId)
Setter for Activity::ParentApplicationId.
void SetType(discordpp::ActivityTypes Type)
Setter for Activity::Type.
std::optional< discordpp::ActivityAssets > Assets() const
Images used to customize how the Activity is displayed in the Discord client.
void SetTimestamps(std::optional< discordpp::ActivityTimestamps > Timestamps)
Setter for Activity::Timestamps.
bool Equals(discordpp::Activity other) const
Compares each field of the Activity struct for equality.
void SetApplicationId(std::optional< uint64_t > ApplicationId)
Setter for Activity::ApplicationId.
void SetName(std::string Name)
Setter for Activity::Name.
void SetSecrets(std::optional< discordpp::ActivitySecrets > Secrets)
Setter for Activity::Secrets.
Activity(const Activity &arg0)
Copy constructor for Activity.
void SetAssets(std::optional< discordpp::ActivityAssets > Assets)
Setter for Activity::Assets.
std::optional< discordpp::StatusDisplayTypes > StatusDisplayType() const
Controls which field is used for the user's status message.
std::optional< discordpp::ActivityTimestamps > Timestamps() const
The timestamps struct can be used to render either:
void SetParty(std::optional< discordpp::ActivityParty > Party)
Setter for Activity::Party.
void SetStatusDisplayType(std::optional< discordpp::StatusDisplayTypes > StatusDisplayType)
Setter for Activity::StatusDisplayType.
Activity & operator=(const Activity &arg0)
Copy assignment operator for Activity.
std::optional< discordpp::ActivityParty > Party() const
The party struct is used to indicate the size and members of the people the current user is playing w...
void AddButton(discordpp::ActivityButton button)
Adds a custom button to the rich presence.
std::optional< std::string > DetailsUrl() const
A URL that opens when the user clicks/taps the details text.
void SetSupportedPlatforms(discordpp::ActivityGamePlatforms SupportedPlatforms)
Setter for Activity::SupportedPlatforms.
std::optional< std::string > Details() const
The state of the what the user is doing for this activity.
void SetState(std::optional< std::string > State)
Setter for Activity::State.
Activity(Activity &&other) noexcept
Move constructor for Activity.
discordpp::ActivityGamePlatforms SupportedPlatforms() const
If an activity is joinable, but only on certain platforms, this field can be used to indicate which p...
std::optional< std::string > StateUrl() const
A URL that opens when the user clicks/taps the state text.
std::optional< discordpp::ActivitySecrets > Secrets() const
The secrets struct is used in combination with the party struct to make an Activity joinable.
std::optional< std::string > State() const
The state of the party for this activity.
discordpp::ActivityTypes Type() const
The type of activity this is.
Contains information about non-text content in a message that likely cannot be rendered in game such ...
Definition discordpp.h:2766
static std::string TypeToString(discordpp::AdditionalContentType type)
Converts the AdditionalContentType enum to a string.
AdditionalContent & operator=(AdditionalContent &&other) noexcept
Move assignment operator for AdditionalContent.
void SetCount(uint8_t Count)
Setter for AdditionalContent::Count.
void SetType(discordpp::AdditionalContentType Type)
Setter for AdditionalContent::Type.
std::optional< std::string > Title() const
When the additional content is a poll or thread, this field will contain the name of the poll or thre...
discordpp::AdditionalContentType Type() const
Represents the type of additional content in the message.
uint8_t Count() const
Represents the number of pieces of additional content so you could for example renders "2 additional ...
bool Equals(discordpp::AdditionalContent rhs) const
Compares each field of the AdditionalContent struct for equality.
AdditionalContent(AdditionalContent &&other) noexcept
Move constructor for AdditionalContent.
AdditionalContent & operator=(const AdditionalContent &arg0)
Copy assignment operator for AdditionalContent.
AdditionalContent(const AdditionalContent &arg0)
Copy constructor for AdditionalContent.
void SetTitle(std::optional< std::string > Title)
Setter for AdditionalContent::Title.
static const AdditionalContent nullobj
Uninitialized instance of AdditionalContent.
Definition discordpp.h:2785
Represents a single input or output audio device available to the user.
Definition discordpp.h:2991
AudioDevice & operator=(const AudioDevice &arg0)
Copy assignment operator for AudioDevice.
bool Equals(discordpp::AudioDevice rhs)
Compares the ID of two AudioDevice objects for equality.
std::string Name() const
The display name of the audio device.
bool IsDefault() const
Whether the audio device is the system default device.
std::string Id() const
The ID of the audio device.
AudioDevice(AudioDevice &&other) noexcept
Move constructor for AudioDevice.
AudioDevice & operator=(AudioDevice &&other) noexcept
Move assignment operator for AudioDevice.
static const AudioDevice nullobj
Uninitialized instance of AudioDevice.
Definition discordpp.h:3010
void SetId(std::string Id)
Setter for AudioDevice::Id.
void SetIsDefault(bool IsDefault)
Setter for AudioDevice::IsDefault.
void SetName(std::string Name)
Setter for AudioDevice::Name.
AudioDevice(const AudioDevice &arg0)
Copy constructor for AudioDevice.
Arguments to the Client::Authorize function.
Definition discordpp.h:1583
void SetIntegrationType(std::optional< discordpp::IntegrationType > IntegrationType)
Setter for AuthorizationArgs::IntegrationType.
std::optional< std::string > State() const
See https://discord.com/developers/docs/topics/oauth2#state-and-security for details on this field.
AuthorizationArgs & operator=(AuthorizationArgs &&other) noexcept
Move assignment operator for AuthorizationArgs.
void SetCustomSchemeParam(std::optional< std::string > CustomSchemeParam)
Setter for AuthorizationArgs::CustomSchemeParam.
std::optional< std::string > Nonce() const
The nonce field is generally only useful for backend integrations using ID tokens.
std::optional< discordpp::AuthorizationCodeChallenge > CodeChallenge() const
If using the Client::GetToken flow, you will need to generate a code challenge and verifier.
uint64_t ClientId() const
Optional. The Discord application ID for your game. Defaults to the value set by Client::SetApplicati...
AuthorizationArgs(const AuthorizationArgs &arg0)
Copy constructor for AuthorizationArgs.
void SetScopes(std::string Scopes)
Setter for AuthorizationArgs::Scopes.
static const AuthorizationArgs nullobj
Uninitialized instance of AuthorizationArgs.
Definition discordpp.h:1602
void SetClientId(uint64_t ClientId)
Setter for AuthorizationArgs::ClientId.
std::optional< std::string > CustomSchemeParam() const
Custom URI scheme for mobile redirects.
std::optional< discordpp::IntegrationType > IntegrationType() const
The type of integration the app will be installed as.
void SetCodeChallenge(std::optional< discordpp::AuthorizationCodeChallenge > CodeChallenge)
Setter for AuthorizationArgs::CodeChallenge.
AuthorizationArgs(AuthorizationArgs &&other) noexcept
Move constructor for AuthorizationArgs.
AuthorizationArgs & operator=(const AuthorizationArgs &arg0)
Copy assignment operator for AuthorizationArgs.
std::string Scopes() const
Scopes is a space separated string of the oauth scopes your game is requesting.
void SetNonce(std::optional< std::string > Nonce)
Setter for AuthorizationArgs::Nonce.
void SetState(std::optional< std::string > State)
Setter for AuthorizationArgs::State.
Struct that encapsulates the challenge part of the code verification flow.
Definition discordpp.h:1491
discordpp::AuthenticationCodeChallengeMethod Method() const
The method used to generate the challenge. The only method used by the SDK is sha256.
AuthorizationCodeChallenge(const AuthorizationCodeChallenge &arg0)
Copy constructor for AuthorizationCodeChallenge.
std::string Challenge() const
The challenge value.
AuthorizationCodeChallenge & operator=(AuthorizationCodeChallenge &&other) noexcept
Move assignment operator for AuthorizationCodeChallenge.
void SetMethod(discordpp::AuthenticationCodeChallengeMethod Method)
Setter for AuthorizationCodeChallenge::Method.
static const AuthorizationCodeChallenge nullobj
Uninitialized instance of AuthorizationCodeChallenge.
Definition discordpp.h:1511
AuthorizationCodeChallenge & operator=(const AuthorizationCodeChallenge &arg0)
Copy assignment operator for AuthorizationCodeChallenge.
AuthorizationCodeChallenge(AuthorizationCodeChallenge &&other) noexcept
Move constructor for AuthorizationCodeChallenge.
void SetChallenge(std::string Challenge)
Setter for AuthorizationCodeChallenge::Challenge.
Struct that encapsulates both parts of the code verification flow.
Definition discordpp.h:1538
AuthorizationCodeVerifier(const AuthorizationCodeVerifier &arg0)
Copy constructor for AuthorizationCodeVerifier.
AuthorizationCodeVerifier & operator=(const AuthorizationCodeVerifier &arg0)
Copy assignment operator for AuthorizationCodeVerifier.
void SetVerifier(std::string Verifier)
Setter for AuthorizationCodeVerifier::Verifier.
AuthorizationCodeVerifier(AuthorizationCodeVerifier &&other) noexcept
Move constructor for AuthorizationCodeVerifier.
std::string Verifier() const
The verifier part of the code verification flow.
void SetChallenge(discordpp::AuthorizationCodeChallenge Challenge)
Setter for AuthorizationCodeVerifier::Challenge.
static const AuthorizationCodeVerifier nullobj
Uninitialized instance of AuthorizationCodeVerifier.
Definition discordpp.h:1558
discordpp::AuthorizationCodeChallenge Challenge() const
The challenge part of the code verification flow.
AuthorizationCodeVerifier & operator=(AuthorizationCodeVerifier &&other) noexcept
Move assignment operator for AuthorizationCodeVerifier.
Convenience class that represents the state of a single Discord call in a lobby.
Definition discordpp.h:5024
std::optional< discordpp::VoiceStateHandle > GetVoiceStateHandle(uint64_t userId) const
Accesses the voice state for a single user so you can know if they have muted or deafened themselves.
std::vector< uint64_t > GetParticipants() const
Returns a list of the user IDs of the participants in the call.
CallInfoHandle & operator=(const CallInfoHandle &other)
Copy assignment operator for CallInfoHandle.
CallInfoHandle(const CallInfoHandle &other)
Copy constructor for CallInfoHandle.
CallInfoHandle & operator=(CallInfoHandle &&other) noexcept
Move assignment operator for CallInfoHandle.
uint64_t GuildId() const
Returns the lobby ID of the call.
static const CallInfoHandle nullobj
Uninitialized instance of CallInfoHandle.
Definition discordpp.h:5043
CallInfoHandle(CallInfoHandle &&other) noexcept
Move constructor for CallInfoHandle.
uint64_t ChannelId() const
Returns the lobby ID of the call.
Class that manages an active voice session in a Lobby.
Definition discordpp.h:1843
static std::string ErrorToString(discordpp::Call::Error type)
Converts the Error enum to a string.
Call & operator=(const Call &other)
Copy assignment operator for Call.
void SetSelfDeaf(bool deaf)
Mutes all audio from the currently active call for the current user. They will not be able to hear an...
std::function< void(uint64_t userId, bool isPlayingSound)> OnSpeakingStatusChanged
Callback function for Call::SetSpeakingStatusChangedCallback.
Definition discordpp.h:1904
static const Call nullobj
Uninitialized instance of Call.
Definition discordpp.h:1921
Call(Call &&other) noexcept
Move constructor for Call.
void SetOnVoiceStateChangedCallback(discordpp::Call::OnVoiceStateChanged cb)
Sets a callback function to generally be invoked whenever a field on a VoiceStateHandle object for a ...
Call & operator=(Call &&other) noexcept
Move assignment operator for Call.
discordpp::AudioModeType GetAudioMode()
Returns whether the call is configured to use voice auto detection or push to talk for the current us...
bool GetPTTActive()
Returns whether push to talk is currently active, meaning the user is currently pressing their config...
discordpp::VADThresholdSettings GetVADThreshold() const
Returns the current configuration for void auto detection thresholds. See the description of the VADT...
std::optional< discordpp::VoiceStateHandle > GetVoiceStateHandle(uint64_t userId) const
Returns a reference to the VoiceStateHandle for the user ID of the given call participant.
static std::string StatusToString(discordpp::Call::Status type)
Converts the Status enum to a string.
void SetVADThreshold(bool automatic, float threshold)
Customizes the void auto detection thresholds for picking up activity from a user's mic.
bool GetSelfDeaf()
Returns whether the current user is deafened.
Error
Enum that represents any network errors with the Call.
Definition discordpp.h:1851
@ None
None.
Definition discordpp.h:1854
@ Forbidden
Forbidden.
Definition discordpp.h:1869
@ SignalingConnectionFailed
SignalingConnectionFailed.
Definition discordpp.h:1857
@ SignalingUnexpectedClose
SignalingUnexpectedClose.
Definition discordpp.h:1860
@ JoinTimeout
JoinTimeout.
Definition discordpp.h:1866
@ VoiceConnectionFailed
VoiceConnectionFailed.
Definition discordpp.h:1863
Status
Enum that respresents the state of the Call's network connection.
Definition discordpp.h:1873
@ Disconnecting
Disconnecting.
Definition discordpp.h:1894
@ Connected
Connected.
Definition discordpp.h:1888
@ Reconnecting
Reconnecting.
Definition discordpp.h:1891
@ Connecting
Connecting.
Definition discordpp.h:1882
@ SignalingConnected
SignalingConnected.
Definition discordpp.h:1885
@ Disconnected
Disconnected.
Definition discordpp.h:1876
@ Joining
Joining.
Definition discordpp.h:1879
void SetLocalMute(uint64_t userId, bool mute)
Locally mutes the given userId, so that the current user cannot hear them anymore.
void SetSpeakingStatusChangedCallback(discordpp::Call::OnSpeakingStatusChanged cb)
Sets a callback function to be invoked whenever a user starts or stops speaking and is passed in the ...
std::function< void(discordpp::Call::Status status, discordpp::Call::Error error, int32_t errorDetail)> OnStatusChanged
Callback function for Call::SetStatusChangedCallback.
Definition discordpp.h:1907
uint32_t GetPTTReleaseDelay()
Returns the time that PTT is active after the user releases the PTT key and SetPTTActive(false) is ca...
uint64_t GetGuildId() const
Returns the ID of the lobby with which this call is associated.
Call(const Call &other)
Copy constructor for Call.
void SetPTTActive(bool active)
When push to talk is enabled, this should be called whenever the user pushes or releases their config...
void SetParticipantChangedCallback(discordpp::Call::OnParticipantChanged cb)
Sets a callback function to be invoked whenever some joins or leaves a voice call.
std::vector< uint64_t > GetParticipants() const
Returns a list of all of the user IDs of the participants in the call.
bool GetSelfMute()
Returns whether the current user's microphone is muted.
void SetPTTReleaseDelay(uint32_t releaseDelayMs)
If set, extends the time that PTT is active after the user releases the PTT key and SetPTTActive(fals...
discordpp::Call::Status GetStatus() const
Returns the current call status.
std::function< void(uint64_t userId, bool added)> OnParticipantChanged
Callback function for Call::SetParticipantChangedCallback.
Definition discordpp.h:1901
void SetParticipantVolume(uint64_t userId, float volume)
Locally changes the playout volume of the given userId.
void SetStatusChangedCallback(discordpp::Call::OnStatusChanged cb)
Sets a callback function to be invoked when the call status changes, such as when it fully connects o...
void SetAudioMode(discordpp::AudioModeType audioMode)
Sets whether to use voice auto detection or push to talk for the current user on this call.
bool GetLocalMute(uint64_t userId)
Returns whether the current user has locally muted the given userId for themselves.
float GetParticipantVolume(uint64_t userId)
Returns the locally set playout volume of the given userId.
void SetSelfMute(bool mute)
Mutes the current user's microphone so that no other participant in their active calls can hear them.
std::function< void(uint64_t userId)> OnVoiceStateChanged
Callback function for Call::SetOnVoiceStateChangedCallback.
Definition discordpp.h:1898
uint64_t GetChannelId() const
Returns the ID of the lobby with which this call is associated.
All messages sent on Discord are done so in a Channel. MessageHandle::ChannelId will contain the ID o...
Definition discordpp.h:2070
ChannelHandle(const ChannelHandle &other)
Copy constructor for ChannelHandle.
ChannelHandle & operator=(const ChannelHandle &other)
Copy assignment operator for ChannelHandle.
static const ChannelHandle nullobj
Uninitialized instance of ChannelHandle.
Definition discordpp.h:2089
uint64_t Id() const
Returns the ID of the channel.
ChannelHandle & operator=(ChannelHandle &&other) noexcept
Move assignment operator for ChannelHandle.
ChannelHandle(ChannelHandle &&other) noexcept
Move constructor for ChannelHandle.
std::vector< uint64_t > Recipients() const
For DMs and GroupDMs, returns the user IDs of the members of the channel. For all other channels retu...
std::string Name() const
Returns the name of the channel.
discordpp::ChannelType Type() const
Returns the type of the channel.
Options for creating a new Client instance.
Definition discordpp.h:3085
discordpp::AudioSystem ExperimentalAudioSystem() const
The audio system to use. Defaults to AudioSystem::Standard.
static const ClientCreateOptions nullobj
Uninitialized instance of ClientCreateOptions.
Definition discordpp.h:3104
ClientCreateOptions & operator=(const ClientCreateOptions &arg0)
Copy assignment operator for ClientCreateOptions.
bool ExperimentalAndroidPreventCommsForBluetooth() const
Whether to prevent communications mode on Android when Bluetooth is connected.
std::string WebBase() const
The base URL for the Discord web application.
std::string ApiBase() const
The base URL for the Discord API.
void SetApiBase(std::string ApiBase)
Setter for ClientCreateOptions::ApiBase.
ClientCreateOptions(const ClientCreateOptions &arg0)
Copy constructor for ClientCreateOptions.
void SetExperimentalAudioSystem(discordpp::AudioSystem ExperimentalAudioSystem)
Setter for ClientCreateOptions::ExperimentalAudioSystem.
ClientCreateOptions(ClientCreateOptions &&other) noexcept
Move constructor for ClientCreateOptions.
void SetWebBase(std::string WebBase)
Setter for ClientCreateOptions::WebBase.
void SetExperimentalAndroidPreventCommsForBluetooth(bool ExperimentalAndroidPreventCommsForBluetooth)
Setter for ClientCreateOptions::ExperimentalAndroidPreventCommsForBluetooth.
ClientCreateOptions & operator=(ClientCreateOptions &&other) noexcept
Move assignment operator for ClientCreateOptions.
Struct that stores information about the result of an SDK function call.
Definition discordpp.h:1398
void SetRetryable(bool Retryable)
Setter for ClientResult::Retryable.
bool Retryable() const
Indicates if, although an API request failed, it is safe and recommended to retry it.
void SetErrorCode(int32_t ErrorCode)
Setter for ClientResult::ErrorCode.
ClientResult & operator=(const ClientResult &arg0)
Copy assignment operator for ClientResult.
void SetStatus(discordpp::HttpStatusCode Status)
Setter for ClientResult::Status.
std::string Error() const
A description of the error that occurred.
discordpp::ErrorType Type() const
The type of error that occurred. See ErrorType for more information.
void SetResponseBody(std::string ResponseBody)
Setter for ClientResult::ResponseBody.
ClientResult(ClientResult &&other) noexcept
Move constructor for ClientResult.
void SetSuccessful(bool Successful)
Setter for ClientResult::Successful.
std::string ToString() const
Returns the error message if any of the ClientResult.
static const ClientResult nullobj
Uninitialized instance of ClientResult.
Definition discordpp.h:1417
ClientResult & operator=(ClientResult &&other) noexcept
Move assignment operator for ClientResult.
int32_t ErrorCode() const
A more detailed error code for this failure. Currently the only use of this is when an API request is...
void SetRetryAfter(float RetryAfter)
Setter for ClientResult::RetryAfter.
float RetryAfter() const
When a user is being rate limited by Discord (and so status == 429), this field should be set and is ...
std::string ResponseBody() const
The full HTTP response body, which will usually be a JSON string.
discordpp::HttpStatusCode Status() const
The HTTP status code of the API call.
void SetError(std::string Error)
Setter for ClientResult::Error.
ClientResult(const ClientResult &arg0)
Copy constructor for ClientResult.
bool Successful() const
Equivalent to type == ErrorType::None.
void SetType(discordpp::ErrorType Type)
Setter for ClientResult::Type.
The Client class is the main entry point for the Discord SDK. All functionality is exposed through th...
Definition discordpp.h:3159
std::function< void(discordpp::ClientResult result)> UnmergeIntoProvisionalAccountCallback
Callback function for the Client::UnmergeIntoProvisionalAccount method.
Definition discordpp.h:3332
std::function< void(std::vector< discordpp::AudioDevice > devices)> GetOutputDevicesCallback
Callback function for Client::GetOutputDevices.
Definition discordpp.h:3256
std::function< void(discordpp::ClientResult result, std::string inviteUrl)> JoinLinkedLobbyGuildCallback
Callback function for Client::JoinLinkedLobbyGuild.
Definition discordpp.h:3414
bool RegisterLaunchCommand(uint64_t applicationId, std::string command)
When a user accepts an activity invite for your game within the Discord client, Discord needs to know...
void SetRelationshipCreatedCallback(discordpp::Client::RelationshipCreatedCallback cb)
Sets a callback to be invoked whenever a relationship for this user is established or changes type.
void GetUserMessagesWithLimit(uint64_t recipientId, int32_t limit, discordpp::Client::UserMessagesWithLimitCallback cb)
Retrieves messages from the DM conversation with the specified user.
void GetLobbyMessagesWithLimit(uint64_t lobbyId, int32_t limit, discordpp::Client::GetLobbyMessagesCallback cb)
Retrieves recent messages from the specified lobby.
std::function< void(uint64_t messageId)> MessageCreatedCallback
Callback function for Client::SetMessageCreatedCallback.
Definition discordpp.h:3377
discordpp::Call GetCall(uint64_t channelId)
Returns a reference to the currently active call, if any.
std::function< void(uint64_t userId)> RelationshipGroupsUpdatedCallback
Callback function for Client::SetRelationshipGroupsUpdatedCallback.
Definition discordpp.h:3494
std::function< void(discordpp::ClientResult result)> UpdateRelationshipCallback
Callback function for most other Relationship functions such as Client::SendDiscordFriendRequestById.
Definition discordpp.h:3468
void EndCalls(discordpp::Client::EndCallsCallback callback)
Ends any active call, if any. Any references you have to Call objects are invalid after they are ende...
static std::string StatusToString(discordpp::Client::Status type)
Converts the Status enum to a string.
void Disconnect()
Asynchronously disconnects the client.
void SendDiscordFriendRequest(std::string const &username, discordpp::Client::SendFriendRequestCallback cb)
Sends a Discord friend request to the target user.
void RefreshToken(uint64_t applicationId, std::string const &refreshToken, discordpp::Client::TokenExchangeCallback callback)
Generates a new access token for the current user from a refresh token.
void SendLobbyMessageWithMetadata(uint64_t lobbyId, std::string const &content, std::unordered_map< std::string, std::string > const &metadata, discordpp::Client::SendUserMessageCallback cb)
Variant of Client::SendLobbyMessage that also accepts metadata to be sent with the message.
void SetEchoCancellation(bool on)
Enables or disables the basic echo cancellation provided by the WebRTC library.
void GetInputDevices(discordpp::Client::GetInputDevicesCallback cb)
Asynchronously fetches the list of audio input devices available to the user.
void CancelGameFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Cancels an outgoing game friend request to the target user.
void AbortGetTokenFromDevice()
This function is used to abort/cleanup the device authorization flow.
bool SetLogDir(std::string const &path, discordpp::LoggingSeverity minSeverity)
Causes logs generated by the SDK to be written to disk in the specified directory.
void OpenConnectedGamesSettingsInDiscord(discordpp::Client::OpenConnectedGamesSettingsInDiscordCallback callback)
Opens the Connected Games settings in the Discord client, which is where users can manage their setti...
void SetAuthorizeDeviceScreenClosedCallback(discordpp::Client::AuthorizeDeviceScreenClosedCallback cb)
Sets a callback function to be invoked when the device authorization screen is closed.
void SetMessageCreatedCallback(discordpp::Client::MessageCreatedCallback cb)
Sets a callback to be invoked whenever a new message is received in either a lobby or a DM.
std::function< void(discordpp::ClientResult result)> UpdateProvisionalAccountDisplayNameCallback
Callback function for Client::UpdateProvisionalAccountDisplayName.
Definition discordpp.h:3336
std::function< void(bool inputDetected)> NoAudioInputCallback
Callback function for Client::SetNoAudioInputCallback.
Definition discordpp.h:3268
void UnlinkChannelFromLobby(uint64_t lobbyId, discordpp::Client::LinkOrUnlinkChannelCallback callback)
Removes any existing channel link from the specified lobby.
std::function< void()> ProvisionalUserMergeRequiredCallback
Callback function for when Client::ProvisionalUserMergeCompleted completes.
Definition discordpp.h:3365
void SetMessageDeletedCallback(discordpp::Client::MessageDeletedCallback cb)
Sets a callback to be invoked whenever a message is deleted.
void DeleteUserMessage(uint64_t recipientId, uint64_t messageId, discordpp::Client::DeleteUserMessageCallback cb)
Deletes the specified message sent by the current user to the specified recipient.
void SetVoiceParticipantChangedCallback(discordpp::Client::VoiceParticipantChangedCallback cb)
Callback invoked whenever a user in a lobby joins or leaves a voice call.
void UnmergeIntoProvisionalAccount(uint64_t applicationId, discordpp::AuthenticationExternalAuthType externalAuthType, std::string const &externalAuthToken, discordpp::Client::UnmergeIntoProvisionalAccountCallback callback)
This function is used to unlink/unmerge a external identity from a Discord account....
std::function< void(discordpp::ClientResult result, std::vector< discordpp::GuildMinimal > guilds)> GetUserGuildsCallback
Callback function for Client::GetUserGuilds.
Definition discordpp.h:3410
Client(std::string apiBase, std::string webBase)
Creates a new instance of the Client but allows customizing the Discord URL to use.
void RevokeToken(uint64_t applicationId, std::string const &token, discordpp::Client::RevokeTokenCallback callback)
Revoke all application access/refresh tokens associated with a user with any valid access/refresh tok...
void LinkChannelToLobby(uint64_t lobbyId, uint64_t channelId, discordpp::Client::LinkOrUnlinkChannelCallback callback)
Links the specified channel on Discord to the specified in-game lobby.
std::function< void(uint64_t lobbyId)> LobbyDeletedCallback
Callback function for Client::SetLobbyDeletedCallback.
Definition discordpp.h:3427
std::function< void(std::string message, discordpp::LoggingSeverity severity)> LogCallback
Callback function invoked when a new log message is generated.
Definition discordpp.h:3386
void SetDeviceChangeCallback(discordpp::Client::DeviceChangeCallback callback)
Sets a callback function to be invoked when Discord detects a change in the available audio devices.
void GetUserMessageSummaries(discordpp::Client::UserMessageSummariesCallback cb)
Retrieves message conversation summaries for all users the current user has DM conversations with.
std::function< void(discordpp::ClientResult result)> LinkOrUnlinkChannelCallback
Callback function for Client::LinkChannelToLobby.
Definition discordpp.h:3421
std::function< void(discordpp::AudioDevice device)> GetCurrentOutputDeviceCallback
Callback function for Client::GetCurrentOutputDevice.
Definition discordpp.h:3249
std::vector< uint64_t > GetLobbyIds() const
Returns a list of all the lobbies that the user is a member of and the SDK has loaded.
void SetUserUpdatedCallback(discordpp::Client::UserUpdatedCallback cb)
The UserUpdatedCallback is invoked whenever any user the current session knows about changes,...
std::function< void()> TokenExpirationCallback
Callback function for Client::SetTokenExpirationCallback.
Definition discordpp.h:3329
std::function< void(discordpp::ClientResult result)> SetOutputDeviceCallback
Callback function for Client::SetOutputDevice.
Definition discordpp.h:3271
void SetAecDump(bool on)
Enables or disables AEC diagnostic recording.
std::function< void(discordpp::ClientResult result, std::optional< discordpp::UserHandle > user)> GetDiscordClientConnectedUserCallback
Callback function for when Client::GetDiscordClientConnectedUser completes.
Definition discordpp.h:3489
void SetActivityInviteCreatedCallback(discordpp::Client::ActivityInviteCallback cb)
Sets a callback function that is invoked when the current user receives an activity invite from anoth...
std::function< void(uint64_t lobbyId, uint64_t memberId)> LobbyMemberUpdatedCallback
Callback function for Client::SetLobbyMemberUpdatedCallback.
Definition discordpp.h:3436
void SendUserMessage(uint64_t recipientId, std::string const &content, discordpp::Client::SendUserMessageCallback cb)
Sends a direct message to the specified user.
Client & operator=(Client &&other) noexcept
Move assignment operator for Client.
void GetTokenFromProvisionalMerge(uint64_t applicationId, std::string const &code, std::string const &codeVerifier, std::string const &redirectUri, discordpp::AuthenticationExternalAuthType externalAuthType, std::string const &externalAuthToken, discordpp::Client::TokenExchangeCallback callback)
This function should be used with the Client::Authorize function whenever a user with a provisional a...
static std::string GetVersionHash()
Returns the git commit hash this version was built from.
bool RegisterLaunchSteamApplication(uint64_t applicationId, uint32_t steamAppId)
When a user accepts an activity invite for your game within the Discord client, Discord needs to know...
void FetchCurrentUser(discordpp::AuthorizationTokenType tokenType, std::string const &token, discordpp::Client::FetchCurrentUserCallback callback)
Fetches basic information about the user associated with the given auth token.
void SetNoAudioInputCallback(discordpp::Client::NoAudioInputCallback callback)
Callback function invoked when the above threshold is set and there is a change in whether audio is b...
std::vector< discordpp::UserHandle > SearchFriendsByUsername(std::string searchStr) const
Searches all of your friends by both username and display name, returning a list of all friends that ...
void SetVoiceLogDir(std::string const &path, discordpp::LoggingSeverity minSeverity)
Causes logs generated by the voice subsystem of the SDK to be written to disk in the specified direct...
std::function< void(uint64_t userId, int16_t *data, uint64_t samplesPerChannel, int32_t sampleRate, uint64_t channels, bool &outShouldMute)> UserAudioReceivedCallback
Callback function for Client::StartCallWithAudioCallbacks.
Definition discordpp.h:3280
std::function< void(discordpp::ClientResult result)> LeaveLobbyCallback
Callback function for Client::LeaveLobby.
Definition discordpp.h:3418
std::function< void(uint64_t lobbyId)> LobbyUpdatedCallback
Callback function for Client::SetLobbyUpdatedCallback.
Definition discordpp.h:3439
void GetTokenFromDevice(discordpp::DeviceAuthorizationArgs args, discordpp::Client::TokenExchangeCallback callback)
This function is a combination of Client::Authorize and Client::GetToken, but is used for the case wh...
void CloseAuthorizeDeviceScreen()
This function is used to hide the device authorization screen and is used for the case where the user...
void SetOpusHardwareCoding(bool encode, bool decode)
Enables or disables hardware encoding and decoding for audio, if it is available.
void JoinLinkedLobbyGuild(uint64_t lobbyId, discordpp::Client::ProvisionalUserMergeRequiredCallback provisionalUserMergeRequiredCallback, discordpp::Client::JoinLinkedLobbyGuildCallback callback)
Invites the current user to the Discord guild of the channel that is linked to the specified lobby....
bool ShowAudioRoutePicker()
On iOS devices, show the system audio route picker.
void SetActivityJoinCallback(discordpp::Client::ActivityJoinCallback cb)
Sets a callback function that is invoked when the current user also has Discord running on their comp...
void GetOutputDevices(discordpp::Client::GetOutputDevicesCallback cb)
Asynchronously fetches the list of audio output devices available to the user.
std::function< void()> AuthorizeDeviceScreenClosedCallback
Callback function for Client::SetAuthorizeDeviceScreenClosedCallback.
Definition discordpp.h:3326
void SetSelfDeafAll(bool deaf)
Mutes all audio from the currently active call for the current user in all calls. They will not be ab...
void ExchangeChildToken(std::string const &parentApplicationToken, uint64_t childApplicationId, discordpp::Client::ExchangeChildTokenCallback callback)
Exchanges a parent application token for a child application token.
std::function< void(discordpp::ClientResult result)> UpdateRichPresenceCallback
Callback function for when Client::UpdateRichPresence completes.
Definition discordpp.h:3464
std::function< void(discordpp::ClientResult result, std::vector< discordpp::MessageHandle > messages)> UserMessagesWithLimitCallback
Callback function for Client::GetUserMessagesWithLimit.
Definition discordpp.h:3360
void CreateOrJoinLobbyWithMetadata(std::string const &secret, std::unordered_map< std::string, std::string > const &lobbyMetadata, std::unordered_map< std::string, std::string > const &memberMetadata, discordpp::Client::CreateOrJoinLobbyCallback callback)
Variant of Client::CreateOrJoinLobby that also accepts developer-supplied metadata.
Client()
Creates a new instance of the Client.
std::function< void(discordpp::ClientResult result)> SendFriendRequestCallback
Callback function for Client::SendDiscordFriendRequest and Client::SendGameFriendRequest.
Definition discordpp.h:3472
std::function< void(discordpp::ClientResult result, std::vector< discordpp::MessageHandle > messages)> GetLobbyMessagesCallback
Callback function for Client::GetLobbyMessagesWithLimit.
Definition discordpp.h:3350
void UpdateToken(discordpp::AuthorizationTokenType tokenType, std::string token, discordpp::Client::UpdateTokenCallback callback)
Asynchronously sets a new auth token for this client to use.
std::function< void(discordpp::Client::Status status, discordpp::Client::Error error, int32_t errorDetail)> OnStatusChanged
Callback function for Client::SetStatusChangedCallback.
Definition discordpp.h:3397
std::function< void(uint64_t applicationId, std::string joinSecret)> ActivityJoinWithApplicationCallback
Callback function for Client::SetActivityJoinWithApplicationCallback.
Definition discordpp.h:3457
void SetOutputVolume(float outputVolume)
Sets the speaker volume for the current user.
std::function< void()> EndCallsCallback
Callback invoked when Client::EndCalls completes.
Definition discordpp.h:3243
void SendGameFriendRequestById(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Sends (or accepts) a game friend request to the target user.
void OpenMessageInDiscord(uint64_t messageId, discordpp::Client::ProvisionalUserMergeRequiredCallback provisionalUserMergeRequiredCallback, discordpp::Client::OpenMessageInDiscordCallback callback)
Opens the given message in the Discord client.
void RemoveGameFriend(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Removes any game friendship between the current user and the target user.
std::vector< discordpp::Call > GetCalls()
Returns a reference to all currently active calls, if any.
std::optional< discordpp::ChannelHandle > GetChannelHandle(uint64_t channelId) const
Returns a reference to the Discord channel object for the given ID.
std::function< void(discordpp::ClientResult result)> RevokeTokenCallback
Callback function for the Client::RevokeToken method.
Definition discordpp.h:3323
void SendActivityJoinRequest(uint64_t userId, discordpp::Client::SendActivityInviteCallback cb)
Requests to join the activity of the specified user.
std::function< void(discordpp::ClientResult result, std::string joinSecret)> AcceptActivityInviteCallback
Callback function for Client::AcceptActivityInvite.
Definition discordpp.h:3442
void RejectDiscordFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Declines an incoming Discord friend request from the target user.
Status
This enum refers to the status of the internal websocket the SDK uses to communicate with Discord The...
Definition discordpp.h:3202
@ Disconnecting
Disconnecting.
Definition discordpp.h:3220
@ Connected
Connected.
Definition discordpp.h:3211
@ HttpWait
HttpWait.
Definition discordpp.h:3223
@ Reconnecting
Reconnecting.
Definition discordpp.h:3217
@ Connecting
Connecting.
Definition discordpp.h:3208
@ Ready
Ready.
Definition discordpp.h:3214
@ Disconnected
Disconnected.
Definition discordpp.h:3205
static std::string GetDefaultCommunicationScopes()
Returns the default set of OAuth2 scopes that should be used with the Discord SDK when making use of ...
void SetRelationshipDeletedCallback(discordpp::Client::RelationshipDeletedCallback cb)
Sets a callback to be invoked whenever a relationship for this user is removed, such as when the user...
void UpdateProvisionalAccountDisplayName(std::string const &name, discordpp::Client::UpdateProvisionalAccountDisplayNameCallback callback)
Updates the display name of a provisional account to the specified name.
static std::string GetDefaultPresenceScopes()
Returns the default set of OAuth2 scopes that should be used with the Discord SDK when leveraging bas...
void SendLobbyMessage(uint64_t lobbyId, std::string const &content, discordpp::Client::SendUserMessageCallback cb)
Sends a message in a lobby chat to all members of the lobby.
std::optional< discordpp::MessageHandle > GetMessageHandle(uint64_t messageId) const
Returns a reference to the Discord message object for the given ID.
float GetOutputVolume()
Returns the output volume for the current user.
std::function< void(discordpp::ClientResult result, std::string accessToken, std::string refreshToken, discordpp::AuthorizationTokenType tokenType, int32_t expiresIn, std::string scopes)> TokenExchangeCallback
Callback function for the token exchange APIs such as Client::GetToken.
Definition discordpp.h:3315
void SetThreadPriority(discordpp::Client::Thread thread, int32_t priority)
Allows setting the priority of various SDK threads.
discordpp::UserHandle GetCurrentUser() const
Returns the user associated with the current client.
std::function< void(discordpp::ClientResult result)> OpenMessageInDiscordCallback
Callback function for when Client::OpenMessageInDiscord completes.
Definition discordpp.h:3368
void GetProvisionalToken(uint64_t applicationId, discordpp::AuthenticationExternalAuthType externalAuthType, std::string const &externalAuthToken, discordpp::Client::TokenExchangeCallback callback)
Provisional accounts are a way for users that have not signed up for Discord to still access SDK func...
void GetCurrentInputDevice(discordpp::Client::GetCurrentInputDeviceCallback cb)
Asynchronously fetches the current audio input device in use by the client.
void SetAutomaticGainControl(bool on)
When enabled, automatically adjusts the microphone volume to keep it clear and consistent.
void EditUserMessage(uint64_t recipientId, uint64_t messageId, std::string const &content, discordpp::Client::EditUserMessageCallback cb)
Edits the specified message sent by the current user to the specified recipient.
std::function< void()> EndCallCallback
Callback invoked when Client::EndCall completes.
Definition discordpp.h:3240
std::function< void(discordpp::ClientResult result)> EditUserMessageCallback
Callback function for Client::EditUserMessage.
Definition discordpp.h:3347
void Connect()
Asynchronously connects the client to Discord.
void SetLobbyDeletedCallback(discordpp::Client::LobbyDeletedCallback cb)
Sets a callback to be invoked when a lobby is no longer available.
void GetDiscordClientConnectedUser(uint64_t applicationId, discordpp::Client::GetDiscordClientConnectedUserCallback callback) const
If the Discord app is running on the user's computer and the SDK establishes a connection to it,...
static int32_t GetVersionPatch()
Returns the patch version of the Discord Social SDK.
void CreateOrJoinLobby(std::string const &secret, discordpp::Client::CreateOrJoinLobbyCallback callback)
Joins the user to the specified lobby, creating one if it does not exist.
void LeaveLobby(uint64_t lobbyId, discordpp::Client::LeaveLobbyCallback callback)
Removes the current user from the specified lobby.
float GetInputVolume()
Returns the input volume for the current user's microphone.
std::function< void(discordpp::ClientResult result)> SetInputDeviceCallback
Callback function for Client::SetInputDevice.
Definition discordpp.h:3265
void SetLobbyMemberRemovedCallback(discordpp::Client::LobbyMemberRemovedCallback cb)
Sets a callback function to be invoked whenever a member of a lobby is removed and can no longer conn...
Client(Client &&other) noexcept
Move constructor for Client.
static std::string GetDefaultAudioDeviceId()
Returns the ID of the system default audio device if the user has not explicitly chosen one.
void CancelDiscordFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Cancels an outgoing Discord friend request to the target user.
std::function< void(uint64_t lobbyId, uint64_t memberId)> LobbyMemberAddedCallback
Callback function for Client::SetLobbyMemberAddedCallback.
Definition discordpp.h:3430
void SetOnlineStatus(discordpp::StatusType status, discordpp::Client::UpdateStatusCallback callback)
Sets whether a user is online/invisible/idle/dnd on Discord.
void ClearRichPresence()
Clears the right presence for the current user.
void SetSelfMuteAll(bool mute)
Mutes the current user's microphone so that no other participant in their active calls can hear them ...
void SetStatusChangedCallback(discordpp::Client::OnStatusChanged cb)
Sets a callback function to be invoked whenever the SDKs status changes.
std::function< void(discordpp::ActivityInvite invite)> ActivityInviteCallback
Callback function for Client::SetActivityInviteCreatedCallback and Client::SetActivityInviteUpdatedCa...
Definition discordpp.h:3451
std::vector< discordpp::RelationshipHandle > GetRelationshipsByGroup(discordpp::RelationshipGroupType groupType) const
Returns a list of relationships that belong to the specified relationship group type....
std::function< void(discordpp::ClientResult result)> UpdateTokenCallback
Callback invoked when Client::UpdateToken completes. Once this is done it is safe to call Client::Con...
Definition discordpp.h:3341
void SetMessageUpdatedCallback(discordpp::Client::MessageUpdatedCallback cb)
Sets a callback to be invoked whenever a message is edited.
void SetOutputDevice(std::string deviceId, discordpp::Client::SetOutputDeviceCallback cb)
Asynchronously changes the audio output device in use by the client to the specified device....
void SendUserMessageWithMetadata(uint64_t recipientId, std::string const &content, std::unordered_map< std::string, std::string > const &metadata, discordpp::Client::SendUserMessageCallback cb)
Variant of Client::SendUserMessage that also accepts metadata to be sent with the message.
std::function< void(uint64_t lobbyId)> LobbyCreatedCallback
Callback function for Client::SetLobbyCreatedCallback.
Definition discordpp.h:3424
void RemoveDiscordAndGameFriend(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Removes any friendship between the current user and the target user. This function will remove BOTH a...
std::function< void(uint64_t lobbyId, uint64_t memberId)> LobbyMemberRemovedCallback
Callback function for Client::SetLobbyMemberRemovedCallback.
Definition discordpp.h:3433
void SetTokenExpirationCallback(discordpp::Client::TokenExpirationCallback callback)
Get a notification when the current token is about to expire or expired.
void GetUserGuilds(discordpp::Client::GetUserGuildsCallback cb)
Fetches all of the guilds (also known as Discord servers) that the current user is a member of.
void SetGameWindowPid(int32_t pid)
When users are linking their account with Discord, which involves an OAuth2 flow, the SDK can streaml...
void GetToken(uint64_t applicationId, std::string const &code, std::string const &codeVerifier, std::string const &redirectUri, discordpp::Client::TokenExchangeCallback callback)
Exchanges an authorization code that was returned from the Client::Authorize function for an access t...
std::function< void(discordpp::ClientResult result, std::string code, std::string redirectUri)> AuthorizationCallback
Callback invoked when the Authorize function completes.
Definition discordpp.h:3299
void SetActivityInviteUpdatedCallback(discordpp::Client::ActivityInviteCallback cb)
Sets a callback function that is invoked when an existing activity invite changes....
void SetNoAudioInputThreshold(float dBFSThreshold)
Threshold that can be set to indicate when no audio is being received by the user's mic.
std::function< void(std::string joinSecret)> ActivityJoinCallback
Callback function for Client::SetActivityJoinCallback.
Definition discordpp.h:3454
static std::string ErrorToString(discordpp::Client::Error type)
Converts the Error enum to a string.
std::optional< discordpp::UserHandle > GetUser(uint64_t userId) const
Returns the UserHandle associated with the given user ID.
discordpp::RelationshipHandle GetRelationshipHandle(uint64_t userId) const
Returns the RelationshipHandle that corresponds to the relationship between the current user and the ...
std::function< void(discordpp::ClientResult result)> SendActivityInviteCallback
Callback function for Client::SendActivityInvite, Client::SendActivityJoinRequest,...
Definition discordpp.h:3447
discordpp::AuthorizationCodeVerifier CreateAuthorizationCodeVerifier()
Helper function that can create a code challenge and verifier for use in the Client::Authorize + Clie...
std::function< void(uint64_t lobbyId, uint64_t memberId, bool added)> VoiceParticipantChangedCallback
Callback function for Client::SetVoiceParticipantChangedCallback.
Definition discordpp.h:3274
discordpp::Call StartCallWithAudioCallbacks(uint64_t lobbyId, discordpp::Client::UserAudioReceivedCallback receivedCb, discordpp::Client::UserAudioCapturedCallback capturedCb)
Starts or joins a call in the specified lobby.
uint64_t GetApplicationId()
This function is used to get the application ID for the client. This is used to identify the applicat...
std::function< void(uint64_t userId, bool isDiscordRelationshipUpdate)> RelationshipDeletedCallback
Callback function for Client::SetRelationshipDeletedCallback.
Definition discordpp.h:3485
bool GetSelfDeafAll() const
Returns whether the current user is deafened in all calls.
bool SetSpeakerMode(bool speakerMode)
(deprecated) On mobile devices, enable speakerphone mode.
static int32_t GetVersionMinor()
Returns the minor version of the Discord Social SDK.
void AddVoiceLogCallback(discordpp::Client::LogCallback callback, discordpp::LoggingSeverity minSeverity)
Adds a callback function to be invoked for each new log message generated by the voice subsystem of t...
void AbortAuthorize()
This will abort the authorize flow if it is in progress and tear down any associated state.
Error
Represents an error state for the socket connection that the Discord SDK maintains with the Discord b...
Definition discordpp.h:3173
@ None
None.
Definition discordpp.h:3176
@ ConnectionCanceled
ConnectionCanceled.
Definition discordpp.h:3185
@ ConnectionFailed
ConnectionFailed.
Definition discordpp.h:3179
@ UnexpectedClose
UnexpectedClose.
Definition discordpp.h:3182
void UnblockUser(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Unblocks the target user. Does not restore any old relationship between the users though.
void SetShowingChat(bool showingChat)
Sets whether chat messages are currently being shown in the game.
static int32_t GetVersionMajor()
Returns the major version of the Discord Social SDK.
std::function< void(discordpp::ClientResult result, uint64_t messageId)> SendUserMessageCallback
This is used for all kinds of 'send message' calls despite the name, to make sure engine bindings use...
Definition discordpp.h:3373
std::function< void(discordpp::AudioDevice device)> GetCurrentInputDeviceCallback
Callback function for Client::GetCurrentInputDevice.
Definition discordpp.h:3246
void SetLobbyCreatedCallback(discordpp::Client::LobbyCreatedCallback cb)
Sets a callback to be invoked when a lobby "becomes available" to the client.
void Authorize(discordpp::AuthorizationArgs args, discordpp::Client::AuthorizationCallback callback)
Initiates an OAuth2 flow for a user to "sign in with Discord". This flow is intended for desktop and ...
std::function< void(uint64_t userId)> UserUpdatedCallback
Callback function for Client::SetUserUpdatedCallback.
Definition discordpp.h:3497
void AcceptActivityInvite(discordpp::ActivityInvite invite, discordpp::Client::AcceptActivityInviteCallback cb)
Accepts an activity invite that the current user has received.
void SetInputDevice(std::string deviceId, discordpp::Client::SetInputDeviceCallback cb)
Asynchronously changes the audio input device in use by the client to the specified device....
void RejectGameFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Declines an incoming game friend request from the target user.
void SetInputVolume(float inputVolume)
Sets the microphone volume for the current user.
void SetApplicationId(uint64_t applicationId)
This function is used to set the application ID for the client. This is used to identify the applicat...
std::vector< discordpp::RelationshipHandle > GetRelationships() const
Returns a list of all of the relationships the current user has with others, including all Discord re...
std::function< void(uint64_t messageId, uint64_t channelId)> MessageDeletedCallback
Callback function for Client::SetMessageDeletedCallback.
Definition discordpp.h:3380
void SetLobbyUpdatedCallback(discordpp::Client::LobbyUpdatedCallback cb)
Sets a callback to be invoked when a lobby is edited, for example if the lobby's metadata is changed.
std::function< void(discordpp::ClientResult result)> OpenConnectedGamesSettingsInDiscordCallback
Callback function for when Client::OpenConnectedGamesSettingsInDiscord completes.
Definition discordpp.h:3390
Thread
Represents the type of thread to control thread priority on.
Definition discordpp.h:3227
@ Client
Client.
Definition discordpp.h:3230
@ Voice
Voice.
Definition discordpp.h:3233
@ Network
Network.
Definition discordpp.h:3236
void SendActivityJoinRequestReply(discordpp::ActivityInvite invite, discordpp::Client::SendActivityInviteCallback cb)
When another user requests to join the current user's party, this function is called to to allow that...
void GetGuildChannels(uint64_t guildId, discordpp::Client::GetGuildChannelsCallback cb)
Fetches all of the channels that the current user can access in the given guild.
static std::string ThreadToString(discordpp::Client::Thread type)
Converts the Thread enum to a string.
void BlockUser(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Blocks the target user so that they cannot send the user friend or activity invites and cannot messag...
std::function< void(uint64_t messageId)> MessageUpdatedCallback
Callback function for Client::SetMessageUpdatedCallback.
Definition discordpp.h:3383
void SetEngineManagedAudioSession(bool isEngineManaged)
On mobile devices, set whether the audio environment is managed by the engine or the SDK....
void SetLobbyMemberUpdatedCallback(discordpp::Client::LobbyMemberUpdatedCallback cb)
Sets a callback function to be invoked whenever a member of a lobby is changed.
void SetActivityJoinWithApplicationCallback(discordpp::Client::ActivityJoinWithApplicationCallback cb)
Sets a callback function that is invoked when the current user also has Discord running on their comp...
bool GetSelfMuteAll() const
Returns whether the current user's microphone is muted in all calls.
std::function< void(uint64_t userId, bool isDiscordRelationshipUpdate)> RelationshipCreatedCallback
Callback function for Client::SetRelationshipCreatedCallback.
Definition discordpp.h:3478
std::function< void(discordpp::ClientResult result)> DeleteUserMessageCallback
Callback function for Client::DeleteUserMessage.
Definition discordpp.h:3344
std::function< void(discordpp::ClientResult result, std::string accessToken, discordpp::AuthorizationTokenType tokenType, int32_t expiresIn, std::string scopes)> ExchangeChildTokenCallback
Callback function for Client::ExchangeChildToken.
Definition discordpp.h:3303
bool CanOpenMessageInDiscord(uint64_t messageId)
Returns true if the given message is able to be viewed in a Discord client.
void SetNoiseSuppression(bool on)
Enables basic background noise suppression.
std::optional< discordpp::UserHandle > GetCurrentUserV2() const
Returns the UserHandle associated with the current user, if one is available.
void SetLobbyMemberAddedCallback(discordpp::Client::LobbyMemberAddedCallback cb)
Sets a callback function to be invoked whenever a user is added to a lobby.
void GetCurrentOutputDevice(discordpp::Client::GetCurrentOutputDeviceCallback cb)
Asynchronously fetches the current audio output device in use by the client.
void SetHttpRequestTimeout(int32_t httpTimeoutInMilliseconds)
This function is used to override the default HTTP timeout for the websocket client.
void EndCall(uint64_t channelId, discordpp::Client::EndCallCallback callback)
Ends any active call, if any. Any references you have to Call objects are invalid after they are ende...
void AcceptGameFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Accepts an incoming game friend request from the target user.
std::function< void(discordpp::ClientResult result, uint64_t id, std::string name)> FetchCurrentUserCallback
Callback function for Client::FetchCurrentUser.
Definition discordpp.h:3311
std::function< void(discordpp::ClientResult result, std::vector< discordpp::GuildChannel > guildChannels)> GetGuildChannelsCallback
Callback function for Client::GetGuildChannels.
Definition discordpp.h:3405
std::function< void(discordpp::ClientResult result)> UpdateStatusCallback
Callback function for when Client::SetOnlineStatus completes.
Definition discordpp.h:3461
std::optional< discordpp::LobbyHandle > GetLobbyHandle(uint64_t lobbyId) const
Returns a reference to the Discord lobby object for the given ID.
std::function< void(discordpp::ClientResult result, uint64_t lobbyId)> CreateOrJoinLobbyCallback
Callback function for Client::CreateOrJoinLobby.
Definition discordpp.h:3401
std::function< void(discordpp::ClientResult result, std::vector< discordpp::UserMessageSummary > summaries)> UserMessageSummariesCallback
Callback function for Client::GetUserMessageSummaries.
Definition discordpp.h:3355
discordpp::Call StartCall(uint64_t channelId)
Starts or joins a call in the lobby specified by channelId (For a lobby, simply pass in the lobbyId).
void UpdateRichPresence(discordpp::Activity activity, discordpp::Client::UpdateRichPresenceCallback cb)
Updates the rich presence for the current user.
void SetRelationshipGroupsUpdatedCallback(discordpp::Client::RelationshipGroupsUpdatedCallback cb)
The RelationshipGroupsUpdatedCallback is invoked whenever any user in the friends list changes....
Client(discordpp::ClientCreateOptions options)
Creates a new instance of the Client with custom options.
void OpenAuthorizeDeviceScreen(uint64_t clientId, std::string const &userCode)
This function is used to show the device authorization screen and is used for the case where the user...
std::function< void(int16_t *data, uint64_t samplesPerChannel, int32_t sampleRate, uint64_t channels)> UserAudioCapturedCallback
Callback function for Client::StartCallWithAudioCallbacks.
Definition discordpp.h:3290
std::function< void(std::vector< discordpp::AudioDevice > inputDevices, std::vector< discordpp::AudioDevice > outputDevices)> DeviceChangeCallback
Callback function for Client::SetDeviceChangeCallback.
Definition discordpp.h:3260
void AddLogCallback(discordpp::Client::LogCallback callback, discordpp::LoggingSeverity minSeverity)
Adds a callback function to be invoked for each new log message generated by the SDK.
void ProvisionalUserMergeCompleted(bool success)
Some functions don't work for provisional accounts, and require the user merge their account into a f...
void AcceptDiscordFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Accepts an incoming Discord friend request from the target user.
void SendDiscordFriendRequestById(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Sends a Discord friend request to the target user.
void SendGameFriendRequest(std::string const &username, discordpp::Client::SendFriendRequestCallback cb)
Sends (or accepts) a game friend request to the target user.
void SendActivityInvite(uint64_t userId, std::string const &content, discordpp::Client::SendActivityInviteCallback cb)
Sends a Discord activity invite to the specified user.
std::function< void(std::vector< discordpp::AudioDevice > devices)> GetInputDevicesCallback
Callback function for Client::GetInputDevices.
Definition discordpp.h:3252
void GetTokenFromDeviceProvisionalMerge(discordpp::DeviceAuthorizationArgs args, discordpp::AuthenticationExternalAuthType externalAuthType, std::string const &externalAuthToken, discordpp::Client::TokenExchangeCallback callback)
This function is a combination of Client::Authorize and Client::GetTokenFromProvisionalMerge,...
bool IsAuthenticated()
Returns true if the SDK has a non-empty OAuth2 token set, regardless of whether that token is valid o...
static const Client nullobj
Uninitialized instance of Client.
Definition discordpp.h:3510
discordpp::Client::Status GetStatus() const
Returns the current status of the client, see the Status enum for an explanation of the possible valu...
Arguments to the Client::GetTokenFromDevice function.
Definition discordpp.h:1689
DeviceAuthorizationArgs(DeviceAuthorizationArgs &&other) noexcept
Move constructor for DeviceAuthorizationArgs.
DeviceAuthorizationArgs(const DeviceAuthorizationArgs &arg0)
Copy constructor for DeviceAuthorizationArgs.
uint64_t ClientId() const
Optional. The Discord application ID for your game. Defaults to the value set by Client::SetApplicati...
static const DeviceAuthorizationArgs nullobj
Uninitialized instance of DeviceAuthorizationArgs.
Definition discordpp.h:1709
void SetClientId(uint64_t ClientId)
Setter for DeviceAuthorizationArgs::ClientId.
void SetScopes(std::string Scopes)
Setter for DeviceAuthorizationArgs::Scopes.
DeviceAuthorizationArgs & operator=(const DeviceAuthorizationArgs &arg0)
Copy assignment operator for DeviceAuthorizationArgs.
std::string Scopes() const
Scopes is a space separated string of the oauth scopes your game is requesting.
DeviceAuthorizationArgs & operator=(DeviceAuthorizationArgs &&other) noexcept
Move assignment operator for DeviceAuthorizationArgs.
void SetIsLinkable(bool IsLinkable)
Setter for GuildChannel::IsLinkable.
bool IsViewableAndWriteableByAllMembers() const
Whether the channel is "fully public" which means every member of the guild is able to view and send ...
std::optional< discordpp::LinkedLobby > LinkedLobby() const
Information about the currently linked lobby, if any. Currently Discord enforces that a channel can o...
uint64_t Id() const
The id of the channel.
void SetName(std::string Name)
Setter for GuildChannel::Name.
GuildChannel(const GuildChannel &arg0)
Copy constructor for GuildChannel.
void SetId(uint64_t Id)
Setter for GuildChannel::Id.
std::string Name() const
The name of the channel.
GuildChannel & operator=(const GuildChannel &arg0)
Copy assignment operator for GuildChannel.
GuildChannel & operator=(GuildChannel &&other) noexcept
Move assignment operator for GuildChannel.
GuildChannel(GuildChannel &&other) noexcept
Move constructor for GuildChannel.
bool IsLinkable() const
Whether the current user is able to link this channel to a lobby.
void SetLinkedLobby(std::optional< discordpp::LinkedLobby > LinkedLobby)
Setter for GuildChannel::LinkedLobby.
void SetIsViewableAndWriteableByAllMembers(bool IsViewableAndWriteableByAllMembers)
Setter for GuildChannel::IsViewableAndWriteableByAllMembers.
static const GuildChannel nullobj
Uninitialized instance of GuildChannel.
Definition discordpp.h:2185
void SetName(std::string Name)
Setter for GuildMinimal::Name.
std::string Name() const
The name of the guild.
void SetId(uint64_t Id)
Setter for GuildMinimal::Id.
static const GuildMinimal nullobj
Uninitialized instance of GuildMinimal.
Definition discordpp.h:2140
GuildMinimal & operator=(GuildMinimal &&other) noexcept
Move assignment operator for GuildMinimal.
GuildMinimal & operator=(const GuildMinimal &arg0)
Copy assignment operator for GuildMinimal.
GuildMinimal(const GuildMinimal &arg0)
Copy constructor for GuildMinimal.
GuildMinimal(GuildMinimal &&other) noexcept
Move constructor for GuildMinimal.
uint64_t Id() const
The id of the guild.
Struct that stores information about the channel that a lobby is linked to.
Definition discordpp.h:2293
uint64_t GuildId() const
The id of the guild (aka server) that owns the linked channel.
void SetName(std::string Name)
Setter for LinkedChannel::Name.
LinkedChannel & operator=(LinkedChannel &&other) noexcept
Move assignment operator for LinkedChannel.
LinkedChannel & operator=(const LinkedChannel &arg0)
Copy assignment operator for LinkedChannel.
std::string Name() const
The name of the linked channel.
void SetGuildId(uint64_t GuildId)
Setter for LinkedChannel::GuildId.
static const LinkedChannel nullobj
Uninitialized instance of LinkedChannel.
Definition discordpp.h:2312
LinkedChannel(const LinkedChannel &arg0)
Copy constructor for LinkedChannel.
void SetId(uint64_t Id)
Setter for LinkedChannel::Id.
uint64_t Id() const
The id of the linked channel.
LinkedChannel(LinkedChannel &&other) noexcept
Move constructor for LinkedChannel.
Struct that stores information about the lobby linked to a channel.
Definition discordpp.h:2247
LinkedLobby & operator=(const LinkedLobby &arg0)
Copy assignment operator for LinkedLobby.
LinkedLobby(const LinkedLobby &arg0)
Copy constructor for LinkedLobby.
uint64_t ApplicationId() const
The ID of the application that owns the lobby.
void SetLobbyId(uint64_t LobbyId)
Setter for LinkedLobby::LobbyId.
static const LinkedLobby nullobj
Uninitialized instance of LinkedLobby.
Definition discordpp.h:2266
void SetApplicationId(uint64_t ApplicationId)
Setter for LinkedLobby::ApplicationId.
LinkedLobby & operator=(LinkedLobby &&other) noexcept
Move assignment operator for LinkedLobby.
uint64_t LobbyId() const
The ID of the lobby.
LinkedLobby(LinkedLobby &&other) noexcept
Move constructor for LinkedLobby.
A LobbyHandle represents a single lobby in the SDK. A lobby can be thought of as just an arbitrary,...
Definition discordpp.h:2702
LobbyHandle(LobbyHandle &&other) noexcept
Move constructor for LobbyHandle.
std::optional< discordpp::LinkedChannel > LinkedChannel() const
Returns information about the channel linked to this lobby, if any.
static const LobbyHandle nullobj
Uninitialized instance of LobbyHandle.
Definition discordpp.h:2721
LobbyHandle & operator=(const LobbyHandle &other)
Copy assignment operator for LobbyHandle.
std::optional< discordpp::CallInfoHandle > GetCallInfoHandle() const
Returns a reference to the CallInfoHandle if there is an active voice call in this lobby.
std::unordered_map< std::string, std::string > Metadata() const
Returns any developer supplied metadata for this lobby.
std::optional< discordpp::LobbyMemberHandle > GetLobbyMemberHandle(uint64_t memberId) const
Returns a reference to the LobbyMemberHandle for the given user ID, if they are a member of this lobb...
LobbyHandle(const LobbyHandle &other)
Copy constructor for LobbyHandle.
std::vector< discordpp::LobbyMemberHandle > LobbyMembers() const
Returns a list of the LobbyMemberHandle objects for each member of this lobby.
uint64_t Id() const
Returns the id of the lobby.
std::vector< uint64_t > LobbyMemberIds() const
Returns a list of the user IDs that are members of this lobby.
LobbyHandle & operator=(LobbyHandle &&other) noexcept
Move assignment operator for LobbyHandle.
A LobbyMemberHandle represents the state of a single user in a Lobby.
Definition discordpp.h:2559
LobbyMemberHandle & operator=(const LobbyMemberHandle &other)
Copy assignment operator for LobbyMemberHandle.
static const LobbyMemberHandle nullobj
Uninitialized instance of LobbyMemberHandle.
Definition discordpp.h:2578
uint64_t Id() const
The user id of the lobby member.
LobbyMemberHandle(const LobbyMemberHandle &other)
Copy constructor for LobbyMemberHandle.
bool Connected() const
Returns true if the user is currently connected to the lobby.
LobbyMemberHandle & operator=(LobbyMemberHandle &&other) noexcept
Move assignment operator for LobbyMemberHandle.
std::optional< discordpp::UserHandle > User() const
The UserHandle of the lobby member.
bool CanLinkLobby() const
Returns true if the user is allowed to link a channel to this lobby.
LobbyMemberHandle(LobbyMemberHandle &&other) noexcept
Move constructor for LobbyMemberHandle.
std::unordered_map< std::string, std::string > Metadata() const
Metadata is a set of string key/value pairs that the game developer can use.
A MessageHandle represents a single message received by the SDK.
Definition discordpp.h:2878
uint64_t AuthorId() const
Returns the user ID of the user who sent this message.
std::optional< discordpp::ChannelHandle > Channel() const
Returns the ChannelHandle for the channel this message was sent in.
static const MessageHandle nullobj
Uninitialized instance of MessageHandle.
Definition discordpp.h:2897
std::optional< discordpp::UserHandle > Recipient() const
Returns the UserHandle for the other participant in a DM, if this message was sent in a DM.
std::optional< uint64_t > ApplicationId() const
Returns the application ID associated with this message, if any. You can use this to identify if the ...
MessageHandle & operator=(const MessageHandle &other)
Copy assignment operator for MessageHandle.
uint64_t Id() const
Returns the ID of this message.
std::optional< discordpp::UserHandle > Author() const
Returns the UserHandle for the author of this message.
MessageHandle & operator=(MessageHandle &&other) noexcept
Move assignment operator for MessageHandle.
uint64_t EditedTimestamp() const
The timestamp in millis since the epoch when the message was most recently edited.
MessageHandle(const MessageHandle &other)
Copy constructor for MessageHandle.
std::string Content() const
Returns the content of this message, if any.
std::unordered_map< std::string, std::string > Metadata() const
Returns any metadata the developer included with this message.
std::string RawContent() const
Returns the content of this message, if any, but without replacing any markup from emojis and mention...
std::optional< discordpp::LobbyHandle > Lobby() const
Returns the LobbyHandle this message was sent in, if it was sent in a lobby.
uint64_t RecipientId() const
When this message was sent in a DM or Ephemeral DM, this method will return the ID of the other user ...
uint64_t SentTimestamp() const
The timestamp in millis since the epoch when the message was sent.
std::optional< discordpp::DisclosureTypes > DisclosureType() const
If this is an auto-generated message that is explaining some integration behavior to users,...
uint64_t ChannelId() const
Returns the channel ID this message was sent in.
MessageHandle(MessageHandle &&other) noexcept
Move constructor for MessageHandle.
bool SentFromGame() const
Returns true if this message was sent in-game, otherwise false (i.e. from Discord itself)....
std::optional< discordpp::AdditionalContent > AdditionalContent() const
If the message contains non-text content, such as images, videos, embeds, polls, etc,...
A RelationshipHandle represents the relationship between the current user and a target user on Discor...
Definition discordpp.h:2375
RelationshipHandle & operator=(const RelationshipHandle &other)
Copy assignment operator for RelationshipHandle.
RelationshipHandle(const RelationshipHandle &other)
Copy constructor for RelationshipHandle.
uint64_t Id() const
Returns the ID of the target user in this relationship.
discordpp::RelationshipType DiscordRelationshipType() const
Returns the type of the Discord relationship.
RelationshipHandle(RelationshipHandle &&other) noexcept
Move constructor for RelationshipHandle.
discordpp::RelationshipType GameRelationshipType() const
Returns the type of the Game relationship.
static const RelationshipHandle nullobj
Uninitialized instance of RelationshipHandle.
Definition discordpp.h:2394
bool IsSpamRequest() const
Returns whether this relationship is a spam request.
std::optional< discordpp::UserHandle > User() const
Returns a handle to the target user in this relationship, if one is available. This would be the user...
RelationshipHandle & operator=(RelationshipHandle &&other) noexcept
Move assignment operator for RelationshipHandle.
A UserHandle represents a single user on Discord that the SDK knows about and contains basic account ...
Definition discordpp.h:2434
uint64_t Id() const
Returns the ID of this user.
UserHandle & operator=(UserHandle &&other) noexcept
Move assignment operator for UserHandle.
std::string Username() const
Returns the globally unique username of this user.
static const UserHandle nullobj
Uninitialized instance of UserHandle.
Definition discordpp.h:2468
std::optional< std::string > Avatar() const
Returns the hash of the user's Discord profile avatar, if one is set.
UserHandle(const UserHandle &arg0)
Copy constructor for UserHandle.
discordpp::StatusType Status() const
Returns the user's online/offline/idle status.
UserHandle(UserHandle &&other) noexcept
Move constructor for UserHandle.
std::string AvatarUrl(discordpp::UserHandle::AvatarType animatedType, discordpp::UserHandle::AvatarType staticType) const
Returns a CDN url to the user's Discord profile avatar.
AvatarType
The desired type of avatar url to generate for a User.
Definition discordpp.h:2442
@ Jpeg
Jpeg.
Definition discordpp.h:2454
@ Gif
Gif.
Definition discordpp.h:2445
@ Webp
Webp.
Definition discordpp.h:2448
@ Png
Png.
Definition discordpp.h:2451
bool IsProvisional() const
Returns true if this user is a provisional account.
std::optional< std::string > GlobalName() const
Returns the preferred display name of this user, if one is set.
std::optional< discordpp::Activity > GameActivity() const
Returns the user's rich presence activity that is associated with the current game,...
UserHandle & operator=(const UserHandle &arg0)
Copy assignment operator for UserHandle.
static std::string AvatarTypeToString(discordpp::UserHandle::AvatarType type)
Converts the AvatarType enum to a string.
std::string DisplayName() const
Returns the user's preferred name, if one is set, otherwise returns their unique username.
discordpp::RelationshipHandle Relationship() const
Returns a reference to the RelationshipHandle between the currently authenticated user and this user,...
UserMessageSummary & operator=(const UserMessageSummary &arg0)
Copy assignment operator for UserMessageSummary.
static const UserMessageSummary nullobj
Uninitialized instance of UserMessageSummary.
Definition discordpp.h:3062
UserMessageSummary(UserMessageSummary &&other) noexcept
Move constructor for UserMessageSummary.
uint64_t LastMessageId() const
Returns the ID of the last message sent in the DM conversation.
uint64_t UserId() const
Returns the ID of the other user in the DM conversation.
UserMessageSummary(const UserMessageSummary &arg0)
Copy constructor for UserMessageSummary.
UserMessageSummary & operator=(UserMessageSummary &&other) noexcept
Move assignment operator for UserMessageSummary.
Settings for the void auto detection threshold for picking up activity from a user's mic.
Definition discordpp.h:1799
VADThresholdSettings & operator=(VADThresholdSettings &&other) noexcept
Move assignment operator for VADThresholdSettings.
VADThresholdSettings(VADThresholdSettings &&other) noexcept
Move constructor for VADThresholdSettings.
static const VADThresholdSettings nullobj
Uninitialized instance of VADThresholdSettings.
Definition discordpp.h:1818
bool Automatic() const
Whether or not Discord is currently automatically setting and detecting the appropriate threshold to ...
float VadThreshold() const
The current void auto detection threshold value, has a range of -100, 0 and defaults to -60.
void SetAutomatic(bool Automatic)
Setter for VADThresholdSettings::Automatic.
void SetVadThreshold(float VadThreshold)
Setter for VADThresholdSettings::VadThreshold.
A VoiceStateHandle represents the state of a single participant in a Discord voice call.
Definition discordpp.h:1757
VoiceStateHandle & operator=(VoiceStateHandle &&other) noexcept
Move assignment operator for VoiceStateHandle.
bool SelfMute() const
Returns true if the given user has muted themselves so that no one else in the call can hear them.
static const VoiceStateHandle nullobj
Uninitialized instance of VoiceStateHandle.
Definition discordpp.h:1776
bool SelfDeaf() const
Returns true if the given user has deafened themselves so that no one else in the call can hear them ...
VoiceStateHandle(VoiceStateHandle &&other) noexcept
Move constructor for VoiceStateHandle.
VoiceStateHandle & operator=(const VoiceStateHandle &other)
Copy assignment operator for VoiceStateHandle.
VoiceStateHandle(const VoiceStateHandle &other)
Copy constructor for VoiceStateHandle.
The namespace for the generated Discord SDK bindings.
Definition discordpp.h:16
ActivityPartyPrivacy
Allows your game to control the privacy of the party the user is in.
Definition discordpp.h:51
@ Public
The party is public, which means that the user is in a party which could be joinable by either friend...
Definition discordpp.h:65
@ Private
The party is private (or unknown), which means that the user is in a party but it is not joinable wit...
Definition discordpp.h:59
DisclosureTypes
Enum that represents various informational disclosures that Discord may make to users,...
Definition discordpp.h:573
@ MessageDataVisibleOnDiscord
This disclosure type happens the first time a user sends a message in game, and that message will be ...
Definition discordpp.h:579
const char * EnumToString(discordpp::ActivityActionTypes value)
Converts a discordpp::ActivityActionTypes to a string.
Definition discordpp.h:5070
HttpStatusCode
Enum that represents the various HTTP status codes that can be returned.
Definition discordpp.h:204
@ RequestHeaderFieldsTooLarge
RequestHeaderFieldsTooLarge.
Definition discordpp.h:351
@ PayloadTooLarge
PayloadTooLarge.
Definition discordpp.h:312
@ MultiStatus
MultiStatus.
Definition discordpp.h:243
@ VariantAlsoNegotiates
VariantAlsoNegotiates.
Definition discordpp.h:372
@ Gone
Gone.
Definition discordpp.h:303
@ BadGateway
BadGateway.
Definition discordpp.h:360
@ Created
Created.
Definition discordpp.h:225
@ TemporaryRedirect
TemporaryRedirect.
Definition discordpp.h:267
@ ServiceUnavailable
ServiceUnavailable.
Definition discordpp.h:363
@ MovedPermanently
MovedPermanently.
Definition discordpp.h:255
@ PreconditionFailed
PreconditionFailed.
Definition discordpp.h:309
@ RequestTimeout
RequestTimeout.
Definition discordpp.h:297
@ Accepted
Accepted.
Definition discordpp.h:228
@ NonAuthoritativeInfo
NonAuthoritativeInfo.
Definition discordpp.h:231
@ NotFound
NotFound.
Definition discordpp.h:285
@ FailedDependency
FailedDependency.
Definition discordpp.h:336
@ PaymentRequired
PaymentRequired.
Definition discordpp.h:279
@ PreconditionRequired
PreconditionRequired.
Definition discordpp.h:345
@ ResetContent
ResetContent.
Definition discordpp.h:237
@ SwitchingProtocols
SwitchingProtocols.
Definition discordpp.h:213
@ HttpVersionNotSupported
HttpVersionNotSupported.
Definition discordpp.h:369
@ Found
Found.
Definition discordpp.h:258
@ Processing
Processing.
Definition discordpp.h:216
@ None
None.
Definition discordpp.h:207
@ ExpectationFailed
ExpectationFailed.
Definition discordpp.h:324
@ Forbidden
Forbidden.
Definition discordpp.h:282
@ PartialContent
PartialContent.
Definition discordpp.h:240
@ SeeOther
SeeOther.
Definition discordpp.h:261
@ EarlyHints
EarlyHints.
Definition discordpp.h:219
@ LengthRequired
LengthRequired.
Definition discordpp.h:306
@ MethodNotAllowed
MethodNotAllowed.
Definition discordpp.h:288
@ NotExtended
NotExtended.
Definition discordpp.h:381
@ RangeNotSatisfiable
RangeNotSatisfiable.
Definition discordpp.h:321
@ NotImplemented
NotImplemented.
Definition discordpp.h:357
@ BadRequest
BadRequest.
Definition discordpp.h:273
@ Continue
Continue.
Definition discordpp.h:210
@ LoopDetected
LoopDetected.
Definition discordpp.h:378
@ UnsupportedMediaType
UnsupportedMediaType.
Definition discordpp.h:318
@ NetworkAuthorizationRequired
NetworkAuthorizationRequired.
Definition discordpp.h:384
@ ImUsed
ImUsed.
Definition discordpp.h:249
@ MultipleChoices
MultipleChoices.
Definition discordpp.h:252
@ Ok
Ok.
Definition discordpp.h:222
@ TooManyRequests
TooManyRequests.
Definition discordpp.h:348
@ ProxyAuthRequired
ProxyAuthRequired.
Definition discordpp.h:294
@ UnprocessableEntity
UnprocessableEntity.
Definition discordpp.h:330
@ MisdirectedRequest
MisdirectedRequest.
Definition discordpp.h:327
@ PermanentRedirect
PermanentRedirect.
Definition discordpp.h:270
@ NotModified
NotModified.
Definition discordpp.h:264
@ AlreadyReported
AlreadyReported.
Definition discordpp.h:246
@ NoContent
NoContent.
Definition discordpp.h:234
@ Locked
Locked.
Definition discordpp.h:333
@ GatewayTimeout
GatewayTimeout.
Definition discordpp.h:366
@ Unauthorized
Unauthorized.
Definition discordpp.h:276
@ UpgradeRequired
UpgradeRequired.
Definition discordpp.h:342
@ InsufficientStorage
InsufficientStorage.
Definition discordpp.h:375
@ InternalServerError
InternalServerError.
Definition discordpp.h:354
@ TooEarly
TooEarly.
Definition discordpp.h:339
@ Conflict
Conflict.
Definition discordpp.h:300
@ UriTooLong
UriTooLong.
Definition discordpp.h:315
@ NotAcceptable
NotAcceptable.
Definition discordpp.h:291
AuthorizationTokenType
Represents the type of auth token used by the SDK, either the normal tokens produced by the Discord d...
Definition discordpp.h:584
@ Bearer
Bearer.
Definition discordpp.h:590
@ User
User.
Definition discordpp.h:587
ChannelType
Enum that represents the various channel types on Discord.
Definition discordpp.h:457
@ GuildForum
GuildForum.
Definition discordpp.h:496
@ Dm
Dm.
Definition discordpp.h:463
@ Lobby
Lobby.
Definition discordpp.h:502
@ GuildNews
GuildNews.
Definition discordpp.h:475
@ GuildVoice
GuildVoice.
Definition discordpp.h:466
@ GuildPublicThread
GuildPublicThread.
Definition discordpp.h:484
@ GuildNewsThread
GuildNewsThread.
Definition discordpp.h:481
@ GuildDirectory
GuildDirectory.
Definition discordpp.h:493
@ GuildCategory
GuildCategory.
Definition discordpp.h:472
@ GuildStageVoice
GuildStageVoice.
Definition discordpp.h:490
@ GuildMedia
GuildMedia.
Definition discordpp.h:499
@ GuildStore
GuildStore.
Definition discordpp.h:478
@ GuildText
GuildText.
Definition discordpp.h:460
@ GroupDm
GroupDm.
Definition discordpp.h:469
@ EphemeralDm
EphemeralDm.
Definition discordpp.h:505
@ GuildPrivateThread
GuildPrivateThread.
Definition discordpp.h:487
AuthenticationCodeChallengeMethod
Represents the crypto method used to generate a code challenge.
Definition discordpp.h:390
@ S256
S256.
Definition discordpp.h:393
RelationshipType
Enum that represents the possible types of relationships that can exist between two users.
Definition discordpp.h:509
@ PendingIncoming
The current user has received a friend request from the target user, but it is not yet accepted.
Definition discordpp.h:524
@ Implicit
The Implicit type is documented for visibility, but should be unused in the SDK.
Definition discordpp.h:531
@ Suggestion
The Suggestion type is documented for visibility, but should be unused in the SDK.
Definition discordpp.h:534
@ PendingOutgoing
The current user has sent a friend request to the target user, but it is not yet accepted.
Definition discordpp.h:528
@ Blocked
The current user has blocked the target user, and so certain actions such as sending messages between...
Definition discordpp.h:519
@ None
The user has no relationship with the other user.
Definition discordpp.h:512
@ Friend
The user is friends with the other user.
Definition discordpp.h:515
AuthenticationExternalAuthType
Represents the various identity providers that can be used to authenticate a provisional account user...
Definition discordpp.h:595
@ EpicOnlineServicesIdToken
EpicOnlineServicesIdToken.
Definition discordpp.h:604
@ EpicOnlineServicesAccessToken
EpicOnlineServicesAccessToken.
Definition discordpp.h:601
@ SteamSessionTicket
SteamSessionTicket.
Definition discordpp.h:607
@ OIDC
OIDC.
Definition discordpp.h:598
@ UnityServicesIdToken
UnityServicesIdToken.
Definition discordpp.h:610
LoggingSeverity
Enum that represents the various log levels supported by the SDK.
Definition discordpp.h:614
@ Warning
Warning.
Definition discordpp.h:623
@ Info
Info.
Definition discordpp.h:620
@ None
None.
Definition discordpp.h:629
@ Error
Error.
Definition discordpp.h:626
@ Verbose
Verbose.
Definition discordpp.h:617
RelationshipGroupType
Enum that represents the logical groups of relationships based on online status and game activity.
Definition discordpp.h:634
@ OnlinePlayingGame
Users who are online and currently playing the game.
Definition discordpp.h:637
@ Offline
Users who are offline.
Definition discordpp.h:643
@ OnlineElsewhere
Users who are online but not playing the game.
Definition discordpp.h:640
IntegrationType
Represents the type of integration the app will be installed as.
Definition discordpp.h:397
@ GuildInstall
GuildInstall.
Definition discordpp.h:400
@ UserInstall
UserInstall.
Definition discordpp.h:403
AudioSystem
The Discord Voice audio system to use.
Definition discordpp.h:432
@ Game
Use the game audio system.
Definition discordpp.h:438
@ Standard
Use the standard audio system.
Definition discordpp.h:435
ActivityGamePlatforms
Represents the type of platforms that an activity invite can be accepted on.
Definition discordpp.h:114
@ Embedded
Embedded.
Definition discordpp.h:132
@ Xbox
Xbox.
Definition discordpp.h:120
@ Desktop
Desktop.
Definition discordpp.h:117
@ Samsung
Samsung.
Definition discordpp.h:123
@ PS5
PS5.
Definition discordpp.h:138
@ PS4
PS4.
Definition discordpp.h:135
@ IOS
IOS.
Definition discordpp.h:126
@ Android
Android.
Definition discordpp.h:129
ActivityTypes
Discord RichPresence supports multiple types of activities that a user can be doing.
Definition discordpp.h:74
@ Watching
Watching.
Definition discordpp.h:86
@ Competing
Competing.
Definition discordpp.h:92
@ HangStatus
HangStatus.
Definition discordpp.h:95
@ Listening
Listening.
Definition discordpp.h:83
@ Streaming
Streaming.
Definition discordpp.h:80
@ CustomStatus
CustomStatus.
Definition discordpp.h:89
@ Playing
Playing.
Definition discordpp.h:77
StatusType
Enum that specifies the various online statuses for a user.
Definition discordpp.h:541
@ Blocked
Blocked.
Definition discordpp.h:550
@ Online
The user is online and recently active.
Definition discordpp.h:544
@ Dnd
The user is online, but wishes to suppress notifications for the time being.
Definition discordpp.h:557
@ Unknown
Unknown.
Definition discordpp.h:566
@ Invisible
The user is online, but wishes to appear as if they are offline to other users.
Definition discordpp.h:560
@ Offline
The user is offline and not connected to Discord.
Definition discordpp.h:547
@ Streaming
The user is online and is actively streaming content.
Definition discordpp.h:563
@ Idle
The user is online, but has not been active for a while and may be away from their computer.
Definition discordpp.h:554
StatusDisplayTypes
Controls which Discord RichPresence field is displayed in the user's status.
Definition discordpp.h:101
@ Details
Details.
Definition discordpp.h:110
@ State
State.
Definition discordpp.h:107
@ Name
Name.
Definition discordpp.h:104
void RunCallbacks()
Definition discordpp.h:29
AudioModeType
Represents whether a voice call is using push to talk or auto voice detection.
Definition discordpp.h:442
@ MODE_PTT
MODE_PTT.
Definition discordpp.h:451
@ MODE_VAD
MODE_VAD.
Definition discordpp.h:448
@ MODE_UNINIT
MODE_UNINIT.
Definition discordpp.h:445
ErrorType
Enum representing various types of errors the SDK returns.
Definition discordpp.h:142
@ HTTPError
An HTTP call was made to Discord's servers but a non success HTTP status code was returned....
Definition discordpp.h:157
@ NetworkError
The user is offline or there was some network issue that prevented an underlying HTTP call from succe...
Definition discordpp.h:149
@ AuthorizationFailed
An authorization function failed, but not necessarily as the result of an HTTP call that returned an ...
Definition discordpp.h:191
@ ClientNotReady
An operation such as sending a friend request or joining a lobby was attempted but the Client is not ...
Definition discordpp.h:167
@ None
No error, the operation was successful.
Definition discordpp.h:145
@ Aborted
The user or developer aborted an operation, such as an authorization flow.
Definition discordpp.h:186
@ RPCError
An RPC call was made to Discord's desktop application, but it returned a non-success result....
Definition discordpp.h:196
@ ValidationError
Used when an SDK method is called but the inputs don't pass local validation. For example if one atte...
Definition discordpp.h:183
@ ClientDestroyed
The Client has been destroyed and so this operation cannot complete.
Definition discordpp.h:173
@ Disabled
An operation was temporarily disabled for stability reasons.
Definition discordpp.h:170
DiscordObjectState
Represents the memory state of a Discord object.
Definition discordpp.h:19
@ Invalid
The object has been freed.
Definition discordpp.h:21
@ Owned
The object is owned by the C++ wrapper and methods can be called on it.
Definition discordpp.h:23
AdditionalContentType
Represents the type of additional content contained in a message.
Definition discordpp.h:407
@ Sticker
Sticker.
Definition discordpp.h:428
@ VoiceMessage
VoiceMessage.
Definition discordpp.h:419
@ Other
Other.
Definition discordpp.h:410
@ Poll
Poll.
Definition discordpp.h:416
@ Thread
Thread.
Definition discordpp.h:422
@ Attachment
Attachment.
Definition discordpp.h:413
@ Embed
Embed.
Definition discordpp.h:425
ActivityActionTypes
ActivityActionTypes represents the type of invite being sent to a user.
Definition discordpp.h:41
@ Join
Join.
Definition discordpp.h:44
@ JoinRequest
JoinRequest.
Definition discordpp.h:47