Discord Social SDK
Loading...
Searching...
No Matches
discordpp.h
1// Generated with <3 by Discord.Sdk.Derive
2#ifndef DISCORD_HEADER_DISCORDPP_H_
3#define DISCORD_HEADER_DISCORDPP_H_
4#include "cdiscord.h"
5#include <atomic>
6#include <cassert>
7#include <cstddef>
8#include <cstdlib>
9#include <cstring>
10#include <functional>
11#include <memory>
12#include <new>
13#include <optional>
14#include <string>
15#include <string_view>
16#include <type_traits>
17#include <unordered_map>
18#include <utility>
19#include <vector>
20
22namespace discordpp {
23
31
35inline void RunCallbacks()
36{
37 Discord_RunCallbacks();
38}
39
48inline Discord_AllocatorInstallStatus InstallAllocator(const Discord_Allocator& allocator)
49{
50 return Discord_InstallAllocator(&allocator);
51}
52
55inline Discord_AllocatorInstallStatus InstallAllocator(void* userData,
56 Discord_AllocatorAllocFn fnAlloc,
57 Discord_AllocatorFreeFn fnFree)
58{
59 Discord_Allocator allocator{};
60 allocator.structSize = sizeof(Discord_Allocator);
61 allocator.version = DISCORD_ALLOCATOR_VERSION;
62 allocator.userData = userData;
63 allocator.fnAlloc = fnAlloc;
64 allocator.fnFree = fnFree;
65 return Discord_InstallAllocator(&allocator);
66}
67
69namespace detail {
70[[noreturn]] inline void FailAllocation()
71{
72#if defined(__cpp_exceptions) || defined(_CPPUNWIND)
73 throw std::bad_alloc();
74#else
75 std::abort();
76#endif
77}
78
79inline void* AllocateOrFail(size_t size)
80{
81 void* ptr = Discord_Alloc(size);
82 if (ptr == nullptr) {
83 FailAllocation();
84 }
85 return ptr;
86}
87} // namespace detail
89
92template <typename T>
95 using value_type = T;
96
98 SdkAllocator() noexcept = default;
100 template <typename U>
101 SdkAllocator(const SdkAllocator<U>&) noexcept
102 {
103 }
104
106 T* allocate(size_t count)
107 {
108 static_assert(alignof(T) <= alignof(std::max_align_t),
109 "Discord_Alloc only guarantees max_align_t alignment");
110 if (count > static_cast<size_t>(-1) / sizeof(T)) {
111 detail::FailAllocation();
112 }
113 return static_cast<T*>(detail::AllocateOrFail(count * sizeof(T)));
114 }
115
117 void deallocate(T* ptr, size_t) noexcept { Discord_Free(ptr); }
118};
119
121template <typename T, typename U>
122bool operator==(const SdkAllocator<T>&, const SdkAllocator<U>&) noexcept
123{
124 return true;
125}
126
128template <typename T, typename U>
129bool operator!=(const SdkAllocator<T>&, const SdkAllocator<U>&) noexcept
130{
131 return false;
132}
133
135using SdkString = std::basic_string<char, std::char_traits<char>, SdkAllocator<char>>;
136
138template <typename T>
139using SdkVector = std::vector<T, SdkAllocator<T>>;
140
144 size_t operator()(const SdkString& value) const noexcept
145 {
146 return std::hash<std::string_view>{}(std::string_view(value.data(), value.size()));
147 }
148};
149
151using SdkStringMap = std::unordered_map<SdkString,
152 SdkString,
154 std::equal_to<SdkString>,
156
158template <typename Signature>
160
163template <typename R, typename... Args>
164class SdkFunction<R(Args...)> {
165public:
167 SdkFunction() noexcept = default;
169 SdkFunction(std::nullptr_t) noexcept {}
170
173 template <typename F,
174 typename = std::enable_if_t<!std::is_same_v<std::decay_t<F>, SdkFunction> &&
175 std::is_invocable_r_v<R, std::decay_t<F>&, Args...>>>
176 SdkFunction(F&& function)
177 {
178 using Target = std::decay_t<F>;
179 if constexpr (std::is_pointer_v<Target> || std::is_member_pointer_v<Target>) {
180 if (function == nullptr) {
181 return;
182 }
183 }
184 callable_ = Holder<Target>::Create(std::forward<F>(function));
185 }
186
189 : callable_(other.callable_ != nullptr ? other.callable_->Clone() : nullptr)
190 {
191 }
192
194 SdkFunction(SdkFunction&& other) noexcept
195 : callable_(other.callable_)
196 {
197 other.callable_ = nullptr;
198 }
199
201 ~SdkFunction() { Reset(); }
202
205 {
206 if (this != &other) {
207 SdkFunction copy(other);
208 std::swap(callable_, copy.callable_);
209 }
210 return *this;
211 }
212
215 {
216 if (this != &other) {
217 Reset();
218 callable_ = other.callable_;
219 other.callable_ = nullptr;
220 }
221 return *this;
222 }
223
225 SdkFunction& operator=(std::nullptr_t) noexcept
226 {
227 Reset();
228 return *this;
229 }
230
232 explicit operator bool() const noexcept { return callable_ != nullptr; }
233
235 R operator()(Args... args) const
236 {
237 assert(callable_ != nullptr);
238 return callable_->Invoke(std::forward<Args>(args)...);
239 }
240
242 friend bool operator==(const SdkFunction& function, std::nullptr_t) noexcept
243 {
244 return !function;
245 }
246
247 friend bool operator==(std::nullptr_t, const SdkFunction& function) noexcept
248 {
249 return !function;
250 }
251
252 friend bool operator!=(const SdkFunction& function, std::nullptr_t) noexcept
253 {
254 return static_cast<bool>(function);
255 }
256
257 friend bool operator!=(std::nullptr_t, const SdkFunction& function) noexcept
258 {
259 return static_cast<bool>(function);
260 }
261
262private:
263 struct Callable {
264 virtual ~Callable() = default;
265 virtual R Invoke(Args&&... args) = 0;
266 virtual Callable* Clone() const = 0;
267 virtual void Destroy() noexcept = 0;
268 };
269
270 template <typename F>
271 struct Holder final : Callable {
272 F function;
273
274 template <typename G>
275 explicit Holder(G&& source)
276 : function(std::forward<G>(source))
277 {
278 }
279
280 template <typename G>
281 static Holder* Create(G&& source)
282 {
283 void* storage = detail::AllocateOrFail(sizeof(Holder));
284#if defined(__cpp_exceptions) || defined(_CPPUNWIND)
285 try {
286 return ::new (storage) Holder(std::forward<G>(source));
287 }
288 catch (...) {
289 Discord_Free(storage);
290 throw;
291 }
292#else
293 return ::new (storage) Holder(std::forward<G>(source));
294#endif
295 }
296
297 R Invoke(Args&&... args) override
298 {
299 if constexpr (std::is_void_v<R>) {
300 std::invoke(function, std::forward<Args>(args)...);
301 }
302 else {
303 return std::invoke(function, std::forward<Args>(args)...);
304 }
305 }
306
307 Callable* Clone() const override { return Create(function); }
308
309 void Destroy() noexcept override
310 {
311 this->~Holder();
312 Discord_Free(this);
313 }
314 };
315
316 void Reset() noexcept
317 {
318 if (callable_ != nullptr) {
319 callable_->Destroy();
320 callable_ = nullptr;
321 }
322 }
323
324 Callable* callable_ = nullptr;
325};
326
327#ifdef DISCORDPP_USE_SDK_ALLOCATOR
329using String = SdkString;
331template <typename T>
332using Vector = SdkVector<T>;
334using StringMap = SdkStringMap;
336template <typename Signature>
338#else
343using String = std::string;
345template <typename T>
346using Vector = std::vector<T>;
348using StringMap = std::unordered_map<std::string, std::string>;
350template <typename Signature>
351using Function = std::function<Signature>;
352#endif
353
362
365
367 Join = 1,
368
371};
372
375
383
389};
390
397enum class ActivityTypes {
398
401
404
407
410
413
416
419};
420
425
427 Name = 0,
428
430 State = 1,
431
434};
435
438
441
443 Xbox = 2,
444
447
449 IOS = 8,
450
453
456
458 PS4 = 64,
459
461 PS5 = 128,
462};
463
465enum class ErrorType {
466
468 None = 0,
469
473
481
491
494
497
507
510
515
520};
521
527enum class HttpStatusCode {
528
530 None = 0,
531
533 Continue = 100,
534
537
540
543
545 Ok = 200,
546
548 Created = 201,
549
551 Accepted = 202,
552
555
558
561
564
567
570
572 ImUsed = 209,
573
576
579
581 Found = 302,
582
584 SeeOther = 303,
585
588
591
594
597
600
603
606
608 NotFound = 404,
609
612
615
618
621
623 Conflict = 409,
624
626 Gone = 410,
627
630
633
636
639
642
645
648
651
654
656 Locked = 423,
657
660
662 TooEarly = 425,
663
666
669
672
675
678
681
684
687
690
693
696
699
702
705
708};
709
714
716 S256 = 0,
717};
718
720enum class IntegrationType {
721
724
727};
728
732enum class ChannelType {
733
736
738 Dm = 1,
739
742
745
748
751
754
757
760
763
766
769
772
775
777 Lobby = 17,
778
781};
782
785
787 Other = 0,
788
791
793 Poll = 2,
794
797
800
802 Embed = 5,
803
806};
807
810
813
816};
817
830
832enum class AudioSystem {
833
836
838 Game = 1,
839};
840
842enum class AudioModeType {
843
846
849
852};
853
856
858 None = 0,
859
862
866
871
875
878
881};
882
885
887 OIDC = 0,
888
891
893 Steam = 2,
894
896 Unity = 3,
897
900
902 None = 5,
903
906};
907
912enum class StatusType {
913
916
919
922
925 Idle = 3,
926
928 Dnd = 4,
929
932
935
938};
939
952
956
958 User = 0,
959
962};
963
992
994enum class LoggingSeverity {
995
998
1000 Info = 2,
1001
1004
1007
1009 None = 5,
1010};
1011
1015
1018
1021
1024};
1025class ActivityInvite;
1026class ActivityAssets;
1027class ActivityTimestamps;
1028class ActivityParty;
1029class ActivitySecrets;
1030class ActivityButton;
1031class Activity;
1032class ClientResult;
1033class AuthorizationCodeChallenge;
1034class AuthorizationCodeVerifier;
1035class AuthorizationArgs;
1036class DeviceAuthorizationArgs;
1037class VoiceStateHandle;
1038class VADThresholdSettings;
1039class Call;
1040class ChannelHandle;
1041class GuildMinimal;
1042class UserGuild;
1043class LinkedGameOrganization;
1044class GuildChannel;
1045class LinkedLobby;
1046class LinkedChannel;
1047class RelationshipHandle;
1048class UserApplicationProfileHandle;
1049class UserHandle;
1050class LobbyMemberHandle;
1051class LobbyHandle;
1052class AdditionalContent;
1053class MessageHandle;
1054class AudioDevice;
1055class VoiceSettings;
1056class DiscordClientGuildVoiceMember;
1057class DiscordClientGuildVoiceSnapshot;
1058class UserMessageSummary;
1059class ClientCreateOptions;
1060class Client;
1061class CallInfoHandle;
1062
1068 mutable Discord_ActivityInvite instance_{};
1071
1072public:
1074 Discord_ActivityInvite* instance() const { return &instance_; }
1077 explicit ActivityInvite(Discord_ActivityInvite instance, DiscordObjectState state);
1087 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1088
1093
1094 explicit ActivityInvite();
1095
1097 void Drop();
1099
1101 uint64_t SenderId() const;
1103 void SetSenderId(uint64_t SenderId);
1104
1106 uint64_t ChannelId() const;
1108 void SetChannelId(uint64_t ChannelId);
1109
1111 uint64_t MessageId() const;
1113 void SetMessageId(uint64_t MessageId);
1114
1119
1121 uint64_t ApplicationId() const;
1124
1127 uint64_t ParentApplicationId() const;
1130
1134 void SetPartyId(std::string_view PartyId);
1135
1139 void SetSessionId(std::string_view SessionId);
1140
1143 bool IsValid() const;
1146};
1147
1166 mutable Discord_ActivityAssets instance_{};
1169
1170public:
1172 Discord_ActivityAssets* instance() const { return &instance_; }
1175 explicit ActivityAssets(Discord_ActivityAssets instance, DiscordObjectState state);
1185 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1186
1191
1192 explicit ActivityAssets();
1193
1195 void Drop();
1197
1202 std::optional<discordpp::String> LargeImage() const;
1204 void SetLargeImage(std::optional<std::string_view> LargeImage);
1205
1209 std::optional<discordpp::String> LargeText() const;
1211 void SetLargeText(std::optional<std::string_view> LargeText);
1212
1216 std::optional<discordpp::String> LargeUrl() const;
1218 void SetLargeUrl(std::optional<std::string_view> LargeUrl);
1219
1223 std::optional<discordpp::String> SmallImage() const;
1225 void SetSmallImage(std::optional<std::string_view> SmallImage);
1226
1230 std::optional<discordpp::String> SmallText() const;
1232 void SetSmallText(std::optional<std::string_view> SmallText);
1233
1237 std::optional<discordpp::String> SmallUrl() const;
1239 void SetSmallUrl(std::optional<std::string_view> SmallUrl);
1240
1245 std::optional<discordpp::String> InviteCoverImage() const;
1247 void SetInviteCoverImage(std::optional<std::string_view> InviteCoverImage);
1248};
1249
1253 mutable Discord_ActivityTimestamps instance_{};
1256
1257public:
1259 Discord_ActivityTimestamps* instance() const { return &instance_; }
1262 explicit ActivityTimestamps(Discord_ActivityTimestamps instance, DiscordObjectState state);
1272 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1273
1278
1279 explicit ActivityTimestamps();
1280
1282 void Drop();
1284
1290 uint64_t Start() const;
1292 void SetStart(uint64_t Start);
1293
1299 uint64_t End() const;
1301 void SetEnd(uint64_t End);
1302};
1303
1307 mutable Discord_ActivityParty instance_{};
1310
1311public:
1313 Discord_ActivityParty* instance() const { return &instance_; }
1316 explicit ActivityParty(Discord_ActivityParty instance, DiscordObjectState state);
1320 ActivityParty(ActivityParty&& other) noexcept;
1326 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1327
1332
1333 explicit ActivityParty();
1334
1336 void Drop();
1338
1347 void SetId(std::string_view Id);
1348
1350 int32_t CurrentSize() const;
1353
1356 int32_t MaxSize() const;
1358 void SetMaxSize(int32_t MaxSize);
1359
1364};
1365
1369 mutable Discord_ActivitySecrets instance_{};
1372
1373public:
1375 Discord_ActivitySecrets* instance() const { return &instance_; }
1378 explicit ActivitySecrets(Discord_ActivitySecrets instance, DiscordObjectState state);
1388 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1389
1394
1395 explicit ActivitySecrets();
1396
1398 void Drop();
1400
1407 void SetJoin(std::string_view Join);
1408};
1409
1413 mutable Discord_ActivityButton instance_{};
1416
1417public:
1419 Discord_ActivityButton* instance() const { return &instance_; }
1422 explicit ActivityButton(Discord_ActivityButton instance, DiscordObjectState state);
1432 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1433
1438
1439 explicit ActivityButton();
1440
1442 void Drop();
1444
1448 void SetLabel(std::string_view Label);
1449
1453 void SetUrl(std::string_view Url);
1454};
1455
1638 mutable Discord_Activity instance_{};
1641
1642public:
1644 Discord_Activity* instance() const { return &instance_; }
1647 explicit Activity(Discord_Activity instance, DiscordObjectState state);
1648 ~Activity();
1651 Activity(Activity&& other) noexcept;
1653 Activity& operator=(Activity&& other) noexcept;
1655 static const Activity nullobj;
1657 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1658
1660 Activity(const Activity& arg0);
1663
1664 explicit Activity();
1665
1667 void Drop();
1669
1672
1674 bool Equals(discordpp::Activity other) const;
1675
1678
1684 void SetName(std::string_view Name);
1685
1692
1696 std::optional<discordpp::StatusDisplayTypes> StatusDisplayType() const;
1698 void SetStatusDisplayType(std::optional<discordpp::StatusDisplayTypes> StatusDisplayType);
1699
1704 std::optional<discordpp::String> State() const;
1706 void SetState(std::optional<std::string_view> State);
1707
1712 std::optional<discordpp::String> StateUrl() const;
1714 void SetStateUrl(std::optional<std::string_view> StateUrl);
1715
1720 std::optional<discordpp::String> Details() const;
1722 void SetDetails(std::optional<std::string_view> Details);
1723
1728 std::optional<discordpp::String> DetailsUrl() const;
1730 void SetDetailsUrl(std::optional<std::string_view> DetailsUrl);
1731
1736 std::optional<uint64_t> ApplicationId() const;
1738 void SetApplicationId(std::optional<uint64_t> ApplicationId);
1739
1745 std::optional<uint64_t> ParentApplicationId() const;
1747 void SetParentApplicationId(std::optional<uint64_t> ParentApplicationId);
1748
1750 std::optional<discordpp::ActivityAssets> Assets() const;
1752 void SetAssets(std::optional<discordpp::ActivityAssets> Assets);
1753
1757 std::optional<discordpp::ActivityTimestamps> Timestamps() const;
1759 void SetTimestamps(std::optional<discordpp::ActivityTimestamps> Timestamps);
1760
1763 std::optional<discordpp::ActivityParty> Party() const;
1765 void SetParty(std::optional<discordpp::ActivityParty> Party);
1766
1769 std::optional<discordpp::ActivitySecrets> Secrets() const;
1771 void SetSecrets(std::optional<discordpp::ActivitySecrets> Secrets);
1772
1781};
1782
1794 mutable Discord_ClientResult instance_{};
1797
1798public:
1800 Discord_ClientResult* instance() const { return &instance_; }
1803 explicit ClientResult(Discord_ClientResult instance, DiscordObjectState state);
1804 ~ClientResult();
1807 ClientResult(ClientResult&& other) noexcept;
1811 static const ClientResult nullobj;
1813 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1814
1819
1821 void Drop();
1823
1826
1831
1835 void SetError(std::string_view Error);
1836
1845 int32_t ErrorCode() const;
1848
1855
1865 void SetResponseBody(std::string_view ResponseBody);
1866
1868 bool Successful() const;
1871
1873 bool Retryable() const;
1876
1879 float RetryAfter() const;
1882};
1883
1887 mutable Discord_AuthorizationCodeChallenge instance_{};
1890
1891public:
1893 Discord_AuthorizationCodeChallenge* instance() const { return &instance_; }
1896 explicit AuthorizationCodeChallenge(Discord_AuthorizationCodeChallenge instance,
1897 DiscordObjectState state);
1907 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1908
1913
1914 explicit AuthorizationCodeChallenge();
1915
1917 void Drop();
1919
1924
1928 void SetChallenge(std::string_view Challenge);
1929};
1930
1934 mutable Discord_AuthorizationCodeVerifier instance_{};
1937
1938public:
1940 Discord_AuthorizationCodeVerifier* instance() const { return &instance_; }
1943 explicit AuthorizationCodeVerifier(Discord_AuthorizationCodeVerifier instance,
1944 DiscordObjectState state);
1954 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1955
1960
1962 void Drop();
1964
1969
1973 void SetVerifier(std::string_view Verifier);
1974};
1975
1979 mutable Discord_AuthorizationArgs instance_{};
1982
1983public:
1985 Discord_AuthorizationArgs* instance() const { return &instance_; }
1988 explicit AuthorizationArgs(Discord_AuthorizationArgs instance, DiscordObjectState state);
1998 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1999
2004
2005 explicit AuthorizationArgs();
2006
2008 void Drop();
2010
2013 uint64_t ClientId() const;
2015 void SetClientId(uint64_t ClientId);
2016
2031 void SetScopes(std::string_view Scopes);
2032
2038 std::optional<discordpp::String> State() const;
2040 void SetState(std::optional<std::string_view> State);
2041
2046 std::optional<discordpp::String> Nonce() const;
2048 void SetNonce(std::optional<std::string_view> Nonce);
2049
2055 std::optional<discordpp::AuthorizationCodeChallenge> CodeChallenge() const;
2057 void SetCodeChallenge(std::optional<discordpp::AuthorizationCodeChallenge> CodeChallenge);
2058
2062 std::optional<discordpp::IntegrationType> IntegrationType() const;
2064 void SetIntegrationType(std::optional<discordpp::IntegrationType> IntegrationType);
2065
2077 std::optional<discordpp::String> CustomSchemeParam() const;
2079 void SetCustomSchemeParam(std::optional<std::string_view> CustomSchemeParam);
2080};
2081
2085 mutable Discord_DeviceAuthorizationArgs instance_{};
2088
2089public:
2091 Discord_DeviceAuthorizationArgs* instance() const { return &instance_; }
2094 explicit DeviceAuthorizationArgs(Discord_DeviceAuthorizationArgs instance,
2095 DiscordObjectState state);
2105 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2106
2111
2112 explicit DeviceAuthorizationArgs();
2113
2115 void Drop();
2117
2120 uint64_t ClientId() const;
2122 void SetClientId(uint64_t ClientId);
2123
2138 void SetScopes(std::string_view Scopes);
2139};
2140
2153 mutable Discord_VoiceStateHandle instance_{};
2156
2157public:
2159 Discord_VoiceStateHandle* instance() const { return &instance_; }
2162 explicit VoiceStateHandle(Discord_VoiceStateHandle instance, DiscordObjectState state);
2172 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2173
2178
2180 void Drop();
2182
2185 bool SelfDeaf() const;
2186
2189 bool SelfMute() const;
2190};
2191
2195 mutable Discord_VADThresholdSettings instance_{};
2198
2199public:
2201 Discord_VADThresholdSettings* instance() const { return &instance_; }
2204 explicit VADThresholdSettings(Discord_VADThresholdSettings instance, DiscordObjectState state);
2214 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2215
2218
2220 void Drop();
2222
2225 float VadThreshold() const;
2228
2231 bool Automatic() const;
2234};
2235
2237class Call {
2239 mutable Discord_Call instance_{};
2242
2243public:
2265
2267 enum class Status {
2268
2271
2274
2277
2280
2283
2286
2289 };
2290
2292 using OnVoiceStateChanged = discordpp::Function<void(uint64_t userId)>;
2293
2295 using OnParticipantChanged = discordpp::Function<void(uint64_t userId, bool added)>;
2296
2298 using OnSpeakingStatusChanged = discordpp::Function<void(uint64_t userId, bool isPlayingSound)>;
2299
2302 void(discordpp::Call::Status status, discordpp::Call::Error error, int32_t errorDetail)>;
2304 Discord_Call* instance() const { return &instance_; }
2307 explicit Call(Discord_Call instance, DiscordObjectState state);
2308 ~Call();
2311 Call(Call&& other) noexcept;
2313 Call& operator=(Call&& other) noexcept;
2315 static const Call nullobj;
2317 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2318
2320 Call(const Call& other);
2322 Call& operator=(const Call& other);
2323
2325 void Drop();
2327
2330
2334
2336 uint64_t GetChannelId() const;
2337
2339 uint64_t GetGuildId() const;
2340
2342 bool GetLocalMute(uint64_t userId);
2343
2346
2351 float GetParticipantVolume(uint64_t userId);
2352
2356
2360
2363
2366
2371
2375
2381 std::optional<discordpp::VoiceStateHandle> GetVoiceStateHandle(uint64_t userId) const;
2382
2389
2393 void SetLocalMute(uint64_t userId, bool mute);
2394
2402
2405
2410 void SetParticipantVolume(uint64_t userId, float volume);
2411
2415 void SetPTTActive(bool active);
2416
2421 void SetPTTReleaseDelay(uint32_t releaseDelayMs);
2422
2426 void SetSelfDeaf(bool deaf);
2427
2430 void SetSelfMute(bool mute);
2431
2438
2442
2449 void SetVADThreshold(bool automatic, float threshold);
2450
2453};
2454
2466 mutable Discord_ChannelHandle instance_{};
2469
2470public:
2472 Discord_ChannelHandle* instance() const { return &instance_; }
2475 explicit ChannelHandle(Discord_ChannelHandle instance, DiscordObjectState state);
2479 ChannelHandle(ChannelHandle&& other) noexcept;
2485 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2486
2491
2493 void Drop();
2495
2497 uint64_t Id() const;
2498
2504
2508
2511};
2512
2517 mutable Discord_GuildMinimal instance_{};
2520
2521public:
2523 Discord_GuildMinimal* instance() const { return &instance_; }
2526 explicit GuildMinimal(Discord_GuildMinimal instance, DiscordObjectState state);
2527 ~GuildMinimal();
2530 GuildMinimal(GuildMinimal&& other) noexcept;
2534 static const GuildMinimal nullobj;
2536 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2537
2542
2544 void Drop();
2546
2548 uint64_t Id() const;
2550 void SetId(uint64_t Id);
2551
2555 void SetName(std::string_view Name);
2556};
2557
2562 mutable Discord_UserGuild instance_{};
2565
2566public:
2568 Discord_UserGuild* instance() const { return &instance_; }
2571 explicit UserGuild(Discord_UserGuild instance, DiscordObjectState state);
2572 ~UserGuild();
2575 UserGuild(UserGuild&& other) noexcept;
2577 UserGuild& operator=(UserGuild&& other) noexcept;
2579 static const UserGuild nullobj;
2581 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2582
2584 UserGuild(const UserGuild& arg0);
2587
2589 void Drop();
2591
2593 uint64_t Id() const;
2595 void SetId(uint64_t Id);
2596
2600 void SetName(std::string_view Name);
2601
2603 std::optional<discordpp::String> Icon() const;
2605 void SetIcon(std::optional<std::string_view> Icon);
2606
2608 std::optional<discordpp::String> Banner() const;
2610 void SetBanner(std::optional<std::string_view> Banner);
2611
2613 bool Owner() const;
2615 void SetOwner(bool Owner);
2616
2621 uint64_t Permissions() const;
2624
2626 std::optional<discordpp::LinkedGameOrganization> LinkedGameOrganization() const;
2629 std::optional<discordpp::LinkedGameOrganization> LinkedGameOrganization);
2630};
2631
2638 mutable Discord_LinkedGameOrganization instance_{};
2641
2642public:
2644 Discord_LinkedGameOrganization* instance() const { return &instance_; }
2647 explicit LinkedGameOrganization(Discord_LinkedGameOrganization instance,
2648 DiscordObjectState state);
2658 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2659
2664
2665 explicit LinkedGameOrganization();
2666
2668 void Drop();
2670
2672 std::optional<uint64_t> ApplicationId() const;
2674 void SetApplicationId(std::optional<uint64_t> ApplicationId);
2675
2677 std::optional<discordpp::String> GameOrganizationId() const;
2679 void SetGameOrganizationId(std::optional<std::string_view> GameOrganizationId);
2680};
2681
2686 mutable Discord_GuildChannel instance_{};
2689
2690public:
2692 Discord_GuildChannel* instance() const { return &instance_; }
2695 explicit GuildChannel(Discord_GuildChannel instance, DiscordObjectState state);
2696 ~GuildChannel();
2699 GuildChannel(GuildChannel&& other) noexcept;
2703 static const GuildChannel nullobj;
2705 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2706
2711
2713 void Drop();
2715
2717 uint64_t Id() const;
2719 void SetId(uint64_t Id);
2720
2724 void SetName(std::string_view Name);
2725
2730
2732 int32_t Position() const;
2734 void SetPosition(int32_t Position);
2735
2737 std::optional<uint64_t> ParentId() const;
2739 void SetParentId(std::optional<uint64_t> ParentId);
2740
2751 bool IsLinkable() const;
2754
2771
2774 std::optional<discordpp::LinkedLobby> LinkedLobby() const;
2776 void SetLinkedLobby(std::optional<discordpp::LinkedLobby> LinkedLobby);
2777};
2778
2782 mutable Discord_LinkedLobby instance_{};
2785
2786public:
2788 Discord_LinkedLobby* instance() const { return &instance_; }
2791 explicit LinkedLobby(Discord_LinkedLobby instance, DiscordObjectState state);
2792 ~LinkedLobby();
2795 LinkedLobby(LinkedLobby&& other) noexcept;
2799 static const LinkedLobby nullobj;
2801 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2802
2807
2808 explicit LinkedLobby();
2809
2811 void Drop();
2813
2815 uint64_t ApplicationId() const;
2818
2820 uint64_t LobbyId() const;
2822 void SetLobbyId(uint64_t LobbyId);
2823};
2824
2828 mutable Discord_LinkedChannel instance_{};
2831
2832public:
2834 Discord_LinkedChannel* instance() const { return &instance_; }
2837 explicit LinkedChannel(Discord_LinkedChannel instance, DiscordObjectState state);
2841 LinkedChannel(LinkedChannel&& other) noexcept;
2847 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2848
2853
2855 void Drop();
2857
2859 uint64_t Id() const;
2861 void SetId(uint64_t Id);
2862
2866 void SetName(std::string_view Name);
2867
2869 uint64_t GuildId() const;
2871 void SetGuildId(uint64_t GuildId);
2872};
2873
2911 mutable Discord_RelationshipHandle instance_{};
2914
2915public:
2917 Discord_RelationshipHandle* instance() const { return &instance_; }
2920 explicit RelationshipHandle(Discord_RelationshipHandle instance, DiscordObjectState state);
2930 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2931
2936
2938 void Drop();
2940
2943
2946
2948 uint64_t Id() const;
2949
2951 bool IsSpamRequest() const;
2952
2955 std::optional<discordpp::UserHandle> User() const;
2956};
2957
2968 mutable Discord_UserApplicationProfileHandle instance_{};
2971
2972public:
2974 Discord_UserApplicationProfileHandle* instance() const { return &instance_; }
2977 explicit UserApplicationProfileHandle(Discord_UserApplicationProfileHandle instance,
2978 DiscordObjectState state);
2988 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2989
2994
2996 void Drop();
2998
3001
3004
3006 std::optional<discordpp::String> ProviderId() const;
3007
3010
3013
3016};
3017
3030 mutable Discord_UserHandle instance_{};
3033
3034public:
3036 enum class AvatarType {
3037
3039 Gif = 0,
3040
3042 Webp = 1,
3043
3045 Png = 2,
3046
3048 Jpeg = 3,
3049 };
3050
3051 Discord_UserHandle* instance() const { return &instance_; }
3054 explicit UserHandle(Discord_UserHandle instance, DiscordObjectState state);
3055 ~UserHandle();
3058 UserHandle(UserHandle&& other) noexcept;
3060 UserHandle& operator=(UserHandle&& other) noexcept;
3062 static const UserHandle nullobj;
3064 operator bool() const { return state_ != DiscordObjectState::Invalid; }
3065
3070
3072 void Drop();
3074
3076 std::optional<discordpp::String> Avatar() const;
3077
3080
3086 discordpp::UserHandle::AvatarType staticType) const;
3087
3091
3101 std::optional<discordpp::Activity> GameActivity() const;
3102
3111 std::optional<discordpp::String> GlobalName() const;
3112
3116 uint64_t Id() const;
3117
3119 bool IsProvisional() const;
3120
3124
3127
3132
3140};
3141
3160 mutable Discord_LobbyMemberHandle instance_{};
3163
3164public:
3166 Discord_LobbyMemberHandle* instance() const { return &instance_; }
3169 explicit LobbyMemberHandle(Discord_LobbyMemberHandle instance, DiscordObjectState state);
3179 operator bool() const { return state_ != DiscordObjectState::Invalid; }
3180
3185
3187 void Drop();
3189
3196 bool CanLinkLobby() const;
3197
3199 bool Connected() const;
3200
3202 uint64_t Id() const;
3203
3210
3212 std::optional<discordpp::UserHandle> User() const;
3213};
3214
3305 mutable Discord_LobbyHandle instance_{};
3308
3309public:
3311 Discord_LobbyHandle* instance() const { return &instance_; }
3314 explicit LobbyHandle(Discord_LobbyHandle instance, DiscordObjectState state);
3315 ~LobbyHandle();
3318 LobbyHandle(LobbyHandle&& other) noexcept;
3322 static const LobbyHandle nullobj;
3324 operator bool() const { return state_ != DiscordObjectState::Invalid; }
3325
3330
3332 void Drop();
3334
3340 std::optional<discordpp::CallInfoHandle> GetCallInfoHandle() const;
3341
3344 std::optional<discordpp::LobbyMemberHandle> GetLobbyMemberHandle(uint64_t memberId) const;
3345
3347 uint64_t Id() const;
3348
3350 std::optional<discordpp::LinkedChannel> LinkedChannel() const;
3351
3354
3357
3363};
3364
3369 mutable Discord_AdditionalContent instance_{};
3372
3373public:
3375 Discord_AdditionalContent* instance() const { return &instance_; }
3378 explicit AdditionalContent(Discord_AdditionalContent instance, DiscordObjectState state);
3388 operator bool() const { return state_ != DiscordObjectState::Invalid; }
3389
3394
3395 explicit AdditionalContent();
3396
3398 void Drop();
3400
3403
3406
3411
3414 std::optional<discordpp::String> Title() const;
3416 void SetTitle(std::optional<std::string_view> Title);
3417
3420 uint8_t Count() const;
3422 void SetCount(uint8_t Count);
3423};
3424
3481 mutable Discord_MessageHandle instance_{};
3484
3485public:
3487 Discord_MessageHandle* instance() const { return &instance_; }
3490 explicit MessageHandle(Discord_MessageHandle instance, DiscordObjectState state);
3494 MessageHandle(MessageHandle&& other) noexcept;
3500 operator bool() const { return state_ != DiscordObjectState::Invalid; }
3501
3506
3508 void Drop();
3510
3513 std::optional<discordpp::AdditionalContent> AdditionalContent() const;
3514
3519 std::optional<discordpp::String> AdditionalName() const;
3520
3527 std::optional<uint64_t> ApplicationId() const;
3528
3530 std::optional<discordpp::UserHandle> Author() const;
3531
3533 uint64_t AuthorId() const;
3534
3536 std::optional<discordpp::ChannelHandle> Channel() const;
3537
3539 uint64_t ChannelId() const;
3540
3547
3550 std::optional<discordpp::DisclosureTypes> DisclosureType() const;
3551
3555 uint64_t EditedTimestamp() const;
3556
3558 uint64_t Id() const;
3559
3561 std::optional<discordpp::LobbyHandle> Lobby() const;
3562
3569
3577
3584
3587 std::optional<discordpp::UserHandle> Recipient() const;
3588
3591 uint64_t RecipientId() const;
3592
3596 bool SentFromGame() const;
3597
3599 uint64_t SentTimestamp() const;
3600};
3601
3608 mutable Discord_AudioDevice instance_{};
3611
3612public:
3614 Discord_AudioDevice* instance() const { return &instance_; }
3617 explicit AudioDevice(Discord_AudioDevice instance, DiscordObjectState state);
3618 ~AudioDevice();
3621 AudioDevice(AudioDevice&& other) noexcept;
3625 static const AudioDevice nullobj;
3627 operator bool() const { return state_ != DiscordObjectState::Invalid; }
3628
3633
3635 void Drop();
3637
3640
3644 void SetId(std::string_view Id);
3645
3649 void SetName(std::string_view Name);
3650
3652 bool IsDefault() const;
3655};
3656
3663 mutable Discord_VoiceSettings instance_{};
3666
3667public:
3669 Discord_VoiceSettings* instance() const { return &instance_; }
3672 explicit VoiceSettings(Discord_VoiceSettings instance, DiscordObjectState state);
3676 VoiceSettings(VoiceSettings&& other) noexcept;
3682 operator bool() const { return state_ != DiscordObjectState::Invalid; }
3683
3688
3690 void Drop();
3692
3694 bool SelfMute() const;
3697
3699 bool SelfDeaf() const;
3702
3707
3712 void SetPttKey(std::string_view PttKey);
3713
3715 float InputVolume() const;
3718
3720 float OutputVolume() const;
3723
3728
3730 bool EchoCancellation() const;
3733
3735 bool NoiseSuppression() const;
3738
3740 bool NoiseCancellation() const;
3743};
3744
3748 mutable Discord_DiscordClientGuildVoiceMember instance_{};
3751
3752public:
3754 Discord_DiscordClientGuildVoiceMember* instance() const { return &instance_; }
3757 explicit DiscordClientGuildVoiceMember(Discord_DiscordClientGuildVoiceMember instance,
3758 DiscordObjectState state);
3768 operator bool() const { return state_ != DiscordObjectState::Invalid; }
3769
3774
3776
3778 void Drop();
3780
3782 uint64_t UserId() const;
3784 void SetUserId(uint64_t UserId);
3785
3789 void SetDisplayName(std::string_view DisplayName);
3790
3794 void SetUsername(std::string_view Username);
3795
3797 std::optional<discordpp::String> AvatarHash() const;
3799 void SetAvatarHash(std::optional<std::string_view> AvatarHash);
3800
3802 bool Mute() const;
3804 void SetMute(bool Mute);
3805
3807 bool Deaf() const;
3809 void SetDeaf(bool Deaf);
3810
3812 bool SelfMute() const;
3815
3817 bool SelfDeaf() const;
3820
3825};
3826
3830 mutable Discord_DiscordClientGuildVoiceSnapshot instance_{};
3833
3834public:
3836 Discord_DiscordClientGuildVoiceSnapshot* instance() const { return &instance_; }
3839 explicit DiscordClientGuildVoiceSnapshot(Discord_DiscordClientGuildVoiceSnapshot instance,
3840 DiscordObjectState state);
3850 operator bool() const { return state_ != DiscordObjectState::Invalid; }
3851
3856
3858 void Drop();
3860
3863
3868
3870 bool Selected() const;
3873
3875 bool SpeakingAvailable() const;
3878};
3879
3883 mutable Discord_UserMessageSummary instance_{};
3886
3887public:
3889 Discord_UserMessageSummary* instance() const { return &instance_; }
3892 explicit UserMessageSummary(Discord_UserMessageSummary instance, DiscordObjectState state);
3902 operator bool() const { return state_ != DiscordObjectState::Invalid; }
3903
3908
3910 void Drop();
3912
3914 uint64_t LastMessageId() const;
3915
3917 uint64_t UserId() const;
3918};
3919
3925 mutable Discord_ClientCreateOptions instance_{};
3928
3929public:
3931 Discord_ClientCreateOptions* instance() const { return &instance_; }
3934 explicit ClientCreateOptions(Discord_ClientCreateOptions instance, DiscordObjectState state);
3944 operator bool() const { return state_ != DiscordObjectState::Invalid; }
3945
3950
3951 explicit ClientCreateOptions();
3952
3954 void Drop();
3956
3960 void SetWebBase(std::string_view WebBase);
3961
3965 void SetApiBase(std::string_view ApiBase);
3966
3978
3991
3994 std::optional<uint64_t> CpuAffinityMask() const;
3996 void SetCpuAffinityMask(std::optional<uint64_t> CpuAffinityMask);
3997};
3998
4004class Client {
4006 mutable Discord_Client instance_{};
4009
4010public:
4018 enum class Error {
4019
4021 None = 0,
4022
4025
4028
4031 };
4032
4047 enum class Status {
4048
4051
4054
4057
4060
4063
4066
4069 };
4070
4072 enum class Thread {
4073
4076
4079
4082 };
4083
4088
4093
4097
4100 discordpp::Function<void(uint64_t channelId, discordpp::ClientResult result)>;
4101
4104 discordpp::Function<void(uint64_t channelId, uint64_t userId)>;
4105
4108 discordpp::Function<void(uint64_t channelId, uint64_t userId)>;
4109
4112 discordpp::Function<void(uint64_t channelId, uint64_t userId)>;
4113
4116 discordpp::Function<void(uint64_t channelId, uint64_t userId)>;
4117
4120 discordpp::Function<void(uint64_t channelId, uint64_t userId)>;
4121
4124
4128
4131
4134
4137
4140
4144
4148
4152
4157
4160
4162 using NoAudioInputCallback = discordpp::Function<void(bool inputDetected)>;
4163
4166
4169 discordpp::Function<void(uint64_t lobbyId, uint64_t memberId, bool added)>;
4170
4174
4179 int16_t* data,
4180 uint64_t samplesPerChannel,
4181 int32_t sampleRate,
4182 uint64_t channels,
4183 bool& outShouldMute)>;
4184
4189 void(int16_t* data, uint64_t samplesPerChannel, int32_t sampleRate, uint64_t channels)>;
4190
4198 void(discordpp::ClientResult result, discordpp::String code, discordpp::String redirectUri)>;
4199
4203 discordpp::String accessToken,
4205 int32_t expiresIn,
4206 discordpp::String scopes)>;
4207
4210 void(discordpp::ClientResult result, uint64_t id, discordpp::String name)>;
4211
4215 discordpp::String accessToken,
4216 discordpp::String refreshToken,
4218 int32_t expiresIn,
4219 discordpp::String scopes)>;
4220
4227
4230
4233
4236
4240
4244
4248
4251
4254
4259
4264
4269
4272
4275
4280 discordpp::Function<void(discordpp::ClientResult result, uint64_t messageId)>;
4281
4283 using MessageCreatedCallback = discordpp::Function<void(uint64_t messageId)>;
4284
4287 discordpp::Function<void(uint64_t messageId, uint64_t channelId)>;
4288
4290 using MessageUpdatedCallback = discordpp::Function<void(uint64_t messageId)>;
4291
4295
4299
4305 void(discordpp::Client::Status status, discordpp::Client::Error error, int32_t errorDetail)>;
4306
4311
4314
4318
4321 discordpp::Function<void(discordpp::ClientResult result, uint64_t lobbyId)>;
4322
4327
4332
4336
4339
4342
4344 using LobbyCreatedCallback = discordpp::Function<void(uint64_t lobbyId)>;
4345
4347 using LobbyDeletedCallback = discordpp::Function<void(uint64_t lobbyId)>;
4348
4350 using LobbyMemberAddedCallback = discordpp::Function<void(uint64_t lobbyId, uint64_t memberId)>;
4351
4354 discordpp::Function<void(uint64_t lobbyId, uint64_t memberId)>;
4355
4358 discordpp::Function<void(uint64_t lobbyId, uint64_t memberId)>;
4359
4361 using LobbyUpdatedCallback = discordpp::Function<void(uint64_t lobbyId)>;
4362
4365
4369
4373
4377
4380
4383 discordpp::Function<void(uint64_t applicationId, discordpp::String joinSecret)>;
4384
4387
4390
4394
4398
4404 discordpp::Function<void(uint64_t userId, bool isDiscordRelationshipUpdate)>;
4405
4411 discordpp::Function<void(uint64_t userId, bool isDiscordRelationshipUpdate)>;
4412
4416 std::optional<discordpp::UserHandle> user)>;
4417
4420
4422 using UserUpdatedCallback = discordpp::Function<void(uint64_t userId)>;
4424 Discord_Client* instance() const { return &instance_; }
4427 explicit Client(Discord_Client instance, DiscordObjectState state);
4428 ~Client();
4431 Client(Client&& other) noexcept;
4433 Client& operator=(Client&& other) noexcept;
4435 static const Client nullobj;
4437 operator bool() const { return state_ != DiscordObjectState::Invalid; }
4438
4439 Client(const Client&) = delete;
4440 Client& operator=(const Client&) = delete;
4441
4443 explicit Client();
4444
4446 explicit Client(std::string_view apiBase, std::string_view webBase);
4447
4450
4452 void Drop();
4454
4457
4463
4467 [[deprecated("Please use GetCurrentUserV2 instead. This will be removed in a future version.")]]
4469
4473
4489
4501
4505 uint64_t channelId,
4507
4512 uint64_t guildId,
4514
4517
4519 static int32_t GetVersionMajor();
4520
4522 static int32_t GetVersionMinor();
4523
4525 static int32_t GetVersionPatch();
4526
4530 uint64_t channelId,
4531 bool force,
4533
4537 uint64_t channelId,
4539
4544
4549
4554
4559
4564
4569
4574
4579
4581 void SetHttpRequestTimeout(int32_t httpTimeoutInMilliseconds);
4582
4585
4589 uint64_t channelId,
4591
4594
4598
4601
4604 void EndCall(uint64_t channelId, discordpp::Client::EndCallCallback callback);
4605
4609
4611 discordpp::Call GetCall(uint64_t channelId);
4612
4615
4618
4621
4624
4630
4633
4639
4641 bool GetSelfDeafAll() const;
4642
4644 bool GetSelfMuteAll() const;
4645
4651
4656 void SetAecDump(bool on);
4657
4666
4670
4677 void SetEchoCancellation(bool on);
4678
4689 void SetEngineManagedAudioSession(bool isEngineManaged);
4690
4695
4700 void SetInputVolume(float inputVolume);
4701
4705
4714 void SetNoAudioInputThreshold(float dBFSThreshold);
4715
4722
4729 void SetNoiseSuppression(bool on);
4730
4737 void SetOpusHardwareCoding(bool encode, bool decode);
4738
4743
4748 void SetOutputVolume(float outputVolume);
4749
4754 void SetSelfDeafAll(bool deaf);
4755
4758 void SetSelfMuteAll(bool mute);
4759
4763 [[deprecated("Calling Client::SetSpeakerMode is DEPRECATED.")]]
4764 bool SetSpeakerMode(bool speakerMode);
4765
4772 void SetThreadPriority(discordpp::Client::Thread thread, int32_t priority);
4773
4780
4787
4790
4801 discordpp::Call StartCall(uint64_t channelId);
4802
4822 uint64_t lobbyId,
4826
4829
4835
4838
4934
4941
4947
4963 void ExchangeChildToken(std::string_view parentApplicationToken,
4964 uint64_t childApplicationId,
4966
4973 std::string_view token,
4975
5009 void GetProvisionalToken(uint64_t applicationId,
5011 std::string_view externalAuthToken,
5013
5037 void GetToken(uint64_t applicationId,
5038 std::string_view code,
5039 std::string_view codeVerifier,
5040 std::string_view redirectUri,
5042
5070
5110 std::string_view externalAuthToken,
5112
5143 void GetTokenFromProvisionalMerge(uint64_t applicationId,
5144 std::string_view code,
5145 std::string_view codeVerifier,
5146 std::string_view redirectUri,
5148 std::string_view externalAuthToken,
5150
5154
5159 void OpenAuthorizeDeviceScreen(uint64_t clientId, std::string_view userCode);
5160
5168
5183 void RefreshToken(uint64_t applicationId,
5184 std::string_view refreshToken,
5186
5197
5204
5217 void RevokeToken(uint64_t applicationId,
5218 std::string_view token,
5220
5225
5231 void SetGameWindowPid(int32_t pid);
5232
5246
5264 uint64_t applicationId,
5266 std::string_view externalAuthToken,
5268
5275 std::string_view name,
5277
5285 std::string_view token,
5288
5291
5300 bool CanOpenMessageInDiscord(uint64_t messageId);
5301
5303 void DeleteUserMessage(uint64_t recipientId,
5304 uint64_t messageId,
5306
5310 void EditUserMessage(uint64_t recipientId,
5311 uint64_t messageId,
5312 std::string_view content,
5314
5321 std::optional<discordpp::ChannelHandle> GetChannelHandle(uint64_t channelId) const;
5322
5334 void GetLobbyMessagesWithLimit(uint64_t lobbyId,
5335 int32_t limit,
5337
5342 std::optional<discordpp::MessageHandle> GetMessageHandle(uint64_t messageId) const;
5343
5351
5366 void GetUserMessagesWithLimit(uint64_t recipientId,
5367 int32_t limit,
5369
5380 uint64_t messageId,
5381 discordpp::Client::ProvisionalUserMergeRequiredCallback provisionalUserMergeRequiredCallback,
5383
5394 void SendLobbyMessage(uint64_t lobbyId,
5395 std::string_view content,
5397
5404 void SendLobbyMessageWithMetadata(uint64_t lobbyId,
5405 std::string_view content,
5406 discordpp::StringMap const& metadata,
5408
5421 void SendUserMessage(uint64_t recipientId,
5422 std::string_view content,
5424
5431 void SendUserMessageWithMetadata(uint64_t recipientId,
5432 std::string_view content,
5433 discordpp::StringMap const& metadata,
5435
5448
5456
5464
5475 void SetShowingChat(bool showingChat);
5477
5480
5491 discordpp::LoggingSeverity minSeverity);
5492
5499 discordpp::LoggingSeverity minSeverity);
5500
5507 void Connect();
5508
5515
5519
5529
5534 void SetApplicationId(uint64_t applicationId);
5535
5550 bool SetLogDir(std::string_view path, discordpp::LoggingSeverity minSeverity);
5551
5554
5567 void SetVoiceLogDir(std::string_view path, discordpp::LoggingSeverity minSeverity);
5569
5572
5576
5581
5583 void LinkGameOrganization(uint64_t guildId,
5584 std::string_view gameOrganizationId,
5586
5588 void UnlinkGameOrganization(std::string_view gameOrganizationId,
5591
5594
5612 void CreateOrJoinLobby(std::string_view secret,
5614
5621 void CreateOrJoinLobbyWithMetadata(std::string_view secret,
5622 discordpp::StringMap const& lobbyMetadata,
5623 discordpp::StringMap const& memberMetadata,
5625
5634
5636 std::optional<discordpp::LobbyHandle> GetLobbyHandle(uint64_t lobbyId) const;
5637
5644
5652
5660 uint64_t lobbyId,
5661 discordpp::Client::ProvisionalUserMergeRequiredCallback provisionalUserMergeRequiredCallback,
5663
5670 void LeaveLobby(uint64_t lobbyId, discordpp::Client::LeaveLobbyCallback callback);
5671
5676 void LinkChannelToLobby(uint64_t lobbyId,
5677 uint64_t channelId,
5679
5692
5703
5712
5721
5728
5732
5738 void UnlinkChannelFromLobby(uint64_t lobbyId,
5741
5744
5760
5763
5771
5774
5794 bool RegisterLaunchCommand(uint64_t applicationId, std::string_view command);
5795
5802 bool RegisterLaunchSteamApplication(uint64_t applicationId, uint32_t steamAppId);
5803
5814 void SendActivityInvite(uint64_t userId,
5815 std::string_view content,
5817
5825
5831
5841
5848
5856
5865
5869
5889
5892
5898 void AcceptDiscordFriendRequest(uint64_t userId,
5900
5906
5914
5920 void CancelDiscordFriendRequest(uint64_t userId,
5922
5928
5932
5936
5945 discordpp::RelationshipGroupType groupType) const;
5946
5952 void RejectDiscordFriendRequest(uint64_t userId,
5954
5960
5965 void RemoveDiscordAndGameFriend(uint64_t userId,
5967
5972
5978 std::string_view searchStr) const;
5979
5995 void SendDiscordFriendRequest(std::string_view username,
5997
6013 void SendDiscordFriendRequestById(uint64_t userId,
6015
6031 void SendGameFriendRequest(std::string_view username,
6033
6049 void SendGameFriendRequestById(uint64_t userId,
6051
6058
6065
6072
6075
6079 std::optional<discordpp::UserHandle> GetCurrentUserV2() const;
6080
6085 uint64_t applicationId,
6087
6093 std::optional<discordpp::UserHandle> GetUser(uint64_t userId) const;
6094
6101
6110};
6111
6115 mutable Discord_CallInfoHandle instance_{};
6118
6119public:
6121 Discord_CallInfoHandle* instance() const { return &instance_; }
6124 explicit CallInfoHandle(Discord_CallInfoHandle instance, DiscordObjectState state);
6134 operator bool() const { return state_ != DiscordObjectState::Invalid; }
6135
6140
6142 void Drop();
6144
6146 uint64_t ChannelId() const;
6147
6150
6153 std::optional<discordpp::VoiceStateHandle> GetVoiceStateHandle(uint64_t userId) const;
6154
6156 uint64_t GuildId() const;
6157};
6158
6160{
6161 switch (value) {
6163 return "Invalid";
6165 return "Join";
6167 return "JoinRequest";
6168 default:
6169 return "unknown";
6170 }
6171}
6172
6174{
6175 switch (value) {
6177 return "Private";
6179 return "Public";
6180 default:
6181 return "unknown";
6182 }
6183}
6184
6186{
6187 switch (value) {
6189 return "Playing";
6191 return "Streaming";
6193 return "Listening";
6195 return "Watching";
6197 return "CustomStatus";
6199 return "Competing";
6201 return "HangStatus";
6202 default:
6203 return "unknown";
6204 }
6205}
6206
6208{
6209 switch (value) {
6211 return "Name";
6213 return "State";
6215 return "Details";
6216 default:
6217 return "unknown";
6218 }
6219}
6220
6222{
6223 switch (value) {
6225 return "Desktop";
6227 return "Xbox";
6229 return "Samsung";
6231 return "IOS";
6233 return "Android";
6235 return "Embedded";
6237 return "PS4";
6239 return "PS5";
6240 default:
6241 return "unknown";
6242 }
6243}
6244
6245inline const char* EnumToString(discordpp::ErrorType value)
6246{
6247 switch (value) {
6249 return "None";
6251 return "NetworkError";
6253 return "HTTPError";
6255 return "ClientNotReady";
6257 return "Disabled";
6259 return "ClientDestroyed";
6261 return "ValidationError";
6263 return "Aborted";
6265 return "AuthorizationFailed";
6267 return "RPCError";
6268 default:
6269 return "unknown";
6270 }
6271}
6272
6274{
6275 switch (value) {
6277 return "None";
6279 return "Continue";
6281 return "SwitchingProtocols";
6283 return "Processing";
6285 return "EarlyHints";
6287 return "Ok";
6289 return "Created";
6291 return "Accepted";
6293 return "NonAuthoritativeInfo";
6295 return "NoContent";
6297 return "ResetContent";
6299 return "PartialContent";
6301 return "MultiStatus";
6303 return "AlreadyReported";
6305 return "ImUsed";
6307 return "MultipleChoices";
6309 return "MovedPermanently";
6311 return "Found";
6313 return "SeeOther";
6315 return "NotModified";
6317 return "TemporaryRedirect";
6319 return "PermanentRedirect";
6321 return "BadRequest";
6323 return "Unauthorized";
6325 return "PaymentRequired";
6327 return "Forbidden";
6329 return "NotFound";
6331 return "MethodNotAllowed";
6333 return "NotAcceptable";
6335 return "ProxyAuthRequired";
6337 return "RequestTimeout";
6339 return "Conflict";
6341 return "Gone";
6343 return "LengthRequired";
6345 return "PreconditionFailed";
6347 return "PayloadTooLarge";
6349 return "UriTooLong";
6351 return "UnsupportedMediaType";
6353 return "RangeNotSatisfiable";
6355 return "ExpectationFailed";
6357 return "MisdirectedRequest";
6359 return "UnprocessableEntity";
6361 return "Locked";
6363 return "FailedDependency";
6365 return "TooEarly";
6367 return "UpgradeRequired";
6369 return "PreconditionRequired";
6371 return "TooManyRequests";
6373 return "RequestHeaderFieldsTooLarge";
6375 return "InternalServerError";
6377 return "NotImplemented";
6379 return "BadGateway";
6381 return "ServiceUnavailable";
6383 return "GatewayTimeout";
6385 return "HttpVersionNotSupported";
6387 return "VariantAlsoNegotiates";
6389 return "InsufficientStorage";
6391 return "LoopDetected";
6393 return "NotExtended";
6395 return "NetworkAuthorizationRequired";
6396 default:
6397 return "unknown";
6398 }
6399}
6400
6402{
6403 switch (value) {
6405 return "S256";
6406 default:
6407 return "unknown";
6408 }
6409}
6410
6412{
6413 switch (value) {
6415 return "GuildInstall";
6417 return "UserInstall";
6418 default:
6419 return "unknown";
6420 }
6421}
6422
6423inline const char* EnumToString(discordpp::ChannelType value)
6424{
6425 switch (value) {
6427 return "GuildText";
6429 return "Dm";
6431 return "GuildVoice";
6433 return "GroupDm";
6435 return "GuildCategory";
6437 return "GuildNews";
6439 return "GuildStore";
6441 return "GuildNewsThread";
6443 return "GuildPublicThread";
6445 return "GuildPrivateThread";
6447 return "GuildStageVoice";
6449 return "GuildDirectory";
6451 return "GuildForum";
6453 return "GuildMedia";
6455 return "Lobby";
6457 return "EphemeralDm";
6458 default:
6459 return "unknown";
6460 }
6461}
6462
6464{
6465 switch (value) {
6467 return "Other";
6469 return "Attachment";
6471 return "Poll";
6473 return "VoiceMessage";
6475 return "Thread";
6477 return "Embed";
6479 return "Sticker";
6480 default:
6481 return "unknown";
6482 }
6483}
6484
6486{
6487 switch (value) {
6489 return "VoiceActivity";
6491 return "PushToTalk";
6492 default:
6493 return "unknown";
6494 }
6495}
6496
6498{
6499 switch (value) {
6501 return "Unavailable";
6503 return "Silent";
6505 return "Speaking";
6506 default:
6507 return "unknown";
6508 }
6509}
6510
6511inline const char* EnumToString(discordpp::AudioSystem value)
6512{
6513 switch (value) {
6515 return "Standard";
6517 return "Game";
6518 default:
6519 return "unknown";
6520 }
6521}
6522
6523inline const char* EnumToString(discordpp::Call::Error value)
6524{
6525 switch (value) {
6527 return "None";
6529 return "SignalingConnectionFailed";
6531 return "SignalingUnexpectedClose";
6533 return "VoiceConnectionFailed";
6535 return "JoinTimeout";
6537 return "Forbidden";
6538 default:
6539 return "unknown";
6540 }
6541}
6542
6544{
6545 switch (value) {
6547 return "MODE_UNINIT";
6549 return "MODE_VAD";
6551 return "MODE_PTT";
6552 default:
6553 return "unknown";
6554 }
6555}
6556
6557inline const char* EnumToString(discordpp::Call::Status value)
6558{
6559 switch (value) {
6561 return "Disconnected";
6563 return "Joining";
6565 return "Connecting";
6567 return "SignalingConnected";
6569 return "Connected";
6571 return "Reconnecting";
6573 return "Disconnecting";
6574 default:
6575 return "unknown";
6576 }
6577}
6578
6580{
6581 switch (value) {
6583 return "None";
6585 return "Friend";
6587 return "Blocked";
6589 return "PendingIncoming";
6591 return "PendingOutgoing";
6593 return "Implicit";
6595 return "Suggestion";
6596 default:
6597 return "unknown";
6598 }
6599}
6600
6602{
6603 switch (value) {
6605 return "OIDC";
6607 return "EpicOnlineServices";
6609 return "Steam";
6611 return "Unity";
6613 return "DiscordBot";
6615 return "None";
6617 return "Unknown";
6618 default:
6619 return "unknown";
6620 }
6621}
6622
6624{
6625 switch (value) {
6627 return "Gif";
6629 return "Webp";
6631 return "Png";
6633 return "Jpeg";
6634 default:
6635 return "unknown";
6636 }
6637}
6638
6639inline const char* EnumToString(discordpp::StatusType value)
6640{
6641 switch (value) {
6643 return "Online";
6645 return "Offline";
6647 return "Blocked";
6649 return "Idle";
6651 return "Dnd";
6653 return "Invisible";
6655 return "Streaming";
6657 return "Unknown";
6658 default:
6659 return "unknown";
6660 }
6661}
6662
6664{
6665 switch (value) {
6667 return "MessageDataVisibleOnDiscord";
6668 default:
6669 return "unknown";
6670 }
6671}
6672
6674{
6675 switch (value) {
6677 return "None";
6679 return "ConnectionFailed";
6681 return "UnexpectedClose";
6683 return "ConnectionCanceled";
6684 default:
6685 return "unknown";
6686 }
6687}
6688
6690{
6691 switch (value) {
6693 return "Disconnected";
6695 return "Connecting";
6697 return "Connected";
6699 return "Ready";
6701 return "Reconnecting";
6703 return "Disconnecting";
6705 return "HttpWait";
6706 default:
6707 return "unknown";
6708 }
6709}
6710
6712{
6713 switch (value) {
6715 return "Client";
6717 return "Voice";
6719 return "Network";
6720 default:
6721 return "unknown";
6722 }
6723}
6724
6726{
6727 switch (value) {
6729 return "User";
6731 return "Bearer";
6732 default:
6733 return "unknown";
6734 }
6735}
6736
6738{
6739 switch (value) {
6741 return "OIDC";
6743 return "EpicOnlineServicesAccessToken";
6745 return "EpicOnlineServicesIdToken";
6747 return "SteamSessionTicket";
6749 return "UnityServicesIdToken";
6751 return "DiscordBotIssuedAccessToken";
6753 return "AppleIdToken";
6755 return "PlayStationNetworkIdToken";
6756 default:
6757 return "unknown";
6758 }
6759}
6760
6762{
6763 switch (value) {
6765 return "Verbose";
6767 return "Info";
6769 return "Warning";
6771 return "Error";
6773 return "None";
6774 default:
6775 return "unknown";
6776 }
6777}
6778
6780{
6781 switch (value) {
6783 return "OnlinePlayingGame";
6785 return "OnlineElsewhere";
6787 return "Offline";
6788 default:
6789 return "unknown";
6790 }
6791}
6792} // namespace discordpp
6793#endif // DISCORD_HEADER_DISCORDPP_H_
6794#ifdef DISCORDPP_IMPLEMENTATION
6795#undef DISCORDPP_IMPLEMENTATION
6796#ifdef __clang__
6797#pragma clang diagnostic push
6798#pragma clang diagnostic ignored "-Wunused-parameter"
6799#endif
6800namespace discordpp {
6801Function<void(Function<void()>)> s_synchronizationContext;
6802
6803inline bool HasSynchronizationContext()
6804{
6805 return !!s_synchronizationContext;
6806}
6807
6808inline void PostTask(Function<void()> task)
6809{
6810 assert(s_synchronizationContext);
6811 s_synchronizationContext(std::move(task));
6812}
6813
6814void SetSynchronizationContext(Function<void(Function<void()>)> executor)
6815{
6816 s_synchronizationContext = std::move(executor);
6817}
6818
6819template <typename T>
6820struct TDelegateUserData {
6821 T delegate;
6822 explicit TDelegateUserData(T delegate)
6823 : delegate{std::move(delegate)}
6824 {
6825 }
6826
6827 static TDelegateUserData* Create(T delegate)
6828 {
6829 void* storage = detail::AllocateOrFail(sizeof(TDelegateUserData));
6830 return ::new (storage) TDelegateUserData(std::move(delegate));
6831 }
6832
6833 static void Free(void* ptr)
6834 {
6835 reinterpret_cast<TDelegateUserData*>(ptr)->~TDelegateUserData();
6836 Discord_Free(ptr);
6837 }
6838
6839 static T& Get(void* userData)
6840 {
6841 return reinterpret_cast<TDelegateUserData*>(userData)->delegate;
6842 }
6843};
6844
6845struct ConvertedProperties {
6846 ConvertedProperties(StringMap const& PropertyMap)
6847 {
6848 Properties.size = PropertyMap.size();
6849 Properties.keys = reinterpret_cast<Discord_String*>(
6850 Discord_Alloc(Properties.size * sizeof(Discord_String)));
6851 Properties.values = reinterpret_cast<Discord_String*>(
6852 Discord_Alloc(Properties.size * sizeof(Discord_String)));
6853 size_t i = 0;
6854 for (auto& pair : PropertyMap) {
6855 Properties.keys[i] = AllocateString(pair.first);
6856 Properties.values[i] = AllocateString(pair.second);
6857 ++i;
6858 }
6859 }
6860 ~ConvertedProperties() { Discord_FreeProperties(Properties); }
6861 Discord_Properties Properties{};
6862
6863private:
6864 Discord_String AllocateString(String const& str)
6865 {
6866 Discord_String result;
6867 result.ptr = reinterpret_cast<uint8_t*>(Discord_Alloc(str.size()));
6868 result.size = str.size();
6869 std::memcpy(result.ptr, str.data(), result.size);
6870 return result;
6871 }
6872};
6873
6874StringMap ConvertReturnedProperties(Discord_Properties const& Properties)
6875{
6876 StringMap result;
6877 for (size_t i = 0; i < Properties.size; ++i) {
6878 String key(reinterpret_cast<char*>(Properties.keys[i].ptr), Properties.keys[i].size);
6879 String value(reinterpret_cast<char*>(Properties.values[i].ptr), Properties.values[i].size);
6880 result.emplace(std::move(key), std::move(value));
6881 }
6882 return result;
6883}
6885ActivityInvite::~ActivityInvite()
6886{
6887 if (state_ == DiscordObjectState::Owned) {
6888 Drop();
6890 }
6891}
6893 : instance_(other.instance_)
6894 , state_(other.state_)
6895{
6896 other.state_ = DiscordObjectState::Invalid;
6897}
6899{
6900 if (this != &other) {
6901 if (state_ == DiscordObjectState::Owned) {
6902 Drop();
6903 }
6904 instance_ = other.instance_;
6905 state_ = other.state_;
6906 other.state_ = DiscordObjectState::Invalid;
6907 }
6908 return *this;
6909}
6911 : instance_{}
6912 , state_(DiscordObjectState::Invalid)
6913{
6914 if (rhs.state_ == DiscordObjectState::Owned) {
6915 Discord_ActivityInvite_Clone(&instance_, rhs.instance());
6916
6917 state_ = DiscordObjectState::Owned;
6918 }
6919}
6920ActivityInvite& ActivityInvite::operator=(const ActivityInvite& rhs)
6921{
6922 if (this != &rhs) {
6923 if (state_ == DiscordObjectState::Owned) {
6924 Drop();
6925 state_ = DiscordObjectState::Invalid;
6926 }
6927 if (rhs.state_ == DiscordObjectState::Owned) {
6928 Discord_ActivityInvite_Clone(&instance_, rhs.instance());
6929
6930 state_ = DiscordObjectState::Owned;
6931 }
6932 }
6933 return *this;
6934}
6935ActivityInvite::ActivityInvite(Discord_ActivityInvite instance, DiscordObjectState state)
6936 : instance_(instance)
6937 , state_(state)
6938{
6939}
6940ActivityInvite::ActivityInvite()
6941{
6942 assert(state_ == DiscordObjectState::Invalid);
6943 Discord_ActivityInvite_Init(&instance_);
6944 state_ = DiscordObjectState::Owned;
6945}
6946void ActivityInvite::Drop()
6947{
6948 if (state_ != DiscordObjectState::Owned) {
6949 return;
6950 }
6951 Discord_ActivityInvite_Drop(&instance_);
6952 state_ = DiscordObjectState::Invalid;
6953}
6954uint64_t ActivityInvite::SenderId() const
6955{
6956 assert(state_ == DiscordObjectState::Owned);
6957 uint64_t returnValue__;
6958 returnValue__ = Discord_ActivityInvite_SenderId(&instance_);
6959 return returnValue__;
6960}
6961void ActivityInvite::SetSenderId(uint64_t SenderId)
6962{
6963 assert(state_ == DiscordObjectState::Owned);
6964 Discord_ActivityInvite_SetSenderId(&instance_, SenderId);
6965}
6966uint64_t ActivityInvite::ChannelId() const
6967{
6968 assert(state_ == DiscordObjectState::Owned);
6969 uint64_t returnValue__;
6970 returnValue__ = Discord_ActivityInvite_ChannelId(&instance_);
6971 return returnValue__;
6972}
6973void ActivityInvite::SetChannelId(uint64_t ChannelId)
6974{
6975 assert(state_ == DiscordObjectState::Owned);
6976 Discord_ActivityInvite_SetChannelId(&instance_, ChannelId);
6977}
6978uint64_t ActivityInvite::MessageId() const
6979{
6980 assert(state_ == DiscordObjectState::Owned);
6981 uint64_t returnValue__;
6982 returnValue__ = Discord_ActivityInvite_MessageId(&instance_);
6983 return returnValue__;
6984}
6985void ActivityInvite::SetMessageId(uint64_t MessageId)
6986{
6987 assert(state_ == DiscordObjectState::Owned);
6988 Discord_ActivityInvite_SetMessageId(&instance_, MessageId);
6989}
6990discordpp::ActivityActionTypes ActivityInvite::Type() const
6991{
6992 assert(state_ == DiscordObjectState::Owned);
6993 Discord_ActivityActionTypes returnValue__;
6994 returnValue__ = Discord_ActivityInvite_Type(&instance_);
6995 return static_cast<discordpp::ActivityActionTypes>(returnValue__);
6996}
6997void ActivityInvite::SetType(discordpp::ActivityActionTypes Type)
6998{
6999 assert(state_ == DiscordObjectState::Owned);
7000 Discord_ActivityInvite_SetType(&instance_, static_cast<Discord_ActivityActionTypes>(Type));
7001}
7002uint64_t ActivityInvite::ApplicationId() const
7003{
7004 assert(state_ == DiscordObjectState::Owned);
7005 uint64_t returnValue__;
7006 returnValue__ = Discord_ActivityInvite_ApplicationId(&instance_);
7007 return returnValue__;
7008}
7009void ActivityInvite::SetApplicationId(uint64_t ApplicationId)
7010{
7011 assert(state_ == DiscordObjectState::Owned);
7012 Discord_ActivityInvite_SetApplicationId(&instance_, ApplicationId);
7013}
7014uint64_t ActivityInvite::ParentApplicationId() const
7015{
7016 assert(state_ == DiscordObjectState::Owned);
7017 uint64_t returnValue__;
7018 returnValue__ = Discord_ActivityInvite_ParentApplicationId(&instance_);
7019 return returnValue__;
7020}
7021void ActivityInvite::SetParentApplicationId(uint64_t ParentApplicationId)
7022{
7023 assert(state_ == DiscordObjectState::Owned);
7024 Discord_ActivityInvite_SetParentApplicationId(&instance_, ParentApplicationId);
7025}
7026discordpp::String ActivityInvite::PartyId() const
7027{
7028 assert(state_ == DiscordObjectState::Owned);
7029 Discord_String returnValueNative__;
7030 Discord_ActivityInvite_PartyId(&instance_, &returnValueNative__);
7031 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7032 returnValueNative__.size);
7033 Discord_Free(returnValueNative__.ptr);
7034 return returnValue__;
7035}
7036void ActivityInvite::SetPartyId(std::string_view PartyId)
7037{
7038 assert(state_ == DiscordObjectState::Owned);
7039 Discord_String PartyId__str{(uint8_t*)(PartyId.data() != nullptr ? PartyId.data() : ""),
7040 PartyId.size()};
7041 Discord_ActivityInvite_SetPartyId(&instance_, PartyId__str);
7042}
7043discordpp::String ActivityInvite::SessionId() const
7044{
7045 assert(state_ == DiscordObjectState::Owned);
7046 Discord_String returnValueNative__;
7047 Discord_ActivityInvite_SessionId(&instance_, &returnValueNative__);
7048 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7049 returnValueNative__.size);
7050 Discord_Free(returnValueNative__.ptr);
7051 return returnValue__;
7052}
7053void ActivityInvite::SetSessionId(std::string_view SessionId)
7054{
7055 assert(state_ == DiscordObjectState::Owned);
7056 Discord_String SessionId__str{(uint8_t*)(SessionId.data() != nullptr ? SessionId.data() : ""),
7057 SessionId.size()};
7058 Discord_ActivityInvite_SetSessionId(&instance_, SessionId__str);
7059}
7060bool ActivityInvite::IsValid() const
7061{
7062 assert(state_ == DiscordObjectState::Owned);
7063 bool returnValue__;
7064 returnValue__ = Discord_ActivityInvite_IsValid(&instance_);
7065 return returnValue__;
7066}
7067void ActivityInvite::SetIsValid(bool IsValid)
7068{
7069 assert(state_ == DiscordObjectState::Owned);
7070 Discord_ActivityInvite_SetIsValid(&instance_, IsValid);
7071}
7072const ActivityAssets ActivityAssets::nullobj{{}, DiscordObjectState::Invalid};
7073ActivityAssets::~ActivityAssets()
7074{
7075 if (state_ == DiscordObjectState::Owned) {
7076 Drop();
7077 state_ = DiscordObjectState::Invalid;
7078 }
7079}
7080ActivityAssets::ActivityAssets(ActivityAssets&& other) noexcept
7081 : instance_(other.instance_)
7082 , state_(other.state_)
7083{
7084 other.state_ = DiscordObjectState::Invalid;
7085}
7086ActivityAssets& ActivityAssets::operator=(ActivityAssets&& other) noexcept
7087{
7088 if (this != &other) {
7089 if (state_ == DiscordObjectState::Owned) {
7090 Drop();
7091 }
7092 instance_ = other.instance_;
7093 state_ = other.state_;
7094 other.state_ = DiscordObjectState::Invalid;
7095 }
7096 return *this;
7097}
7098ActivityAssets::ActivityAssets(const ActivityAssets& arg0)
7099 : instance_{}
7100 , state_(DiscordObjectState::Invalid)
7101{
7102 if (arg0.state_ == DiscordObjectState::Owned) {
7103 Discord_ActivityAssets_Clone(&instance_, arg0.instance());
7104
7105 state_ = DiscordObjectState::Owned;
7106 }
7107}
7108ActivityAssets& ActivityAssets::operator=(const ActivityAssets& arg0)
7109{
7110 if (this != &arg0) {
7111 if (state_ == DiscordObjectState::Owned) {
7112 Drop();
7113 state_ = DiscordObjectState::Invalid;
7114 }
7115 if (arg0.state_ == DiscordObjectState::Owned) {
7116 Discord_ActivityAssets_Clone(&instance_, arg0.instance());
7117
7118 state_ = DiscordObjectState::Owned;
7119 }
7120 }
7121 return *this;
7122}
7123ActivityAssets::ActivityAssets(Discord_ActivityAssets instance, DiscordObjectState state)
7124 : instance_(instance)
7125 , state_(state)
7126{
7127}
7128ActivityAssets::ActivityAssets()
7129{
7130 assert(state_ == DiscordObjectState::Invalid);
7131 Discord_ActivityAssets_Init(&instance_);
7132 state_ = DiscordObjectState::Owned;
7133}
7134void ActivityAssets::Drop()
7135{
7136 if (state_ != DiscordObjectState::Owned) {
7137 return;
7138 }
7139 Discord_ActivityAssets_Drop(&instance_);
7140 state_ = DiscordObjectState::Invalid;
7141}
7142std::optional<discordpp::String> ActivityAssets::LargeImage() const
7143{
7144 assert(state_ == DiscordObjectState::Owned);
7145 bool returnIsNonNull__;
7146 Discord_String returnValueNative__;
7147 returnIsNonNull__ = Discord_ActivityAssets_LargeImage(&instance_, &returnValueNative__);
7148 if (!returnIsNonNull__) {
7149 return {};
7150 }
7151 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7152 returnValueNative__.size);
7153 Discord_Free(returnValueNative__.ptr);
7154 return returnValue__;
7155}
7156void ActivityAssets::SetLargeImage(std::optional<std::string_view> LargeImage)
7157{
7158 assert(state_ == DiscordObjectState::Owned);
7159 Discord_String LargeImage__str{};
7160 if (LargeImage.has_value()) {
7161 LargeImage__str.ptr = (uint8_t*)(LargeImage->data() != nullptr ? LargeImage->data() : "");
7162 LargeImage__str.size = LargeImage->size();
7163 }
7164 Discord_ActivityAssets_SetLargeImage(&instance_,
7165 (LargeImage.has_value() ? &LargeImage__str : nullptr));
7166}
7167std::optional<discordpp::String> ActivityAssets::LargeText() const
7168{
7169 assert(state_ == DiscordObjectState::Owned);
7170 bool returnIsNonNull__;
7171 Discord_String returnValueNative__;
7172 returnIsNonNull__ = Discord_ActivityAssets_LargeText(&instance_, &returnValueNative__);
7173 if (!returnIsNonNull__) {
7174 return {};
7175 }
7176 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7177 returnValueNative__.size);
7178 Discord_Free(returnValueNative__.ptr);
7179 return returnValue__;
7180}
7181void ActivityAssets::SetLargeText(std::optional<std::string_view> LargeText)
7182{
7183 assert(state_ == DiscordObjectState::Owned);
7184 Discord_String LargeText__str{};
7185 if (LargeText.has_value()) {
7186 LargeText__str.ptr = (uint8_t*)(LargeText->data() != nullptr ? LargeText->data() : "");
7187 LargeText__str.size = LargeText->size();
7188 }
7189 Discord_ActivityAssets_SetLargeText(&instance_,
7190 (LargeText.has_value() ? &LargeText__str : nullptr));
7191}
7192std::optional<discordpp::String> ActivityAssets::LargeUrl() const
7193{
7194 assert(state_ == DiscordObjectState::Owned);
7195 bool returnIsNonNull__;
7196 Discord_String returnValueNative__;
7197 returnIsNonNull__ = Discord_ActivityAssets_LargeUrl(&instance_, &returnValueNative__);
7198 if (!returnIsNonNull__) {
7199 return {};
7200 }
7201 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7202 returnValueNative__.size);
7203 Discord_Free(returnValueNative__.ptr);
7204 return returnValue__;
7205}
7206void ActivityAssets::SetLargeUrl(std::optional<std::string_view> LargeUrl)
7207{
7208 assert(state_ == DiscordObjectState::Owned);
7209 Discord_String LargeUrl__str{};
7210 if (LargeUrl.has_value()) {
7211 LargeUrl__str.ptr = (uint8_t*)(LargeUrl->data() != nullptr ? LargeUrl->data() : "");
7212 LargeUrl__str.size = LargeUrl->size();
7213 }
7214 Discord_ActivityAssets_SetLargeUrl(&instance_,
7215 (LargeUrl.has_value() ? &LargeUrl__str : nullptr));
7216}
7217std::optional<discordpp::String> ActivityAssets::SmallImage() const
7218{
7219 assert(state_ == DiscordObjectState::Owned);
7220 bool returnIsNonNull__;
7221 Discord_String returnValueNative__;
7222 returnIsNonNull__ = Discord_ActivityAssets_SmallImage(&instance_, &returnValueNative__);
7223 if (!returnIsNonNull__) {
7224 return {};
7225 }
7226 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7227 returnValueNative__.size);
7228 Discord_Free(returnValueNative__.ptr);
7229 return returnValue__;
7230}
7231void ActivityAssets::SetSmallImage(std::optional<std::string_view> SmallImage)
7232{
7233 assert(state_ == DiscordObjectState::Owned);
7234 Discord_String SmallImage__str{};
7235 if (SmallImage.has_value()) {
7236 SmallImage__str.ptr = (uint8_t*)(SmallImage->data() != nullptr ? SmallImage->data() : "");
7237 SmallImage__str.size = SmallImage->size();
7238 }
7239 Discord_ActivityAssets_SetSmallImage(&instance_,
7240 (SmallImage.has_value() ? &SmallImage__str : nullptr));
7241}
7242std::optional<discordpp::String> ActivityAssets::SmallText() const
7243{
7244 assert(state_ == DiscordObjectState::Owned);
7245 bool returnIsNonNull__;
7246 Discord_String returnValueNative__;
7247 returnIsNonNull__ = Discord_ActivityAssets_SmallText(&instance_, &returnValueNative__);
7248 if (!returnIsNonNull__) {
7249 return {};
7250 }
7251 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7252 returnValueNative__.size);
7253 Discord_Free(returnValueNative__.ptr);
7254 return returnValue__;
7255}
7256void ActivityAssets::SetSmallText(std::optional<std::string_view> SmallText)
7257{
7258 assert(state_ == DiscordObjectState::Owned);
7259 Discord_String SmallText__str{};
7260 if (SmallText.has_value()) {
7261 SmallText__str.ptr = (uint8_t*)(SmallText->data() != nullptr ? SmallText->data() : "");
7262 SmallText__str.size = SmallText->size();
7263 }
7264 Discord_ActivityAssets_SetSmallText(&instance_,
7265 (SmallText.has_value() ? &SmallText__str : nullptr));
7266}
7267std::optional<discordpp::String> ActivityAssets::SmallUrl() const
7268{
7269 assert(state_ == DiscordObjectState::Owned);
7270 bool returnIsNonNull__;
7271 Discord_String returnValueNative__;
7272 returnIsNonNull__ = Discord_ActivityAssets_SmallUrl(&instance_, &returnValueNative__);
7273 if (!returnIsNonNull__) {
7274 return {};
7275 }
7276 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7277 returnValueNative__.size);
7278 Discord_Free(returnValueNative__.ptr);
7279 return returnValue__;
7280}
7281void ActivityAssets::SetSmallUrl(std::optional<std::string_view> SmallUrl)
7282{
7283 assert(state_ == DiscordObjectState::Owned);
7284 Discord_String SmallUrl__str{};
7285 if (SmallUrl.has_value()) {
7286 SmallUrl__str.ptr = (uint8_t*)(SmallUrl->data() != nullptr ? SmallUrl->data() : "");
7287 SmallUrl__str.size = SmallUrl->size();
7288 }
7289 Discord_ActivityAssets_SetSmallUrl(&instance_,
7290 (SmallUrl.has_value() ? &SmallUrl__str : nullptr));
7291}
7292std::optional<discordpp::String> ActivityAssets::InviteCoverImage() const
7293{
7294 assert(state_ == DiscordObjectState::Owned);
7295 bool returnIsNonNull__;
7296 Discord_String returnValueNative__;
7297 returnIsNonNull__ = Discord_ActivityAssets_InviteCoverImage(&instance_, &returnValueNative__);
7298 if (!returnIsNonNull__) {
7299 return {};
7300 }
7301 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7302 returnValueNative__.size);
7303 Discord_Free(returnValueNative__.ptr);
7304 return returnValue__;
7305}
7306void ActivityAssets::SetInviteCoverImage(std::optional<std::string_view> InviteCoverImage)
7307{
7308 assert(state_ == DiscordObjectState::Owned);
7309 Discord_String InviteCoverImage__str{};
7310 if (InviteCoverImage.has_value()) {
7311 InviteCoverImage__str.ptr =
7312 (uint8_t*)(InviteCoverImage->data() != nullptr ? InviteCoverImage->data() : "");
7313 InviteCoverImage__str.size = InviteCoverImage->size();
7314 }
7315 Discord_ActivityAssets_SetInviteCoverImage(
7316 &instance_, (InviteCoverImage.has_value() ? &InviteCoverImage__str : nullptr));
7317}
7318const ActivityTimestamps ActivityTimestamps::nullobj{{}, DiscordObjectState::Invalid};
7319ActivityTimestamps::~ActivityTimestamps()
7320{
7321 if (state_ == DiscordObjectState::Owned) {
7322 Drop();
7323 state_ = DiscordObjectState::Invalid;
7324 }
7325}
7326ActivityTimestamps::ActivityTimestamps(ActivityTimestamps&& other) noexcept
7327 : instance_(other.instance_)
7328 , state_(other.state_)
7329{
7330 other.state_ = DiscordObjectState::Invalid;
7331}
7332ActivityTimestamps& ActivityTimestamps::operator=(ActivityTimestamps&& other) noexcept
7333{
7334 if (this != &other) {
7335 if (state_ == DiscordObjectState::Owned) {
7336 Drop();
7337 }
7338 instance_ = other.instance_;
7339 state_ = other.state_;
7340 other.state_ = DiscordObjectState::Invalid;
7341 }
7342 return *this;
7343}
7344ActivityTimestamps::ActivityTimestamps(const ActivityTimestamps& arg0)
7345 : instance_{}
7346 , state_(DiscordObjectState::Invalid)
7347{
7348 if (arg0.state_ == DiscordObjectState::Owned) {
7349 Discord_ActivityTimestamps_Clone(&instance_, arg0.instance());
7350
7351 state_ = DiscordObjectState::Owned;
7352 }
7353}
7354ActivityTimestamps& ActivityTimestamps::operator=(const ActivityTimestamps& arg0)
7355{
7356 if (this != &arg0) {
7357 if (state_ == DiscordObjectState::Owned) {
7358 Drop();
7359 state_ = DiscordObjectState::Invalid;
7360 }
7361 if (arg0.state_ == DiscordObjectState::Owned) {
7362 Discord_ActivityTimestamps_Clone(&instance_, arg0.instance());
7363
7364 state_ = DiscordObjectState::Owned;
7365 }
7366 }
7367 return *this;
7368}
7369ActivityTimestamps::ActivityTimestamps(Discord_ActivityTimestamps instance,
7370 DiscordObjectState state)
7371 : instance_(instance)
7372 , state_(state)
7373{
7374}
7375ActivityTimestamps::ActivityTimestamps()
7376{
7377 assert(state_ == DiscordObjectState::Invalid);
7378 Discord_ActivityTimestamps_Init(&instance_);
7379 state_ = DiscordObjectState::Owned;
7380}
7381void ActivityTimestamps::Drop()
7382{
7383 if (state_ != DiscordObjectState::Owned) {
7384 return;
7385 }
7386 Discord_ActivityTimestamps_Drop(&instance_);
7387 state_ = DiscordObjectState::Invalid;
7388}
7389uint64_t ActivityTimestamps::Start() const
7390{
7391 assert(state_ == DiscordObjectState::Owned);
7392 uint64_t returnValue__;
7393 returnValue__ = Discord_ActivityTimestamps_Start(&instance_);
7394 return returnValue__;
7395}
7396void ActivityTimestamps::SetStart(uint64_t Start)
7397{
7398 assert(state_ == DiscordObjectState::Owned);
7399 Discord_ActivityTimestamps_SetStart(&instance_, Start);
7400}
7401uint64_t ActivityTimestamps::End() const
7402{
7403 assert(state_ == DiscordObjectState::Owned);
7404 uint64_t returnValue__;
7405 returnValue__ = Discord_ActivityTimestamps_End(&instance_);
7406 return returnValue__;
7407}
7408void ActivityTimestamps::SetEnd(uint64_t End)
7409{
7410 assert(state_ == DiscordObjectState::Owned);
7411 Discord_ActivityTimestamps_SetEnd(&instance_, End);
7412}
7413const ActivityParty ActivityParty::nullobj{{}, DiscordObjectState::Invalid};
7414ActivityParty::~ActivityParty()
7415{
7416 if (state_ == DiscordObjectState::Owned) {
7417 Drop();
7418 state_ = DiscordObjectState::Invalid;
7419 }
7420}
7421ActivityParty::ActivityParty(ActivityParty&& other) noexcept
7422 : instance_(other.instance_)
7423 , state_(other.state_)
7424{
7425 other.state_ = DiscordObjectState::Invalid;
7426}
7427ActivityParty& ActivityParty::operator=(ActivityParty&& other) noexcept
7428{
7429 if (this != &other) {
7430 if (state_ == DiscordObjectState::Owned) {
7431 Drop();
7432 }
7433 instance_ = other.instance_;
7434 state_ = other.state_;
7435 other.state_ = DiscordObjectState::Invalid;
7436 }
7437 return *this;
7438}
7439ActivityParty::ActivityParty(const ActivityParty& arg0)
7440 : instance_{}
7441 , state_(DiscordObjectState::Invalid)
7442{
7443 if (arg0.state_ == DiscordObjectState::Owned) {
7444 Discord_ActivityParty_Clone(&instance_, arg0.instance());
7445
7446 state_ = DiscordObjectState::Owned;
7447 }
7448}
7449ActivityParty& ActivityParty::operator=(const ActivityParty& arg0)
7450{
7451 if (this != &arg0) {
7452 if (state_ == DiscordObjectState::Owned) {
7453 Drop();
7454 state_ = DiscordObjectState::Invalid;
7455 }
7456 if (arg0.state_ == DiscordObjectState::Owned) {
7457 Discord_ActivityParty_Clone(&instance_, arg0.instance());
7458
7459 state_ = DiscordObjectState::Owned;
7460 }
7461 }
7462 return *this;
7463}
7464ActivityParty::ActivityParty(Discord_ActivityParty instance, DiscordObjectState state)
7465 : instance_(instance)
7466 , state_(state)
7467{
7468}
7469ActivityParty::ActivityParty()
7470{
7471 assert(state_ == DiscordObjectState::Invalid);
7472 Discord_ActivityParty_Init(&instance_);
7473 state_ = DiscordObjectState::Owned;
7474}
7475void ActivityParty::Drop()
7476{
7477 if (state_ != DiscordObjectState::Owned) {
7478 return;
7479 }
7480 Discord_ActivityParty_Drop(&instance_);
7481 state_ = DiscordObjectState::Invalid;
7482}
7483discordpp::String ActivityParty::Id() const
7484{
7485 assert(state_ == DiscordObjectState::Owned);
7486 Discord_String returnValueNative__;
7487 Discord_ActivityParty_Id(&instance_, &returnValueNative__);
7488 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7489 returnValueNative__.size);
7490 Discord_Free(returnValueNative__.ptr);
7491 return returnValue__;
7492}
7493void ActivityParty::SetId(std::string_view Id)
7494{
7495 assert(state_ == DiscordObjectState::Owned);
7496 Discord_String Id__str{(uint8_t*)(Id.data() != nullptr ? Id.data() : ""), Id.size()};
7497 Discord_ActivityParty_SetId(&instance_, Id__str);
7498}
7499int32_t ActivityParty::CurrentSize() const
7500{
7501 assert(state_ == DiscordObjectState::Owned);
7502 int32_t returnValue__;
7503 returnValue__ = Discord_ActivityParty_CurrentSize(&instance_);
7504 return returnValue__;
7505}
7506void ActivityParty::SetCurrentSize(int32_t CurrentSize)
7507{
7508 assert(state_ == DiscordObjectState::Owned);
7509 Discord_ActivityParty_SetCurrentSize(&instance_, CurrentSize);
7510}
7511int32_t ActivityParty::MaxSize() const
7512{
7513 assert(state_ == DiscordObjectState::Owned);
7514 int32_t returnValue__;
7515 returnValue__ = Discord_ActivityParty_MaxSize(&instance_);
7516 return returnValue__;
7517}
7518void ActivityParty::SetMaxSize(int32_t MaxSize)
7519{
7520 assert(state_ == DiscordObjectState::Owned);
7521 Discord_ActivityParty_SetMaxSize(&instance_, MaxSize);
7522}
7523discordpp::ActivityPartyPrivacy ActivityParty::Privacy() const
7524{
7525 assert(state_ == DiscordObjectState::Owned);
7526 Discord_ActivityPartyPrivacy returnValue__;
7527 returnValue__ = Discord_ActivityParty_Privacy(&instance_);
7528 return static_cast<discordpp::ActivityPartyPrivacy>(returnValue__);
7529}
7530void ActivityParty::SetPrivacy(discordpp::ActivityPartyPrivacy Privacy)
7531{
7532 assert(state_ == DiscordObjectState::Owned);
7533 Discord_ActivityParty_SetPrivacy(&instance_,
7534 static_cast<Discord_ActivityPartyPrivacy>(Privacy));
7535}
7536const ActivitySecrets ActivitySecrets::nullobj{{}, DiscordObjectState::Invalid};
7537ActivitySecrets::~ActivitySecrets()
7538{
7539 if (state_ == DiscordObjectState::Owned) {
7540 Drop();
7541 state_ = DiscordObjectState::Invalid;
7542 }
7543}
7544ActivitySecrets::ActivitySecrets(ActivitySecrets&& other) noexcept
7545 : instance_(other.instance_)
7546 , state_(other.state_)
7547{
7548 other.state_ = DiscordObjectState::Invalid;
7549}
7550ActivitySecrets& ActivitySecrets::operator=(ActivitySecrets&& other) noexcept
7551{
7552 if (this != &other) {
7553 if (state_ == DiscordObjectState::Owned) {
7554 Drop();
7555 }
7556 instance_ = other.instance_;
7557 state_ = other.state_;
7558 other.state_ = DiscordObjectState::Invalid;
7559 }
7560 return *this;
7561}
7562ActivitySecrets::ActivitySecrets(const ActivitySecrets& arg0)
7563 : instance_{}
7564 , state_(DiscordObjectState::Invalid)
7565{
7566 if (arg0.state_ == DiscordObjectState::Owned) {
7567 Discord_ActivitySecrets_Clone(&instance_, arg0.instance());
7568
7569 state_ = DiscordObjectState::Owned;
7570 }
7571}
7572ActivitySecrets& ActivitySecrets::operator=(const ActivitySecrets& arg0)
7573{
7574 if (this != &arg0) {
7575 if (state_ == DiscordObjectState::Owned) {
7576 Drop();
7577 state_ = DiscordObjectState::Invalid;
7578 }
7579 if (arg0.state_ == DiscordObjectState::Owned) {
7580 Discord_ActivitySecrets_Clone(&instance_, arg0.instance());
7581
7582 state_ = DiscordObjectState::Owned;
7583 }
7584 }
7585 return *this;
7586}
7587ActivitySecrets::ActivitySecrets(Discord_ActivitySecrets instance, DiscordObjectState state)
7588 : instance_(instance)
7589 , state_(state)
7590{
7591}
7592ActivitySecrets::ActivitySecrets()
7593{
7594 assert(state_ == DiscordObjectState::Invalid);
7595 Discord_ActivitySecrets_Init(&instance_);
7596 state_ = DiscordObjectState::Owned;
7597}
7598void ActivitySecrets::Drop()
7599{
7600 if (state_ != DiscordObjectState::Owned) {
7601 return;
7602 }
7603 Discord_ActivitySecrets_Drop(&instance_);
7604 state_ = DiscordObjectState::Invalid;
7605}
7606discordpp::String ActivitySecrets::Join() const
7607{
7608 assert(state_ == DiscordObjectState::Owned);
7609 Discord_String returnValueNative__;
7610 Discord_ActivitySecrets_Join(&instance_, &returnValueNative__);
7611 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7612 returnValueNative__.size);
7613 Discord_Free(returnValueNative__.ptr);
7614 return returnValue__;
7615}
7616void ActivitySecrets::SetJoin(std::string_view Join)
7617{
7618 assert(state_ == DiscordObjectState::Owned);
7619 Discord_String Join__str{(uint8_t*)(Join.data() != nullptr ? Join.data() : ""), Join.size()};
7620 Discord_ActivitySecrets_SetJoin(&instance_, Join__str);
7621}
7622const ActivityButton ActivityButton::nullobj{{}, DiscordObjectState::Invalid};
7623ActivityButton::~ActivityButton()
7624{
7625 if (state_ == DiscordObjectState::Owned) {
7626 Drop();
7627 state_ = DiscordObjectState::Invalid;
7628 }
7629}
7630ActivityButton::ActivityButton(ActivityButton&& other) noexcept
7631 : instance_(other.instance_)
7632 , state_(other.state_)
7633{
7634 other.state_ = DiscordObjectState::Invalid;
7635}
7636ActivityButton& ActivityButton::operator=(ActivityButton&& other) noexcept
7637{
7638 if (this != &other) {
7639 if (state_ == DiscordObjectState::Owned) {
7640 Drop();
7641 }
7642 instance_ = other.instance_;
7643 state_ = other.state_;
7644 other.state_ = DiscordObjectState::Invalid;
7645 }
7646 return *this;
7647}
7648ActivityButton::ActivityButton(const ActivityButton& arg0)
7649 : instance_{}
7650 , state_(DiscordObjectState::Invalid)
7651{
7652 if (arg0.state_ == DiscordObjectState::Owned) {
7653 Discord_ActivityButton_Clone(&instance_, arg0.instance());
7654
7655 state_ = DiscordObjectState::Owned;
7656 }
7657}
7658ActivityButton& ActivityButton::operator=(const ActivityButton& arg0)
7659{
7660 if (this != &arg0) {
7661 if (state_ == DiscordObjectState::Owned) {
7662 Drop();
7663 state_ = DiscordObjectState::Invalid;
7664 }
7665 if (arg0.state_ == DiscordObjectState::Owned) {
7666 Discord_ActivityButton_Clone(&instance_, arg0.instance());
7667
7668 state_ = DiscordObjectState::Owned;
7669 }
7670 }
7671 return *this;
7672}
7673ActivityButton::ActivityButton(Discord_ActivityButton instance, DiscordObjectState state)
7674 : instance_(instance)
7675 , state_(state)
7676{
7677}
7678ActivityButton::ActivityButton()
7679{
7680 assert(state_ == DiscordObjectState::Invalid);
7681 Discord_ActivityButton_Init(&instance_);
7682 state_ = DiscordObjectState::Owned;
7683}
7684void ActivityButton::Drop()
7685{
7686 if (state_ != DiscordObjectState::Owned) {
7687 return;
7688 }
7689 Discord_ActivityButton_Drop(&instance_);
7690 state_ = DiscordObjectState::Invalid;
7691}
7692discordpp::String ActivityButton::Label() const
7693{
7694 assert(state_ == DiscordObjectState::Owned);
7695 Discord_String returnValueNative__;
7696 Discord_ActivityButton_Label(&instance_, &returnValueNative__);
7697 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7698 returnValueNative__.size);
7699 Discord_Free(returnValueNative__.ptr);
7700 return returnValue__;
7701}
7702void ActivityButton::SetLabel(std::string_view Label)
7703{
7704 assert(state_ == DiscordObjectState::Owned);
7705 Discord_String Label__str{(uint8_t*)(Label.data() != nullptr ? Label.data() : ""),
7706 Label.size()};
7707 Discord_ActivityButton_SetLabel(&instance_, Label__str);
7708}
7709discordpp::String ActivityButton::Url() const
7710{
7711 assert(state_ == DiscordObjectState::Owned);
7712 Discord_String returnValueNative__;
7713 Discord_ActivityButton_Url(&instance_, &returnValueNative__);
7714 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7715 returnValueNative__.size);
7716 Discord_Free(returnValueNative__.ptr);
7717 return returnValue__;
7718}
7719void ActivityButton::SetUrl(std::string_view Url)
7720{
7721 assert(state_ == DiscordObjectState::Owned);
7722 Discord_String Url__str{(uint8_t*)(Url.data() != nullptr ? Url.data() : ""), Url.size()};
7723 Discord_ActivityButton_SetUrl(&instance_, Url__str);
7724}
7725const Activity Activity::nullobj{{}, DiscordObjectState::Invalid};
7726Activity::~Activity()
7727{
7728 if (state_ == DiscordObjectState::Owned) {
7729 Drop();
7730 state_ = DiscordObjectState::Invalid;
7731 }
7732}
7733Activity::Activity(Activity&& other) noexcept
7734 : instance_(other.instance_)
7735 , state_(other.state_)
7736{
7737 other.state_ = DiscordObjectState::Invalid;
7738}
7739Activity& Activity::operator=(Activity&& other) noexcept
7740{
7741 if (this != &other) {
7742 if (state_ == DiscordObjectState::Owned) {
7743 Drop();
7744 }
7745 instance_ = other.instance_;
7746 state_ = other.state_;
7747 other.state_ = DiscordObjectState::Invalid;
7748 }
7749 return *this;
7750}
7751Activity::Activity(const Activity& arg0)
7752 : instance_{}
7753 , state_(DiscordObjectState::Invalid)
7754{
7755 if (arg0.state_ == DiscordObjectState::Owned) {
7756 Discord_Activity_Clone(&instance_, arg0.instance());
7757
7758 state_ = DiscordObjectState::Owned;
7759 }
7760}
7761Activity& Activity::operator=(const Activity& arg0)
7762{
7763 if (this != &arg0) {
7764 if (state_ == DiscordObjectState::Owned) {
7765 Drop();
7766 state_ = DiscordObjectState::Invalid;
7767 }
7768 if (arg0.state_ == DiscordObjectState::Owned) {
7769 Discord_Activity_Clone(&instance_, arg0.instance());
7770
7771 state_ = DiscordObjectState::Owned;
7772 }
7773 }
7774 return *this;
7775}
7776Activity::Activity(Discord_Activity instance, DiscordObjectState state)
7777 : instance_(instance)
7778 , state_(state)
7779{
7780}
7781Activity::Activity()
7782{
7783 assert(state_ == DiscordObjectState::Invalid);
7784 Discord_Activity_Init(&instance_);
7785 state_ = DiscordObjectState::Owned;
7786}
7787void Activity::Drop()
7788{
7789 if (state_ != DiscordObjectState::Owned) {
7790 return;
7791 }
7792 Discord_Activity_Drop(&instance_);
7793 state_ = DiscordObjectState::Invalid;
7794}
7795void Activity::AddButton(discordpp::ActivityButton button)
7796{
7797 assert(state_ == DiscordObjectState::Owned);
7798 Discord_Activity_AddButton(&instance_, button.instance());
7799}
7800bool Activity::Equals(discordpp::Activity other) const
7801{
7802 assert(state_ == DiscordObjectState::Owned);
7803 bool returnValue__;
7804 returnValue__ = Discord_Activity_Equals(&instance_, other.instance());
7805 return returnValue__;
7806}
7807discordpp::Vector<discordpp::ActivityButton> Activity::GetButtons() const
7808{
7809 assert(state_ == DiscordObjectState::Owned);
7810 Discord_ActivityButtonSpan returnValueNative__;
7811 Discord_Activity_GetButtons(&instance_, &returnValueNative__);
7813 returnValue__.reserve(returnValueNative__.size);
7814 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
7815 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
7816 }
7817 Discord_Free(returnValueNative__.ptr);
7818 return returnValue__;
7819}
7820discordpp::String Activity::Name() const
7821{
7822 assert(state_ == DiscordObjectState::Owned);
7823 Discord_String returnValueNative__;
7824 Discord_Activity_Name(&instance_, &returnValueNative__);
7825 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7826 returnValueNative__.size);
7827 Discord_Free(returnValueNative__.ptr);
7828 return returnValue__;
7829}
7830void Activity::SetName(std::string_view Name)
7831{
7832 assert(state_ == DiscordObjectState::Owned);
7833 Discord_String Name__str{(uint8_t*)(Name.data() != nullptr ? Name.data() : ""), Name.size()};
7834 Discord_Activity_SetName(&instance_, Name__str);
7835}
7836discordpp::ActivityTypes Activity::Type() const
7837{
7838 assert(state_ == DiscordObjectState::Owned);
7839 Discord_ActivityTypes returnValue__;
7840 returnValue__ = Discord_Activity_Type(&instance_);
7841 return static_cast<discordpp::ActivityTypes>(returnValue__);
7842}
7843void Activity::SetType(discordpp::ActivityTypes Type)
7844{
7845 assert(state_ == DiscordObjectState::Owned);
7846 Discord_Activity_SetType(&instance_, static_cast<Discord_ActivityTypes>(Type));
7847}
7848std::optional<discordpp::StatusDisplayTypes> Activity::StatusDisplayType() const
7849{
7850 assert(state_ == DiscordObjectState::Owned);
7851 bool returnIsNonNull__;
7852 Discord_StatusDisplayTypes returnValueNative__;
7853 returnIsNonNull__ = Discord_Activity_StatusDisplayType(&instance_, &returnValueNative__);
7854 if (!returnIsNonNull__) {
7855 return {};
7856 }
7857 auto returnValue__ = static_cast<discordpp::StatusDisplayTypes>(returnValueNative__);
7858 return returnValue__;
7859}
7860void Activity::SetStatusDisplayType(std::optional<discordpp::StatusDisplayTypes> StatusDisplayType)
7861{
7862 assert(state_ == DiscordObjectState::Owned);
7863 Discord_Activity_SetStatusDisplayType(
7864 &instance_,
7865 (StatusDisplayType.has_value()
7866 ? reinterpret_cast<Discord_StatusDisplayTypes*>(&*StatusDisplayType)
7867 : nullptr));
7868}
7869std::optional<discordpp::String> Activity::State() const
7870{
7871 assert(state_ == DiscordObjectState::Owned);
7872 bool returnIsNonNull__;
7873 Discord_String returnValueNative__;
7874 returnIsNonNull__ = Discord_Activity_State(&instance_, &returnValueNative__);
7875 if (!returnIsNonNull__) {
7876 return {};
7877 }
7878 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7879 returnValueNative__.size);
7880 Discord_Free(returnValueNative__.ptr);
7881 return returnValue__;
7882}
7883void Activity::SetState(std::optional<std::string_view> State)
7884{
7885 assert(state_ == DiscordObjectState::Owned);
7886 Discord_String State__str{};
7887 if (State.has_value()) {
7888 State__str.ptr = (uint8_t*)(State->data() != nullptr ? State->data() : "");
7889 State__str.size = State->size();
7890 }
7891 Discord_Activity_SetState(&instance_, (State.has_value() ? &State__str : nullptr));
7892}
7893std::optional<discordpp::String> Activity::StateUrl() const
7894{
7895 assert(state_ == DiscordObjectState::Owned);
7896 bool returnIsNonNull__;
7897 Discord_String returnValueNative__;
7898 returnIsNonNull__ = Discord_Activity_StateUrl(&instance_, &returnValueNative__);
7899 if (!returnIsNonNull__) {
7900 return {};
7901 }
7902 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7903 returnValueNative__.size);
7904 Discord_Free(returnValueNative__.ptr);
7905 return returnValue__;
7906}
7907void Activity::SetStateUrl(std::optional<std::string_view> StateUrl)
7908{
7909 assert(state_ == DiscordObjectState::Owned);
7910 Discord_String StateUrl__str{};
7911 if (StateUrl.has_value()) {
7912 StateUrl__str.ptr = (uint8_t*)(StateUrl->data() != nullptr ? StateUrl->data() : "");
7913 StateUrl__str.size = StateUrl->size();
7914 }
7915 Discord_Activity_SetStateUrl(&instance_, (StateUrl.has_value() ? &StateUrl__str : nullptr));
7916}
7917std::optional<discordpp::String> Activity::Details() const
7918{
7919 assert(state_ == DiscordObjectState::Owned);
7920 bool returnIsNonNull__;
7921 Discord_String returnValueNative__;
7922 returnIsNonNull__ = Discord_Activity_Details(&instance_, &returnValueNative__);
7923 if (!returnIsNonNull__) {
7924 return {};
7925 }
7926 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7927 returnValueNative__.size);
7928 Discord_Free(returnValueNative__.ptr);
7929 return returnValue__;
7930}
7931void Activity::SetDetails(std::optional<std::string_view> Details)
7932{
7933 assert(state_ == DiscordObjectState::Owned);
7934 Discord_String Details__str{};
7935 if (Details.has_value()) {
7936 Details__str.ptr = (uint8_t*)(Details->data() != nullptr ? Details->data() : "");
7937 Details__str.size = Details->size();
7938 }
7939 Discord_Activity_SetDetails(&instance_, (Details.has_value() ? &Details__str : nullptr));
7940}
7941std::optional<discordpp::String> Activity::DetailsUrl() const
7942{
7943 assert(state_ == DiscordObjectState::Owned);
7944 bool returnIsNonNull__;
7945 Discord_String returnValueNative__;
7946 returnIsNonNull__ = Discord_Activity_DetailsUrl(&instance_, &returnValueNative__);
7947 if (!returnIsNonNull__) {
7948 return {};
7949 }
7950 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7951 returnValueNative__.size);
7952 Discord_Free(returnValueNative__.ptr);
7953 return returnValue__;
7954}
7955void Activity::SetDetailsUrl(std::optional<std::string_view> DetailsUrl)
7956{
7957 assert(state_ == DiscordObjectState::Owned);
7958 Discord_String DetailsUrl__str{};
7959 if (DetailsUrl.has_value()) {
7960 DetailsUrl__str.ptr = (uint8_t*)(DetailsUrl->data() != nullptr ? DetailsUrl->data() : "");
7961 DetailsUrl__str.size = DetailsUrl->size();
7962 }
7963 Discord_Activity_SetDetailsUrl(&instance_,
7964 (DetailsUrl.has_value() ? &DetailsUrl__str : nullptr));
7965}
7966std::optional<uint64_t> Activity::ApplicationId() const
7967{
7968 assert(state_ == DiscordObjectState::Owned);
7969 bool returnIsNonNull__;
7970 uint64_t returnValue__;
7971 returnIsNonNull__ = Discord_Activity_ApplicationId(&instance_, &returnValue__);
7972 if (!returnIsNonNull__) {
7973 return std::nullopt;
7974 }
7975 return returnValue__;
7976}
7977void Activity::SetApplicationId(std::optional<uint64_t> ApplicationId)
7978{
7979 assert(state_ == DiscordObjectState::Owned);
7980 Discord_Activity_SetApplicationId(&instance_,
7981 (ApplicationId.has_value() ? &*ApplicationId : nullptr));
7982}
7983std::optional<uint64_t> Activity::ParentApplicationId() const
7984{
7985 assert(state_ == DiscordObjectState::Owned);
7986 bool returnIsNonNull__;
7987 uint64_t returnValue__;
7988 returnIsNonNull__ = Discord_Activity_ParentApplicationId(&instance_, &returnValue__);
7989 if (!returnIsNonNull__) {
7990 return std::nullopt;
7991 }
7992 return returnValue__;
7993}
7994void Activity::SetParentApplicationId(std::optional<uint64_t> ParentApplicationId)
7995{
7996 assert(state_ == DiscordObjectState::Owned);
7997 Discord_Activity_SetParentApplicationId(
7998 &instance_, (ParentApplicationId.has_value() ? &*ParentApplicationId : nullptr));
7999}
8000std::optional<discordpp::ActivityAssets> Activity::Assets() const
8001{
8002 assert(state_ == DiscordObjectState::Owned);
8003 bool returnIsNonNull__;
8004 Discord_ActivityAssets returnValueNative__;
8005 returnIsNonNull__ = Discord_Activity_Assets(&instance_, &returnValueNative__);
8006 if (!returnIsNonNull__) {
8007 return {};
8008 }
8009 discordpp::ActivityAssets returnValue__(returnValueNative__, DiscordObjectState::Owned);
8010 return returnValue__;
8011}
8012void Activity::SetAssets(std::optional<discordpp::ActivityAssets> Assets)
8013{
8014 assert(state_ == DiscordObjectState::Owned);
8015 Discord_Activity_SetAssets(&instance_, (Assets.has_value() ? Assets->instance() : nullptr));
8016}
8017std::optional<discordpp::ActivityTimestamps> Activity::Timestamps() const
8018{
8019 assert(state_ == DiscordObjectState::Owned);
8020 bool returnIsNonNull__;
8021 Discord_ActivityTimestamps returnValueNative__;
8022 returnIsNonNull__ = Discord_Activity_Timestamps(&instance_, &returnValueNative__);
8023 if (!returnIsNonNull__) {
8024 return {};
8025 }
8026 discordpp::ActivityTimestamps returnValue__(returnValueNative__, DiscordObjectState::Owned);
8027 return returnValue__;
8028}
8029void Activity::SetTimestamps(std::optional<discordpp::ActivityTimestamps> Timestamps)
8030{
8031 assert(state_ == DiscordObjectState::Owned);
8032 Discord_Activity_SetTimestamps(&instance_,
8033 (Timestamps.has_value() ? Timestamps->instance() : nullptr));
8034}
8035std::optional<discordpp::ActivityParty> Activity::Party() const
8036{
8037 assert(state_ == DiscordObjectState::Owned);
8038 bool returnIsNonNull__;
8039 Discord_ActivityParty returnValueNative__;
8040 returnIsNonNull__ = Discord_Activity_Party(&instance_, &returnValueNative__);
8041 if (!returnIsNonNull__) {
8042 return {};
8043 }
8044 discordpp::ActivityParty returnValue__(returnValueNative__, DiscordObjectState::Owned);
8045 return returnValue__;
8046}
8047void Activity::SetParty(std::optional<discordpp::ActivityParty> Party)
8048{
8049 assert(state_ == DiscordObjectState::Owned);
8050 Discord_Activity_SetParty(&instance_, (Party.has_value() ? Party->instance() : nullptr));
8051}
8052std::optional<discordpp::ActivitySecrets> Activity::Secrets() const
8053{
8054 assert(state_ == DiscordObjectState::Owned);
8055 bool returnIsNonNull__;
8056 Discord_ActivitySecrets returnValueNative__;
8057 returnIsNonNull__ = Discord_Activity_Secrets(&instance_, &returnValueNative__);
8058 if (!returnIsNonNull__) {
8059 return {};
8060 }
8061 discordpp::ActivitySecrets returnValue__(returnValueNative__, DiscordObjectState::Owned);
8062 return returnValue__;
8063}
8064void Activity::SetSecrets(std::optional<discordpp::ActivitySecrets> Secrets)
8065{
8066 assert(state_ == DiscordObjectState::Owned);
8067 Discord_Activity_SetSecrets(&instance_, (Secrets.has_value() ? Secrets->instance() : nullptr));
8068}
8069discordpp::ActivityGamePlatforms Activity::SupportedPlatforms() const
8070{
8071 assert(state_ == DiscordObjectState::Owned);
8072 Discord_ActivityGamePlatforms returnValue__;
8073 returnValue__ = Discord_Activity_SupportedPlatforms(&instance_);
8074 return static_cast<discordpp::ActivityGamePlatforms>(returnValue__);
8075}
8076void Activity::SetSupportedPlatforms(discordpp::ActivityGamePlatforms SupportedPlatforms)
8077{
8078 assert(state_ == DiscordObjectState::Owned);
8079 Discord_Activity_SetSupportedPlatforms(
8080 &instance_, static_cast<Discord_ActivityGamePlatforms>(SupportedPlatforms));
8081}
8082const ClientResult ClientResult::nullobj{{}, DiscordObjectState::Invalid};
8083ClientResult::~ClientResult()
8084{
8085 if (state_ == DiscordObjectState::Owned) {
8086 Drop();
8087 state_ = DiscordObjectState::Invalid;
8088 }
8089}
8090ClientResult::ClientResult(ClientResult&& other) noexcept
8091 : instance_(other.instance_)
8092 , state_(other.state_)
8093{
8094 other.state_ = DiscordObjectState::Invalid;
8095}
8096ClientResult& ClientResult::operator=(ClientResult&& other) noexcept
8097{
8098 if (this != &other) {
8099 if (state_ == DiscordObjectState::Owned) {
8100 Drop();
8101 }
8102 instance_ = other.instance_;
8103 state_ = other.state_;
8104 other.state_ = DiscordObjectState::Invalid;
8105 }
8106 return *this;
8107}
8108ClientResult::ClientResult(const ClientResult& arg0)
8109 : instance_{}
8110 , state_(DiscordObjectState::Invalid)
8111{
8112 if (arg0.state_ == DiscordObjectState::Owned) {
8113 Discord_ClientResult_Clone(&instance_, arg0.instance());
8114
8115 state_ = DiscordObjectState::Owned;
8116 }
8117}
8118ClientResult& ClientResult::operator=(const ClientResult& arg0)
8119{
8120 if (this != &arg0) {
8121 if (state_ == DiscordObjectState::Owned) {
8122 Drop();
8123 state_ = DiscordObjectState::Invalid;
8124 }
8125 if (arg0.state_ == DiscordObjectState::Owned) {
8126 Discord_ClientResult_Clone(&instance_, arg0.instance());
8127
8128 state_ = DiscordObjectState::Owned;
8129 }
8130 }
8131 return *this;
8132}
8133ClientResult::ClientResult(Discord_ClientResult instance, DiscordObjectState state)
8134 : instance_(instance)
8135 , state_(state)
8136{
8137}
8138void ClientResult::Drop()
8139{
8140 if (state_ != DiscordObjectState::Owned) {
8141 return;
8142 }
8143 Discord_ClientResult_Drop(&instance_);
8144 state_ = DiscordObjectState::Invalid;
8145}
8146discordpp::String ClientResult::ToString() const
8147{
8148 assert(state_ == DiscordObjectState::Owned);
8149 Discord_String returnValueNative__;
8150 Discord_ClientResult_ToString(&instance_, &returnValueNative__);
8151 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8152 returnValueNative__.size);
8153 Discord_Free(returnValueNative__.ptr);
8154 return returnValue__;
8155}
8156discordpp::ErrorType ClientResult::Type() const
8157{
8158 assert(state_ == DiscordObjectState::Owned);
8159 Discord_ErrorType returnValue__;
8160 returnValue__ = Discord_ClientResult_Type(&instance_);
8161 return static_cast<discordpp::ErrorType>(returnValue__);
8162}
8163void ClientResult::SetType(discordpp::ErrorType Type)
8164{
8165 assert(state_ == DiscordObjectState::Owned);
8166 Discord_ClientResult_SetType(&instance_, static_cast<Discord_ErrorType>(Type));
8167}
8168discordpp::String ClientResult::Error() const
8169{
8170 assert(state_ == DiscordObjectState::Owned);
8171 Discord_String returnValueNative__;
8172 Discord_ClientResult_Error(&instance_, &returnValueNative__);
8173 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8174 returnValueNative__.size);
8175 Discord_Free(returnValueNative__.ptr);
8176 return returnValue__;
8177}
8178void ClientResult::SetError(std::string_view Error)
8179{
8180 assert(state_ == DiscordObjectState::Owned);
8181 Discord_String Error__str{(uint8_t*)(Error.data() != nullptr ? Error.data() : ""),
8182 Error.size()};
8183 Discord_ClientResult_SetError(&instance_, Error__str);
8184}
8185int32_t ClientResult::ErrorCode() const
8186{
8187 assert(state_ == DiscordObjectState::Owned);
8188 int32_t returnValue__;
8189 returnValue__ = Discord_ClientResult_ErrorCode(&instance_);
8190 return returnValue__;
8191}
8192void ClientResult::SetErrorCode(int32_t ErrorCode)
8193{
8194 assert(state_ == DiscordObjectState::Owned);
8195 Discord_ClientResult_SetErrorCode(&instance_, ErrorCode);
8196}
8197discordpp::HttpStatusCode ClientResult::Status() const
8198{
8199 assert(state_ == DiscordObjectState::Owned);
8200 Discord_HttpStatusCode returnValue__;
8201 returnValue__ = Discord_ClientResult_Status(&instance_);
8202 return static_cast<discordpp::HttpStatusCode>(returnValue__);
8203}
8204void ClientResult::SetStatus(discordpp::HttpStatusCode Status)
8205{
8206 assert(state_ == DiscordObjectState::Owned);
8207 Discord_ClientResult_SetStatus(&instance_, static_cast<Discord_HttpStatusCode>(Status));
8208}
8209discordpp::String ClientResult::ResponseBody() const
8210{
8211 assert(state_ == DiscordObjectState::Owned);
8212 Discord_String returnValueNative__;
8213 Discord_ClientResult_ResponseBody(&instance_, &returnValueNative__);
8214 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8215 returnValueNative__.size);
8216 Discord_Free(returnValueNative__.ptr);
8217 return returnValue__;
8218}
8219void ClientResult::SetResponseBody(std::string_view ResponseBody)
8220{
8221 assert(state_ == DiscordObjectState::Owned);
8222 Discord_String ResponseBody__str{
8223 (uint8_t*)(ResponseBody.data() != nullptr ? ResponseBody.data() : ""), ResponseBody.size()};
8224 Discord_ClientResult_SetResponseBody(&instance_, ResponseBody__str);
8225}
8226bool ClientResult::Successful() const
8227{
8228 assert(state_ == DiscordObjectState::Owned);
8229 bool returnValue__;
8230 returnValue__ = Discord_ClientResult_Successful(&instance_);
8231 return returnValue__;
8232}
8233void ClientResult::SetSuccessful(bool Successful)
8234{
8235 assert(state_ == DiscordObjectState::Owned);
8236 Discord_ClientResult_SetSuccessful(&instance_, Successful);
8237}
8238bool ClientResult::Retryable() const
8239{
8240 assert(state_ == DiscordObjectState::Owned);
8241 bool returnValue__;
8242 returnValue__ = Discord_ClientResult_Retryable(&instance_);
8243 return returnValue__;
8244}
8245void ClientResult::SetRetryable(bool Retryable)
8246{
8247 assert(state_ == DiscordObjectState::Owned);
8248 Discord_ClientResult_SetRetryable(&instance_, Retryable);
8249}
8250float ClientResult::RetryAfter() const
8251{
8252 assert(state_ == DiscordObjectState::Owned);
8253 float returnValue__;
8254 returnValue__ = Discord_ClientResult_RetryAfter(&instance_);
8255 return returnValue__;
8256}
8257void ClientResult::SetRetryAfter(float RetryAfter)
8258{
8259 assert(state_ == DiscordObjectState::Owned);
8260 Discord_ClientResult_SetRetryAfter(&instance_, RetryAfter);
8261}
8262const AuthorizationCodeChallenge AuthorizationCodeChallenge::nullobj{{},
8263 DiscordObjectState::Invalid};
8264AuthorizationCodeChallenge::~AuthorizationCodeChallenge()
8265{
8266 if (state_ == DiscordObjectState::Owned) {
8267 Drop();
8268 state_ = DiscordObjectState::Invalid;
8269 }
8270}
8271AuthorizationCodeChallenge::AuthorizationCodeChallenge(AuthorizationCodeChallenge&& other) noexcept
8272 : instance_(other.instance_)
8273 , state_(other.state_)
8274{
8275 other.state_ = DiscordObjectState::Invalid;
8276}
8277AuthorizationCodeChallenge& AuthorizationCodeChallenge::operator=(
8278 AuthorizationCodeChallenge&& other) noexcept
8279{
8280 if (this != &other) {
8281 if (state_ == DiscordObjectState::Owned) {
8282 Drop();
8283 }
8284 instance_ = other.instance_;
8285 state_ = other.state_;
8286 other.state_ = DiscordObjectState::Invalid;
8287 }
8288 return *this;
8289}
8290AuthorizationCodeChallenge::AuthorizationCodeChallenge(const AuthorizationCodeChallenge& arg0)
8291 : instance_{}
8292 , state_(DiscordObjectState::Invalid)
8293{
8294 if (arg0.state_ == DiscordObjectState::Owned) {
8295 Discord_AuthorizationCodeChallenge_Clone(&instance_, arg0.instance());
8296
8297 state_ = DiscordObjectState::Owned;
8298 }
8299}
8300AuthorizationCodeChallenge& AuthorizationCodeChallenge::operator=(
8301 const AuthorizationCodeChallenge& arg0)
8302{
8303 if (this != &arg0) {
8304 if (state_ == DiscordObjectState::Owned) {
8305 Drop();
8306 state_ = DiscordObjectState::Invalid;
8307 }
8308 if (arg0.state_ == DiscordObjectState::Owned) {
8309 Discord_AuthorizationCodeChallenge_Clone(&instance_, arg0.instance());
8310
8311 state_ = DiscordObjectState::Owned;
8312 }
8313 }
8314 return *this;
8315}
8316AuthorizationCodeChallenge::AuthorizationCodeChallenge(Discord_AuthorizationCodeChallenge instance,
8317 DiscordObjectState state)
8318 : instance_(instance)
8319 , state_(state)
8320{
8321}
8322AuthorizationCodeChallenge::AuthorizationCodeChallenge()
8323{
8324 assert(state_ == DiscordObjectState::Invalid);
8325 Discord_AuthorizationCodeChallenge_Init(&instance_);
8326 state_ = DiscordObjectState::Owned;
8327}
8328void AuthorizationCodeChallenge::Drop()
8329{
8330 if (state_ != DiscordObjectState::Owned) {
8331 return;
8332 }
8333 Discord_AuthorizationCodeChallenge_Drop(&instance_);
8334 state_ = DiscordObjectState::Invalid;
8335}
8336discordpp::AuthenticationCodeChallengeMethod AuthorizationCodeChallenge::Method() const
8337{
8338 assert(state_ == DiscordObjectState::Owned);
8339 Discord_AuthenticationCodeChallengeMethod returnValue__;
8340 returnValue__ = Discord_AuthorizationCodeChallenge_Method(&instance_);
8341 return static_cast<discordpp::AuthenticationCodeChallengeMethod>(returnValue__);
8342}
8343void AuthorizationCodeChallenge::SetMethod(discordpp::AuthenticationCodeChallengeMethod Method)
8344{
8345 assert(state_ == DiscordObjectState::Owned);
8346 Discord_AuthorizationCodeChallenge_SetMethod(
8347 &instance_, static_cast<Discord_AuthenticationCodeChallengeMethod>(Method));
8348}
8349discordpp::String AuthorizationCodeChallenge::Challenge() const
8350{
8351 assert(state_ == DiscordObjectState::Owned);
8352 Discord_String returnValueNative__;
8353 Discord_AuthorizationCodeChallenge_Challenge(&instance_, &returnValueNative__);
8354 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8355 returnValueNative__.size);
8356 Discord_Free(returnValueNative__.ptr);
8357 return returnValue__;
8358}
8359void AuthorizationCodeChallenge::SetChallenge(std::string_view Challenge)
8360{
8361 assert(state_ == DiscordObjectState::Owned);
8362 Discord_String Challenge__str{(uint8_t*)(Challenge.data() != nullptr ? Challenge.data() : ""),
8363 Challenge.size()};
8364 Discord_AuthorizationCodeChallenge_SetChallenge(&instance_, Challenge__str);
8365}
8366const AuthorizationCodeVerifier AuthorizationCodeVerifier::nullobj{{}, DiscordObjectState::Invalid};
8367AuthorizationCodeVerifier::~AuthorizationCodeVerifier()
8368{
8369 if (state_ == DiscordObjectState::Owned) {
8370 Drop();
8371 state_ = DiscordObjectState::Invalid;
8372 }
8373}
8374AuthorizationCodeVerifier::AuthorizationCodeVerifier(AuthorizationCodeVerifier&& other) noexcept
8375 : instance_(other.instance_)
8376 , state_(other.state_)
8377{
8378 other.state_ = DiscordObjectState::Invalid;
8379}
8380AuthorizationCodeVerifier& AuthorizationCodeVerifier::operator=(
8381 AuthorizationCodeVerifier&& other) noexcept
8382{
8383 if (this != &other) {
8384 if (state_ == DiscordObjectState::Owned) {
8385 Drop();
8386 }
8387 instance_ = other.instance_;
8388 state_ = other.state_;
8389 other.state_ = DiscordObjectState::Invalid;
8390 }
8391 return *this;
8392}
8393AuthorizationCodeVerifier::AuthorizationCodeVerifier(const AuthorizationCodeVerifier& arg0)
8394 : instance_{}
8395 , state_(DiscordObjectState::Invalid)
8396{
8397 if (arg0.state_ == DiscordObjectState::Owned) {
8398 Discord_AuthorizationCodeVerifier_Clone(&instance_, arg0.instance());
8399
8400 state_ = DiscordObjectState::Owned;
8401 }
8402}
8403AuthorizationCodeVerifier& AuthorizationCodeVerifier::operator=(
8404 const AuthorizationCodeVerifier& arg0)
8405{
8406 if (this != &arg0) {
8407 if (state_ == DiscordObjectState::Owned) {
8408 Drop();
8409 state_ = DiscordObjectState::Invalid;
8410 }
8411 if (arg0.state_ == DiscordObjectState::Owned) {
8412 Discord_AuthorizationCodeVerifier_Clone(&instance_, arg0.instance());
8413
8414 state_ = DiscordObjectState::Owned;
8415 }
8416 }
8417 return *this;
8418}
8419AuthorizationCodeVerifier::AuthorizationCodeVerifier(Discord_AuthorizationCodeVerifier instance,
8420 DiscordObjectState state)
8421 : instance_(instance)
8422 , state_(state)
8423{
8424}
8425void AuthorizationCodeVerifier::Drop()
8426{
8427 if (state_ != DiscordObjectState::Owned) {
8428 return;
8429 }
8430 Discord_AuthorizationCodeVerifier_Drop(&instance_);
8431 state_ = DiscordObjectState::Invalid;
8432}
8433discordpp::AuthorizationCodeChallenge AuthorizationCodeVerifier::Challenge() const
8434{
8435 assert(state_ == DiscordObjectState::Owned);
8436 Discord_AuthorizationCodeChallenge returnValueNative__{};
8437 Discord_AuthorizationCodeVerifier_Challenge(&instance_, &returnValueNative__);
8438 discordpp::AuthorizationCodeChallenge returnValue__(returnValueNative__,
8439 DiscordObjectState::Owned);
8440 return returnValue__;
8441}
8442void AuthorizationCodeVerifier::SetChallenge(discordpp::AuthorizationCodeChallenge Challenge)
8443{
8444 assert(state_ == DiscordObjectState::Owned);
8445 Discord_AuthorizationCodeVerifier_SetChallenge(&instance_, Challenge.instance());
8446}
8447discordpp::String AuthorizationCodeVerifier::Verifier() const
8448{
8449 assert(state_ == DiscordObjectState::Owned);
8450 Discord_String returnValueNative__;
8451 Discord_AuthorizationCodeVerifier_Verifier(&instance_, &returnValueNative__);
8452 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8453 returnValueNative__.size);
8454 Discord_Free(returnValueNative__.ptr);
8455 return returnValue__;
8456}
8457void AuthorizationCodeVerifier::SetVerifier(std::string_view Verifier)
8458{
8459 assert(state_ == DiscordObjectState::Owned);
8460 Discord_String Verifier__str{(uint8_t*)(Verifier.data() != nullptr ? Verifier.data() : ""),
8461 Verifier.size()};
8462 Discord_AuthorizationCodeVerifier_SetVerifier(&instance_, Verifier__str);
8463}
8464const AuthorizationArgs AuthorizationArgs::nullobj{{}, DiscordObjectState::Invalid};
8465AuthorizationArgs::~AuthorizationArgs()
8466{
8467 if (state_ == DiscordObjectState::Owned) {
8468 Drop();
8469 state_ = DiscordObjectState::Invalid;
8470 }
8471}
8472AuthorizationArgs::AuthorizationArgs(AuthorizationArgs&& other) noexcept
8473 : instance_(other.instance_)
8474 , state_(other.state_)
8475{
8476 other.state_ = DiscordObjectState::Invalid;
8477}
8478AuthorizationArgs& AuthorizationArgs::operator=(AuthorizationArgs&& other) noexcept
8479{
8480 if (this != &other) {
8481 if (state_ == DiscordObjectState::Owned) {
8482 Drop();
8483 }
8484 instance_ = other.instance_;
8485 state_ = other.state_;
8486 other.state_ = DiscordObjectState::Invalid;
8487 }
8488 return *this;
8489}
8490AuthorizationArgs::AuthorizationArgs(const AuthorizationArgs& arg0)
8491 : instance_{}
8492 , state_(DiscordObjectState::Invalid)
8493{
8494 if (arg0.state_ == DiscordObjectState::Owned) {
8495 Discord_AuthorizationArgs_Clone(&instance_, arg0.instance());
8496
8497 state_ = DiscordObjectState::Owned;
8498 }
8499}
8500AuthorizationArgs& AuthorizationArgs::operator=(const AuthorizationArgs& arg0)
8501{
8502 if (this != &arg0) {
8503 if (state_ == DiscordObjectState::Owned) {
8504 Drop();
8505 state_ = DiscordObjectState::Invalid;
8506 }
8507 if (arg0.state_ == DiscordObjectState::Owned) {
8508 Discord_AuthorizationArgs_Clone(&instance_, arg0.instance());
8509
8510 state_ = DiscordObjectState::Owned;
8511 }
8512 }
8513 return *this;
8514}
8515AuthorizationArgs::AuthorizationArgs(Discord_AuthorizationArgs instance, DiscordObjectState state)
8516 : instance_(instance)
8517 , state_(state)
8518{
8519}
8520AuthorizationArgs::AuthorizationArgs()
8521{
8522 assert(state_ == DiscordObjectState::Invalid);
8523 Discord_AuthorizationArgs_Init(&instance_);
8524 state_ = DiscordObjectState::Owned;
8525}
8526void AuthorizationArgs::Drop()
8527{
8528 if (state_ != DiscordObjectState::Owned) {
8529 return;
8530 }
8531 Discord_AuthorizationArgs_Drop(&instance_);
8532 state_ = DiscordObjectState::Invalid;
8533}
8534uint64_t AuthorizationArgs::ClientId() const
8535{
8536 assert(state_ == DiscordObjectState::Owned);
8537 uint64_t returnValue__;
8538 returnValue__ = Discord_AuthorizationArgs_ClientId(&instance_);
8539 return returnValue__;
8540}
8541void AuthorizationArgs::SetClientId(uint64_t ClientId)
8542{
8543 assert(state_ == DiscordObjectState::Owned);
8544 Discord_AuthorizationArgs_SetClientId(&instance_, ClientId);
8545}
8546discordpp::String AuthorizationArgs::Scopes() const
8547{
8548 assert(state_ == DiscordObjectState::Owned);
8549 Discord_String returnValueNative__;
8550 Discord_AuthorizationArgs_Scopes(&instance_, &returnValueNative__);
8551 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8552 returnValueNative__.size);
8553 Discord_Free(returnValueNative__.ptr);
8554 return returnValue__;
8555}
8556void AuthorizationArgs::SetScopes(std::string_view Scopes)
8557{
8558 assert(state_ == DiscordObjectState::Owned);
8559 Discord_String Scopes__str{(uint8_t*)(Scopes.data() != nullptr ? Scopes.data() : ""),
8560 Scopes.size()};
8561 Discord_AuthorizationArgs_SetScopes(&instance_, Scopes__str);
8562}
8563std::optional<discordpp::String> AuthorizationArgs::State() const
8564{
8565 assert(state_ == DiscordObjectState::Owned);
8566 bool returnIsNonNull__;
8567 Discord_String returnValueNative__;
8568 returnIsNonNull__ = Discord_AuthorizationArgs_State(&instance_, &returnValueNative__);
8569 if (!returnIsNonNull__) {
8570 return {};
8571 }
8572 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8573 returnValueNative__.size);
8574 Discord_Free(returnValueNative__.ptr);
8575 return returnValue__;
8576}
8577void AuthorizationArgs::SetState(std::optional<std::string_view> State)
8578{
8579 assert(state_ == DiscordObjectState::Owned);
8580 Discord_String State__str{};
8581 if (State.has_value()) {
8582 State__str.ptr = (uint8_t*)(State->data() != nullptr ? State->data() : "");
8583 State__str.size = State->size();
8584 }
8585 Discord_AuthorizationArgs_SetState(&instance_, (State.has_value() ? &State__str : nullptr));
8586}
8587std::optional<discordpp::String> AuthorizationArgs::Nonce() const
8588{
8589 assert(state_ == DiscordObjectState::Owned);
8590 bool returnIsNonNull__;
8591 Discord_String returnValueNative__;
8592 returnIsNonNull__ = Discord_AuthorizationArgs_Nonce(&instance_, &returnValueNative__);
8593 if (!returnIsNonNull__) {
8594 return {};
8595 }
8596 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8597 returnValueNative__.size);
8598 Discord_Free(returnValueNative__.ptr);
8599 return returnValue__;
8600}
8601void AuthorizationArgs::SetNonce(std::optional<std::string_view> Nonce)
8602{
8603 assert(state_ == DiscordObjectState::Owned);
8604 Discord_String Nonce__str{};
8605 if (Nonce.has_value()) {
8606 Nonce__str.ptr = (uint8_t*)(Nonce->data() != nullptr ? Nonce->data() : "");
8607 Nonce__str.size = Nonce->size();
8608 }
8609 Discord_AuthorizationArgs_SetNonce(&instance_, (Nonce.has_value() ? &Nonce__str : nullptr));
8610}
8611std::optional<discordpp::AuthorizationCodeChallenge> AuthorizationArgs::CodeChallenge() const
8612{
8613 assert(state_ == DiscordObjectState::Owned);
8614 bool returnIsNonNull__;
8615 Discord_AuthorizationCodeChallenge returnValueNative__;
8616 returnIsNonNull__ = Discord_AuthorizationArgs_CodeChallenge(&instance_, &returnValueNative__);
8617 if (!returnIsNonNull__) {
8618 return {};
8619 }
8620 discordpp::AuthorizationCodeChallenge returnValue__(returnValueNative__,
8621 DiscordObjectState::Owned);
8622 return returnValue__;
8623}
8624void AuthorizationArgs::SetCodeChallenge(
8625 std::optional<discordpp::AuthorizationCodeChallenge> CodeChallenge)
8626{
8627 assert(state_ == DiscordObjectState::Owned);
8628 Discord_AuthorizationArgs_SetCodeChallenge(
8629 &instance_, (CodeChallenge.has_value() ? CodeChallenge->instance() : nullptr));
8630}
8631std::optional<discordpp::IntegrationType> AuthorizationArgs::IntegrationType() const
8632{
8633 assert(state_ == DiscordObjectState::Owned);
8634 bool returnIsNonNull__;
8635 Discord_IntegrationType returnValueNative__;
8636 returnIsNonNull__ = Discord_AuthorizationArgs_IntegrationType(&instance_, &returnValueNative__);
8637 if (!returnIsNonNull__) {
8638 return {};
8639 }
8640 auto returnValue__ = static_cast<discordpp::IntegrationType>(returnValueNative__);
8641 return returnValue__;
8642}
8643void AuthorizationArgs::SetIntegrationType(
8644 std::optional<discordpp::IntegrationType> IntegrationType)
8645{
8646 assert(state_ == DiscordObjectState::Owned);
8647 Discord_AuthorizationArgs_SetIntegrationType(
8648 &instance_,
8649 (IntegrationType.has_value() ? reinterpret_cast<Discord_IntegrationType*>(&*IntegrationType)
8650 : nullptr));
8651}
8652std::optional<discordpp::String> AuthorizationArgs::CustomSchemeParam() const
8653{
8654 assert(state_ == DiscordObjectState::Owned);
8655 bool returnIsNonNull__;
8656 Discord_String returnValueNative__;
8657 returnIsNonNull__ =
8658 Discord_AuthorizationArgs_CustomSchemeParam(&instance_, &returnValueNative__);
8659 if (!returnIsNonNull__) {
8660 return {};
8661 }
8662 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8663 returnValueNative__.size);
8664 Discord_Free(returnValueNative__.ptr);
8665 return returnValue__;
8666}
8667void AuthorizationArgs::SetCustomSchemeParam(std::optional<std::string_view> CustomSchemeParam)
8668{
8669 assert(state_ == DiscordObjectState::Owned);
8670 Discord_String CustomSchemeParam__str{};
8671 if (CustomSchemeParam.has_value()) {
8672 CustomSchemeParam__str.ptr =
8673 (uint8_t*)(CustomSchemeParam->data() != nullptr ? CustomSchemeParam->data() : "");
8674 CustomSchemeParam__str.size = CustomSchemeParam->size();
8675 }
8676 Discord_AuthorizationArgs_SetCustomSchemeParam(
8677 &instance_, (CustomSchemeParam.has_value() ? &CustomSchemeParam__str : nullptr));
8678}
8679const DeviceAuthorizationArgs DeviceAuthorizationArgs::nullobj{{}, DiscordObjectState::Invalid};
8680DeviceAuthorizationArgs::~DeviceAuthorizationArgs()
8681{
8682 if (state_ == DiscordObjectState::Owned) {
8683 Drop();
8684 state_ = DiscordObjectState::Invalid;
8685 }
8686}
8687DeviceAuthorizationArgs::DeviceAuthorizationArgs(DeviceAuthorizationArgs&& other) noexcept
8688 : instance_(other.instance_)
8689 , state_(other.state_)
8690{
8691 other.state_ = DiscordObjectState::Invalid;
8692}
8693DeviceAuthorizationArgs& DeviceAuthorizationArgs::operator=(
8694 DeviceAuthorizationArgs&& other) noexcept
8695{
8696 if (this != &other) {
8697 if (state_ == DiscordObjectState::Owned) {
8698 Drop();
8699 }
8700 instance_ = other.instance_;
8701 state_ = other.state_;
8702 other.state_ = DiscordObjectState::Invalid;
8703 }
8704 return *this;
8705}
8706DeviceAuthorizationArgs::DeviceAuthorizationArgs(const DeviceAuthorizationArgs& arg0)
8707 : instance_{}
8708 , state_(DiscordObjectState::Invalid)
8709{
8710 if (arg0.state_ == DiscordObjectState::Owned) {
8711 Discord_DeviceAuthorizationArgs_Clone(&instance_, arg0.instance());
8712
8713 state_ = DiscordObjectState::Owned;
8714 }
8715}
8716DeviceAuthorizationArgs& DeviceAuthorizationArgs::operator=(const DeviceAuthorizationArgs& arg0)
8717{
8718 if (this != &arg0) {
8719 if (state_ == DiscordObjectState::Owned) {
8720 Drop();
8721 state_ = DiscordObjectState::Invalid;
8722 }
8723 if (arg0.state_ == DiscordObjectState::Owned) {
8724 Discord_DeviceAuthorizationArgs_Clone(&instance_, arg0.instance());
8725
8726 state_ = DiscordObjectState::Owned;
8727 }
8728 }
8729 return *this;
8730}
8731DeviceAuthorizationArgs::DeviceAuthorizationArgs(Discord_DeviceAuthorizationArgs instance,
8732 DiscordObjectState state)
8733 : instance_(instance)
8734 , state_(state)
8735{
8736}
8737DeviceAuthorizationArgs::DeviceAuthorizationArgs()
8738{
8739 assert(state_ == DiscordObjectState::Invalid);
8740 Discord_DeviceAuthorizationArgs_Init(&instance_);
8741 state_ = DiscordObjectState::Owned;
8742}
8743void DeviceAuthorizationArgs::Drop()
8744{
8745 if (state_ != DiscordObjectState::Owned) {
8746 return;
8747 }
8748 Discord_DeviceAuthorizationArgs_Drop(&instance_);
8749 state_ = DiscordObjectState::Invalid;
8750}
8751uint64_t DeviceAuthorizationArgs::ClientId() const
8752{
8753 assert(state_ == DiscordObjectState::Owned);
8754 uint64_t returnValue__;
8755 returnValue__ = Discord_DeviceAuthorizationArgs_ClientId(&instance_);
8756 return returnValue__;
8757}
8758void DeviceAuthorizationArgs::SetClientId(uint64_t ClientId)
8759{
8760 assert(state_ == DiscordObjectState::Owned);
8761 Discord_DeviceAuthorizationArgs_SetClientId(&instance_, ClientId);
8762}
8763discordpp::String DeviceAuthorizationArgs::Scopes() const
8764{
8765 assert(state_ == DiscordObjectState::Owned);
8766 Discord_String returnValueNative__;
8767 Discord_DeviceAuthorizationArgs_Scopes(&instance_, &returnValueNative__);
8768 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8769 returnValueNative__.size);
8770 Discord_Free(returnValueNative__.ptr);
8771 return returnValue__;
8772}
8773void DeviceAuthorizationArgs::SetScopes(std::string_view Scopes)
8774{
8775 assert(state_ == DiscordObjectState::Owned);
8776 Discord_String Scopes__str{(uint8_t*)(Scopes.data() != nullptr ? Scopes.data() : ""),
8777 Scopes.size()};
8778 Discord_DeviceAuthorizationArgs_SetScopes(&instance_, Scopes__str);
8779}
8780const VoiceStateHandle VoiceStateHandle::nullobj{{}, DiscordObjectState::Invalid};
8781VoiceStateHandle::~VoiceStateHandle()
8782{
8783 if (state_ == DiscordObjectState::Owned) {
8784 Drop();
8785 state_ = DiscordObjectState::Invalid;
8786 }
8787}
8788VoiceStateHandle::VoiceStateHandle(VoiceStateHandle&& other) noexcept
8789 : instance_(other.instance_)
8790 , state_(other.state_)
8791{
8792 other.state_ = DiscordObjectState::Invalid;
8793}
8794VoiceStateHandle& VoiceStateHandle::operator=(VoiceStateHandle&& other) noexcept
8795{
8796 if (this != &other) {
8797 if (state_ == DiscordObjectState::Owned) {
8798 Drop();
8799 }
8800 instance_ = other.instance_;
8801 state_ = other.state_;
8802 other.state_ = DiscordObjectState::Invalid;
8803 }
8804 return *this;
8805}
8806VoiceStateHandle::VoiceStateHandle(const VoiceStateHandle& other)
8807 : instance_{}
8808 , state_(DiscordObjectState::Invalid)
8809{
8810 if (other.state_ == DiscordObjectState::Owned) {
8811 Discord_VoiceStateHandle_Clone(&instance_, other.instance());
8812
8813 state_ = DiscordObjectState::Owned;
8814 }
8815}
8816VoiceStateHandle& VoiceStateHandle::operator=(const VoiceStateHandle& other)
8817{
8818 if (this != &other) {
8819 if (state_ == DiscordObjectState::Owned) {
8820 Drop();
8821 state_ = DiscordObjectState::Invalid;
8822 }
8823 if (other.state_ == DiscordObjectState::Owned) {
8824 Discord_VoiceStateHandle_Clone(&instance_, other.instance());
8825
8826 state_ = DiscordObjectState::Owned;
8827 }
8828 }
8829 return *this;
8830}
8831VoiceStateHandle::VoiceStateHandle(Discord_VoiceStateHandle instance, DiscordObjectState state)
8832 : instance_(instance)
8833 , state_(state)
8834{
8835}
8836void VoiceStateHandle::Drop()
8837{
8838 if (state_ != DiscordObjectState::Owned) {
8839 return;
8840 }
8841 Discord_VoiceStateHandle_Drop(&instance_);
8842 state_ = DiscordObjectState::Invalid;
8843}
8844bool VoiceStateHandle::SelfDeaf() const
8845{
8846 assert(state_ == DiscordObjectState::Owned);
8847 bool returnValue__;
8848 returnValue__ = Discord_VoiceStateHandle_SelfDeaf(&instance_);
8849 return returnValue__;
8850}
8851bool VoiceStateHandle::SelfMute() const
8852{
8853 assert(state_ == DiscordObjectState::Owned);
8854 bool returnValue__;
8855 returnValue__ = Discord_VoiceStateHandle_SelfMute(&instance_);
8856 return returnValue__;
8857}
8858const VADThresholdSettings VADThresholdSettings::nullobj{{}, DiscordObjectState::Invalid};
8859VADThresholdSettings::~VADThresholdSettings()
8860{
8861 if (state_ == DiscordObjectState::Owned) {
8862 Drop();
8863 state_ = DiscordObjectState::Invalid;
8864 }
8865}
8866VADThresholdSettings::VADThresholdSettings(VADThresholdSettings&& other) noexcept
8867 : instance_(other.instance_)
8868 , state_(other.state_)
8869{
8870 other.state_ = DiscordObjectState::Invalid;
8871}
8872VADThresholdSettings& VADThresholdSettings::operator=(VADThresholdSettings&& other) noexcept
8873{
8874 if (this != &other) {
8875 if (state_ == DiscordObjectState::Owned) {
8876 Drop();
8877 }
8878 instance_ = other.instance_;
8879 state_ = other.state_;
8880 other.state_ = DiscordObjectState::Invalid;
8881 }
8882 return *this;
8883}
8884VADThresholdSettings::VADThresholdSettings(Discord_VADThresholdSettings instance,
8885 DiscordObjectState state)
8886 : instance_(instance)
8887 , state_(state)
8888{
8889}
8890void VADThresholdSettings::Drop()
8891{
8892 if (state_ != DiscordObjectState::Owned) {
8893 return;
8894 }
8895 Discord_VADThresholdSettings_Drop(&instance_);
8896 state_ = DiscordObjectState::Invalid;
8897}
8898float VADThresholdSettings::VadThreshold() const
8899{
8900 assert(state_ == DiscordObjectState::Owned);
8901 float returnValue__;
8902 returnValue__ = Discord_VADThresholdSettings_VadThreshold(&instance_);
8903 return returnValue__;
8904}
8905void VADThresholdSettings::SetVadThreshold(float VadThreshold)
8906{
8907 assert(state_ == DiscordObjectState::Owned);
8908 Discord_VADThresholdSettings_SetVadThreshold(&instance_, VadThreshold);
8909}
8910bool VADThresholdSettings::Automatic() const
8911{
8912 assert(state_ == DiscordObjectState::Owned);
8913 bool returnValue__;
8914 returnValue__ = Discord_VADThresholdSettings_Automatic(&instance_);
8915 return returnValue__;
8916}
8917void VADThresholdSettings::SetAutomatic(bool Automatic)
8918{
8919 assert(state_ == DiscordObjectState::Owned);
8920 Discord_VADThresholdSettings_SetAutomatic(&instance_, Automatic);
8921}
8922const Call Call::nullobj{{}, DiscordObjectState::Invalid};
8923Call::~Call()
8924{
8925 if (state_ == DiscordObjectState::Owned) {
8926 Drop();
8927 state_ = DiscordObjectState::Invalid;
8928 }
8929}
8930Call::Call(Call&& other) noexcept
8931 : instance_(other.instance_)
8932 , state_(other.state_)
8933{
8934 other.state_ = DiscordObjectState::Invalid;
8935}
8936Call& Call::operator=(Call&& other) noexcept
8937{
8938 if (this != &other) {
8939 if (state_ == DiscordObjectState::Owned) {
8940 Drop();
8941 }
8942 instance_ = other.instance_;
8943 state_ = other.state_;
8944 other.state_ = DiscordObjectState::Invalid;
8945 }
8946 return *this;
8947}
8948Call::Call(const Call& other)
8949 : instance_{}
8950 , state_(DiscordObjectState::Invalid)
8951{
8952 if (other.state_ == DiscordObjectState::Owned) {
8953 Discord_Call_Clone(&instance_, other.instance());
8954
8955 state_ = DiscordObjectState::Owned;
8956 }
8957}
8958Call& Call::operator=(const Call& other)
8959{
8960 if (this != &other) {
8961 if (state_ == DiscordObjectState::Owned) {
8962 Drop();
8963 state_ = DiscordObjectState::Invalid;
8964 }
8965 if (other.state_ == DiscordObjectState::Owned) {
8966 Discord_Call_Clone(&instance_, other.instance());
8967
8968 state_ = DiscordObjectState::Owned;
8969 }
8970 }
8971 return *this;
8972}
8973Call::Call(Discord_Call instance, DiscordObjectState state)
8974 : instance_(instance)
8975 , state_(state)
8976{
8977}
8978void Call::Drop()
8979{
8980 if (state_ != DiscordObjectState::Owned) {
8981 return;
8982 }
8983 Discord_Call_Drop(&instance_);
8984 state_ = DiscordObjectState::Invalid;
8985}
8986discordpp::String Call::ErrorToString(discordpp::Call::Error type)
8987{
8988 Discord_String returnValueNative__;
8989 Discord_Call_ErrorToString(static_cast<Discord_Call_Error>(type), &returnValueNative__);
8990 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8991 returnValueNative__.size);
8992 Discord_Free(returnValueNative__.ptr);
8993 return returnValue__;
8994}
8995discordpp::AudioModeType Call::GetAudioMode()
8996{
8997 assert(state_ == DiscordObjectState::Owned);
8998 Discord_AudioModeType returnValue__;
8999 returnValue__ = Discord_Call_GetAudioMode(&instance_);
9000 return static_cast<discordpp::AudioModeType>(returnValue__);
9001}
9002uint64_t Call::GetChannelId() const
9003{
9004 assert(state_ == DiscordObjectState::Owned);
9005 uint64_t returnValue__;
9006 returnValue__ = Discord_Call_GetChannelId(&instance_);
9007 return returnValue__;
9008}
9009uint64_t Call::GetGuildId() const
9010{
9011 assert(state_ == DiscordObjectState::Owned);
9012 uint64_t returnValue__;
9013 returnValue__ = Discord_Call_GetGuildId(&instance_);
9014 return returnValue__;
9015}
9016bool Call::GetLocalMute(uint64_t userId)
9017{
9018 assert(state_ == DiscordObjectState::Owned);
9019 bool returnValue__;
9020 returnValue__ = Discord_Call_GetLocalMute(&instance_, userId);
9021 return returnValue__;
9022}
9023discordpp::Vector<uint64_t> Call::GetParticipants() const
9024{
9025 assert(state_ == DiscordObjectState::Owned);
9026 Discord_UInt64Span returnValueNative__;
9027 Discord_Call_GetParticipants(&instance_, &returnValueNative__);
9028 discordpp::Vector<uint64_t> returnValue__(returnValueNative__.ptr,
9029 returnValueNative__.ptr + returnValueNative__.size);
9030 Discord_Free(returnValueNative__.ptr);
9031 return returnValue__;
9032}
9033float Call::GetParticipantVolume(uint64_t userId)
9034{
9035 assert(state_ == DiscordObjectState::Owned);
9036 float returnValue__;
9037 returnValue__ = Discord_Call_GetParticipantVolume(&instance_, userId);
9038 return returnValue__;
9039}
9040bool Call::GetPTTActive()
9041{
9042 assert(state_ == DiscordObjectState::Owned);
9043 bool returnValue__;
9044 returnValue__ = Discord_Call_GetPTTActive(&instance_);
9045 return returnValue__;
9046}
9047uint32_t Call::GetPTTReleaseDelay()
9048{
9049 assert(state_ == DiscordObjectState::Owned);
9050 uint32_t returnValue__;
9051 returnValue__ = Discord_Call_GetPTTReleaseDelay(&instance_);
9052 return returnValue__;
9053}
9054bool Call::GetSelfDeaf()
9055{
9056 assert(state_ == DiscordObjectState::Owned);
9057 bool returnValue__;
9058 returnValue__ = Discord_Call_GetSelfDeaf(&instance_);
9059 return returnValue__;
9060}
9061bool Call::GetSelfMute()
9062{
9063 assert(state_ == DiscordObjectState::Owned);
9064 bool returnValue__;
9065 returnValue__ = Discord_Call_GetSelfMute(&instance_);
9066 return returnValue__;
9067}
9068discordpp::Call::Status Call::GetStatus() const
9069{
9070 assert(state_ == DiscordObjectState::Owned);
9071 Discord_Call_Status returnValue__;
9072 returnValue__ = Discord_Call_GetStatus(&instance_);
9073 return static_cast<discordpp::Call::Status>(returnValue__);
9074}
9075discordpp::VADThresholdSettings Call::GetVADThreshold() const
9076{
9077 assert(state_ == DiscordObjectState::Owned);
9078 Discord_VADThresholdSettings returnValueNative__{};
9079 Discord_Call_GetVADThreshold(&instance_, &returnValueNative__);
9080 discordpp::VADThresholdSettings returnValue__(returnValueNative__, DiscordObjectState::Owned);
9081 return returnValue__;
9082}
9083std::optional<discordpp::VoiceStateHandle> Call::GetVoiceStateHandle(uint64_t userId) const
9084{
9085 assert(state_ == DiscordObjectState::Owned);
9086 bool returnIsNonNull__;
9087 Discord_VoiceStateHandle returnValueNative__;
9088 returnIsNonNull__ = Discord_Call_GetVoiceStateHandle(&instance_, userId, &returnValueNative__);
9089 if (!returnIsNonNull__) {
9090 return {};
9091 }
9092 discordpp::VoiceStateHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
9093 return returnValue__;
9094}
9095void Call::SetAudioMode(discordpp::AudioModeType audioMode)
9096{
9097 assert(state_ == DiscordObjectState::Owned);
9098 Discord_Call_SetAudioMode(&instance_, static_cast<Discord_AudioModeType>(audioMode));
9099}
9100void Call::SetLocalMute(uint64_t userId, bool mute)
9101{
9102 assert(state_ == DiscordObjectState::Owned);
9103 Discord_Call_SetLocalMute(&instance_, userId, mute);
9104}
9105void Call::SetOnVoiceStateChangedCallback(discordpp::Call::OnVoiceStateChanged cb)
9106{
9107 assert(state_ == DiscordObjectState::Owned);
9108 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9109 auto cb__userData = Tcb__UserData::Create(std::move(cb));
9110 Discord_Call_OnVoiceStateChanged cb__native = [](auto userId, void* userData__) {
9111 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9112 userData__typed->delegate(userId);
9113 };
9114 Discord_Call_SetOnVoiceStateChangedCallback(&instance_,
9115 (cb__userData->delegate ? cb__native : nullptr),
9116 Tcb__UserData::Free,
9117 cb__userData);
9118}
9119void Call::SetParticipantChangedCallback(discordpp::Call::OnParticipantChanged cb)
9120{
9121 assert(state_ == DiscordObjectState::Owned);
9122 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9123 auto cb__userData = Tcb__UserData::Create(std::move(cb));
9124 Discord_Call_OnParticipantChanged cb__native = [](auto userId, auto added, void* userData__) {
9125 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9126 userData__typed->delegate(userId, added);
9127 };
9128 Discord_Call_SetParticipantChangedCallback(&instance_,
9129 (cb__userData->delegate ? cb__native : nullptr),
9130 Tcb__UserData::Free,
9131 cb__userData);
9132}
9133void Call::SetParticipantVolume(uint64_t userId, float volume)
9134{
9135 assert(state_ == DiscordObjectState::Owned);
9136 Discord_Call_SetParticipantVolume(&instance_, userId, volume);
9137}
9138void Call::SetPTTActive(bool active)
9139{
9140 assert(state_ == DiscordObjectState::Owned);
9141 Discord_Call_SetPTTActive(&instance_, active);
9142}
9143void Call::SetPTTReleaseDelay(uint32_t releaseDelayMs)
9144{
9145 assert(state_ == DiscordObjectState::Owned);
9146 Discord_Call_SetPTTReleaseDelay(&instance_, releaseDelayMs);
9147}
9148void Call::SetSelfDeaf(bool deaf)
9149{
9150 assert(state_ == DiscordObjectState::Owned);
9151 Discord_Call_SetSelfDeaf(&instance_, deaf);
9152}
9153void Call::SetSelfMute(bool mute)
9154{
9155 assert(state_ == DiscordObjectState::Owned);
9156 Discord_Call_SetSelfMute(&instance_, mute);
9157}
9158void Call::SetSpeakingStatusChangedCallback(discordpp::Call::OnSpeakingStatusChanged cb)
9159{
9160 assert(state_ == DiscordObjectState::Owned);
9161 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9162 auto cb__userData = Tcb__UserData::Create(std::move(cb));
9163 Discord_Call_OnSpeakingStatusChanged cb__native =
9164 [](auto userId, auto isPlayingSound, void* userData__) {
9165 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9166 userData__typed->delegate(userId, isPlayingSound);
9167 };
9168 Discord_Call_SetSpeakingStatusChangedCallback(&instance_,
9169 (cb__userData->delegate ? cb__native : nullptr),
9170 Tcb__UserData::Free,
9171 cb__userData);
9172}
9173void Call::SetStatusChangedCallback(discordpp::Call::OnStatusChanged cb)
9174{
9175 assert(state_ == DiscordObjectState::Owned);
9176 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9177 auto cb__userData = Tcb__UserData::Create(std::move(cb));
9178 Discord_Call_OnStatusChanged cb__native =
9179 [](auto status, auto error, auto errorDetail, void* userData__) {
9180 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9181 userData__typed->delegate(static_cast<discordpp::Call::Status>(status),
9182 static_cast<discordpp::Call::Error>(error),
9183 errorDetail);
9184 };
9185 Discord_Call_SetStatusChangedCallback(&instance_,
9186 (cb__userData->delegate ? cb__native : nullptr),
9187 Tcb__UserData::Free,
9188 cb__userData);
9189}
9190void Call::SetVADThreshold(bool automatic, float threshold)
9191{
9192 assert(state_ == DiscordObjectState::Owned);
9193 Discord_Call_SetVADThreshold(&instance_, automatic, threshold);
9194}
9195discordpp::String Call::StatusToString(discordpp::Call::Status type)
9196{
9197 Discord_String returnValueNative__;
9198 Discord_Call_StatusToString(static_cast<Discord_Call_Status>(type), &returnValueNative__);
9199 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9200 returnValueNative__.size);
9201 Discord_Free(returnValueNative__.ptr);
9202 return returnValue__;
9203}
9204const ChannelHandle ChannelHandle::nullobj{{}, DiscordObjectState::Invalid};
9205ChannelHandle::~ChannelHandle()
9206{
9207 if (state_ == DiscordObjectState::Owned) {
9208 Drop();
9209 state_ = DiscordObjectState::Invalid;
9210 }
9211}
9212ChannelHandle::ChannelHandle(ChannelHandle&& other) noexcept
9213 : instance_(other.instance_)
9214 , state_(other.state_)
9215{
9216 other.state_ = DiscordObjectState::Invalid;
9217}
9218ChannelHandle& ChannelHandle::operator=(ChannelHandle&& other) noexcept
9219{
9220 if (this != &other) {
9221 if (state_ == DiscordObjectState::Owned) {
9222 Drop();
9223 }
9224 instance_ = other.instance_;
9225 state_ = other.state_;
9226 other.state_ = DiscordObjectState::Invalid;
9227 }
9228 return *this;
9229}
9230ChannelHandle::ChannelHandle(const ChannelHandle& other)
9231 : instance_{}
9232 , state_(DiscordObjectState::Invalid)
9233{
9234 if (other.state_ == DiscordObjectState::Owned) {
9235 Discord_ChannelHandle_Clone(&instance_, other.instance());
9236
9237 state_ = DiscordObjectState::Owned;
9238 }
9239}
9240ChannelHandle& ChannelHandle::operator=(const ChannelHandle& other)
9241{
9242 if (this != &other) {
9243 if (state_ == DiscordObjectState::Owned) {
9244 Drop();
9245 state_ = DiscordObjectState::Invalid;
9246 }
9247 if (other.state_ == DiscordObjectState::Owned) {
9248 Discord_ChannelHandle_Clone(&instance_, other.instance());
9249
9250 state_ = DiscordObjectState::Owned;
9251 }
9252 }
9253 return *this;
9254}
9255ChannelHandle::ChannelHandle(Discord_ChannelHandle instance, DiscordObjectState state)
9256 : instance_(instance)
9257 , state_(state)
9258{
9259}
9260void ChannelHandle::Drop()
9261{
9262 if (state_ != DiscordObjectState::Owned) {
9263 return;
9264 }
9265 Discord_ChannelHandle_Drop(&instance_);
9266 state_ = DiscordObjectState::Invalid;
9267}
9268uint64_t ChannelHandle::Id() const
9269{
9270 assert(state_ == DiscordObjectState::Owned);
9271 uint64_t returnValue__;
9272 returnValue__ = Discord_ChannelHandle_Id(&instance_);
9273 return returnValue__;
9274}
9275discordpp::String ChannelHandle::Name() const
9276{
9277 assert(state_ == DiscordObjectState::Owned);
9278 Discord_String returnValueNative__;
9279 Discord_ChannelHandle_Name(&instance_, &returnValueNative__);
9280 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9281 returnValueNative__.size);
9282 Discord_Free(returnValueNative__.ptr);
9283 return returnValue__;
9284}
9285discordpp::Vector<uint64_t> ChannelHandle::Recipients() const
9286{
9287 assert(state_ == DiscordObjectState::Owned);
9288 Discord_UInt64Span returnValueNative__;
9289 Discord_ChannelHandle_Recipients(&instance_, &returnValueNative__);
9290 discordpp::Vector<uint64_t> returnValue__(returnValueNative__.ptr,
9291 returnValueNative__.ptr + returnValueNative__.size);
9292 Discord_Free(returnValueNative__.ptr);
9293 return returnValue__;
9294}
9295discordpp::ChannelType ChannelHandle::Type() const
9296{
9297 assert(state_ == DiscordObjectState::Owned);
9298 Discord_ChannelType returnValue__;
9299 returnValue__ = Discord_ChannelHandle_Type(&instance_);
9300 return static_cast<discordpp::ChannelType>(returnValue__);
9301}
9302const GuildMinimal GuildMinimal::nullobj{{}, DiscordObjectState::Invalid};
9303GuildMinimal::~GuildMinimal()
9304{
9305 if (state_ == DiscordObjectState::Owned) {
9306 Drop();
9307 state_ = DiscordObjectState::Invalid;
9308 }
9309}
9310GuildMinimal::GuildMinimal(GuildMinimal&& other) noexcept
9311 : instance_(other.instance_)
9312 , state_(other.state_)
9313{
9314 other.state_ = DiscordObjectState::Invalid;
9315}
9316GuildMinimal& GuildMinimal::operator=(GuildMinimal&& other) noexcept
9317{
9318 if (this != &other) {
9319 if (state_ == DiscordObjectState::Owned) {
9320 Drop();
9321 }
9322 instance_ = other.instance_;
9323 state_ = other.state_;
9324 other.state_ = DiscordObjectState::Invalid;
9325 }
9326 return *this;
9327}
9328GuildMinimal::GuildMinimal(const GuildMinimal& arg0)
9329 : instance_{}
9330 , state_(DiscordObjectState::Invalid)
9331{
9332 if (arg0.state_ == DiscordObjectState::Owned) {
9333 Discord_GuildMinimal_Clone(&instance_, arg0.instance());
9334
9335 state_ = DiscordObjectState::Owned;
9336 }
9337}
9338GuildMinimal& GuildMinimal::operator=(const GuildMinimal& arg0)
9339{
9340 if (this != &arg0) {
9341 if (state_ == DiscordObjectState::Owned) {
9342 Drop();
9343 state_ = DiscordObjectState::Invalid;
9344 }
9345 if (arg0.state_ == DiscordObjectState::Owned) {
9346 Discord_GuildMinimal_Clone(&instance_, arg0.instance());
9347
9348 state_ = DiscordObjectState::Owned;
9349 }
9350 }
9351 return *this;
9352}
9353GuildMinimal::GuildMinimal(Discord_GuildMinimal instance, DiscordObjectState state)
9354 : instance_(instance)
9355 , state_(state)
9356{
9357}
9358void GuildMinimal::Drop()
9359{
9360 if (state_ != DiscordObjectState::Owned) {
9361 return;
9362 }
9363 Discord_GuildMinimal_Drop(&instance_);
9364 state_ = DiscordObjectState::Invalid;
9365}
9366uint64_t GuildMinimal::Id() const
9367{
9368 assert(state_ == DiscordObjectState::Owned);
9369 uint64_t returnValue__;
9370 returnValue__ = Discord_GuildMinimal_Id(&instance_);
9371 return returnValue__;
9372}
9373void GuildMinimal::SetId(uint64_t Id)
9374{
9375 assert(state_ == DiscordObjectState::Owned);
9376 Discord_GuildMinimal_SetId(&instance_, Id);
9377}
9378discordpp::String GuildMinimal::Name() const
9379{
9380 assert(state_ == DiscordObjectState::Owned);
9381 Discord_String returnValueNative__;
9382 Discord_GuildMinimal_Name(&instance_, &returnValueNative__);
9383 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9384 returnValueNative__.size);
9385 Discord_Free(returnValueNative__.ptr);
9386 return returnValue__;
9387}
9388void GuildMinimal::SetName(std::string_view Name)
9389{
9390 assert(state_ == DiscordObjectState::Owned);
9391 Discord_String Name__str{(uint8_t*)(Name.data() != nullptr ? Name.data() : ""), Name.size()};
9392 Discord_GuildMinimal_SetName(&instance_, Name__str);
9393}
9394const UserGuild UserGuild::nullobj{{}, DiscordObjectState::Invalid};
9395UserGuild::~UserGuild()
9396{
9397 if (state_ == DiscordObjectState::Owned) {
9398 Drop();
9399 state_ = DiscordObjectState::Invalid;
9400 }
9401}
9402UserGuild::UserGuild(UserGuild&& other) noexcept
9403 : instance_(other.instance_)
9404 , state_(other.state_)
9405{
9406 other.state_ = DiscordObjectState::Invalid;
9407}
9408UserGuild& UserGuild::operator=(UserGuild&& other) noexcept
9409{
9410 if (this != &other) {
9411 if (state_ == DiscordObjectState::Owned) {
9412 Drop();
9413 }
9414 instance_ = other.instance_;
9415 state_ = other.state_;
9416 other.state_ = DiscordObjectState::Invalid;
9417 }
9418 return *this;
9419}
9420UserGuild::UserGuild(const UserGuild& arg0)
9421 : instance_{}
9422 , state_(DiscordObjectState::Invalid)
9423{
9424 if (arg0.state_ == DiscordObjectState::Owned) {
9425 Discord_UserGuild_Clone(&instance_, arg0.instance());
9426
9427 state_ = DiscordObjectState::Owned;
9428 }
9429}
9430UserGuild& UserGuild::operator=(const UserGuild& arg0)
9431{
9432 if (this != &arg0) {
9433 if (state_ == DiscordObjectState::Owned) {
9434 Drop();
9435 state_ = DiscordObjectState::Invalid;
9436 }
9437 if (arg0.state_ == DiscordObjectState::Owned) {
9438 Discord_UserGuild_Clone(&instance_, arg0.instance());
9439
9440 state_ = DiscordObjectState::Owned;
9441 }
9442 }
9443 return *this;
9444}
9445UserGuild::UserGuild(Discord_UserGuild instance, DiscordObjectState state)
9446 : instance_(instance)
9447 , state_(state)
9448{
9449}
9450void UserGuild::Drop()
9451{
9452 if (state_ != DiscordObjectState::Owned) {
9453 return;
9454 }
9455 Discord_UserGuild_Drop(&instance_);
9456 state_ = DiscordObjectState::Invalid;
9457}
9458uint64_t UserGuild::Id() const
9459{
9460 assert(state_ == DiscordObjectState::Owned);
9461 uint64_t returnValue__;
9462 returnValue__ = Discord_UserGuild_Id(&instance_);
9463 return returnValue__;
9464}
9465void UserGuild::SetId(uint64_t Id)
9466{
9467 assert(state_ == DiscordObjectState::Owned);
9468 Discord_UserGuild_SetId(&instance_, Id);
9469}
9470discordpp::String UserGuild::Name() const
9471{
9472 assert(state_ == DiscordObjectState::Owned);
9473 Discord_String returnValueNative__;
9474 Discord_UserGuild_Name(&instance_, &returnValueNative__);
9475 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9476 returnValueNative__.size);
9477 Discord_Free(returnValueNative__.ptr);
9478 return returnValue__;
9479}
9480void UserGuild::SetName(std::string_view Name)
9481{
9482 assert(state_ == DiscordObjectState::Owned);
9483 Discord_String Name__str{(uint8_t*)(Name.data() != nullptr ? Name.data() : ""), Name.size()};
9484 Discord_UserGuild_SetName(&instance_, Name__str);
9485}
9486std::optional<discordpp::String> UserGuild::Icon() const
9487{
9488 assert(state_ == DiscordObjectState::Owned);
9489 bool returnIsNonNull__;
9490 Discord_String returnValueNative__;
9491 returnIsNonNull__ = Discord_UserGuild_Icon(&instance_, &returnValueNative__);
9492 if (!returnIsNonNull__) {
9493 return {};
9494 }
9495 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9496 returnValueNative__.size);
9497 Discord_Free(returnValueNative__.ptr);
9498 return returnValue__;
9499}
9500void UserGuild::SetIcon(std::optional<std::string_view> Icon)
9501{
9502 assert(state_ == DiscordObjectState::Owned);
9503 Discord_String Icon__str{};
9504 if (Icon.has_value()) {
9505 Icon__str.ptr = (uint8_t*)(Icon->data() != nullptr ? Icon->data() : "");
9506 Icon__str.size = Icon->size();
9507 }
9508 Discord_UserGuild_SetIcon(&instance_, (Icon.has_value() ? &Icon__str : nullptr));
9509}
9510std::optional<discordpp::String> UserGuild::Banner() const
9511{
9512 assert(state_ == DiscordObjectState::Owned);
9513 bool returnIsNonNull__;
9514 Discord_String returnValueNative__;
9515 returnIsNonNull__ = Discord_UserGuild_Banner(&instance_, &returnValueNative__);
9516 if (!returnIsNonNull__) {
9517 return {};
9518 }
9519 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9520 returnValueNative__.size);
9521 Discord_Free(returnValueNative__.ptr);
9522 return returnValue__;
9523}
9524void UserGuild::SetBanner(std::optional<std::string_view> Banner)
9525{
9526 assert(state_ == DiscordObjectState::Owned);
9527 Discord_String Banner__str{};
9528 if (Banner.has_value()) {
9529 Banner__str.ptr = (uint8_t*)(Banner->data() != nullptr ? Banner->data() : "");
9530 Banner__str.size = Banner->size();
9531 }
9532 Discord_UserGuild_SetBanner(&instance_, (Banner.has_value() ? &Banner__str : nullptr));
9533}
9534bool UserGuild::Owner() const
9535{
9536 assert(state_ == DiscordObjectState::Owned);
9537 bool returnValue__;
9538 returnValue__ = Discord_UserGuild_Owner(&instance_);
9539 return returnValue__;
9540}
9541void UserGuild::SetOwner(bool Owner)
9542{
9543 assert(state_ == DiscordObjectState::Owned);
9544 Discord_UserGuild_SetOwner(&instance_, Owner);
9545}
9546uint64_t UserGuild::Permissions() const
9547{
9548 assert(state_ == DiscordObjectState::Owned);
9549 uint64_t returnValue__;
9550 returnValue__ = Discord_UserGuild_Permissions(&instance_);
9551 return returnValue__;
9552}
9553void UserGuild::SetPermissions(uint64_t Permissions)
9554{
9555 assert(state_ == DiscordObjectState::Owned);
9556 Discord_UserGuild_SetPermissions(&instance_, Permissions);
9557}
9558std::optional<discordpp::LinkedGameOrganization> UserGuild::LinkedGameOrganization() const
9559{
9560 assert(state_ == DiscordObjectState::Owned);
9561 bool returnIsNonNull__;
9562 Discord_LinkedGameOrganization returnValueNative__;
9563 returnIsNonNull__ = Discord_UserGuild_LinkedGameOrganization(&instance_, &returnValueNative__);
9564 if (!returnIsNonNull__) {
9565 return {};
9566 }
9567 discordpp::LinkedGameOrganization returnValue__(returnValueNative__, DiscordObjectState::Owned);
9568 return returnValue__;
9569}
9570void UserGuild::SetLinkedGameOrganization(
9571 std::optional<discordpp::LinkedGameOrganization> LinkedGameOrganization)
9572{
9573 assert(state_ == DiscordObjectState::Owned);
9574 Discord_UserGuild_SetLinkedGameOrganization(
9575 &instance_,
9576 (LinkedGameOrganization.has_value() ? LinkedGameOrganization->instance() : nullptr));
9577}
9578const LinkedGameOrganization LinkedGameOrganization::nullobj{{}, DiscordObjectState::Invalid};
9579LinkedGameOrganization::~LinkedGameOrganization()
9580{
9581 if (state_ == DiscordObjectState::Owned) {
9582 Drop();
9583 state_ = DiscordObjectState::Invalid;
9584 }
9585}
9586LinkedGameOrganization::LinkedGameOrganization(LinkedGameOrganization&& other) noexcept
9587 : instance_(other.instance_)
9588 , state_(other.state_)
9589{
9590 other.state_ = DiscordObjectState::Invalid;
9591}
9592LinkedGameOrganization& LinkedGameOrganization::operator=(LinkedGameOrganization&& other) noexcept
9593{
9594 if (this != &other) {
9595 if (state_ == DiscordObjectState::Owned) {
9596 Drop();
9597 }
9598 instance_ = other.instance_;
9599 state_ = other.state_;
9600 other.state_ = DiscordObjectState::Invalid;
9601 }
9602 return *this;
9603}
9604LinkedGameOrganization::LinkedGameOrganization(const LinkedGameOrganization& arg0)
9605 : instance_{}
9606 , state_(DiscordObjectState::Invalid)
9607{
9608 if (arg0.state_ == DiscordObjectState::Owned) {
9609 Discord_LinkedGameOrganization_Clone(&instance_, arg0.instance());
9610
9611 state_ = DiscordObjectState::Owned;
9612 }
9613}
9614LinkedGameOrganization& LinkedGameOrganization::operator=(const LinkedGameOrganization& arg0)
9615{
9616 if (this != &arg0) {
9617 if (state_ == DiscordObjectState::Owned) {
9618 Drop();
9619 state_ = DiscordObjectState::Invalid;
9620 }
9621 if (arg0.state_ == DiscordObjectState::Owned) {
9622 Discord_LinkedGameOrganization_Clone(&instance_, arg0.instance());
9623
9624 state_ = DiscordObjectState::Owned;
9625 }
9626 }
9627 return *this;
9628}
9629LinkedGameOrganization::LinkedGameOrganization(Discord_LinkedGameOrganization instance,
9630 DiscordObjectState state)
9631 : instance_(instance)
9632 , state_(state)
9633{
9634}
9635LinkedGameOrganization::LinkedGameOrganization()
9636{
9637 assert(state_ == DiscordObjectState::Invalid);
9638 Discord_LinkedGameOrganization_Init(&instance_);
9639 state_ = DiscordObjectState::Owned;
9640}
9641void LinkedGameOrganization::Drop()
9642{
9643 if (state_ != DiscordObjectState::Owned) {
9644 return;
9645 }
9646 Discord_LinkedGameOrganization_Drop(&instance_);
9647 state_ = DiscordObjectState::Invalid;
9648}
9649std::optional<uint64_t> LinkedGameOrganization::ApplicationId() const
9650{
9651 assert(state_ == DiscordObjectState::Owned);
9652 bool returnIsNonNull__;
9653 uint64_t returnValue__;
9654 returnIsNonNull__ = Discord_LinkedGameOrganization_ApplicationId(&instance_, &returnValue__);
9655 if (!returnIsNonNull__) {
9656 return std::nullopt;
9657 }
9658 return returnValue__;
9659}
9660void LinkedGameOrganization::SetApplicationId(std::optional<uint64_t> ApplicationId)
9661{
9662 assert(state_ == DiscordObjectState::Owned);
9663 Discord_LinkedGameOrganization_SetApplicationId(
9664 &instance_, (ApplicationId.has_value() ? &*ApplicationId : nullptr));
9665}
9666std::optional<discordpp::String> LinkedGameOrganization::GameOrganizationId() const
9667{
9668 assert(state_ == DiscordObjectState::Owned);
9669 bool returnIsNonNull__;
9670 Discord_String returnValueNative__;
9671 returnIsNonNull__ =
9672 Discord_LinkedGameOrganization_GameOrganizationId(&instance_, &returnValueNative__);
9673 if (!returnIsNonNull__) {
9674 return {};
9675 }
9676 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9677 returnValueNative__.size);
9678 Discord_Free(returnValueNative__.ptr);
9679 return returnValue__;
9680}
9681void LinkedGameOrganization::SetGameOrganizationId(
9682 std::optional<std::string_view> GameOrganizationId)
9683{
9684 assert(state_ == DiscordObjectState::Owned);
9685 Discord_String GameOrganizationId__str{};
9686 if (GameOrganizationId.has_value()) {
9687 GameOrganizationId__str.ptr =
9688 (uint8_t*)(GameOrganizationId->data() != nullptr ? GameOrganizationId->data() : "");
9689 GameOrganizationId__str.size = GameOrganizationId->size();
9690 }
9691 Discord_LinkedGameOrganization_SetGameOrganizationId(
9692 &instance_, (GameOrganizationId.has_value() ? &GameOrganizationId__str : nullptr));
9693}
9694const GuildChannel GuildChannel::nullobj{{}, DiscordObjectState::Invalid};
9695GuildChannel::~GuildChannel()
9696{
9697 if (state_ == DiscordObjectState::Owned) {
9698 Drop();
9699 state_ = DiscordObjectState::Invalid;
9700 }
9701}
9702GuildChannel::GuildChannel(GuildChannel&& other) noexcept
9703 : instance_(other.instance_)
9704 , state_(other.state_)
9705{
9706 other.state_ = DiscordObjectState::Invalid;
9707}
9708GuildChannel& GuildChannel::operator=(GuildChannel&& other) noexcept
9709{
9710 if (this != &other) {
9711 if (state_ == DiscordObjectState::Owned) {
9712 Drop();
9713 }
9714 instance_ = other.instance_;
9715 state_ = other.state_;
9716 other.state_ = DiscordObjectState::Invalid;
9717 }
9718 return *this;
9719}
9720GuildChannel::GuildChannel(const GuildChannel& arg0)
9721 : instance_{}
9722 , state_(DiscordObjectState::Invalid)
9723{
9724 if (arg0.state_ == DiscordObjectState::Owned) {
9725 Discord_GuildChannel_Clone(&instance_, arg0.instance());
9726
9727 state_ = DiscordObjectState::Owned;
9728 }
9729}
9730GuildChannel& GuildChannel::operator=(const GuildChannel& arg0)
9731{
9732 if (this != &arg0) {
9733 if (state_ == DiscordObjectState::Owned) {
9734 Drop();
9735 state_ = DiscordObjectState::Invalid;
9736 }
9737 if (arg0.state_ == DiscordObjectState::Owned) {
9738 Discord_GuildChannel_Clone(&instance_, arg0.instance());
9739
9740 state_ = DiscordObjectState::Owned;
9741 }
9742 }
9743 return *this;
9744}
9745GuildChannel::GuildChannel(Discord_GuildChannel instance, DiscordObjectState state)
9746 : instance_(instance)
9747 , state_(state)
9748{
9749}
9750void GuildChannel::Drop()
9751{
9752 if (state_ != DiscordObjectState::Owned) {
9753 return;
9754 }
9755 Discord_GuildChannel_Drop(&instance_);
9756 state_ = DiscordObjectState::Invalid;
9757}
9758uint64_t GuildChannel::Id() const
9759{
9760 assert(state_ == DiscordObjectState::Owned);
9761 uint64_t returnValue__;
9762 returnValue__ = Discord_GuildChannel_Id(&instance_);
9763 return returnValue__;
9764}
9765void GuildChannel::SetId(uint64_t Id)
9766{
9767 assert(state_ == DiscordObjectState::Owned);
9768 Discord_GuildChannel_SetId(&instance_, Id);
9769}
9770discordpp::String GuildChannel::Name() const
9771{
9772 assert(state_ == DiscordObjectState::Owned);
9773 Discord_String returnValueNative__;
9774 Discord_GuildChannel_Name(&instance_, &returnValueNative__);
9775 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9776 returnValueNative__.size);
9777 Discord_Free(returnValueNative__.ptr);
9778 return returnValue__;
9779}
9780void GuildChannel::SetName(std::string_view Name)
9781{
9782 assert(state_ == DiscordObjectState::Owned);
9783 Discord_String Name__str{(uint8_t*)(Name.data() != nullptr ? Name.data() : ""), Name.size()};
9784 Discord_GuildChannel_SetName(&instance_, Name__str);
9785}
9786discordpp::ChannelType GuildChannel::Type() const
9787{
9788 assert(state_ == DiscordObjectState::Owned);
9789 Discord_ChannelType returnValue__;
9790 returnValue__ = Discord_GuildChannel_Type(&instance_);
9791 return static_cast<discordpp::ChannelType>(returnValue__);
9792}
9793void GuildChannel::SetType(discordpp::ChannelType Type)
9794{
9795 assert(state_ == DiscordObjectState::Owned);
9796 Discord_GuildChannel_SetType(&instance_, static_cast<Discord_ChannelType>(Type));
9797}
9798int32_t GuildChannel::Position() const
9799{
9800 assert(state_ == DiscordObjectState::Owned);
9801 int32_t returnValue__;
9802 returnValue__ = Discord_GuildChannel_Position(&instance_);
9803 return returnValue__;
9804}
9805void GuildChannel::SetPosition(int32_t Position)
9806{
9807 assert(state_ == DiscordObjectState::Owned);
9808 Discord_GuildChannel_SetPosition(&instance_, Position);
9809}
9810std::optional<uint64_t> GuildChannel::ParentId() const
9811{
9812 assert(state_ == DiscordObjectState::Owned);
9813 bool returnIsNonNull__;
9814 uint64_t returnValue__;
9815 returnIsNonNull__ = Discord_GuildChannel_ParentId(&instance_, &returnValue__);
9816 if (!returnIsNonNull__) {
9817 return std::nullopt;
9818 }
9819 return returnValue__;
9820}
9821void GuildChannel::SetParentId(std::optional<uint64_t> ParentId)
9822{
9823 assert(state_ == DiscordObjectState::Owned);
9824 Discord_GuildChannel_SetParentId(&instance_, (ParentId.has_value() ? &*ParentId : nullptr));
9825}
9826bool GuildChannel::IsLinkable() const
9827{
9828 assert(state_ == DiscordObjectState::Owned);
9829 bool returnValue__;
9830 returnValue__ = Discord_GuildChannel_IsLinkable(&instance_);
9831 return returnValue__;
9832}
9833void GuildChannel::SetIsLinkable(bool IsLinkable)
9834{
9835 assert(state_ == DiscordObjectState::Owned);
9836 Discord_GuildChannel_SetIsLinkable(&instance_, IsLinkable);
9837}
9838bool GuildChannel::IsViewableAndWriteableByAllMembers() const
9839{
9840 assert(state_ == DiscordObjectState::Owned);
9841 bool returnValue__;
9842 returnValue__ = Discord_GuildChannel_IsViewableAndWriteableByAllMembers(&instance_);
9843 return returnValue__;
9844}
9845void GuildChannel::SetIsViewableAndWriteableByAllMembers(bool IsViewableAndWriteableByAllMembers)
9846{
9847 assert(state_ == DiscordObjectState::Owned);
9848 Discord_GuildChannel_SetIsViewableAndWriteableByAllMembers(&instance_,
9849 IsViewableAndWriteableByAllMembers);
9850}
9851std::optional<discordpp::LinkedLobby> GuildChannel::LinkedLobby() const
9852{
9853 assert(state_ == DiscordObjectState::Owned);
9854 bool returnIsNonNull__;
9855 Discord_LinkedLobby returnValueNative__;
9856 returnIsNonNull__ = Discord_GuildChannel_LinkedLobby(&instance_, &returnValueNative__);
9857 if (!returnIsNonNull__) {
9858 return {};
9859 }
9860 discordpp::LinkedLobby returnValue__(returnValueNative__, DiscordObjectState::Owned);
9861 return returnValue__;
9862}
9863void GuildChannel::SetLinkedLobby(std::optional<discordpp::LinkedLobby> LinkedLobby)
9864{
9865 assert(state_ == DiscordObjectState::Owned);
9866 Discord_GuildChannel_SetLinkedLobby(
9867 &instance_, (LinkedLobby.has_value() ? LinkedLobby->instance() : nullptr));
9868}
9869const LinkedLobby LinkedLobby::nullobj{{}, DiscordObjectState::Invalid};
9870LinkedLobby::~LinkedLobby()
9871{
9872 if (state_ == DiscordObjectState::Owned) {
9873 Drop();
9874 state_ = DiscordObjectState::Invalid;
9875 }
9876}
9877LinkedLobby::LinkedLobby(LinkedLobby&& other) noexcept
9878 : instance_(other.instance_)
9879 , state_(other.state_)
9880{
9881 other.state_ = DiscordObjectState::Invalid;
9882}
9883LinkedLobby& LinkedLobby::operator=(LinkedLobby&& other) noexcept
9884{
9885 if (this != &other) {
9886 if (state_ == DiscordObjectState::Owned) {
9887 Drop();
9888 }
9889 instance_ = other.instance_;
9890 state_ = other.state_;
9891 other.state_ = DiscordObjectState::Invalid;
9892 }
9893 return *this;
9894}
9895LinkedLobby::LinkedLobby(const LinkedLobby& arg0)
9896 : instance_{}
9897 , state_(DiscordObjectState::Invalid)
9898{
9899 if (arg0.state_ == DiscordObjectState::Owned) {
9900 Discord_LinkedLobby_Clone(&instance_, arg0.instance());
9901
9902 state_ = DiscordObjectState::Owned;
9903 }
9904}
9905LinkedLobby& LinkedLobby::operator=(const LinkedLobby& arg0)
9906{
9907 if (this != &arg0) {
9908 if (state_ == DiscordObjectState::Owned) {
9909 Drop();
9910 state_ = DiscordObjectState::Invalid;
9911 }
9912 if (arg0.state_ == DiscordObjectState::Owned) {
9913 Discord_LinkedLobby_Clone(&instance_, arg0.instance());
9914
9915 state_ = DiscordObjectState::Owned;
9916 }
9917 }
9918 return *this;
9919}
9920LinkedLobby::LinkedLobby(Discord_LinkedLobby instance, DiscordObjectState state)
9921 : instance_(instance)
9922 , state_(state)
9923{
9924}
9925LinkedLobby::LinkedLobby()
9926{
9927 assert(state_ == DiscordObjectState::Invalid);
9928 Discord_LinkedLobby_Init(&instance_);
9929 state_ = DiscordObjectState::Owned;
9930}
9931void LinkedLobby::Drop()
9932{
9933 if (state_ != DiscordObjectState::Owned) {
9934 return;
9935 }
9936 Discord_LinkedLobby_Drop(&instance_);
9937 state_ = DiscordObjectState::Invalid;
9938}
9939uint64_t LinkedLobby::ApplicationId() const
9940{
9941 assert(state_ == DiscordObjectState::Owned);
9942 uint64_t returnValue__;
9943 returnValue__ = Discord_LinkedLobby_ApplicationId(&instance_);
9944 return returnValue__;
9945}
9946void LinkedLobby::SetApplicationId(uint64_t ApplicationId)
9947{
9948 assert(state_ == DiscordObjectState::Owned);
9949 Discord_LinkedLobby_SetApplicationId(&instance_, ApplicationId);
9950}
9951uint64_t LinkedLobby::LobbyId() const
9952{
9953 assert(state_ == DiscordObjectState::Owned);
9954 uint64_t returnValue__;
9955 returnValue__ = Discord_LinkedLobby_LobbyId(&instance_);
9956 return returnValue__;
9957}
9958void LinkedLobby::SetLobbyId(uint64_t LobbyId)
9959{
9960 assert(state_ == DiscordObjectState::Owned);
9961 Discord_LinkedLobby_SetLobbyId(&instance_, LobbyId);
9962}
9963const LinkedChannel LinkedChannel::nullobj{{}, DiscordObjectState::Invalid};
9964LinkedChannel::~LinkedChannel()
9965{
9966 if (state_ == DiscordObjectState::Owned) {
9967 Drop();
9968 state_ = DiscordObjectState::Invalid;
9969 }
9970}
9971LinkedChannel::LinkedChannel(LinkedChannel&& other) noexcept
9972 : instance_(other.instance_)
9973 , state_(other.state_)
9974{
9975 other.state_ = DiscordObjectState::Invalid;
9976}
9977LinkedChannel& LinkedChannel::operator=(LinkedChannel&& other) noexcept
9978{
9979 if (this != &other) {
9980 if (state_ == DiscordObjectState::Owned) {
9981 Drop();
9982 }
9983 instance_ = other.instance_;
9984 state_ = other.state_;
9985 other.state_ = DiscordObjectState::Invalid;
9986 }
9987 return *this;
9988}
9989LinkedChannel::LinkedChannel(const LinkedChannel& arg0)
9990 : instance_{}
9991 , state_(DiscordObjectState::Invalid)
9992{
9993 if (arg0.state_ == DiscordObjectState::Owned) {
9994 Discord_LinkedChannel_Clone(&instance_, arg0.instance());
9995
9996 state_ = DiscordObjectState::Owned;
9997 }
9998}
9999LinkedChannel& LinkedChannel::operator=(const LinkedChannel& arg0)
10000{
10001 if (this != &arg0) {
10002 if (state_ == DiscordObjectState::Owned) {
10003 Drop();
10004 state_ = DiscordObjectState::Invalid;
10005 }
10006 if (arg0.state_ == DiscordObjectState::Owned) {
10007 Discord_LinkedChannel_Clone(&instance_, arg0.instance());
10008
10009 state_ = DiscordObjectState::Owned;
10010 }
10011 }
10012 return *this;
10013}
10014LinkedChannel::LinkedChannel(Discord_LinkedChannel instance, DiscordObjectState state)
10015 : instance_(instance)
10016 , state_(state)
10017{
10018}
10019void LinkedChannel::Drop()
10020{
10021 if (state_ != DiscordObjectState::Owned) {
10022 return;
10023 }
10024 Discord_LinkedChannel_Drop(&instance_);
10025 state_ = DiscordObjectState::Invalid;
10026}
10027uint64_t LinkedChannel::Id() const
10028{
10029 assert(state_ == DiscordObjectState::Owned);
10030 uint64_t returnValue__;
10031 returnValue__ = Discord_LinkedChannel_Id(&instance_);
10032 return returnValue__;
10033}
10034void LinkedChannel::SetId(uint64_t Id)
10035{
10036 assert(state_ == DiscordObjectState::Owned);
10037 Discord_LinkedChannel_SetId(&instance_, Id);
10038}
10039discordpp::String LinkedChannel::Name() const
10040{
10041 assert(state_ == DiscordObjectState::Owned);
10042 Discord_String returnValueNative__;
10043 Discord_LinkedChannel_Name(&instance_, &returnValueNative__);
10044 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
10045 returnValueNative__.size);
10046 Discord_Free(returnValueNative__.ptr);
10047 return returnValue__;
10048}
10049void LinkedChannel::SetName(std::string_view Name)
10050{
10051 assert(state_ == DiscordObjectState::Owned);
10052 Discord_String Name__str{(uint8_t*)(Name.data() != nullptr ? Name.data() : ""), Name.size()};
10053 Discord_LinkedChannel_SetName(&instance_, Name__str);
10054}
10055uint64_t LinkedChannel::GuildId() const
10056{
10057 assert(state_ == DiscordObjectState::Owned);
10058 uint64_t returnValue__;
10059 returnValue__ = Discord_LinkedChannel_GuildId(&instance_);
10060 return returnValue__;
10061}
10062void LinkedChannel::SetGuildId(uint64_t GuildId)
10063{
10064 assert(state_ == DiscordObjectState::Owned);
10065 Discord_LinkedChannel_SetGuildId(&instance_, GuildId);
10066}
10067const RelationshipHandle RelationshipHandle::nullobj{{}, DiscordObjectState::Invalid};
10068RelationshipHandle::~RelationshipHandle()
10069{
10070 if (state_ == DiscordObjectState::Owned) {
10071 Drop();
10072 state_ = DiscordObjectState::Invalid;
10073 }
10074}
10075RelationshipHandle::RelationshipHandle(RelationshipHandle&& other) noexcept
10076 : instance_(other.instance_)
10077 , state_(other.state_)
10078{
10079 other.state_ = DiscordObjectState::Invalid;
10080}
10081RelationshipHandle& RelationshipHandle::operator=(RelationshipHandle&& other) noexcept
10082{
10083 if (this != &other) {
10084 if (state_ == DiscordObjectState::Owned) {
10085 Drop();
10086 }
10087 instance_ = other.instance_;
10088 state_ = other.state_;
10089 other.state_ = DiscordObjectState::Invalid;
10090 }
10091 return *this;
10092}
10093RelationshipHandle::RelationshipHandle(const RelationshipHandle& other)
10094 : instance_{}
10095 , state_(DiscordObjectState::Invalid)
10096{
10097 if (other.state_ == DiscordObjectState::Owned) {
10098 Discord_RelationshipHandle_Clone(&instance_, other.instance());
10099
10100 state_ = DiscordObjectState::Owned;
10101 }
10102}
10103RelationshipHandle& RelationshipHandle::operator=(const RelationshipHandle& other)
10104{
10105 if (this != &other) {
10106 if (state_ == DiscordObjectState::Owned) {
10107 Drop();
10108 state_ = DiscordObjectState::Invalid;
10109 }
10110 if (other.state_ == DiscordObjectState::Owned) {
10111 Discord_RelationshipHandle_Clone(&instance_, other.instance());
10112
10113 state_ = DiscordObjectState::Owned;
10114 }
10115 }
10116 return *this;
10117}
10118RelationshipHandle::RelationshipHandle(Discord_RelationshipHandle instance,
10119 DiscordObjectState state)
10120 : instance_(instance)
10121 , state_(state)
10122{
10123}
10124void RelationshipHandle::Drop()
10125{
10126 if (state_ != DiscordObjectState::Owned) {
10127 return;
10128 }
10129 Discord_RelationshipHandle_Drop(&instance_);
10130 state_ = DiscordObjectState::Invalid;
10131}
10132discordpp::RelationshipType RelationshipHandle::DiscordRelationshipType() const
10133{
10134 assert(state_ == DiscordObjectState::Owned);
10135 Discord_RelationshipType returnValue__;
10136 returnValue__ = Discord_RelationshipHandle_DiscordRelationshipType(&instance_);
10137 return static_cast<discordpp::RelationshipType>(returnValue__);
10138}
10139discordpp::RelationshipType RelationshipHandle::GameRelationshipType() const
10140{
10141 assert(state_ == DiscordObjectState::Owned);
10142 Discord_RelationshipType returnValue__;
10143 returnValue__ = Discord_RelationshipHandle_GameRelationshipType(&instance_);
10144 return static_cast<discordpp::RelationshipType>(returnValue__);
10145}
10146uint64_t RelationshipHandle::Id() const
10147{
10148 assert(state_ == DiscordObjectState::Owned);
10149 uint64_t returnValue__;
10150 returnValue__ = Discord_RelationshipHandle_Id(&instance_);
10151 return returnValue__;
10152}
10153bool RelationshipHandle::IsSpamRequest() const
10154{
10155 assert(state_ == DiscordObjectState::Owned);
10156 bool returnValue__;
10157 returnValue__ = Discord_RelationshipHandle_IsSpamRequest(&instance_);
10158 return returnValue__;
10159}
10160std::optional<discordpp::UserHandle> RelationshipHandle::User() const
10161{
10162 assert(state_ == DiscordObjectState::Owned);
10163 bool returnIsNonNull__;
10164 Discord_UserHandle returnValueNative__;
10165 returnIsNonNull__ = Discord_RelationshipHandle_User(&instance_, &returnValueNative__);
10166 if (!returnIsNonNull__) {
10167 return {};
10168 }
10169 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
10170 return returnValue__;
10171}
10172const UserApplicationProfileHandle UserApplicationProfileHandle::nullobj{
10173 {},
10174 DiscordObjectState::Invalid};
10175UserApplicationProfileHandle::~UserApplicationProfileHandle()
10176{
10177 if (state_ == DiscordObjectState::Owned) {
10178 Drop();
10179 state_ = DiscordObjectState::Invalid;
10180 }
10181}
10182UserApplicationProfileHandle::UserApplicationProfileHandle(
10183 UserApplicationProfileHandle&& other) noexcept
10184 : instance_(other.instance_)
10185 , state_(other.state_)
10186{
10187 other.state_ = DiscordObjectState::Invalid;
10188}
10189UserApplicationProfileHandle& UserApplicationProfileHandle::operator=(
10190 UserApplicationProfileHandle&& other) noexcept
10191{
10192 if (this != &other) {
10193 if (state_ == DiscordObjectState::Owned) {
10194 Drop();
10195 }
10196 instance_ = other.instance_;
10197 state_ = other.state_;
10198 other.state_ = DiscordObjectState::Invalid;
10199 }
10200 return *this;
10201}
10202UserApplicationProfileHandle::UserApplicationProfileHandle(
10203 const UserApplicationProfileHandle& other)
10204 : instance_{}
10205 , state_(DiscordObjectState::Invalid)
10206{
10207 if (other.state_ == DiscordObjectState::Owned) {
10208 Discord_UserApplicationProfileHandle_Clone(&instance_, other.instance());
10209
10210 state_ = DiscordObjectState::Owned;
10211 }
10212}
10213UserApplicationProfileHandle& UserApplicationProfileHandle::operator=(
10214 const UserApplicationProfileHandle& other)
10215{
10216 if (this != &other) {
10217 if (state_ == DiscordObjectState::Owned) {
10218 Drop();
10219 state_ = DiscordObjectState::Invalid;
10220 }
10221 if (other.state_ == DiscordObjectState::Owned) {
10222 Discord_UserApplicationProfileHandle_Clone(&instance_, other.instance());
10223
10224 state_ = DiscordObjectState::Owned;
10225 }
10226 }
10227 return *this;
10228}
10229UserApplicationProfileHandle::UserApplicationProfileHandle(
10230 Discord_UserApplicationProfileHandle instance,
10231 DiscordObjectState state)
10232 : instance_(instance)
10233 , state_(state)
10234{
10235}
10236void UserApplicationProfileHandle::Drop()
10237{
10238 if (state_ != DiscordObjectState::Owned) {
10239 return;
10240 }
10241 Discord_UserApplicationProfileHandle_Drop(&instance_);
10242 state_ = DiscordObjectState::Invalid;
10243}
10244discordpp::String UserApplicationProfileHandle::AvatarHash() const
10245{
10246 assert(state_ == DiscordObjectState::Owned);
10247 Discord_String returnValueNative__;
10248 Discord_UserApplicationProfileHandle_AvatarHash(&instance_, &returnValueNative__);
10249 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
10250 returnValueNative__.size);
10251 Discord_Free(returnValueNative__.ptr);
10252 return returnValue__;
10253}
10254discordpp::String UserApplicationProfileHandle::Metadata() const
10255{
10256 assert(state_ == DiscordObjectState::Owned);
10257 Discord_String returnValueNative__;
10258 Discord_UserApplicationProfileHandle_Metadata(&instance_, &returnValueNative__);
10259 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
10260 returnValueNative__.size);
10261 Discord_Free(returnValueNative__.ptr);
10262 return returnValue__;
10263}
10264std::optional<discordpp::String> UserApplicationProfileHandle::ProviderId() const
10265{
10266 assert(state_ == DiscordObjectState::Owned);
10267 bool returnIsNonNull__;
10268 Discord_String returnValueNative__;
10269 returnIsNonNull__ =
10270 Discord_UserApplicationProfileHandle_ProviderId(&instance_, &returnValueNative__);
10271 if (!returnIsNonNull__) {
10272 return {};
10273 }
10274 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
10275 returnValueNative__.size);
10276 Discord_Free(returnValueNative__.ptr);
10277 return returnValue__;
10278}
10279discordpp::String UserApplicationProfileHandle::ProviderIssuedUserId() const
10280{
10281 assert(state_ == DiscordObjectState::Owned);
10282 Discord_String returnValueNative__;
10283 Discord_UserApplicationProfileHandle_ProviderIssuedUserId(&instance_, &returnValueNative__);
10284 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
10285 returnValueNative__.size);
10286 Discord_Free(returnValueNative__.ptr);
10287 return returnValue__;
10288}
10289discordpp::ExternalIdentityProviderType UserApplicationProfileHandle::ProviderType() const
10290{
10291 assert(state_ == DiscordObjectState::Owned);
10292 Discord_ExternalIdentityProviderType returnValue__;
10293 returnValue__ = Discord_UserApplicationProfileHandle_ProviderType(&instance_);
10294 return static_cast<discordpp::ExternalIdentityProviderType>(returnValue__);
10295}
10296discordpp::String UserApplicationProfileHandle::Username() const
10297{
10298 assert(state_ == DiscordObjectState::Owned);
10299 Discord_String returnValueNative__;
10300 Discord_UserApplicationProfileHandle_Username(&instance_, &returnValueNative__);
10301 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
10302 returnValueNative__.size);
10303 Discord_Free(returnValueNative__.ptr);
10304 return returnValue__;
10305}
10306const UserHandle UserHandle::nullobj{{}, DiscordObjectState::Invalid};
10307UserHandle::~UserHandle()
10308{
10309 if (state_ == DiscordObjectState::Owned) {
10310 Drop();
10311 state_ = DiscordObjectState::Invalid;
10312 }
10313}
10314UserHandle::UserHandle(UserHandle&& other) noexcept
10315 : instance_(other.instance_)
10316 , state_(other.state_)
10317{
10318 other.state_ = DiscordObjectState::Invalid;
10319}
10320UserHandle& UserHandle::operator=(UserHandle&& other) noexcept
10321{
10322 if (this != &other) {
10323 if (state_ == DiscordObjectState::Owned) {
10324 Drop();
10325 }
10326 instance_ = other.instance_;
10327 state_ = other.state_;
10328 other.state_ = DiscordObjectState::Invalid;
10329 }
10330 return *this;
10331}
10332UserHandle::UserHandle(const UserHandle& arg0)
10333 : instance_{}
10334 , state_(DiscordObjectState::Invalid)
10335{
10336 if (arg0.state_ == DiscordObjectState::Owned) {
10337 Discord_UserHandle_Clone(&instance_, arg0.instance());
10338
10339 state_ = DiscordObjectState::Owned;
10340 }
10341}
10342UserHandle& UserHandle::operator=(const UserHandle& arg0)
10343{
10344 if (this != &arg0) {
10345 if (state_ == DiscordObjectState::Owned) {
10346 Drop();
10347 state_ = DiscordObjectState::Invalid;
10348 }
10349 if (arg0.state_ == DiscordObjectState::Owned) {
10350 Discord_UserHandle_Clone(&instance_, arg0.instance());
10351
10352 state_ = DiscordObjectState::Owned;
10353 }
10354 }
10355 return *this;
10356}
10357UserHandle::UserHandle(Discord_UserHandle instance, DiscordObjectState state)
10358 : instance_(instance)
10359 , state_(state)
10360{
10361}
10362void UserHandle::Drop()
10363{
10364 if (state_ != DiscordObjectState::Owned) {
10365 return;
10366 }
10367 Discord_UserHandle_Drop(&instance_);
10368 state_ = DiscordObjectState::Invalid;
10369}
10370std::optional<discordpp::String> UserHandle::Avatar() const
10371{
10372 assert(state_ == DiscordObjectState::Owned);
10373 bool returnIsNonNull__;
10374 Discord_String returnValueNative__;
10375 returnIsNonNull__ = Discord_UserHandle_Avatar(&instance_, &returnValueNative__);
10376 if (!returnIsNonNull__) {
10377 return {};
10378 }
10379 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
10380 returnValueNative__.size);
10381 Discord_Free(returnValueNative__.ptr);
10382 return returnValue__;
10383}
10384discordpp::String UserHandle::AvatarTypeToString(discordpp::UserHandle::AvatarType type)
10385{
10386 Discord_String returnValueNative__;
10387 Discord_UserHandle_AvatarTypeToString(static_cast<Discord_UserHandle_AvatarType>(type),
10388 &returnValueNative__);
10389 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
10390 returnValueNative__.size);
10391 Discord_Free(returnValueNative__.ptr);
10392 return returnValue__;
10393}
10394discordpp::String UserHandle::AvatarUrl(discordpp::UserHandle::AvatarType animatedType,
10395 discordpp::UserHandle::AvatarType staticType) const
10396{
10397 assert(state_ == DiscordObjectState::Owned);
10398 Discord_String returnValueNative__;
10399 Discord_UserHandle_AvatarUrl(&instance_,
10400 static_cast<Discord_UserHandle_AvatarType>(animatedType),
10401 static_cast<Discord_UserHandle_AvatarType>(staticType),
10402 &returnValueNative__);
10403 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
10404 returnValueNative__.size);
10405 Discord_Free(returnValueNative__.ptr);
10406 return returnValue__;
10407}
10408discordpp::String UserHandle::DisplayName() const
10409{
10410 assert(state_ == DiscordObjectState::Owned);
10411 Discord_String returnValueNative__;
10412 Discord_UserHandle_DisplayName(&instance_, &returnValueNative__);
10413 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
10414 returnValueNative__.size);
10415 Discord_Free(returnValueNative__.ptr);
10416 return returnValue__;
10417}
10418std::optional<discordpp::Activity> UserHandle::GameActivity() const
10419{
10420 assert(state_ == DiscordObjectState::Owned);
10421 bool returnIsNonNull__;
10422 Discord_Activity returnValueNative__;
10423 returnIsNonNull__ = Discord_UserHandle_GameActivity(&instance_, &returnValueNative__);
10424 if (!returnIsNonNull__) {
10425 return {};
10426 }
10427 discordpp::Activity returnValue__(returnValueNative__, DiscordObjectState::Owned);
10428 return returnValue__;
10429}
10430std::optional<discordpp::String> UserHandle::GlobalName() const
10431{
10432 assert(state_ == DiscordObjectState::Owned);
10433 bool returnIsNonNull__;
10434 Discord_String returnValueNative__;
10435 returnIsNonNull__ = Discord_UserHandle_GlobalName(&instance_, &returnValueNative__);
10436 if (!returnIsNonNull__) {
10437 return {};
10438 }
10439 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
10440 returnValueNative__.size);
10441 Discord_Free(returnValueNative__.ptr);
10442 return returnValue__;
10443}
10444uint64_t UserHandle::Id() const
10445{
10446 assert(state_ == DiscordObjectState::Owned);
10447 uint64_t returnValue__;
10448 returnValue__ = Discord_UserHandle_Id(&instance_);
10449 return returnValue__;
10450}
10451bool UserHandle::IsProvisional() const
10452{
10453 assert(state_ == DiscordObjectState::Owned);
10454 bool returnValue__;
10455 returnValue__ = Discord_UserHandle_IsProvisional(&instance_);
10456 return returnValue__;
10457}
10458discordpp::RelationshipHandle UserHandle::Relationship() const
10459{
10460 assert(state_ == DiscordObjectState::Owned);
10461 Discord_RelationshipHandle returnValueNative__{};
10462 Discord_UserHandle_Relationship(&instance_, &returnValueNative__);
10463 discordpp::RelationshipHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
10464 return returnValue__;
10465}
10466discordpp::StatusType UserHandle::Status() const
10467{
10468 assert(state_ == DiscordObjectState::Owned);
10469 Discord_StatusType returnValue__;
10470 returnValue__ = Discord_UserHandle_Status(&instance_);
10471 return static_cast<discordpp::StatusType>(returnValue__);
10472}
10473discordpp::Vector<discordpp::UserApplicationProfileHandle> UserHandle::UserApplicationProfiles()
10474 const
10475{
10476 assert(state_ == DiscordObjectState::Owned);
10477 Discord_UserApplicationProfileHandleSpan returnValueNative__;
10478 Discord_UserHandle_UserApplicationProfiles(&instance_, &returnValueNative__);
10480 returnValue__.reserve(returnValueNative__.size);
10481 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
10482 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
10483 }
10484 Discord_Free(returnValueNative__.ptr);
10485 return returnValue__;
10486}
10487discordpp::String UserHandle::Username() const
10488{
10489 assert(state_ == DiscordObjectState::Owned);
10490 Discord_String returnValueNative__;
10491 Discord_UserHandle_Username(&instance_, &returnValueNative__);
10492 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
10493 returnValueNative__.size);
10494 Discord_Free(returnValueNative__.ptr);
10495 return returnValue__;
10496}
10497const LobbyMemberHandle LobbyMemberHandle::nullobj{{}, DiscordObjectState::Invalid};
10498LobbyMemberHandle::~LobbyMemberHandle()
10499{
10500 if (state_ == DiscordObjectState::Owned) {
10501 Drop();
10502 state_ = DiscordObjectState::Invalid;
10503 }
10504}
10505LobbyMemberHandle::LobbyMemberHandle(LobbyMemberHandle&& other) noexcept
10506 : instance_(other.instance_)
10507 , state_(other.state_)
10508{
10509 other.state_ = DiscordObjectState::Invalid;
10510}
10511LobbyMemberHandle& LobbyMemberHandle::operator=(LobbyMemberHandle&& other) noexcept
10512{
10513 if (this != &other) {
10514 if (state_ == DiscordObjectState::Owned) {
10515 Drop();
10516 }
10517 instance_ = other.instance_;
10518 state_ = other.state_;
10519 other.state_ = DiscordObjectState::Invalid;
10520 }
10521 return *this;
10522}
10523LobbyMemberHandle::LobbyMemberHandle(const LobbyMemberHandle& other)
10524 : instance_{}
10525 , state_(DiscordObjectState::Invalid)
10526{
10527 if (other.state_ == DiscordObjectState::Owned) {
10528 Discord_LobbyMemberHandle_Clone(&instance_, other.instance());
10529
10530 state_ = DiscordObjectState::Owned;
10531 }
10532}
10533LobbyMemberHandle& LobbyMemberHandle::operator=(const LobbyMemberHandle& other)
10534{
10535 if (this != &other) {
10536 if (state_ == DiscordObjectState::Owned) {
10537 Drop();
10538 state_ = DiscordObjectState::Invalid;
10539 }
10540 if (other.state_ == DiscordObjectState::Owned) {
10541 Discord_LobbyMemberHandle_Clone(&instance_, other.instance());
10542
10543 state_ = DiscordObjectState::Owned;
10544 }
10545 }
10546 return *this;
10547}
10548LobbyMemberHandle::LobbyMemberHandle(Discord_LobbyMemberHandle instance, DiscordObjectState state)
10549 : instance_(instance)
10550 , state_(state)
10551{
10552}
10553void LobbyMemberHandle::Drop()
10554{
10555 if (state_ != DiscordObjectState::Owned) {
10556 return;
10557 }
10558 Discord_LobbyMemberHandle_Drop(&instance_);
10559 state_ = DiscordObjectState::Invalid;
10560}
10561bool LobbyMemberHandle::CanLinkLobby() const
10562{
10563 assert(state_ == DiscordObjectState::Owned);
10564 bool returnValue__;
10565 returnValue__ = Discord_LobbyMemberHandle_CanLinkLobby(&instance_);
10566 return returnValue__;
10567}
10568bool LobbyMemberHandle::Connected() const
10569{
10570 assert(state_ == DiscordObjectState::Owned);
10571 bool returnValue__;
10572 returnValue__ = Discord_LobbyMemberHandle_Connected(&instance_);
10573 return returnValue__;
10574}
10575uint64_t LobbyMemberHandle::Id() const
10576{
10577 assert(state_ == DiscordObjectState::Owned);
10578 uint64_t returnValue__;
10579 returnValue__ = Discord_LobbyMemberHandle_Id(&instance_);
10580 return returnValue__;
10581}
10582discordpp::StringMap LobbyMemberHandle::Metadata() const
10583{
10584 assert(state_ == DiscordObjectState::Owned);
10585 Discord_Properties returnValueNative__;
10586 Discord_LobbyMemberHandle_Metadata(&instance_, &returnValueNative__);
10587 discordpp::StringMap returnValue__ = ConvertReturnedProperties(returnValueNative__);
10588 Discord_FreeProperties(returnValueNative__);
10589 return returnValue__;
10590}
10591std::optional<discordpp::UserHandle> LobbyMemberHandle::User() const
10592{
10593 assert(state_ == DiscordObjectState::Owned);
10594 bool returnIsNonNull__;
10595 Discord_UserHandle returnValueNative__;
10596 returnIsNonNull__ = Discord_LobbyMemberHandle_User(&instance_, &returnValueNative__);
10597 if (!returnIsNonNull__) {
10598 return {};
10599 }
10600 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
10601 return returnValue__;
10602}
10603const LobbyHandle LobbyHandle::nullobj{{}, DiscordObjectState::Invalid};
10604LobbyHandle::~LobbyHandle()
10605{
10606 if (state_ == DiscordObjectState::Owned) {
10607 Drop();
10608 state_ = DiscordObjectState::Invalid;
10609 }
10610}
10611LobbyHandle::LobbyHandle(LobbyHandle&& other) noexcept
10612 : instance_(other.instance_)
10613 , state_(other.state_)
10614{
10615 other.state_ = DiscordObjectState::Invalid;
10616}
10617LobbyHandle& LobbyHandle::operator=(LobbyHandle&& other) noexcept
10618{
10619 if (this != &other) {
10620 if (state_ == DiscordObjectState::Owned) {
10621 Drop();
10622 }
10623 instance_ = other.instance_;
10624 state_ = other.state_;
10625 other.state_ = DiscordObjectState::Invalid;
10626 }
10627 return *this;
10628}
10629LobbyHandle::LobbyHandle(const LobbyHandle& other)
10630 : instance_{}
10631 , state_(DiscordObjectState::Invalid)
10632{
10633 if (other.state_ == DiscordObjectState::Owned) {
10634 Discord_LobbyHandle_Clone(&instance_, other.instance());
10635
10636 state_ = DiscordObjectState::Owned;
10637 }
10638}
10639LobbyHandle& LobbyHandle::operator=(const LobbyHandle& other)
10640{
10641 if (this != &other) {
10642 if (state_ == DiscordObjectState::Owned) {
10643 Drop();
10644 state_ = DiscordObjectState::Invalid;
10645 }
10646 if (other.state_ == DiscordObjectState::Owned) {
10647 Discord_LobbyHandle_Clone(&instance_, other.instance());
10648
10649 state_ = DiscordObjectState::Owned;
10650 }
10651 }
10652 return *this;
10653}
10654LobbyHandle::LobbyHandle(Discord_LobbyHandle instance, DiscordObjectState state)
10655 : instance_(instance)
10656 , state_(state)
10657{
10658}
10659void LobbyHandle::Drop()
10660{
10661 if (state_ != DiscordObjectState::Owned) {
10662 return;
10663 }
10664 Discord_LobbyHandle_Drop(&instance_);
10665 state_ = DiscordObjectState::Invalid;
10666}
10667std::optional<discordpp::CallInfoHandle> LobbyHandle::GetCallInfoHandle() const
10668{
10669 assert(state_ == DiscordObjectState::Owned);
10670 bool returnIsNonNull__;
10671 Discord_CallInfoHandle returnValueNative__;
10672 returnIsNonNull__ = Discord_LobbyHandle_GetCallInfoHandle(&instance_, &returnValueNative__);
10673 if (!returnIsNonNull__) {
10674 return {};
10675 }
10676 discordpp::CallInfoHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
10677 return returnValue__;
10678}
10679std::optional<discordpp::LobbyMemberHandle> LobbyHandle::GetLobbyMemberHandle(
10680 uint64_t memberId) const
10681{
10682 assert(state_ == DiscordObjectState::Owned);
10683 bool returnIsNonNull__;
10684 Discord_LobbyMemberHandle returnValueNative__;
10685 returnIsNonNull__ =
10686 Discord_LobbyHandle_GetLobbyMemberHandle(&instance_, memberId, &returnValueNative__);
10687 if (!returnIsNonNull__) {
10688 return {};
10689 }
10690 discordpp::LobbyMemberHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
10691 return returnValue__;
10692}
10693uint64_t LobbyHandle::Id() const
10694{
10695 assert(state_ == DiscordObjectState::Owned);
10696 uint64_t returnValue__;
10697 returnValue__ = Discord_LobbyHandle_Id(&instance_);
10698 return returnValue__;
10699}
10700std::optional<discordpp::LinkedChannel> LobbyHandle::LinkedChannel() const
10701{
10702 assert(state_ == DiscordObjectState::Owned);
10703 bool returnIsNonNull__;
10704 Discord_LinkedChannel returnValueNative__;
10705 returnIsNonNull__ = Discord_LobbyHandle_LinkedChannel(&instance_, &returnValueNative__);
10706 if (!returnIsNonNull__) {
10707 return {};
10708 }
10709 discordpp::LinkedChannel returnValue__(returnValueNative__, DiscordObjectState::Owned);
10710 return returnValue__;
10711}
10712discordpp::Vector<uint64_t> LobbyHandle::LobbyMemberIds() const
10713{
10714 assert(state_ == DiscordObjectState::Owned);
10715 Discord_UInt64Span returnValueNative__;
10716 Discord_LobbyHandle_LobbyMemberIds(&instance_, &returnValueNative__);
10717 discordpp::Vector<uint64_t> returnValue__(returnValueNative__.ptr,
10718 returnValueNative__.ptr + returnValueNative__.size);
10719 Discord_Free(returnValueNative__.ptr);
10720 return returnValue__;
10721}
10722discordpp::Vector<discordpp::LobbyMemberHandle> LobbyHandle::LobbyMembers() const
10723{
10724 assert(state_ == DiscordObjectState::Owned);
10725 Discord_LobbyMemberHandleSpan returnValueNative__;
10726 Discord_LobbyHandle_LobbyMembers(&instance_, &returnValueNative__);
10728 returnValue__.reserve(returnValueNative__.size);
10729 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
10730 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
10731 }
10732 Discord_Free(returnValueNative__.ptr);
10733 return returnValue__;
10734}
10735discordpp::StringMap LobbyHandle::Metadata() const
10736{
10737 assert(state_ == DiscordObjectState::Owned);
10738 Discord_Properties returnValueNative__;
10739 Discord_LobbyHandle_Metadata(&instance_, &returnValueNative__);
10740 discordpp::StringMap returnValue__ = ConvertReturnedProperties(returnValueNative__);
10741 Discord_FreeProperties(returnValueNative__);
10742 return returnValue__;
10743}
10744const AdditionalContent AdditionalContent::nullobj{{}, DiscordObjectState::Invalid};
10745AdditionalContent::~AdditionalContent()
10746{
10747 if (state_ == DiscordObjectState::Owned) {
10748 Drop();
10749 state_ = DiscordObjectState::Invalid;
10750 }
10751}
10752AdditionalContent::AdditionalContent(AdditionalContent&& other) noexcept
10753 : instance_(other.instance_)
10754 , state_(other.state_)
10755{
10756 other.state_ = DiscordObjectState::Invalid;
10757}
10758AdditionalContent& AdditionalContent::operator=(AdditionalContent&& other) noexcept
10759{
10760 if (this != &other) {
10761 if (state_ == DiscordObjectState::Owned) {
10762 Drop();
10763 }
10764 instance_ = other.instance_;
10765 state_ = other.state_;
10766 other.state_ = DiscordObjectState::Invalid;
10767 }
10768 return *this;
10769}
10770AdditionalContent::AdditionalContent(const AdditionalContent& arg0)
10771 : instance_{}
10772 , state_(DiscordObjectState::Invalid)
10773{
10774 if (arg0.state_ == DiscordObjectState::Owned) {
10775 Discord_AdditionalContent_Clone(&instance_, arg0.instance());
10776
10777 state_ = DiscordObjectState::Owned;
10778 }
10779}
10780AdditionalContent& AdditionalContent::operator=(const AdditionalContent& arg0)
10781{
10782 if (this != &arg0) {
10783 if (state_ == DiscordObjectState::Owned) {
10784 Drop();
10785 state_ = DiscordObjectState::Invalid;
10786 }
10787 if (arg0.state_ == DiscordObjectState::Owned) {
10788 Discord_AdditionalContent_Clone(&instance_, arg0.instance());
10789
10790 state_ = DiscordObjectState::Owned;
10791 }
10792 }
10793 return *this;
10794}
10795AdditionalContent::AdditionalContent(Discord_AdditionalContent instance, DiscordObjectState state)
10796 : instance_(instance)
10797 , state_(state)
10798{
10799}
10800AdditionalContent::AdditionalContent()
10801{
10802 assert(state_ == DiscordObjectState::Invalid);
10803 Discord_AdditionalContent_Init(&instance_);
10804 state_ = DiscordObjectState::Owned;
10805}
10806void AdditionalContent::Drop()
10807{
10808 if (state_ != DiscordObjectState::Owned) {
10809 return;
10810 }
10811 Discord_AdditionalContent_Drop(&instance_);
10812 state_ = DiscordObjectState::Invalid;
10813}
10814bool AdditionalContent::Equals(discordpp::AdditionalContent rhs) const
10815{
10816 assert(state_ == DiscordObjectState::Owned);
10817 bool returnValue__;
10818 returnValue__ = Discord_AdditionalContent_Equals(&instance_, rhs.instance());
10819 return returnValue__;
10820}
10821discordpp::String AdditionalContent::TypeToString(discordpp::AdditionalContentType type)
10822{
10823 Discord_String returnValueNative__;
10824 Discord_AdditionalContent_TypeToString(static_cast<Discord_AdditionalContentType>(type),
10825 &returnValueNative__);
10826 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
10827 returnValueNative__.size);
10828 Discord_Free(returnValueNative__.ptr);
10829 return returnValue__;
10830}
10831discordpp::AdditionalContentType AdditionalContent::Type() const
10832{
10833 assert(state_ == DiscordObjectState::Owned);
10834 Discord_AdditionalContentType returnValue__;
10835 returnValue__ = Discord_AdditionalContent_Type(&instance_);
10836 return static_cast<discordpp::AdditionalContentType>(returnValue__);
10837}
10838void AdditionalContent::SetType(discordpp::AdditionalContentType Type)
10839{
10840 assert(state_ == DiscordObjectState::Owned);
10841 Discord_AdditionalContent_SetType(&instance_, static_cast<Discord_AdditionalContentType>(Type));
10842}
10843std::optional<discordpp::String> AdditionalContent::Title() const
10844{
10845 assert(state_ == DiscordObjectState::Owned);
10846 bool returnIsNonNull__;
10847 Discord_String returnValueNative__;
10848 returnIsNonNull__ = Discord_AdditionalContent_Title(&instance_, &returnValueNative__);
10849 if (!returnIsNonNull__) {
10850 return {};
10851 }
10852 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
10853 returnValueNative__.size);
10854 Discord_Free(returnValueNative__.ptr);
10855 return returnValue__;
10856}
10857void AdditionalContent::SetTitle(std::optional<std::string_view> Title)
10858{
10859 assert(state_ == DiscordObjectState::Owned);
10860 Discord_String Title__str{};
10861 if (Title.has_value()) {
10862 Title__str.ptr = (uint8_t*)(Title->data() != nullptr ? Title->data() : "");
10863 Title__str.size = Title->size();
10864 }
10865 Discord_AdditionalContent_SetTitle(&instance_, (Title.has_value() ? &Title__str : nullptr));
10866}
10867uint8_t AdditionalContent::Count() const
10868{
10869 assert(state_ == DiscordObjectState::Owned);
10870 uint8_t returnValue__;
10871 returnValue__ = Discord_AdditionalContent_Count(&instance_);
10872 return returnValue__;
10873}
10874void AdditionalContent::SetCount(uint8_t Count)
10875{
10876 assert(state_ == DiscordObjectState::Owned);
10877 Discord_AdditionalContent_SetCount(&instance_, Count);
10878}
10879const MessageHandle MessageHandle::nullobj{{}, DiscordObjectState::Invalid};
10880MessageHandle::~MessageHandle()
10881{
10882 if (state_ == DiscordObjectState::Owned) {
10883 Drop();
10884 state_ = DiscordObjectState::Invalid;
10885 }
10886}
10887MessageHandle::MessageHandle(MessageHandle&& other) noexcept
10888 : instance_(other.instance_)
10889 , state_(other.state_)
10890{
10891 other.state_ = DiscordObjectState::Invalid;
10892}
10893MessageHandle& MessageHandle::operator=(MessageHandle&& other) noexcept
10894{
10895 if (this != &other) {
10896 if (state_ == DiscordObjectState::Owned) {
10897 Drop();
10898 }
10899 instance_ = other.instance_;
10900 state_ = other.state_;
10901 other.state_ = DiscordObjectState::Invalid;
10902 }
10903 return *this;
10904}
10905MessageHandle::MessageHandle(const MessageHandle& other)
10906 : instance_{}
10907 , state_(DiscordObjectState::Invalid)
10908{
10909 if (other.state_ == DiscordObjectState::Owned) {
10910 Discord_MessageHandle_Clone(&instance_, other.instance());
10911
10912 state_ = DiscordObjectState::Owned;
10913 }
10914}
10915MessageHandle& MessageHandle::operator=(const MessageHandle& other)
10916{
10917 if (this != &other) {
10918 if (state_ == DiscordObjectState::Owned) {
10919 Drop();
10920 state_ = DiscordObjectState::Invalid;
10921 }
10922 if (other.state_ == DiscordObjectState::Owned) {
10923 Discord_MessageHandle_Clone(&instance_, other.instance());
10924
10925 state_ = DiscordObjectState::Owned;
10926 }
10927 }
10928 return *this;
10929}
10930MessageHandle::MessageHandle(Discord_MessageHandle instance, DiscordObjectState state)
10931 : instance_(instance)
10932 , state_(state)
10933{
10934}
10935void MessageHandle::Drop()
10936{
10937 if (state_ != DiscordObjectState::Owned) {
10938 return;
10939 }
10940 Discord_MessageHandle_Drop(&instance_);
10941 state_ = DiscordObjectState::Invalid;
10942}
10943std::optional<discordpp::AdditionalContent> MessageHandle::AdditionalContent() const
10944{
10945 assert(state_ == DiscordObjectState::Owned);
10946 bool returnIsNonNull__;
10947 Discord_AdditionalContent returnValueNative__;
10948 returnIsNonNull__ = Discord_MessageHandle_AdditionalContent(&instance_, &returnValueNative__);
10949 if (!returnIsNonNull__) {
10950 return {};
10951 }
10952 discordpp::AdditionalContent returnValue__(returnValueNative__, DiscordObjectState::Owned);
10953 return returnValue__;
10954}
10955std::optional<discordpp::String> MessageHandle::AdditionalName() const
10956{
10957 assert(state_ == DiscordObjectState::Owned);
10958 bool returnIsNonNull__;
10959 Discord_String returnValueNative__;
10960 returnIsNonNull__ = Discord_MessageHandle_AdditionalName(&instance_, &returnValueNative__);
10961 if (!returnIsNonNull__) {
10962 return {};
10963 }
10964 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
10965 returnValueNative__.size);
10966 Discord_Free(returnValueNative__.ptr);
10967 return returnValue__;
10968}
10969std::optional<uint64_t> MessageHandle::ApplicationId() const
10970{
10971 assert(state_ == DiscordObjectState::Owned);
10972 bool returnIsNonNull__;
10973 uint64_t returnValue__;
10974 returnIsNonNull__ = Discord_MessageHandle_ApplicationId(&instance_, &returnValue__);
10975 if (!returnIsNonNull__) {
10976 return std::nullopt;
10977 }
10978 return returnValue__;
10979}
10980std::optional<discordpp::UserHandle> MessageHandle::Author() const
10981{
10982 assert(state_ == DiscordObjectState::Owned);
10983 bool returnIsNonNull__;
10984 Discord_UserHandle returnValueNative__;
10985 returnIsNonNull__ = Discord_MessageHandle_Author(&instance_, &returnValueNative__);
10986 if (!returnIsNonNull__) {
10987 return {};
10988 }
10989 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
10990 return returnValue__;
10991}
10992uint64_t MessageHandle::AuthorId() const
10993{
10994 assert(state_ == DiscordObjectState::Owned);
10995 uint64_t returnValue__;
10996 returnValue__ = Discord_MessageHandle_AuthorId(&instance_);
10997 return returnValue__;
10998}
10999std::optional<discordpp::ChannelHandle> MessageHandle::Channel() const
11000{
11001 assert(state_ == DiscordObjectState::Owned);
11002 bool returnIsNonNull__;
11003 Discord_ChannelHandle returnValueNative__;
11004 returnIsNonNull__ = Discord_MessageHandle_Channel(&instance_, &returnValueNative__);
11005 if (!returnIsNonNull__) {
11006 return {};
11007 }
11008 discordpp::ChannelHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
11009 return returnValue__;
11010}
11011uint64_t MessageHandle::ChannelId() const
11012{
11013 assert(state_ == DiscordObjectState::Owned);
11014 uint64_t returnValue__;
11015 returnValue__ = Discord_MessageHandle_ChannelId(&instance_);
11016 return returnValue__;
11017}
11018discordpp::String MessageHandle::Content() const
11019{
11020 assert(state_ == DiscordObjectState::Owned);
11021 Discord_String returnValueNative__;
11022 Discord_MessageHandle_Content(&instance_, &returnValueNative__);
11023 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
11024 returnValueNative__.size);
11025 Discord_Free(returnValueNative__.ptr);
11026 return returnValue__;
11027}
11028std::optional<discordpp::DisclosureTypes> MessageHandle::DisclosureType() const
11029{
11030 assert(state_ == DiscordObjectState::Owned);
11031 bool returnIsNonNull__;
11032 Discord_DisclosureTypes returnValueNative__;
11033 returnIsNonNull__ = Discord_MessageHandle_DisclosureType(&instance_, &returnValueNative__);
11034 if (!returnIsNonNull__) {
11035 return {};
11036 }
11037 auto returnValue__ = static_cast<discordpp::DisclosureTypes>(returnValueNative__);
11038 return returnValue__;
11039}
11040uint64_t MessageHandle::EditedTimestamp() const
11041{
11042 assert(state_ == DiscordObjectState::Owned);
11043 uint64_t returnValue__;
11044 returnValue__ = Discord_MessageHandle_EditedTimestamp(&instance_);
11045 return returnValue__;
11046}
11047uint64_t MessageHandle::Id() const
11048{
11049 assert(state_ == DiscordObjectState::Owned);
11050 uint64_t returnValue__;
11051 returnValue__ = Discord_MessageHandle_Id(&instance_);
11052 return returnValue__;
11053}
11054std::optional<discordpp::LobbyHandle> MessageHandle::Lobby() const
11055{
11056 assert(state_ == DiscordObjectState::Owned);
11057 bool returnIsNonNull__;
11058 Discord_LobbyHandle returnValueNative__;
11059 returnIsNonNull__ = Discord_MessageHandle_Lobby(&instance_, &returnValueNative__);
11060 if (!returnIsNonNull__) {
11061 return {};
11062 }
11063 discordpp::LobbyHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
11064 return returnValue__;
11065}
11066discordpp::StringMap MessageHandle::Metadata() const
11067{
11068 assert(state_ == DiscordObjectState::Owned);
11069 Discord_Properties returnValueNative__;
11070 Discord_MessageHandle_Metadata(&instance_, &returnValueNative__);
11071 discordpp::StringMap returnValue__ = ConvertReturnedProperties(returnValueNative__);
11072 Discord_FreeProperties(returnValueNative__);
11073 return returnValue__;
11074}
11075discordpp::StringMap MessageHandle::ModerationMetadata() const
11076{
11077 assert(state_ == DiscordObjectState::Owned);
11078 Discord_Properties returnValueNative__;
11079 Discord_MessageHandle_ModerationMetadata(&instance_, &returnValueNative__);
11080 discordpp::StringMap returnValue__ = ConvertReturnedProperties(returnValueNative__);
11081 Discord_FreeProperties(returnValueNative__);
11082 return returnValue__;
11083}
11084discordpp::String MessageHandle::RawContent() const
11085{
11086 assert(state_ == DiscordObjectState::Owned);
11087 Discord_String returnValueNative__;
11088 Discord_MessageHandle_RawContent(&instance_, &returnValueNative__);
11089 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
11090 returnValueNative__.size);
11091 Discord_Free(returnValueNative__.ptr);
11092 return returnValue__;
11093}
11094std::optional<discordpp::UserHandle> MessageHandle::Recipient() const
11095{
11096 assert(state_ == DiscordObjectState::Owned);
11097 bool returnIsNonNull__;
11098 Discord_UserHandle returnValueNative__;
11099 returnIsNonNull__ = Discord_MessageHandle_Recipient(&instance_, &returnValueNative__);
11100 if (!returnIsNonNull__) {
11101 return {};
11102 }
11103 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
11104 return returnValue__;
11105}
11106uint64_t MessageHandle::RecipientId() const
11107{
11108 assert(state_ == DiscordObjectState::Owned);
11109 uint64_t returnValue__;
11110 returnValue__ = Discord_MessageHandle_RecipientId(&instance_);
11111 return returnValue__;
11112}
11113bool MessageHandle::SentFromGame() const
11114{
11115 assert(state_ == DiscordObjectState::Owned);
11116 bool returnValue__;
11117 returnValue__ = Discord_MessageHandle_SentFromGame(&instance_);
11118 return returnValue__;
11119}
11120uint64_t MessageHandle::SentTimestamp() const
11121{
11122 assert(state_ == DiscordObjectState::Owned);
11123 uint64_t returnValue__;
11124 returnValue__ = Discord_MessageHandle_SentTimestamp(&instance_);
11125 return returnValue__;
11126}
11127const AudioDevice AudioDevice::nullobj{{}, DiscordObjectState::Invalid};
11128AudioDevice::~AudioDevice()
11129{
11130 if (state_ == DiscordObjectState::Owned) {
11131 Drop();
11132 state_ = DiscordObjectState::Invalid;
11133 }
11134}
11135AudioDevice::AudioDevice(AudioDevice&& other) noexcept
11136 : instance_(other.instance_)
11137 , state_(other.state_)
11138{
11139 other.state_ = DiscordObjectState::Invalid;
11140}
11141AudioDevice& AudioDevice::operator=(AudioDevice&& other) noexcept
11142{
11143 if (this != &other) {
11144 if (state_ == DiscordObjectState::Owned) {
11145 Drop();
11146 }
11147 instance_ = other.instance_;
11148 state_ = other.state_;
11149 other.state_ = DiscordObjectState::Invalid;
11150 }
11151 return *this;
11152}
11153AudioDevice::AudioDevice(const AudioDevice& arg0)
11154 : instance_{}
11155 , state_(DiscordObjectState::Invalid)
11156{
11157 if (arg0.state_ == DiscordObjectState::Owned) {
11158 Discord_AudioDevice_Clone(&instance_, arg0.instance());
11159
11160 state_ = DiscordObjectState::Owned;
11161 }
11162}
11163AudioDevice& AudioDevice::operator=(const AudioDevice& arg0)
11164{
11165 if (this != &arg0) {
11166 if (state_ == DiscordObjectState::Owned) {
11167 Drop();
11168 state_ = DiscordObjectState::Invalid;
11169 }
11170 if (arg0.state_ == DiscordObjectState::Owned) {
11171 Discord_AudioDevice_Clone(&instance_, arg0.instance());
11172
11173 state_ = DiscordObjectState::Owned;
11174 }
11175 }
11176 return *this;
11177}
11178AudioDevice::AudioDevice(Discord_AudioDevice instance, DiscordObjectState state)
11179 : instance_(instance)
11180 , state_(state)
11181{
11182}
11183void AudioDevice::Drop()
11184{
11185 if (state_ != DiscordObjectState::Owned) {
11186 return;
11187 }
11188 Discord_AudioDevice_Drop(&instance_);
11189 state_ = DiscordObjectState::Invalid;
11190}
11191bool AudioDevice::Equals(discordpp::AudioDevice rhs)
11192{
11193 assert(state_ == DiscordObjectState::Owned);
11194 bool returnValue__;
11195 returnValue__ = Discord_AudioDevice_Equals(&instance_, rhs.instance());
11196 return returnValue__;
11197}
11198discordpp::String AudioDevice::Id() const
11199{
11200 assert(state_ == DiscordObjectState::Owned);
11201 Discord_String returnValueNative__;
11202 Discord_AudioDevice_Id(&instance_, &returnValueNative__);
11203 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
11204 returnValueNative__.size);
11205 Discord_Free(returnValueNative__.ptr);
11206 return returnValue__;
11207}
11208void AudioDevice::SetId(std::string_view Id)
11209{
11210 assert(state_ == DiscordObjectState::Owned);
11211 Discord_String Id__str{(uint8_t*)(Id.data() != nullptr ? Id.data() : ""), Id.size()};
11212 Discord_AudioDevice_SetId(&instance_, Id__str);
11213}
11214discordpp::String AudioDevice::Name() const
11215{
11216 assert(state_ == DiscordObjectState::Owned);
11217 Discord_String returnValueNative__;
11218 Discord_AudioDevice_Name(&instance_, &returnValueNative__);
11219 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
11220 returnValueNative__.size);
11221 Discord_Free(returnValueNative__.ptr);
11222 return returnValue__;
11223}
11224void AudioDevice::SetName(std::string_view Name)
11225{
11226 assert(state_ == DiscordObjectState::Owned);
11227 Discord_String Name__str{(uint8_t*)(Name.data() != nullptr ? Name.data() : ""), Name.size()};
11228 Discord_AudioDevice_SetName(&instance_, Name__str);
11229}
11230bool AudioDevice::IsDefault() const
11231{
11232 assert(state_ == DiscordObjectState::Owned);
11233 bool returnValue__;
11234 returnValue__ = Discord_AudioDevice_IsDefault(&instance_);
11235 return returnValue__;
11236}
11237void AudioDevice::SetIsDefault(bool IsDefault)
11238{
11239 assert(state_ == DiscordObjectState::Owned);
11240 Discord_AudioDevice_SetIsDefault(&instance_, IsDefault);
11241}
11242const VoiceSettings VoiceSettings::nullobj{{}, DiscordObjectState::Invalid};
11243VoiceSettings::~VoiceSettings()
11244{
11245 if (state_ == DiscordObjectState::Owned) {
11246 Drop();
11247 state_ = DiscordObjectState::Invalid;
11248 }
11249}
11250VoiceSettings::VoiceSettings(VoiceSettings&& other) noexcept
11251 : instance_(other.instance_)
11252 , state_(other.state_)
11253{
11254 other.state_ = DiscordObjectState::Invalid;
11255}
11256VoiceSettings& VoiceSettings::operator=(VoiceSettings&& other) noexcept
11257{
11258 if (this != &other) {
11259 if (state_ == DiscordObjectState::Owned) {
11260 Drop();
11261 }
11262 instance_ = other.instance_;
11263 state_ = other.state_;
11264 other.state_ = DiscordObjectState::Invalid;
11265 }
11266 return *this;
11267}
11268VoiceSettings::VoiceSettings(const VoiceSettings& arg0)
11269 : instance_{}
11270 , state_(DiscordObjectState::Invalid)
11271{
11272 if (arg0.state_ == DiscordObjectState::Owned) {
11273 Discord_VoiceSettings_Clone(&instance_, arg0.instance());
11274
11275 state_ = DiscordObjectState::Owned;
11276 }
11277}
11278VoiceSettings& VoiceSettings::operator=(const VoiceSettings& arg0)
11279{
11280 if (this != &arg0) {
11281 if (state_ == DiscordObjectState::Owned) {
11282 Drop();
11283 state_ = DiscordObjectState::Invalid;
11284 }
11285 if (arg0.state_ == DiscordObjectState::Owned) {
11286 Discord_VoiceSettings_Clone(&instance_, arg0.instance());
11287
11288 state_ = DiscordObjectState::Owned;
11289 }
11290 }
11291 return *this;
11292}
11293VoiceSettings::VoiceSettings(Discord_VoiceSettings instance, DiscordObjectState state)
11294 : instance_(instance)
11295 , state_(state)
11296{
11297}
11298void VoiceSettings::Drop()
11299{
11300 if (state_ != DiscordObjectState::Owned) {
11301 return;
11302 }
11303 Discord_VoiceSettings_Drop(&instance_);
11304 state_ = DiscordObjectState::Invalid;
11305}
11306bool VoiceSettings::SelfMute() const
11307{
11308 assert(state_ == DiscordObjectState::Owned);
11309 bool returnValue__;
11310 returnValue__ = Discord_VoiceSettings_SelfMute(&instance_);
11311 return returnValue__;
11312}
11313void VoiceSettings::SetSelfMute(bool SelfMute)
11314{
11315 assert(state_ == DiscordObjectState::Owned);
11316 Discord_VoiceSettings_SetSelfMute(&instance_, SelfMute);
11317}
11318bool VoiceSettings::SelfDeaf() const
11319{
11320 assert(state_ == DiscordObjectState::Owned);
11321 bool returnValue__;
11322 returnValue__ = Discord_VoiceSettings_SelfDeaf(&instance_);
11323 return returnValue__;
11324}
11325void VoiceSettings::SetSelfDeaf(bool SelfDeaf)
11326{
11327 assert(state_ == DiscordObjectState::Owned);
11328 Discord_VoiceSettings_SetSelfDeaf(&instance_, SelfDeaf);
11329}
11330discordpp::VoiceInputModeType VoiceSettings::InputMode() const
11331{
11332 assert(state_ == DiscordObjectState::Owned);
11333 Discord_VoiceInputModeType returnValue__;
11334 returnValue__ = Discord_VoiceSettings_InputMode(&instance_);
11335 return static_cast<discordpp::VoiceInputModeType>(returnValue__);
11336}
11337void VoiceSettings::SetInputMode(discordpp::VoiceInputModeType InputMode)
11338{
11339 assert(state_ == DiscordObjectState::Owned);
11340 Discord_VoiceSettings_SetInputMode(&instance_,
11341 static_cast<Discord_VoiceInputModeType>(InputMode));
11342}
11343discordpp::String VoiceSettings::PttKey() const
11344{
11345 assert(state_ == DiscordObjectState::Owned);
11346 Discord_String returnValueNative__;
11347 Discord_VoiceSettings_PttKey(&instance_, &returnValueNative__);
11348 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
11349 returnValueNative__.size);
11350 Discord_Free(returnValueNative__.ptr);
11351 return returnValue__;
11352}
11353void VoiceSettings::SetPttKey(std::string_view PttKey)
11354{
11355 assert(state_ == DiscordObjectState::Owned);
11356 Discord_String PttKey__str{(uint8_t*)(PttKey.data() != nullptr ? PttKey.data() : ""),
11357 PttKey.size()};
11358 Discord_VoiceSettings_SetPttKey(&instance_, PttKey__str);
11359}
11360float VoiceSettings::InputVolume() const
11361{
11362 assert(state_ == DiscordObjectState::Owned);
11363 float returnValue__;
11364 returnValue__ = Discord_VoiceSettings_InputVolume(&instance_);
11365 return returnValue__;
11366}
11367void VoiceSettings::SetInputVolume(float InputVolume)
11368{
11369 assert(state_ == DiscordObjectState::Owned);
11370 Discord_VoiceSettings_SetInputVolume(&instance_, InputVolume);
11371}
11372float VoiceSettings::OutputVolume() const
11373{
11374 assert(state_ == DiscordObjectState::Owned);
11375 float returnValue__;
11376 returnValue__ = Discord_VoiceSettings_OutputVolume(&instance_);
11377 return returnValue__;
11378}
11379void VoiceSettings::SetOutputVolume(float OutputVolume)
11380{
11381 assert(state_ == DiscordObjectState::Owned);
11382 Discord_VoiceSettings_SetOutputVolume(&instance_, OutputVolume);
11383}
11384bool VoiceSettings::AutomaticGainControl() const
11385{
11386 assert(state_ == DiscordObjectState::Owned);
11387 bool returnValue__;
11388 returnValue__ = Discord_VoiceSettings_AutomaticGainControl(&instance_);
11389 return returnValue__;
11390}
11391void VoiceSettings::SetAutomaticGainControl(bool AutomaticGainControl)
11392{
11393 assert(state_ == DiscordObjectState::Owned);
11394 Discord_VoiceSettings_SetAutomaticGainControl(&instance_, AutomaticGainControl);
11395}
11396bool VoiceSettings::EchoCancellation() const
11397{
11398 assert(state_ == DiscordObjectState::Owned);
11399 bool returnValue__;
11400 returnValue__ = Discord_VoiceSettings_EchoCancellation(&instance_);
11401 return returnValue__;
11402}
11403void VoiceSettings::SetEchoCancellation(bool EchoCancellation)
11404{
11405 assert(state_ == DiscordObjectState::Owned);
11406 Discord_VoiceSettings_SetEchoCancellation(&instance_, EchoCancellation);
11407}
11408bool VoiceSettings::NoiseSuppression() const
11409{
11410 assert(state_ == DiscordObjectState::Owned);
11411 bool returnValue__;
11412 returnValue__ = Discord_VoiceSettings_NoiseSuppression(&instance_);
11413 return returnValue__;
11414}
11415void VoiceSettings::SetNoiseSuppression(bool NoiseSuppression)
11416{
11417 assert(state_ == DiscordObjectState::Owned);
11418 Discord_VoiceSettings_SetNoiseSuppression(&instance_, NoiseSuppression);
11419}
11420bool VoiceSettings::NoiseCancellation() const
11421{
11422 assert(state_ == DiscordObjectState::Owned);
11423 bool returnValue__;
11424 returnValue__ = Discord_VoiceSettings_NoiseCancellation(&instance_);
11425 return returnValue__;
11426}
11427void VoiceSettings::SetNoiseCancellation(bool NoiseCancellation)
11428{
11429 assert(state_ == DiscordObjectState::Owned);
11430 Discord_VoiceSettings_SetNoiseCancellation(&instance_, NoiseCancellation);
11431}
11432const DiscordClientGuildVoiceMember DiscordClientGuildVoiceMember::nullobj{
11433 {},
11434 DiscordObjectState::Invalid};
11435DiscordClientGuildVoiceMember::~DiscordClientGuildVoiceMember()
11436{
11437 if (state_ == DiscordObjectState::Owned) {
11438 Drop();
11439 state_ = DiscordObjectState::Invalid;
11440 }
11441}
11442DiscordClientGuildVoiceMember::DiscordClientGuildVoiceMember(
11443 DiscordClientGuildVoiceMember&& other) noexcept
11444 : instance_(other.instance_)
11445 , state_(other.state_)
11446{
11447 other.state_ = DiscordObjectState::Invalid;
11448}
11449DiscordClientGuildVoiceMember& DiscordClientGuildVoiceMember::operator=(
11450 DiscordClientGuildVoiceMember&& other) noexcept
11451{
11452 if (this != &other) {
11453 if (state_ == DiscordObjectState::Owned) {
11454 Drop();
11455 }
11456 instance_ = other.instance_;
11457 state_ = other.state_;
11458 other.state_ = DiscordObjectState::Invalid;
11459 }
11460 return *this;
11461}
11462DiscordClientGuildVoiceMember::DiscordClientGuildVoiceMember(
11463 const DiscordClientGuildVoiceMember& arg0)
11464 : instance_{}
11465 , state_(DiscordObjectState::Invalid)
11466{
11467 if (arg0.state_ == DiscordObjectState::Owned) {
11468 Discord_DiscordClientGuildVoiceMember_Clone(&instance_, arg0.instance());
11469
11470 state_ = DiscordObjectState::Owned;
11471 }
11472}
11473DiscordClientGuildVoiceMember& DiscordClientGuildVoiceMember::operator=(
11474 const DiscordClientGuildVoiceMember& arg0)
11475{
11476 if (this != &arg0) {
11477 if (state_ == DiscordObjectState::Owned) {
11478 Drop();
11479 state_ = DiscordObjectState::Invalid;
11480 }
11481 if (arg0.state_ == DiscordObjectState::Owned) {
11482 Discord_DiscordClientGuildVoiceMember_Clone(&instance_, arg0.instance());
11483
11484 state_ = DiscordObjectState::Owned;
11485 }
11486 }
11487 return *this;
11488}
11489DiscordClientGuildVoiceMember::DiscordClientGuildVoiceMember(
11490 Discord_DiscordClientGuildVoiceMember instance,
11491 DiscordObjectState state)
11492 : instance_(instance)
11493 , state_(state)
11494{
11495}
11496DiscordClientGuildVoiceMember::DiscordClientGuildVoiceMember()
11497{
11498 assert(state_ == DiscordObjectState::Invalid);
11499 Discord_DiscordClientGuildVoiceMember_Init(&instance_);
11500 state_ = DiscordObjectState::Owned;
11501}
11502void DiscordClientGuildVoiceMember::Drop()
11503{
11504 if (state_ != DiscordObjectState::Owned) {
11505 return;
11506 }
11507 Discord_DiscordClientGuildVoiceMember_Drop(&instance_);
11508 state_ = DiscordObjectState::Invalid;
11509}
11510uint64_t DiscordClientGuildVoiceMember::UserId() const
11511{
11512 assert(state_ == DiscordObjectState::Owned);
11513 uint64_t returnValue__;
11514 returnValue__ = Discord_DiscordClientGuildVoiceMember_UserId(&instance_);
11515 return returnValue__;
11516}
11517void DiscordClientGuildVoiceMember::SetUserId(uint64_t UserId)
11518{
11519 assert(state_ == DiscordObjectState::Owned);
11520 Discord_DiscordClientGuildVoiceMember_SetUserId(&instance_, UserId);
11521}
11522discordpp::String DiscordClientGuildVoiceMember::DisplayName() const
11523{
11524 assert(state_ == DiscordObjectState::Owned);
11525 Discord_String returnValueNative__;
11526 Discord_DiscordClientGuildVoiceMember_DisplayName(&instance_, &returnValueNative__);
11527 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
11528 returnValueNative__.size);
11529 Discord_Free(returnValueNative__.ptr);
11530 return returnValue__;
11531}
11532void DiscordClientGuildVoiceMember::SetDisplayName(std::string_view DisplayName)
11533{
11534 assert(state_ == DiscordObjectState::Owned);
11535 Discord_String DisplayName__str{
11536 (uint8_t*)(DisplayName.data() != nullptr ? DisplayName.data() : ""), DisplayName.size()};
11537 Discord_DiscordClientGuildVoiceMember_SetDisplayName(&instance_, DisplayName__str);
11538}
11539discordpp::String DiscordClientGuildVoiceMember::Username() const
11540{
11541 assert(state_ == DiscordObjectState::Owned);
11542 Discord_String returnValueNative__;
11543 Discord_DiscordClientGuildVoiceMember_Username(&instance_, &returnValueNative__);
11544 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
11545 returnValueNative__.size);
11546 Discord_Free(returnValueNative__.ptr);
11547 return returnValue__;
11548}
11549void DiscordClientGuildVoiceMember::SetUsername(std::string_view Username)
11550{
11551 assert(state_ == DiscordObjectState::Owned);
11552 Discord_String Username__str{(uint8_t*)(Username.data() != nullptr ? Username.data() : ""),
11553 Username.size()};
11554 Discord_DiscordClientGuildVoiceMember_SetUsername(&instance_, Username__str);
11555}
11556std::optional<discordpp::String> DiscordClientGuildVoiceMember::AvatarHash() const
11557{
11558 assert(state_ == DiscordObjectState::Owned);
11559 bool returnIsNonNull__;
11560 Discord_String returnValueNative__;
11561 returnIsNonNull__ =
11562 Discord_DiscordClientGuildVoiceMember_AvatarHash(&instance_, &returnValueNative__);
11563 if (!returnIsNonNull__) {
11564 return {};
11565 }
11566 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
11567 returnValueNative__.size);
11568 Discord_Free(returnValueNative__.ptr);
11569 return returnValue__;
11570}
11571void DiscordClientGuildVoiceMember::SetAvatarHash(std::optional<std::string_view> AvatarHash)
11572{
11573 assert(state_ == DiscordObjectState::Owned);
11574 Discord_String AvatarHash__str{};
11575 if (AvatarHash.has_value()) {
11576 AvatarHash__str.ptr = (uint8_t*)(AvatarHash->data() != nullptr ? AvatarHash->data() : "");
11577 AvatarHash__str.size = AvatarHash->size();
11578 }
11579 Discord_DiscordClientGuildVoiceMember_SetAvatarHash(
11580 &instance_, (AvatarHash.has_value() ? &AvatarHash__str : nullptr));
11581}
11582bool DiscordClientGuildVoiceMember::Mute() const
11583{
11584 assert(state_ == DiscordObjectState::Owned);
11585 bool returnValue__;
11586 returnValue__ = Discord_DiscordClientGuildVoiceMember_Mute(&instance_);
11587 return returnValue__;
11588}
11589void DiscordClientGuildVoiceMember::SetMute(bool Mute)
11590{
11591 assert(state_ == DiscordObjectState::Owned);
11592 Discord_DiscordClientGuildVoiceMember_SetMute(&instance_, Mute);
11593}
11594bool DiscordClientGuildVoiceMember::Deaf() const
11595{
11596 assert(state_ == DiscordObjectState::Owned);
11597 bool returnValue__;
11598 returnValue__ = Discord_DiscordClientGuildVoiceMember_Deaf(&instance_);
11599 return returnValue__;
11600}
11601void DiscordClientGuildVoiceMember::SetDeaf(bool Deaf)
11602{
11603 assert(state_ == DiscordObjectState::Owned);
11604 Discord_DiscordClientGuildVoiceMember_SetDeaf(&instance_, Deaf);
11605}
11606bool DiscordClientGuildVoiceMember::SelfMute() const
11607{
11608 assert(state_ == DiscordObjectState::Owned);
11609 bool returnValue__;
11610 returnValue__ = Discord_DiscordClientGuildVoiceMember_SelfMute(&instance_);
11611 return returnValue__;
11612}
11613void DiscordClientGuildVoiceMember::SetSelfMute(bool SelfMute)
11614{
11615 assert(state_ == DiscordObjectState::Owned);
11616 Discord_DiscordClientGuildVoiceMember_SetSelfMute(&instance_, SelfMute);
11617}
11618bool DiscordClientGuildVoiceMember::SelfDeaf() const
11619{
11620 assert(state_ == DiscordObjectState::Owned);
11621 bool returnValue__;
11622 returnValue__ = Discord_DiscordClientGuildVoiceMember_SelfDeaf(&instance_);
11623 return returnValue__;
11624}
11625void DiscordClientGuildVoiceMember::SetSelfDeaf(bool SelfDeaf)
11626{
11627 assert(state_ == DiscordObjectState::Owned);
11628 Discord_DiscordClientGuildVoiceMember_SetSelfDeaf(&instance_, SelfDeaf);
11629}
11630discordpp::DiscordClientGuildVoiceSpeakingState DiscordClientGuildVoiceMember::Speaking() const
11631{
11632 assert(state_ == DiscordObjectState::Owned);
11633 Discord_DiscordClientGuildVoiceSpeakingState returnValue__;
11634 returnValue__ = Discord_DiscordClientGuildVoiceMember_Speaking(&instance_);
11635 return static_cast<discordpp::DiscordClientGuildVoiceSpeakingState>(returnValue__);
11636}
11637void DiscordClientGuildVoiceMember::SetSpeaking(
11639{
11640 assert(state_ == DiscordObjectState::Owned);
11641 Discord_DiscordClientGuildVoiceMember_SetSpeaking(
11642 &instance_, static_cast<Discord_DiscordClientGuildVoiceSpeakingState>(Speaking));
11643}
11644const DiscordClientGuildVoiceSnapshot DiscordClientGuildVoiceSnapshot::nullobj{
11645 {},
11646 DiscordObjectState::Invalid};
11647DiscordClientGuildVoiceSnapshot::~DiscordClientGuildVoiceSnapshot()
11648{
11649 if (state_ == DiscordObjectState::Owned) {
11650 Drop();
11651 state_ = DiscordObjectState::Invalid;
11652 }
11653}
11654DiscordClientGuildVoiceSnapshot::DiscordClientGuildVoiceSnapshot(
11655 DiscordClientGuildVoiceSnapshot&& other) noexcept
11656 : instance_(other.instance_)
11657 , state_(other.state_)
11658{
11659 other.state_ = DiscordObjectState::Invalid;
11660}
11661DiscordClientGuildVoiceSnapshot& DiscordClientGuildVoiceSnapshot::operator=(
11662 DiscordClientGuildVoiceSnapshot&& other) noexcept
11663{
11664 if (this != &other) {
11665 if (state_ == DiscordObjectState::Owned) {
11666 Drop();
11667 }
11668 instance_ = other.instance_;
11669 state_ = other.state_;
11670 other.state_ = DiscordObjectState::Invalid;
11671 }
11672 return *this;
11673}
11674DiscordClientGuildVoiceSnapshot::DiscordClientGuildVoiceSnapshot(
11675 const DiscordClientGuildVoiceSnapshot& arg0)
11676 : instance_{}
11677 , state_(DiscordObjectState::Invalid)
11678{
11679 if (arg0.state_ == DiscordObjectState::Owned) {
11680 Discord_DiscordClientGuildVoiceSnapshot_Clone(&instance_, arg0.instance());
11681
11682 state_ = DiscordObjectState::Owned;
11683 }
11684}
11685DiscordClientGuildVoiceSnapshot& DiscordClientGuildVoiceSnapshot::operator=(
11686 const DiscordClientGuildVoiceSnapshot& arg0)
11687{
11688 if (this != &arg0) {
11689 if (state_ == DiscordObjectState::Owned) {
11690 Drop();
11691 state_ = DiscordObjectState::Invalid;
11692 }
11693 if (arg0.state_ == DiscordObjectState::Owned) {
11694 Discord_DiscordClientGuildVoiceSnapshot_Clone(&instance_, arg0.instance());
11695
11696 state_ = DiscordObjectState::Owned;
11697 }
11698 }
11699 return *this;
11700}
11701DiscordClientGuildVoiceSnapshot::DiscordClientGuildVoiceSnapshot(
11702 Discord_DiscordClientGuildVoiceSnapshot instance,
11703 DiscordObjectState state)
11704 : instance_(instance)
11705 , state_(state)
11706{
11707}
11708void DiscordClientGuildVoiceSnapshot::Drop()
11709{
11710 if (state_ != DiscordObjectState::Owned) {
11711 return;
11712 }
11713 Discord_DiscordClientGuildVoiceSnapshot_Drop(&instance_);
11714 state_ = DiscordObjectState::Invalid;
11715}
11717 Members() const
11718{
11719 assert(state_ == DiscordObjectState::Owned);
11720 Discord_DiscordClientGuildVoiceMemberSpan returnValueNative__;
11721 Discord_DiscordClientGuildVoiceSnapshot_Members(&instance_, &returnValueNative__);
11723 returnValue__.reserve(returnValueNative__.size);
11724 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
11725 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
11726 }
11727 Discord_Free(returnValueNative__.ptr);
11728 return returnValue__;
11729}
11730discordpp::GuildChannel DiscordClientGuildVoiceSnapshot::Channel() const
11731{
11732 assert(state_ == DiscordObjectState::Owned);
11733 Discord_GuildChannel returnValueNative__{};
11734 Discord_DiscordClientGuildVoiceSnapshot_Channel(&instance_, &returnValueNative__);
11735 discordpp::GuildChannel returnValue__(returnValueNative__, DiscordObjectState::Owned);
11736 return returnValue__;
11737}
11738void DiscordClientGuildVoiceSnapshot::SetChannel(discordpp::GuildChannel Channel)
11739{
11740 assert(state_ == DiscordObjectState::Owned);
11741 Discord_DiscordClientGuildVoiceSnapshot_SetChannel(&instance_, Channel.instance());
11742}
11743bool DiscordClientGuildVoiceSnapshot::Selected() const
11744{
11745 assert(state_ == DiscordObjectState::Owned);
11746 bool returnValue__;
11747 returnValue__ = Discord_DiscordClientGuildVoiceSnapshot_Selected(&instance_);
11748 return returnValue__;
11749}
11750void DiscordClientGuildVoiceSnapshot::SetSelected(bool Selected)
11751{
11752 assert(state_ == DiscordObjectState::Owned);
11753 Discord_DiscordClientGuildVoiceSnapshot_SetSelected(&instance_, Selected);
11754}
11755bool DiscordClientGuildVoiceSnapshot::SpeakingAvailable() const
11756{
11757 assert(state_ == DiscordObjectState::Owned);
11758 bool returnValue__;
11759 returnValue__ = Discord_DiscordClientGuildVoiceSnapshot_SpeakingAvailable(&instance_);
11760 return returnValue__;
11761}
11762void DiscordClientGuildVoiceSnapshot::SetSpeakingAvailable(bool SpeakingAvailable)
11763{
11764 assert(state_ == DiscordObjectState::Owned);
11765 Discord_DiscordClientGuildVoiceSnapshot_SetSpeakingAvailable(&instance_, SpeakingAvailable);
11766}
11767const UserMessageSummary UserMessageSummary::nullobj{{}, DiscordObjectState::Invalid};
11768UserMessageSummary::~UserMessageSummary()
11769{
11770 if (state_ == DiscordObjectState::Owned) {
11771 Drop();
11772 state_ = DiscordObjectState::Invalid;
11773 }
11774}
11775UserMessageSummary::UserMessageSummary(UserMessageSummary&& other) noexcept
11776 : instance_(other.instance_)
11777 , state_(other.state_)
11778{
11779 other.state_ = DiscordObjectState::Invalid;
11780}
11781UserMessageSummary& UserMessageSummary::operator=(UserMessageSummary&& other) noexcept
11782{
11783 if (this != &other) {
11784 if (state_ == DiscordObjectState::Owned) {
11785 Drop();
11786 }
11787 instance_ = other.instance_;
11788 state_ = other.state_;
11789 other.state_ = DiscordObjectState::Invalid;
11790 }
11791 return *this;
11792}
11793UserMessageSummary::UserMessageSummary(const UserMessageSummary& arg0)
11794 : instance_{}
11795 , state_(DiscordObjectState::Invalid)
11796{
11797 if (arg0.state_ == DiscordObjectState::Owned) {
11798 Discord_UserMessageSummary_Clone(&instance_, arg0.instance());
11799
11800 state_ = DiscordObjectState::Owned;
11801 }
11802}
11803UserMessageSummary& UserMessageSummary::operator=(const UserMessageSummary& arg0)
11804{
11805 if (this != &arg0) {
11806 if (state_ == DiscordObjectState::Owned) {
11807 Drop();
11808 state_ = DiscordObjectState::Invalid;
11809 }
11810 if (arg0.state_ == DiscordObjectState::Owned) {
11811 Discord_UserMessageSummary_Clone(&instance_, arg0.instance());
11812
11813 state_ = DiscordObjectState::Owned;
11814 }
11815 }
11816 return *this;
11817}
11818UserMessageSummary::UserMessageSummary(Discord_UserMessageSummary instance,
11819 DiscordObjectState state)
11820 : instance_(instance)
11821 , state_(state)
11822{
11823}
11824void UserMessageSummary::Drop()
11825{
11826 if (state_ != DiscordObjectState::Owned) {
11827 return;
11828 }
11829 Discord_UserMessageSummary_Drop(&instance_);
11830 state_ = DiscordObjectState::Invalid;
11831}
11832uint64_t UserMessageSummary::LastMessageId() const
11833{
11834 assert(state_ == DiscordObjectState::Owned);
11835 uint64_t returnValue__;
11836 returnValue__ = Discord_UserMessageSummary_LastMessageId(&instance_);
11837 return returnValue__;
11838}
11839uint64_t UserMessageSummary::UserId() const
11840{
11841 assert(state_ == DiscordObjectState::Owned);
11842 uint64_t returnValue__;
11843 returnValue__ = Discord_UserMessageSummary_UserId(&instance_);
11844 return returnValue__;
11845}
11846const ClientCreateOptions ClientCreateOptions::nullobj{{}, DiscordObjectState::Invalid};
11847ClientCreateOptions::~ClientCreateOptions()
11848{
11849 if (state_ == DiscordObjectState::Owned) {
11850 Drop();
11851 state_ = DiscordObjectState::Invalid;
11852 }
11853}
11854ClientCreateOptions::ClientCreateOptions(ClientCreateOptions&& other) noexcept
11855 : instance_(other.instance_)
11856 , state_(other.state_)
11857{
11858 other.state_ = DiscordObjectState::Invalid;
11859}
11860ClientCreateOptions& ClientCreateOptions::operator=(ClientCreateOptions&& other) noexcept
11861{
11862 if (this != &other) {
11863 if (state_ == DiscordObjectState::Owned) {
11864 Drop();
11865 }
11866 instance_ = other.instance_;
11867 state_ = other.state_;
11868 other.state_ = DiscordObjectState::Invalid;
11869 }
11870 return *this;
11871}
11872ClientCreateOptions::ClientCreateOptions(const ClientCreateOptions& arg0)
11873 : instance_{}
11874 , state_(DiscordObjectState::Invalid)
11875{
11876 if (arg0.state_ == DiscordObjectState::Owned) {
11877 Discord_ClientCreateOptions_Clone(&instance_, arg0.instance());
11878
11879 state_ = DiscordObjectState::Owned;
11880 }
11881}
11882ClientCreateOptions& ClientCreateOptions::operator=(const ClientCreateOptions& arg0)
11883{
11884 if (this != &arg0) {
11885 if (state_ == DiscordObjectState::Owned) {
11886 Drop();
11887 state_ = DiscordObjectState::Invalid;
11888 }
11889 if (arg0.state_ == DiscordObjectState::Owned) {
11890 Discord_ClientCreateOptions_Clone(&instance_, arg0.instance());
11891
11892 state_ = DiscordObjectState::Owned;
11893 }
11894 }
11895 return *this;
11896}
11897ClientCreateOptions::ClientCreateOptions(Discord_ClientCreateOptions instance,
11898 DiscordObjectState state)
11899 : instance_(instance)
11900 , state_(state)
11901{
11902}
11903ClientCreateOptions::ClientCreateOptions()
11904{
11905 assert(state_ == DiscordObjectState::Invalid);
11906 Discord_ClientCreateOptions_Init(&instance_);
11907 state_ = DiscordObjectState::Owned;
11908}
11909void ClientCreateOptions::Drop()
11910{
11911 if (state_ != DiscordObjectState::Owned) {
11912 return;
11913 }
11914 Discord_ClientCreateOptions_Drop(&instance_);
11915 state_ = DiscordObjectState::Invalid;
11916}
11917discordpp::String ClientCreateOptions::WebBase() const
11918{
11919 assert(state_ == DiscordObjectState::Owned);
11920 Discord_String returnValueNative__;
11921 Discord_ClientCreateOptions_WebBase(&instance_, &returnValueNative__);
11922 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
11923 returnValueNative__.size);
11924 Discord_Free(returnValueNative__.ptr);
11925 return returnValue__;
11926}
11927void ClientCreateOptions::SetWebBase(std::string_view WebBase)
11928{
11929 assert(state_ == DiscordObjectState::Owned);
11930 Discord_String WebBase__str{(uint8_t*)(WebBase.data() != nullptr ? WebBase.data() : ""),
11931 WebBase.size()};
11932 Discord_ClientCreateOptions_SetWebBase(&instance_, WebBase__str);
11933}
11934discordpp::String ClientCreateOptions::ApiBase() const
11935{
11936 assert(state_ == DiscordObjectState::Owned);
11937 Discord_String returnValueNative__;
11938 Discord_ClientCreateOptions_ApiBase(&instance_, &returnValueNative__);
11939 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
11940 returnValueNative__.size);
11941 Discord_Free(returnValueNative__.ptr);
11942 return returnValue__;
11943}
11944void ClientCreateOptions::SetApiBase(std::string_view ApiBase)
11945{
11946 assert(state_ == DiscordObjectState::Owned);
11947 Discord_String ApiBase__str{(uint8_t*)(ApiBase.data() != nullptr ? ApiBase.data() : ""),
11948 ApiBase.size()};
11949 Discord_ClientCreateOptions_SetApiBase(&instance_, ApiBase__str);
11950}
11951discordpp::AudioSystem ClientCreateOptions::ExperimentalAudioSystem() const
11952{
11953 assert(state_ == DiscordObjectState::Owned);
11954 Discord_AudioSystem returnValue__;
11955 returnValue__ = Discord_ClientCreateOptions_ExperimentalAudioSystem(&instance_);
11956 return static_cast<discordpp::AudioSystem>(returnValue__);
11957}
11958void ClientCreateOptions::SetExperimentalAudioSystem(discordpp::AudioSystem ExperimentalAudioSystem)
11959{
11960 assert(state_ == DiscordObjectState::Owned);
11961 Discord_ClientCreateOptions_SetExperimentalAudioSystem(
11962 &instance_, static_cast<Discord_AudioSystem>(ExperimentalAudioSystem));
11963}
11964bool ClientCreateOptions::ExperimentalAndroidPreventCommsForBluetooth() const
11965{
11966 assert(state_ == DiscordObjectState::Owned);
11967 bool returnValue__;
11968 returnValue__ =
11969 Discord_ClientCreateOptions_ExperimentalAndroidPreventCommsForBluetooth(&instance_);
11970 return returnValue__;
11971}
11972void ClientCreateOptions::SetExperimentalAndroidPreventCommsForBluetooth(
11973 bool ExperimentalAndroidPreventCommsForBluetooth)
11974{
11975 assert(state_ == DiscordObjectState::Owned);
11976 Discord_ClientCreateOptions_SetExperimentalAndroidPreventCommsForBluetooth(
11977 &instance_, ExperimentalAndroidPreventCommsForBluetooth);
11978}
11979std::optional<uint64_t> ClientCreateOptions::CpuAffinityMask() const
11980{
11981 assert(state_ == DiscordObjectState::Owned);
11982 bool returnIsNonNull__;
11983 uint64_t returnValue__;
11984 returnIsNonNull__ = Discord_ClientCreateOptions_CpuAffinityMask(&instance_, &returnValue__);
11985 if (!returnIsNonNull__) {
11986 return std::nullopt;
11987 }
11988 return returnValue__;
11989}
11990void ClientCreateOptions::SetCpuAffinityMask(std::optional<uint64_t> CpuAffinityMask)
11991{
11992 assert(state_ == DiscordObjectState::Owned);
11993 Discord_ClientCreateOptions_SetCpuAffinityMask(
11994 &instance_, (CpuAffinityMask.has_value() ? &*CpuAffinityMask : nullptr));
11995}
11996const Client Client::nullobj{{}, DiscordObjectState::Invalid};
11997Client::~Client()
11998{
11999 if (state_ == DiscordObjectState::Owned) {
12000 Drop();
12001 state_ = DiscordObjectState::Invalid;
12002 }
12003}
12004Client::Client(Client&& other) noexcept
12005 : instance_(other.instance_)
12006 , state_(other.state_)
12007{
12008 other.state_ = DiscordObjectState::Invalid;
12009}
12010Client& Client::operator=(Client&& other) noexcept
12011{
12012 if (this != &other) {
12013 if (state_ == DiscordObjectState::Owned) {
12014 Drop();
12015 }
12016 instance_ = other.instance_;
12017 state_ = other.state_;
12018 other.state_ = DiscordObjectState::Invalid;
12019 }
12020 return *this;
12021}
12022Client::Client(Discord_Client instance, DiscordObjectState state)
12023 : instance_(instance)
12024 , state_(state)
12025{
12026}
12027Client::Client()
12028{
12029 assert(state_ == DiscordObjectState::Invalid);
12030 Discord_Client_Init(&instance_);
12031 state_ = DiscordObjectState::Owned;
12032}
12033Client::Client(std::string_view apiBase, std::string_view webBase)
12034{
12035 assert(state_ == DiscordObjectState::Invalid);
12036 Discord_String apiBase__str{(uint8_t*)(apiBase.data() != nullptr ? apiBase.data() : ""),
12037 apiBase.size()};
12038 Discord_String webBase__str{(uint8_t*)(webBase.data() != nullptr ? webBase.data() : ""),
12039 webBase.size()};
12040 Discord_Client_InitWithBases(&instance_, apiBase__str, webBase__str);
12041 state_ = DiscordObjectState::Owned;
12042}
12043Client::Client(discordpp::ClientCreateOptions options)
12044{
12045 assert(state_ == DiscordObjectState::Invalid);
12046 Discord_Client_InitWithOptions(&instance_, options.instance());
12047 state_ = DiscordObjectState::Owned;
12048}
12049void Client::Drop()
12050{
12051 if (state_ != DiscordObjectState::Owned) {
12052 return;
12053 }
12054 Discord_Client_Drop(&instance_);
12055 state_ = DiscordObjectState::Invalid;
12056}
12057discordpp::String Client::ErrorToString(discordpp::Client::Error type)
12058{
12059 Discord_String returnValueNative__;
12060 Discord_Client_ErrorToString(static_cast<Discord_Client_Error>(type), &returnValueNative__);
12061 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
12062 returnValueNative__.size);
12063 Discord_Free(returnValueNative__.ptr);
12064 return returnValue__;
12065}
12066uint64_t Client::GetApplicationId()
12067{
12068 assert(state_ == DiscordObjectState::Owned);
12069 uint64_t returnValue__;
12070 returnValue__ = Discord_Client_GetApplicationId(&instance_);
12071 return returnValue__;
12072}
12073discordpp::UserHandle Client::GetCurrentUser() const
12074{
12075 assert(state_ == DiscordObjectState::Owned);
12076 Discord_UserHandle returnValueNative__{};
12077 Discord_Client_GetCurrentUser(&instance_, &returnValueNative__);
12078 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
12079 return returnValue__;
12080}
12081discordpp::String Client::GetDefaultAudioDeviceId()
12082{
12083 Discord_String returnValueNative__;
12084 Discord_Client_GetDefaultAudioDeviceId(&returnValueNative__);
12085 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
12086 returnValueNative__.size);
12087 Discord_Free(returnValueNative__.ptr);
12088 return returnValue__;
12089}
12090discordpp::String Client::GetDefaultCommunicationScopes()
12091{
12092 Discord_String returnValueNative__;
12093 Discord_Client_GetDefaultCommunicationScopes(&returnValueNative__);
12094 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
12095 returnValueNative__.size);
12096 Discord_Free(returnValueNative__.ptr);
12097 return returnValue__;
12098}
12099discordpp::String Client::GetDefaultPresenceScopes()
12100{
12101 Discord_String returnValueNative__;
12102 Discord_Client_GetDefaultPresenceScopes(&returnValueNative__);
12103 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
12104 returnValueNative__.size);
12105 Discord_Free(returnValueNative__.ptr);
12106 return returnValue__;
12107}
12108void Client::GetDiscordClientGuildVoiceChannel(
12109 uint64_t channelId,
12111{
12112 assert(state_ == DiscordObjectState::Owned);
12113 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
12114 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
12115 Discord_Client_GetDiscordClientGuildVoiceChannelCallback callback__native =
12116 [](auto result, auto snapshot, void* userData__) {
12117 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
12118 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
12119 discordpp::DiscordClientGuildVoiceSnapshot snapshot__obj(*snapshot,
12120 DiscordObjectState::Owned);
12121 userData__typed->delegate(std::move(result__obj), std::move(snapshot__obj));
12122 };
12123 Discord_Client_GetDiscordClientGuildVoiceChannel(
12124 &instance_,
12125 channelId,
12126 (callback__userData->delegate ? callback__native : nullptr),
12127 Tcallback__UserData::Free,
12128 callback__userData);
12129}
12130void Client::GetDiscordClientGuildVoiceChannels(
12131 uint64_t guildId,
12133{
12134 assert(state_ == DiscordObjectState::Owned);
12135 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
12136 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
12137 Discord_Client_GetDiscordClientGuildVoiceChannelsCallback callback__native =
12138 [](auto result, auto channels, void* userData__) {
12139 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
12140 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
12142 channels__vec.reserve(channels.size);
12143 for (size_t i__ = 0; i__ < channels.size; ++i__) {
12144 channels__vec.emplace_back(channels.ptr[i__], DiscordObjectState::Owned);
12145 }
12146 Discord_Free(channels.ptr);
12147 userData__typed->delegate(std::move(result__obj), std::move(channels__vec));
12148 };
12149 Discord_Client_GetDiscordClientGuildVoiceChannels(
12150 &instance_,
12151 guildId,
12152 (callback__userData->delegate ? callback__native : nullptr),
12153 Tcallback__UserData::Free,
12154 callback__userData);
12155}
12156discordpp::String Client::GetVersionHash()
12157{
12158 Discord_String returnValueNative__;
12159 Discord_Client_GetVersionHash(&returnValueNative__);
12160 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
12161 returnValueNative__.size);
12162 Discord_Free(returnValueNative__.ptr);
12163 return returnValue__;
12164}
12165int32_t Client::GetVersionMajor()
12166{
12167 int32_t returnValue__;
12168 returnValue__ = Discord_Client_GetVersionMajor();
12169 return returnValue__;
12170}
12171int32_t Client::GetVersionMinor()
12172{
12173 int32_t returnValue__;
12174 returnValue__ = Discord_Client_GetVersionMinor();
12175 return returnValue__;
12176}
12177int32_t Client::GetVersionPatch()
12178{
12179 int32_t returnValue__;
12180 returnValue__ = Discord_Client_GetVersionPatch();
12181 return returnValue__;
12182}
12183void Client::JoinDiscordClientGuildVoiceChannel(
12184 uint64_t channelId,
12185 bool force,
12187{
12188 assert(state_ == DiscordObjectState::Owned);
12189 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
12190 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
12191 Discord_Client_DiscordClientGuildVoiceResultCallback callback__native = [](auto result,
12192 void* userData__) {
12193 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
12194 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
12195 userData__typed->delegate(std::move(result__obj));
12196 };
12197 Discord_Client_JoinDiscordClientGuildVoiceChannel(
12198 &instance_,
12199 channelId,
12200 force,
12201 (callback__userData->delegate ? callback__native : nullptr),
12202 Tcallback__UserData::Free,
12203 callback__userData);
12204}
12205void Client::LeaveDiscordClientGuildVoiceChannel(
12206 uint64_t channelId,
12208{
12209 assert(state_ == DiscordObjectState::Owned);
12210 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
12211 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
12212 Discord_Client_DiscordClientGuildVoiceResultCallback callback__native = [](auto result,
12213 void* userData__) {
12214 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
12215 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
12216 userData__typed->delegate(std::move(result__obj));
12217 };
12218 Discord_Client_LeaveDiscordClientGuildVoiceChannel(
12219 &instance_,
12220 channelId,
12221 (callback__userData->delegate ? callback__native : nullptr),
12222 Tcallback__UserData::Free,
12223 callback__userData);
12224}
12225void Client::SetDiscordClientGuildVoiceChannelErrorCallback(
12227{
12228 assert(state_ == DiscordObjectState::Owned);
12229 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
12230 auto cb__userData = Tcb__UserData::Create(std::move(cb));
12231 Discord_Client_DiscordClientGuildVoiceChannelErrorCallback cb__native =
12232 [](auto channelId, auto result, void* userData__) {
12233 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
12234 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
12235 userData__typed->delegate(channelId, std::move(result__obj));
12236 };
12237 Discord_Client_SetDiscordClientGuildVoiceChannelErrorCallback(
12238 &instance_,
12239 (cb__userData->delegate ? cb__native : nullptr),
12240 Tcb__UserData::Free,
12241 cb__userData);
12242}
12243void Client::SetDiscordClientGuildVoiceMemberAddedCallback(
12245{
12246 assert(state_ == DiscordObjectState::Owned);
12247 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
12248 auto cb__userData = Tcb__UserData::Create(std::move(cb));
12249 Discord_Client_DiscordClientGuildVoiceMemberAddedCallback cb__native =
12250 [](auto channelId, auto userId, void* userData__) {
12251 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
12252 userData__typed->delegate(channelId, userId);
12253 };
12254 Discord_Client_SetDiscordClientGuildVoiceMemberAddedCallback(
12255 &instance_,
12256 (cb__userData->delegate ? cb__native : nullptr),
12257 Tcb__UserData::Free,
12258 cb__userData);
12259}
12260void Client::SetDiscordClientGuildVoiceMemberRemovedCallback(
12262{
12263 assert(state_ == DiscordObjectState::Owned);
12264 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
12265 auto cb__userData = Tcb__UserData::Create(std::move(cb));
12266 Discord_Client_DiscordClientGuildVoiceMemberRemovedCallback cb__native =
12267 [](auto channelId, auto userId, void* userData__) {
12268 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
12269 userData__typed->delegate(channelId, userId);
12270 };
12271 Discord_Client_SetDiscordClientGuildVoiceMemberRemovedCallback(
12272 &instance_,
12273 (cb__userData->delegate ? cb__native : nullptr),
12274 Tcb__UserData::Free,
12275 cb__userData);
12276}
12277void Client::SetDiscordClientGuildVoiceMemberUpdatedCallback(
12279{
12280 assert(state_ == DiscordObjectState::Owned);
12281 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
12282 auto cb__userData = Tcb__UserData::Create(std::move(cb));
12283 Discord_Client_DiscordClientGuildVoiceMemberUpdatedCallback cb__native =
12284 [](auto channelId, auto userId, void* userData__) {
12285 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
12286 userData__typed->delegate(channelId, userId);
12287 };
12288 Discord_Client_SetDiscordClientGuildVoiceMemberUpdatedCallback(
12289 &instance_,
12290 (cb__userData->delegate ? cb__native : nullptr),
12291 Tcb__UserData::Free,
12292 cb__userData);
12293}
12294void Client::SetDiscordClientGuildVoiceSpeakingStartedCallback(
12296{
12297 assert(state_ == DiscordObjectState::Owned);
12298 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
12299 auto cb__userData = Tcb__UserData::Create(std::move(cb));
12300 Discord_Client_DiscordClientGuildVoiceSpeakingStartedCallback cb__native =
12301 [](auto channelId, auto userId, void* userData__) {
12302 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
12303 userData__typed->delegate(channelId, userId);
12304 };
12305 Discord_Client_SetDiscordClientGuildVoiceSpeakingStartedCallback(
12306 &instance_,
12307 (cb__userData->delegate ? cb__native : nullptr),
12308 Tcb__UserData::Free,
12309 cb__userData);
12310}
12311void Client::SetDiscordClientGuildVoiceSpeakingStoppedCallback(
12313{
12314 assert(state_ == DiscordObjectState::Owned);
12315 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
12316 auto cb__userData = Tcb__UserData::Create(std::move(cb));
12317 Discord_Client_DiscordClientGuildVoiceSpeakingStoppedCallback cb__native =
12318 [](auto channelId, auto userId, void* userData__) {
12319 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
12320 userData__typed->delegate(channelId, userId);
12321 };
12322 Discord_Client_SetDiscordClientGuildVoiceSpeakingStoppedCallback(
12323 &instance_,
12324 (cb__userData->delegate ? cb__native : nullptr),
12325 Tcb__UserData::Free,
12326 cb__userData);
12327}
12328void Client::SetDiscordClientVoiceChannelSelectedCallback(
12330{
12331 assert(state_ == DiscordObjectState::Owned);
12332 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
12333 auto cb__userData = Tcb__UserData::Create(std::move(cb));
12334 Discord_Client_DiscordClientVoiceChannelSelectedCallback cb__native = [](auto channelId,
12335 void* userData__) {
12336 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
12337 userData__typed->delegate(channelId);
12338 };
12339 Discord_Client_SetDiscordClientVoiceChannelSelectedCallback(
12340 &instance_,
12341 (cb__userData->delegate ? cb__native : nullptr),
12342 Tcb__UserData::Free,
12343 cb__userData);
12344}
12345void Client::SetDiscordClientVoiceConnectionStatusChangedCallback(
12347{
12348 assert(state_ == DiscordObjectState::Owned);
12349 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
12350 auto cb__userData = Tcb__UserData::Create(std::move(cb));
12351 Discord_Client_DiscordClientVoiceConnectionStatusChangedCallback cb__native =
12352 [](auto state, void* userData__) {
12353 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
12354 discordpp::String state__str(reinterpret_cast<char*>(state.ptr), state.size);
12355 userData__typed->delegate(std::move(state__str));
12356 Discord_Free(state.ptr);
12357 };
12358 Discord_Client_SetDiscordClientVoiceConnectionStatusChangedCallback(
12359 &instance_,
12360 (cb__userData->delegate ? cb__native : nullptr),
12361 Tcb__UserData::Free,
12362 cb__userData);
12363}
12364void Client::SetHttpRequestTimeout(int32_t httpTimeoutInMilliseconds)
12365{
12366 assert(state_ == DiscordObjectState::Owned);
12367 Discord_Client_SetHttpRequestTimeout(&instance_, httpTimeoutInMilliseconds);
12368}
12369discordpp::String Client::StatusToString(discordpp::Client::Status type)
12370{
12371 Discord_String returnValueNative__;
12372 Discord_Client_StatusToString(static_cast<Discord_Client_Status>(type), &returnValueNative__);
12373 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
12374 returnValueNative__.size);
12375 Discord_Free(returnValueNative__.ptr);
12376 return returnValue__;
12377}
12378void Client::SubscribeDiscordClientGuildVoiceChannel(
12379 uint64_t channelId,
12381{
12382 assert(state_ == DiscordObjectState::Owned);
12383 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
12384 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
12385 Discord_Client_DiscordClientGuildVoiceResultCallback callback__native = [](auto result,
12386 void* userData__) {
12387 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
12388 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
12389 userData__typed->delegate(std::move(result__obj));
12390 };
12391 Discord_Client_SubscribeDiscordClientGuildVoiceChannel(
12392 &instance_,
12393 channelId,
12394 (callback__userData->delegate ? callback__native : nullptr),
12395 Tcallback__UserData::Free,
12396 callback__userData);
12397}
12398discordpp::String Client::ThreadToString(discordpp::Client::Thread type)
12399{
12400 Discord_String returnValueNative__;
12401 Discord_Client_ThreadToString(static_cast<Discord_Client_Thread>(type), &returnValueNative__);
12402 discordpp::String returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
12403 returnValueNative__.size);
12404 Discord_Free(returnValueNative__.ptr);
12405 return returnValue__;
12406}
12407void Client::UnsubscribeDiscordClientGuildVoiceChannel(uint64_t channelId)
12408{
12409 assert(state_ == DiscordObjectState::Owned);
12410 Discord_Client_UnsubscribeDiscordClientGuildVoiceChannel(&instance_, channelId);
12411}
12412void Client::EndCall(uint64_t channelId, discordpp::Client::EndCallCallback callback)
12413{
12414 assert(state_ == DiscordObjectState::Owned);
12415 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
12416 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
12417 Discord_Client_EndCallCallback callback__native = [](void* userData__) {
12418 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
12419 userData__typed->delegate();
12420 };
12421 Discord_Client_EndCall(&instance_,
12422 channelId,
12423 (callback__userData->delegate ? callback__native : nullptr),
12424 Tcallback__UserData::Free,
12425 callback__userData);
12426}
12427void Client::EndCalls(discordpp::Client::EndCallsCallback callback)
12428{
12429 assert(state_ == DiscordObjectState::Owned);
12430 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
12431 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
12432 Discord_Client_EndCallsCallback callback__native = [](void* userData__) {
12433 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
12434 userData__typed->delegate();
12435 };
12436 Discord_Client_EndCalls(&instance_,
12437 (callback__userData->delegate ? callback__native : nullptr),
12438 Tcallback__UserData::Free,
12439 callback__userData);
12440}
12441discordpp::Call Client::GetCall(uint64_t channelId)
12442{
12443 assert(state_ == DiscordObjectState::Owned);
12444 bool returnIsNonNull__;
12445 Discord_Call returnValueNative__{};
12446 returnIsNonNull__ = Discord_Client_GetCall(&instance_, channelId, &returnValueNative__);
12447 discordpp::Call returnValue__(
12448 returnValueNative__,
12449 returnIsNonNull__ ? DiscordObjectState::Owned : DiscordObjectState::Invalid);
12450 return returnValue__;
12451}
12452discordpp::Vector<discordpp::Call> Client::GetCalls()
12453{
12454 assert(state_ == DiscordObjectState::Owned);
12455 Discord_CallSpan returnValueNative__;
12456 Discord_Client_GetCalls(&instance_, &returnValueNative__);
12458 returnValue__.reserve(returnValueNative__.size);
12459 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
12460 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
12461 }
12462 Discord_Free(returnValueNative__.ptr);
12463 return returnValue__;
12464}
12465void Client::GetCurrentInputDevice(discordpp::Client::GetCurrentInputDeviceCallback cb)
12466{
12467 assert(state_ == DiscordObjectState::Owned);
12468 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
12469 auto cb__userData = Tcb__UserData::Create(std::move(cb));
12470 Discord_Client_GetCurrentInputDeviceCallback cb__native = [](auto device, void* userData__) {
12471 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
12472 discordpp::AudioDevice device__obj(*device, DiscordObjectState::Owned);
12473 userData__typed->delegate(std::move(device__obj));
12474 };
12475 Discord_Client_GetCurrentInputDevice(&instance_,
12476 (cb__userData->delegate ? cb__native : nullptr),
12477 Tcb__UserData::Free,
12478 cb__userData);
12479}
12480void Client::GetCurrentOutputDevice(discordpp::Client::GetCurrentOutputDeviceCallback cb)
12481{
12482 assert(state_ == DiscordObjectState::Owned);
12483 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
12484 auto cb__userData = Tcb__UserData::Create(std::move(cb));
12485 Discord_Client_GetCurrentOutputDeviceCallback cb__native = [](auto device, void* userData__) {
12486 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
12487 discordpp::AudioDevice device__obj(*device, DiscordObjectState::Owned);
12488 userData__typed->delegate(std::move(device__obj));
12489 };
12490 Discord_Client_GetCurrentOutputDevice(&instance_,
12491 (cb__userData->delegate ? cb__native : nullptr),
12492 Tcb__UserData::Free,
12493 cb__userData);
12494}
12495void Client::GetInputDevices(discordpp::Client::GetInputDevicesCallback cb)
12496{
12497 assert(state_ == DiscordObjectState::Owned);
12498 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
12499 auto cb__userData = Tcb__UserData::Create(std::move(cb));
12500 Discord_Client_GetInputDevicesCallback cb__native = [](auto devices, void* userData__) {
12501 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
12503 devices__vec.reserve(devices.size);
12504 for (size_t i__ = 0; i__ < devices.size; ++i__) {
12505 devices__vec.emplace_back(devices.ptr[i__], DiscordObjectState::Owned);
12506 }
12507 Discord_Free(devices.ptr);
12508 userData__typed->delegate(std::move(devices__vec));
12509 };
12510 Discord_Client_GetInputDevices(&instance_,
12511 (cb__userData->delegate ? cb__native : nullptr),
12512 Tcb__UserData::Free,
12513 cb__userData);
12514}
12515float Client::GetInputVolume()
12516{
12517 assert(state_ == DiscordObjectState::Owned);
12518 float returnValue__;
12519 returnValue__ = Discord_Client_GetInputVolume(&instance_);
12520 return returnValue__;
12521}
12522void Client::GetOutputDevices(discordpp::Client::GetOutputDevicesCallback cb)
12523{
12524 assert(state_ == DiscordObjectState::Owned);
12525 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
12526 auto cb__userData = Tcb__UserData::Create(std::move(cb));
12527 Discord_Client_GetOutputDevicesCallback cb__native = [](auto devices, void* userData__) {
12528 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
12530 devices__vec.reserve(devices.size);
12531 for (size_t i__ = 0; i__ < devices.size; ++i__) {
12532 devices__vec.emplace_back(devices.ptr[i__], DiscordObjectState::Owned);
12533 }
12534 Discord_Free(devices.ptr);
12535 userData__typed->delegate(std::move(devices__vec));
12536 };
12537 Discord_Client_GetOutputDevices(&instance_,
12538 (cb__userData->delegate ? cb__native : nullptr),
12539 Tcb__UserData::Free,
12540 cb__userData);
12541}
12542float Client::GetOutputVolume()
12543{
12544 assert(state_ == DiscordObjectState::Owned);
12545 float returnValue__;
12546 returnValue__ = Discord_Client_GetOutputVolume(&instance_);
12547 return returnValue__;
12548}
12549bool Client::GetSelfDeafAll() const
12550{
12551 assert(state_ == DiscordObjectState::Owned);
12552 bool returnValue__;
12553 returnValue__ = Discord_Client_GetSelfDeafAll(&instance_);
12554 return returnValue__;
12555}
12556bool Client::GetSelfMuteAll() const
12557{
12558 assert(state_ == DiscordObjectState::Owned);
12559 bool returnValue__;
12560 returnValue__ = Discord_Client_GetSelfMuteAll(&instance_);
12561 return returnValue__;
12562}
12563void Client::GetVoiceSettings(discordpp::Client::GetVoiceSettingsCallback cb)
12564{
12565 assert(state_ == DiscordObjectState::Owned);
12566 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
12567 auto cb__userData = Tcb__UserData::Create(std::move(cb));
12568 Discord_Client_GetVoiceSettingsCallback cb__native =
12569 [](auto result, auto settings, void* userData__) {
12570 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
12571 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
12572 discordpp::VoiceSettings settings__obj(*settings, DiscordObjectState::Owned);
12573 userData__typed->delegate(std::move(result__obj), std::move(settings__obj));
12574 };
12575 Discord_Client_GetVoiceSettings(&instance_,
12576 (cb__userData->delegate ? cb__native : nullptr),
12577 Tcb__UserData::Free,
12578 cb__userData);
12579}
12580void Client::SetAecDump(bool on)
12581{
12582 assert(state_ == DiscordObjectState::Owned);
12583 Discord_Client_SetAecDump(&instance_, on);
12584}
12585void Client::SetAutomaticGainControl(bool on)
12586{
12587 assert(state_ == DiscordObjectState::Owned);
12588 Discord_Client_SetAutomaticGainControl(&instance_, on);
12589}
12590void Client::SetDeviceChangeCallback(discordpp::Client::DeviceChangeCallback callback)
12591{
12592 assert(state_ == DiscordObjectState::Owned);
12593 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
12594 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
12595 Discord_Client_DeviceChangeCallback callback__native =
12596 [](auto inputDevices, auto outputDevices, void* userData__) {
12597 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
12599 inputDevices__vec.reserve(inputDevices.size);
12600 for (size_t i__ = 0; i__ < inputDevices.size; ++i__) {
12601 inputDevices__vec.emplace_back(inputDevices.ptr[i__], DiscordObjectState::Owned);
12602 }
12603 Discord_Free(inputDevices.ptr);
12605 outputDevices__vec.reserve(outputDevices.size);
12606 for (size_t i__ = 0; i__ < outputDevices.size; ++i__) {
12607 outputDevices__vec.emplace_back(outputDevices.ptr[i__], DiscordObjectState::Owned);
12608 }
12609 Discord_Free(outputDevices.ptr);
12610 userData__typed->delegate(std::move(inputDevices__vec), std::move(outputDevices__vec));
12611 };
12612 Discord_Client_SetDeviceChangeCallback(
12613 &instance_,
12614 (callback__userData->delegate ? callback__native : nullptr),
12615 Tcallback__UserData::Free,
12616 callback__userData);
12617}
12618void Client::SetEchoCancellation(bool on)
12619{
12620 assert(state_ == DiscordObjectState::Owned);
12621 Discord_Client_SetEchoCancellation(&instance_, on);
12622}
12623void Client::SetEngineManagedAudioSession(bool isEngineManaged)
12624{
12625 assert(state_ == DiscordObjectState::Owned);
12626 Discord_Client_SetEngineManagedAudioSession(&instance_, isEngineManaged);
12627}
12628void Client::SetInputDevice(std::string_view deviceId, discordpp::Client::SetInputDeviceCallback cb)
12629{
12630 assert(state_ == DiscordObjectState::Owned);
12631 Discord_String deviceId__str{(uint8_t*)(deviceId.data() != nullptr ? deviceId.data() : ""),
12632 deviceId.size()};
12633 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
12634 auto cb__userData = Tcb__UserData::Create(std::move(cb));
12635 Discord_Client_SetInputDeviceCallback cb__native = [](auto result, void* userData__) {
12636 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
12637 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
12638 userData__typed->delegate(std::move(result__obj));
12639 };
12640 Discord_Client_SetInputDevice(&instance_,
12641 deviceId__str,
12642 (cb__userData->delegate ? cb__native : nullptr),
12643 Tcb__UserData::Free,
12644 cb__userData);
12645}
12646void Client::SetInputVolume(float inputVolume)
12647{
12648 assert(state_ == DiscordObjectState::Owned);
12649 Discord_Client_SetInputVolume(&instance_, inputVolume);
12650}
12651void Client::SetNoAudioInputCallback(discordpp::Client::NoAudioInputCallback callback)
12652{
12653 assert(state_ == DiscordObjectState::Owned);
12654 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
12655 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
12656 Discord_Client_NoAudioInputCallback callback__native = [](auto inputDetected,
12657 void* userData__) {
12658 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
12659 userData__typed->delegate(inputDetected);
12660 };
12661 Discord_Client_SetNoAudioInputCallback(
12662 &instance_,
12663 (callback__userData->delegate ? callback__native : nullptr),
12664 Tcallback__UserData::Free,
12665 callback__userData);
12666}
12667void Client::SetNoAudioInputThreshold(float dBFSThreshold)
12668{
12669 assert(state_ == DiscordObjectState::Owned);
12670 Discord_Client_SetNoAudioInputThreshold(&instance_, dBFSThreshold);
12671}
12672void Client::SetNoiseCancellation(bool on)
12673{
12674 assert(state_ == DiscordObjectState::Owned);
12675 Discord_Client_SetNoiseCancellation(&instance_, on);
12676}
12677void Client::SetNoiseSuppression(bool on)
12678{
12679 assert(state_ == DiscordObjectState::Owned);
12680 Discord_Client_SetNoiseSuppression(&instance_, on);
12681}
12682void Client::SetOpusHardwareCoding(bool encode, bool decode)
12683{
12684 assert(state_ == DiscordObjectState::Owned);
12685 Discord_Client_SetOpusHardwareCoding(&instance_, encode, decode);
12686}
12687void Client::SetOutputDevice(std::string_view deviceId,
12689{
12690 assert(state_ == DiscordObjectState::Owned);
12691 Discord_String deviceId__str{(uint8_t*)(deviceId.data() != nullptr ? deviceId.data() : ""),
12692 deviceId.size()};
12693 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
12694 auto cb__userData = Tcb__UserData::Create(std::move(cb));
12695 Discord_Client_SetOutputDeviceCallback cb__native = [](auto result, void* userData__) {
12696 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
12697 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
12698 userData__typed->delegate(std::move(result__obj));
12699 };
12700 Discord_Client_SetOutputDevice(&instance_,
12701 deviceId__str,
12702 (cb__userData->delegate ? cb__native : nullptr),
12703 Tcb__UserData::Free,
12704 cb__userData);
12705}
12706void Client::SetOutputVolume(float outputVolume)
12707{
12708 assert(state_ == DiscordObjectState::Owned);
12709 Discord_Client_SetOutputVolume(&instance_, outputVolume);
12710}
12711void Client::SetSelfDeafAll(bool deaf)
12712{
12713 assert(state_ == DiscordObjectState::Owned);
12714 Discord_Client_SetSelfDeafAll(&instance_, deaf);
12715}
12716void Client::SetSelfMuteAll(bool mute)
12717{
12718 assert(state_ == DiscordObjectState::Owned);
12719 Discord_Client_SetSelfMuteAll(&instance_, mute);
12720}
12721bool Client::SetSpeakerMode(bool speakerMode)
12722{
12723 assert(state_ == DiscordObjectState::Owned);
12724 bool returnValue__;
12725 returnValue__ = Discord_Client_SetSpeakerMode(&instance_, speakerMode);
12726 return returnValue__;
12727}
12728void Client::SetThreadPriority(discordpp::Client::Thread thread, int32_t priority)
12729{
12730 assert(state_ == DiscordObjectState::Owned);
12731 Discord_Client_SetThreadPriority(
12732 &instance_, static_cast<Discord_Client_Thread>(thread), priority);
12733}
12734void Client::SetVoiceParticipantChangedCallback(
12736{
12737 assert(state_ == DiscordObjectState::Owned);
12738 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
12739 auto cb__userData = Tcb__UserData::Create(std::move(cb));
12740 Discord_Client_VoiceParticipantChangedCallback cb__native =
12741 [](auto lobbyId, auto memberId, auto added, void* userData__) {
12742 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
12743 userData__typed->delegate(lobbyId, memberId, added);
12744 };
12745 Discord_Client_SetVoiceParticipantChangedCallback(
12746 &instance_,
12747 (cb__userData->delegate ? cb__native : nullptr),
12748 Tcb__UserData::Free,
12749 cb__userData);
12750}
12751void Client::SetVoiceSettingsUpdatedCallback(
12753{
12754 assert(state_ == DiscordObjectState::Owned);
12755 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
12756 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
12757 Discord_Client_VoiceSettingsUpdatedCallback callback__native = [](auto settings,
12758 void* userData__) {
12759 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
12760 discordpp::VoiceSettings settings__obj(*settings, DiscordObjectState::Owned);
12761 userData__typed->delegate(std::move(settings__obj));
12762 };
12763 Discord_Client_SetVoiceSettingsUpdatedCallback(
12764 &instance_,
12765 (callback__userData->delegate ? callback__native : nullptr),
12766 Tcallback__UserData::Free,
12767 callback__userData);
12768}
12769bool Client::ShowAudioRoutePicker()
12770{
12771 assert(state_ == DiscordObjectState::Owned);
12772 bool returnValue__;
12773 returnValue__ = Discord_Client_ShowAudioRoutePicker(&instance_);
12774 return returnValue__;
12775}
12776discordpp::Call Client::StartCall(uint64_t channelId)
12777{
12778 assert(state_ == DiscordObjectState::Owned);
12779 bool returnIsNonNull__;
12780 Discord_Call returnValueNative__{};
12781 returnIsNonNull__ = Discord_Client_StartCall(&instance_, channelId, &returnValueNative__);
12782 discordpp::Call returnValue__(
12783 returnValueNative__,
12784 returnIsNonNull__ ? DiscordObjectState::Owned : DiscordObjectState::Invalid);
12785 return returnValue__;
12786}
12787discordpp::Call Client::StartCallWithAudioCallbacks(
12788 uint64_t lobbyId,
12791{
12792 assert(state_ == DiscordObjectState::Owned);
12793 bool returnIsNonNull__;
12794 Discord_Call returnValueNative__{};
12795 using TreceivedCb__UserData = TDelegateUserData<std::remove_reference_t<decltype(receivedCb)>>;
12796 auto receivedCb__userData = TreceivedCb__UserData::Create(std::move(receivedCb));
12797 Discord_Client_UserAudioReceivedCallback receivedCb__native = [](auto userId,
12798 auto data,
12799 auto samplesPerChannel,
12800 auto sampleRate,
12801 auto channels,
12802 auto outShouldMute,
12803 void* userData__) {
12804 auto userData__typed = static_cast<TreceivedCb__UserData*>(userData__);
12805 userData__typed->delegate(
12806 userId, data, samplesPerChannel, sampleRate, channels, *outShouldMute);
12807 };
12808 using TcapturedCb__UserData = TDelegateUserData<std::remove_reference_t<decltype(capturedCb)>>;
12809 auto capturedCb__userData = TcapturedCb__UserData::Create(std::move(capturedCb));
12810 Discord_Client_UserAudioCapturedCallback capturedCb__native =
12811 [](auto data, auto samplesPerChannel, auto sampleRate, auto channels, void* userData__) {
12812 auto userData__typed = static_cast<TcapturedCb__UserData*>(userData__);
12813 userData__typed->delegate(data, samplesPerChannel, sampleRate, channels);
12814 };
12815 returnIsNonNull__ = Discord_Client_StartCallWithAudioCallbacks(
12816 &instance_,
12817 lobbyId,
12818 (receivedCb__userData->delegate ? receivedCb__native : nullptr),
12819 TreceivedCb__UserData::Free,
12820 receivedCb__userData,
12821 (capturedCb__userData->delegate ? capturedCb__native : nullptr),
12822 TcapturedCb__UserData::Free,
12823 capturedCb__userData,
12824 &returnValueNative__);
12825 discordpp::Call returnValue__(
12826 returnValueNative__,
12827 returnIsNonNull__ ? DiscordObjectState::Owned : DiscordObjectState::Invalid);
12828 return returnValue__;
12829}
12830void Client::AbortAuthorize()
12831{
12832 assert(state_ == DiscordObjectState::Owned);
12833 Discord_Client_AbortAuthorize(&instance_);
12834}
12835void Client::AbortGetTokenFromDevice()
12836{
12837 assert(state_ == DiscordObjectState::Owned);
12838 Discord_Client_AbortGetTokenFromDevice(&instance_);
12839}
12840void Client::Authorize(discordpp::AuthorizationArgs args,
12842{
12843 assert(state_ == DiscordObjectState::Owned);
12844 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
12845 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
12846 Discord_Client_AuthorizationCallback callback__native =
12847 [](auto result, auto code, auto redirectUri, void* userData__) {
12848 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
12849 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
12850 discordpp::String code__str(reinterpret_cast<char*>(code.ptr), code.size);
12851 discordpp::String redirectUri__str(reinterpret_cast<char*>(redirectUri.ptr),
12852 redirectUri.size);
12853 userData__typed->delegate(
12854 std::move(result__obj), std::move(code__str), std::move(redirectUri__str));
12855 Discord_Free(redirectUri.ptr);
12856 Discord_Free(code.ptr);
12857 };
12858 Discord_Client_Authorize(&instance_,
12859 args.instance(),
12860 (callback__userData->delegate ? callback__native : nullptr),
12861 Tcallback__UserData::Free,
12862 callback__userData);
12863}
12864void Client::CloseAuthorizeDeviceScreen()
12865{
12866 assert(state_ == DiscordObjectState::Owned);
12867 Discord_Client_CloseAuthorizeDeviceScreen(&instance_);
12868}
12869discordpp::AuthorizationCodeVerifier Client::CreateAuthorizationCodeVerifier()
12870{
12871 assert(state_ == DiscordObjectState::Owned);
12872 Discord_AuthorizationCodeVerifier returnValueNative__{};
12873 Discord_Client_CreateAuthorizationCodeVerifier(&instance_, &returnValueNative__);
12874 discordpp::AuthorizationCodeVerifier returnValue__(returnValueNative__,
12875 DiscordObjectState::Owned);
12876 return returnValue__;
12877}
12878void Client::ExchangeChildToken(std::string_view parentApplicationToken,
12879 uint64_t childApplicationId,
12881{
12882 assert(state_ == DiscordObjectState::Owned);
12883 Discord_String parentApplicationToken__str{
12884 (uint8_t*)(parentApplicationToken.data() != nullptr ? parentApplicationToken.data() : ""),
12885 parentApplicationToken.size()};
12886 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
12887 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
12888 Discord_Client_ExchangeChildTokenCallback callback__native = [](auto result,
12889 auto accessToken,
12890 auto tokenType,
12891 auto expiresIn,
12892 auto scopes,
12893 void* userData__) {
12894 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
12895 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
12896 discordpp::String accessToken__str(reinterpret_cast<char*>(accessToken.ptr),
12897 accessToken.size);
12898 discordpp::String scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
12899 userData__typed->delegate(std::move(result__obj),
12900 std::move(accessToken__str),
12901 static_cast<discordpp::AuthorizationTokenType>(tokenType),
12902 expiresIn,
12903 std::move(scopes__str));
12904 Discord_Free(scopes.ptr);
12905 Discord_Free(accessToken.ptr);
12906 };
12907 Discord_Client_ExchangeChildToken(&instance_,
12908 parentApplicationToken__str,
12909 childApplicationId,
12910 (callback__userData->delegate ? callback__native : nullptr),
12911 Tcallback__UserData::Free,
12912 callback__userData);
12913}
12914void Client::FetchCurrentUser(discordpp::AuthorizationTokenType tokenType,
12915 std::string_view token,
12917{
12918 assert(state_ == DiscordObjectState::Owned);
12919 Discord_String token__str{(uint8_t*)(token.data() != nullptr ? token.data() : ""),
12920 token.size()};
12921 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
12922 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
12923 Discord_Client_FetchCurrentUserCallback callback__native =
12924 [](auto result, auto id, auto name, void* userData__) {
12925 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
12926 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
12927 discordpp::String name__str(reinterpret_cast<char*>(name.ptr), name.size);
12928 userData__typed->delegate(std::move(result__obj), id, std::move(name__str));
12929 Discord_Free(name.ptr);
12930 };
12931 Discord_Client_FetchCurrentUser(&instance_,
12932 static_cast<Discord_AuthorizationTokenType>(tokenType),
12933 token__str,
12934 (callback__userData->delegate ? callback__native : nullptr),
12935 Tcallback__UserData::Free,
12936 callback__userData);
12937}
12938void Client::GetProvisionalToken(uint64_t applicationId,
12940 std::string_view externalAuthToken,
12942{
12943 assert(state_ == DiscordObjectState::Owned);
12944 Discord_String externalAuthToken__str{
12945 (uint8_t*)(externalAuthToken.data() != nullptr ? externalAuthToken.data() : ""),
12946 externalAuthToken.size()};
12947 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
12948 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
12949 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
12950 auto accessToken,
12951 auto refreshToken,
12952 auto tokenType,
12953 auto expiresIn,
12954 auto scopes,
12955 void* userData__) {
12956 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
12957 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
12958 discordpp::String accessToken__str(reinterpret_cast<char*>(accessToken.ptr),
12959 accessToken.size);
12960 discordpp::String refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr),
12961 refreshToken.size);
12962 discordpp::String scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
12963 userData__typed->delegate(std::move(result__obj),
12964 std::move(accessToken__str),
12965 std::move(refreshToken__str),
12966 static_cast<discordpp::AuthorizationTokenType>(tokenType),
12967 expiresIn,
12968 std::move(scopes__str));
12969 Discord_Free(scopes.ptr);
12970 Discord_Free(refreshToken.ptr);
12971 Discord_Free(accessToken.ptr);
12972 };
12973 Discord_Client_GetProvisionalToken(
12974 &instance_,
12975 applicationId,
12976 static_cast<Discord_AuthenticationExternalAuthType>(externalAuthType),
12977 externalAuthToken__str,
12978 (callback__userData->delegate ? callback__native : nullptr),
12979 Tcallback__UserData::Free,
12980 callback__userData);
12981}
12982void Client::GetToken(uint64_t applicationId,
12983 std::string_view code,
12984 std::string_view codeVerifier,
12985 std::string_view redirectUri,
12987{
12988 assert(state_ == DiscordObjectState::Owned);
12989 Discord_String code__str{(uint8_t*)(code.data() != nullptr ? code.data() : ""), code.size()};
12990 Discord_String codeVerifier__str{
12991 (uint8_t*)(codeVerifier.data() != nullptr ? codeVerifier.data() : ""), codeVerifier.size()};
12992 Discord_String redirectUri__str{
12993 (uint8_t*)(redirectUri.data() != nullptr ? redirectUri.data() : ""), redirectUri.size()};
12994 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
12995 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
12996 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
12997 auto accessToken,
12998 auto refreshToken,
12999 auto tokenType,
13000 auto expiresIn,
13001 auto scopes,
13002 void* userData__) {
13003 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
13004 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13005 discordpp::String accessToken__str(reinterpret_cast<char*>(accessToken.ptr),
13006 accessToken.size);
13007 discordpp::String refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr),
13008 refreshToken.size);
13009 discordpp::String scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
13010 userData__typed->delegate(std::move(result__obj),
13011 std::move(accessToken__str),
13012 std::move(refreshToken__str),
13013 static_cast<discordpp::AuthorizationTokenType>(tokenType),
13014 expiresIn,
13015 std::move(scopes__str));
13016 Discord_Free(scopes.ptr);
13017 Discord_Free(refreshToken.ptr);
13018 Discord_Free(accessToken.ptr);
13019 };
13020 Discord_Client_GetToken(&instance_,
13021 applicationId,
13022 code__str,
13023 codeVerifier__str,
13024 redirectUri__str,
13025 (callback__userData->delegate ? callback__native : nullptr),
13026 Tcallback__UserData::Free,
13027 callback__userData);
13028}
13029void Client::GetTokenFromDevice(discordpp::DeviceAuthorizationArgs args,
13031{
13032 assert(state_ == DiscordObjectState::Owned);
13033 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
13034 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
13035 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
13036 auto accessToken,
13037 auto refreshToken,
13038 auto tokenType,
13039 auto expiresIn,
13040 auto scopes,
13041 void* userData__) {
13042 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
13043 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13044 discordpp::String accessToken__str(reinterpret_cast<char*>(accessToken.ptr),
13045 accessToken.size);
13046 discordpp::String refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr),
13047 refreshToken.size);
13048 discordpp::String scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
13049 userData__typed->delegate(std::move(result__obj),
13050 std::move(accessToken__str),
13051 std::move(refreshToken__str),
13052 static_cast<discordpp::AuthorizationTokenType>(tokenType),
13053 expiresIn,
13054 std::move(scopes__str));
13055 Discord_Free(scopes.ptr);
13056 Discord_Free(refreshToken.ptr);
13057 Discord_Free(accessToken.ptr);
13058 };
13059 Discord_Client_GetTokenFromDevice(&instance_,
13060 args.instance(),
13061 (callback__userData->delegate ? callback__native : nullptr),
13062 Tcallback__UserData::Free,
13063 callback__userData);
13064}
13065void Client::GetTokenFromDeviceProvisionalMerge(
13068 std::string_view externalAuthToken,
13070{
13071 assert(state_ == DiscordObjectState::Owned);
13072 Discord_String externalAuthToken__str{
13073 (uint8_t*)(externalAuthToken.data() != nullptr ? externalAuthToken.data() : ""),
13074 externalAuthToken.size()};
13075 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
13076 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
13077 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
13078 auto accessToken,
13079 auto refreshToken,
13080 auto tokenType,
13081 auto expiresIn,
13082 auto scopes,
13083 void* userData__) {
13084 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
13085 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13086 discordpp::String accessToken__str(reinterpret_cast<char*>(accessToken.ptr),
13087 accessToken.size);
13088 discordpp::String refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr),
13089 refreshToken.size);
13090 discordpp::String scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
13091 userData__typed->delegate(std::move(result__obj),
13092 std::move(accessToken__str),
13093 std::move(refreshToken__str),
13094 static_cast<discordpp::AuthorizationTokenType>(tokenType),
13095 expiresIn,
13096 std::move(scopes__str));
13097 Discord_Free(scopes.ptr);
13098 Discord_Free(refreshToken.ptr);
13099 Discord_Free(accessToken.ptr);
13100 };
13101 Discord_Client_GetTokenFromDeviceProvisionalMerge(
13102 &instance_,
13103 args.instance(),
13104 static_cast<Discord_AuthenticationExternalAuthType>(externalAuthType),
13105 externalAuthToken__str,
13106 (callback__userData->delegate ? callback__native : nullptr),
13107 Tcallback__UserData::Free,
13108 callback__userData);
13109}
13110void Client::GetTokenFromProvisionalMerge(
13111 uint64_t applicationId,
13112 std::string_view code,
13113 std::string_view codeVerifier,
13114 std::string_view redirectUri,
13116 std::string_view externalAuthToken,
13118{
13119 assert(state_ == DiscordObjectState::Owned);
13120 Discord_String code__str{(uint8_t*)(code.data() != nullptr ? code.data() : ""), code.size()};
13121 Discord_String codeVerifier__str{
13122 (uint8_t*)(codeVerifier.data() != nullptr ? codeVerifier.data() : ""), codeVerifier.size()};
13123 Discord_String redirectUri__str{
13124 (uint8_t*)(redirectUri.data() != nullptr ? redirectUri.data() : ""), redirectUri.size()};
13125 Discord_String externalAuthToken__str{
13126 (uint8_t*)(externalAuthToken.data() != nullptr ? externalAuthToken.data() : ""),
13127 externalAuthToken.size()};
13128 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
13129 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
13130 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
13131 auto accessToken,
13132 auto refreshToken,
13133 auto tokenType,
13134 auto expiresIn,
13135 auto scopes,
13136 void* userData__) {
13137 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
13138 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13139 discordpp::String accessToken__str(reinterpret_cast<char*>(accessToken.ptr),
13140 accessToken.size);
13141 discordpp::String refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr),
13142 refreshToken.size);
13143 discordpp::String scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
13144 userData__typed->delegate(std::move(result__obj),
13145 std::move(accessToken__str),
13146 std::move(refreshToken__str),
13147 static_cast<discordpp::AuthorizationTokenType>(tokenType),
13148 expiresIn,
13149 std::move(scopes__str));
13150 Discord_Free(scopes.ptr);
13151 Discord_Free(refreshToken.ptr);
13152 Discord_Free(accessToken.ptr);
13153 };
13154 Discord_Client_GetTokenFromProvisionalMerge(
13155 &instance_,
13156 applicationId,
13157 code__str,
13158 codeVerifier__str,
13159 redirectUri__str,
13160 static_cast<Discord_AuthenticationExternalAuthType>(externalAuthType),
13161 externalAuthToken__str,
13162 (callback__userData->delegate ? callback__native : nullptr),
13163 Tcallback__UserData::Free,
13164 callback__userData);
13165}
13166bool Client::IsAuthenticated()
13167{
13168 assert(state_ == DiscordObjectState::Owned);
13169 bool returnValue__;
13170 returnValue__ = Discord_Client_IsAuthenticated(&instance_);
13171 return returnValue__;
13172}
13173void Client::OpenAuthorizeDeviceScreen(uint64_t clientId, std::string_view userCode)
13174{
13175 assert(state_ == DiscordObjectState::Owned);
13176 Discord_String userCode__str{(uint8_t*)(userCode.data() != nullptr ? userCode.data() : ""),
13177 userCode.size()};
13178 Discord_Client_OpenAuthorizeDeviceScreen(&instance_, clientId, userCode__str);
13179}
13180void Client::ProvisionalUserMergeCompleted(bool success)
13181{
13182 assert(state_ == DiscordObjectState::Owned);
13183 Discord_Client_ProvisionalUserMergeCompleted(&instance_, success);
13184}
13185void Client::RefreshToken(uint64_t applicationId,
13186 std::string_view refreshToken,
13188{
13189 assert(state_ == DiscordObjectState::Owned);
13190 Discord_String refreshToken__str{
13191 (uint8_t*)(refreshToken.data() != nullptr ? refreshToken.data() : ""), refreshToken.size()};
13192 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
13193 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
13194 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
13195 auto accessToken,
13196 auto refreshToken,
13197 auto tokenType,
13198 auto expiresIn,
13199 auto scopes,
13200 void* userData__) {
13201 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
13202 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13203 discordpp::String accessToken__str(reinterpret_cast<char*>(accessToken.ptr),
13204 accessToken.size);
13205 discordpp::String refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr),
13206 refreshToken.size);
13207 discordpp::String scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
13208 userData__typed->delegate(std::move(result__obj),
13209 std::move(accessToken__str),
13210 std::move(refreshToken__str),
13211 static_cast<discordpp::AuthorizationTokenType>(tokenType),
13212 expiresIn,
13213 std::move(scopes__str));
13214 Discord_Free(scopes.ptr);
13215 Discord_Free(refreshToken.ptr);
13216 Discord_Free(accessToken.ptr);
13217 };
13218 Discord_Client_RefreshToken(&instance_,
13219 applicationId,
13220 refreshToken__str,
13221 (callback__userData->delegate ? callback__native : nullptr),
13222 Tcallback__UserData::Free,
13223 callback__userData);
13224}
13225void Client::RegisterAuthorizeRequestCallback(discordpp::Client::AuthorizeRequestCallback callback)
13226{
13227 assert(state_ == DiscordObjectState::Owned);
13228 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
13229 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
13230 Discord_Client_AuthorizeRequestCallback callback__native = [](void* userData__) {
13231 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
13232 userData__typed->delegate();
13233 };
13234 Discord_Client_RegisterAuthorizeRequestCallback(
13235 &instance_,
13236 (callback__userData->delegate ? callback__native : nullptr),
13237 Tcallback__UserData::Free,
13238 callback__userData);
13239}
13240void Client::RemoveAuthorizeRequestCallback()
13241{
13242 assert(state_ == DiscordObjectState::Owned);
13243 Discord_Client_RemoveAuthorizeRequestCallback(&instance_);
13244}
13245void Client::RevokeToken(uint64_t applicationId,
13246 std::string_view token,
13248{
13249 assert(state_ == DiscordObjectState::Owned);
13250 Discord_String token__str{(uint8_t*)(token.data() != nullptr ? token.data() : ""),
13251 token.size()};
13252 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
13253 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
13254 Discord_Client_RevokeTokenCallback callback__native = [](auto result, void* userData__) {
13255 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
13256 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13257 userData__typed->delegate(std::move(result__obj));
13258 };
13259 Discord_Client_RevokeToken(&instance_,
13260 applicationId,
13261 token__str,
13262 (callback__userData->delegate ? callback__native : nullptr),
13263 Tcallback__UserData::Free,
13264 callback__userData);
13265}
13266void Client::SetAuthorizeDeviceScreenClosedCallback(
13268{
13269 assert(state_ == DiscordObjectState::Owned);
13270 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13271 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13272 Discord_Client_AuthorizeDeviceScreenClosedCallback cb__native = [](void* userData__) {
13273 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13274 userData__typed->delegate();
13275 };
13276 Discord_Client_SetAuthorizeDeviceScreenClosedCallback(
13277 &instance_,
13278 (cb__userData->delegate ? cb__native : nullptr),
13279 Tcb__UserData::Free,
13280 cb__userData);
13281}
13282void Client::SetGameWindowPid(int32_t pid)
13283{
13284 assert(state_ == DiscordObjectState::Owned);
13285 Discord_Client_SetGameWindowPid(&instance_, pid);
13286}
13287void Client::SetTokenExpirationCallback(discordpp::Client::TokenExpirationCallback callback)
13288{
13289 assert(state_ == DiscordObjectState::Owned);
13290 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
13291 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
13292 Discord_Client_TokenExpirationCallback callback__native = [](void* userData__) {
13293 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
13294 userData__typed->delegate();
13295 };
13296 Discord_Client_SetTokenExpirationCallback(
13297 &instance_,
13298 (callback__userData->delegate ? callback__native : nullptr),
13299 Tcallback__UserData::Free,
13300 callback__userData);
13301}
13302void Client::UnmergeIntoProvisionalAccount(
13303 uint64_t applicationId,
13305 std::string_view externalAuthToken,
13307{
13308 assert(state_ == DiscordObjectState::Owned);
13309 Discord_String externalAuthToken__str{
13310 (uint8_t*)(externalAuthToken.data() != nullptr ? externalAuthToken.data() : ""),
13311 externalAuthToken.size()};
13312 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
13313 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
13314 Discord_Client_UnmergeIntoProvisionalAccountCallback callback__native = [](auto result,
13315 void* userData__) {
13316 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
13317 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13318 userData__typed->delegate(std::move(result__obj));
13319 };
13320 Discord_Client_UnmergeIntoProvisionalAccount(
13321 &instance_,
13322 applicationId,
13323 static_cast<Discord_AuthenticationExternalAuthType>(externalAuthType),
13324 externalAuthToken__str,
13325 (callback__userData->delegate ? callback__native : nullptr),
13326 Tcallback__UserData::Free,
13327 callback__userData);
13328}
13329void Client::UpdateProvisionalAccountDisplayName(
13330 std::string_view name,
13332{
13333 assert(state_ == DiscordObjectState::Owned);
13334 Discord_String name__str{(uint8_t*)(name.data() != nullptr ? name.data() : ""), name.size()};
13335 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
13336 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
13337 Discord_Client_UpdateProvisionalAccountDisplayNameCallback callback__native =
13338 [](auto result, void* userData__) {
13339 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
13340 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13341 userData__typed->delegate(std::move(result__obj));
13342 };
13343 Discord_Client_UpdateProvisionalAccountDisplayName(
13344 &instance_,
13345 name__str,
13346 (callback__userData->delegate ? callback__native : nullptr),
13347 Tcallback__UserData::Free,
13348 callback__userData);
13349}
13350void Client::UpdateToken(discordpp::AuthorizationTokenType tokenType,
13351 std::string_view token,
13353{
13354 assert(state_ == DiscordObjectState::Owned);
13355 Discord_String token__str{(uint8_t*)(token.data() != nullptr ? token.data() : ""),
13356 token.size()};
13357 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
13358 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
13359 Discord_Client_UpdateTokenCallback callback__native = [](auto result, void* userData__) {
13360 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
13361 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13362 userData__typed->delegate(std::move(result__obj));
13363 };
13364 Discord_Client_UpdateToken(&instance_,
13365 static_cast<Discord_AuthorizationTokenType>(tokenType),
13366 token__str,
13367 (callback__userData->delegate ? callback__native : nullptr),
13368 Tcallback__UserData::Free,
13369 callback__userData);
13370}
13371bool Client::CanOpenMessageInDiscord(uint64_t messageId)
13372{
13373 assert(state_ == DiscordObjectState::Owned);
13374 bool returnValue__;
13375 returnValue__ = Discord_Client_CanOpenMessageInDiscord(&instance_, messageId);
13376 return returnValue__;
13377}
13378void Client::DeleteUserMessage(uint64_t recipientId,
13379 uint64_t messageId,
13381{
13382 assert(state_ == DiscordObjectState::Owned);
13383 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13384 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13385 Discord_Client_DeleteUserMessageCallback cb__native = [](auto result, void* userData__) {
13386 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13387 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13388 userData__typed->delegate(std::move(result__obj));
13389 };
13390 Discord_Client_DeleteUserMessage(&instance_,
13391 recipientId,
13392 messageId,
13393 (cb__userData->delegate ? cb__native : nullptr),
13394 Tcb__UserData::Free,
13395 cb__userData);
13396}
13397void Client::EditUserMessage(uint64_t recipientId,
13398 uint64_t messageId,
13399 std::string_view content,
13401{
13402 assert(state_ == DiscordObjectState::Owned);
13403 Discord_String content__str{(uint8_t*)(content.data() != nullptr ? content.data() : ""),
13404 content.size()};
13405 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13406 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13407 Discord_Client_EditUserMessageCallback cb__native = [](auto result, void* userData__) {
13408 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13409 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13410 userData__typed->delegate(std::move(result__obj));
13411 };
13412 Discord_Client_EditUserMessage(&instance_,
13413 recipientId,
13414 messageId,
13415 content__str,
13416 (cb__userData->delegate ? cb__native : nullptr),
13417 Tcb__UserData::Free,
13418 cb__userData);
13419}
13420std::optional<discordpp::ChannelHandle> Client::GetChannelHandle(uint64_t channelId) const
13421{
13422 assert(state_ == DiscordObjectState::Owned);
13423 bool returnIsNonNull__;
13424 Discord_ChannelHandle returnValueNative__;
13425 returnIsNonNull__ =
13426 Discord_Client_GetChannelHandle(&instance_, channelId, &returnValueNative__);
13427 if (!returnIsNonNull__) {
13428 return {};
13429 }
13430 discordpp::ChannelHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
13431 return returnValue__;
13432}
13433void Client::GetLobbyMessagesWithLimit(uint64_t lobbyId,
13434 int32_t limit,
13436{
13437 assert(state_ == DiscordObjectState::Owned);
13438 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13439 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13440 Discord_Client_GetLobbyMessagesCallback cb__native =
13441 [](auto result, auto messages, void* userData__) {
13442 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13443 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13445 messages__vec.reserve(messages.size);
13446 for (size_t i__ = 0; i__ < messages.size; ++i__) {
13447 messages__vec.emplace_back(messages.ptr[i__], DiscordObjectState::Owned);
13448 }
13449 Discord_Free(messages.ptr);
13450 userData__typed->delegate(std::move(result__obj), std::move(messages__vec));
13451 };
13452 Discord_Client_GetLobbyMessagesWithLimit(&instance_,
13453 lobbyId,
13454 limit,
13455 (cb__userData->delegate ? cb__native : nullptr),
13456 Tcb__UserData::Free,
13457 cb__userData);
13458}
13459std::optional<discordpp::MessageHandle> Client::GetMessageHandle(uint64_t messageId) const
13460{
13461 assert(state_ == DiscordObjectState::Owned);
13462 bool returnIsNonNull__;
13463 Discord_MessageHandle returnValueNative__;
13464 returnIsNonNull__ =
13465 Discord_Client_GetMessageHandle(&instance_, messageId, &returnValueNative__);
13466 if (!returnIsNonNull__) {
13467 return {};
13468 }
13469 discordpp::MessageHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
13470 return returnValue__;
13471}
13472void Client::GetUserMessageSummaries(discordpp::Client::UserMessageSummariesCallback cb)
13473{
13474 assert(state_ == DiscordObjectState::Owned);
13475 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13476 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13477 Discord_Client_UserMessageSummariesCallback cb__native =
13478 [](auto result, auto summaries, void* userData__) {
13479 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13480 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13482 summaries__vec.reserve(summaries.size);
13483 for (size_t i__ = 0; i__ < summaries.size; ++i__) {
13484 summaries__vec.emplace_back(summaries.ptr[i__], DiscordObjectState::Owned);
13485 }
13486 Discord_Free(summaries.ptr);
13487 userData__typed->delegate(std::move(result__obj), std::move(summaries__vec));
13488 };
13489 Discord_Client_GetUserMessageSummaries(&instance_,
13490 (cb__userData->delegate ? cb__native : nullptr),
13491 Tcb__UserData::Free,
13492 cb__userData);
13493}
13494void Client::GetUserMessagesWithLimit(uint64_t recipientId,
13495 int32_t limit,
13497{
13498 assert(state_ == DiscordObjectState::Owned);
13499 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13500 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13501 Discord_Client_UserMessagesWithLimitCallback cb__native =
13502 [](auto result, auto messages, void* userData__) {
13503 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13504 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13506 messages__vec.reserve(messages.size);
13507 for (size_t i__ = 0; i__ < messages.size; ++i__) {
13508 messages__vec.emplace_back(messages.ptr[i__], DiscordObjectState::Owned);
13509 }
13510 Discord_Free(messages.ptr);
13511 userData__typed->delegate(std::move(result__obj), std::move(messages__vec));
13512 };
13513 Discord_Client_GetUserMessagesWithLimit(&instance_,
13514 recipientId,
13515 limit,
13516 (cb__userData->delegate ? cb__native : nullptr),
13517 Tcb__UserData::Free,
13518 cb__userData);
13519}
13520void Client::OpenMessageInDiscord(
13521 uint64_t messageId,
13522 discordpp::Client::ProvisionalUserMergeRequiredCallback provisionalUserMergeRequiredCallback,
13524{
13525 assert(state_ == DiscordObjectState::Owned);
13526 using TprovisionalUserMergeRequiredCallback__UserData =
13527 TDelegateUserData<std::remove_reference_t<decltype(provisionalUserMergeRequiredCallback)>>;
13528 auto provisionalUserMergeRequiredCallback__userData =
13529 TprovisionalUserMergeRequiredCallback__UserData::Create(
13530 std::move(provisionalUserMergeRequiredCallback));
13531 Discord_Client_ProvisionalUserMergeRequiredCallback
13532 provisionalUserMergeRequiredCallback__native = [](void* userData__) {
13533 auto userData__typed =
13534 static_cast<TprovisionalUserMergeRequiredCallback__UserData*>(userData__);
13535 userData__typed->delegate();
13536 };
13537 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
13538 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
13539 Discord_Client_OpenMessageInDiscordCallback callback__native = [](auto result,
13540 void* userData__) {
13541 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
13542 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13543 userData__typed->delegate(std::move(result__obj));
13544 };
13545 Discord_Client_OpenMessageInDiscord(&instance_,
13546 messageId,
13547 (provisionalUserMergeRequiredCallback__userData->delegate
13548 ? provisionalUserMergeRequiredCallback__native
13549 : nullptr),
13550 TprovisionalUserMergeRequiredCallback__UserData::Free,
13551 provisionalUserMergeRequiredCallback__userData,
13552 (callback__userData->delegate ? callback__native : nullptr),
13553 Tcallback__UserData::Free,
13554 callback__userData);
13555}
13556void Client::SendLobbyMessage(uint64_t lobbyId,
13557 std::string_view content,
13559{
13560 assert(state_ == DiscordObjectState::Owned);
13561 Discord_String content__str{(uint8_t*)(content.data() != nullptr ? content.data() : ""),
13562 content.size()};
13563 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13564 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13565 Discord_Client_SendUserMessageCallback cb__native =
13566 [](auto result, auto messageId, void* userData__) {
13567 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13568 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13569 userData__typed->delegate(std::move(result__obj), messageId);
13570 };
13571 Discord_Client_SendLobbyMessage(&instance_,
13572 lobbyId,
13573 content__str,
13574 (cb__userData->delegate ? cb__native : nullptr),
13575 Tcb__UserData::Free,
13576 cb__userData);
13577}
13578void Client::SendLobbyMessageWithMetadata(uint64_t lobbyId,
13579 std::string_view content,
13580 discordpp::StringMap const& metadata,
13582{
13583 assert(state_ == DiscordObjectState::Owned);
13584 Discord_String content__str{(uint8_t*)(content.data() != nullptr ? content.data() : ""),
13585 content.size()};
13586 ConvertedProperties metadata__convert(metadata);
13587 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13588 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13589 Discord_Client_SendUserMessageCallback cb__native =
13590 [](auto result, auto messageId, void* userData__) {
13591 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13592 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13593 userData__typed->delegate(std::move(result__obj), messageId);
13594 };
13595 Discord_Client_SendLobbyMessageWithMetadata(&instance_,
13596 lobbyId,
13597 content__str,
13598 metadata__convert.Properties,
13599 (cb__userData->delegate ? cb__native : nullptr),
13600 Tcb__UserData::Free,
13601 cb__userData);
13602}
13603void Client::SendUserMessage(uint64_t recipientId,
13604 std::string_view content,
13606{
13607 assert(state_ == DiscordObjectState::Owned);
13608 Discord_String content__str{(uint8_t*)(content.data() != nullptr ? content.data() : ""),
13609 content.size()};
13610 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13611 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13612 Discord_Client_SendUserMessageCallback cb__native =
13613 [](auto result, auto messageId, void* userData__) {
13614 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13615 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13616 userData__typed->delegate(std::move(result__obj), messageId);
13617 };
13618 Discord_Client_SendUserMessage(&instance_,
13619 recipientId,
13620 content__str,
13621 (cb__userData->delegate ? cb__native : nullptr),
13622 Tcb__UserData::Free,
13623 cb__userData);
13624}
13625void Client::SendUserMessageWithMetadata(uint64_t recipientId,
13626 std::string_view content,
13627 discordpp::StringMap const& metadata,
13629{
13630 assert(state_ == DiscordObjectState::Owned);
13631 Discord_String content__str{(uint8_t*)(content.data() != nullptr ? content.data() : ""),
13632 content.size()};
13633 ConvertedProperties metadata__convert(metadata);
13634 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13635 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13636 Discord_Client_SendUserMessageCallback cb__native =
13637 [](auto result, auto messageId, void* userData__) {
13638 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13639 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13640 userData__typed->delegate(std::move(result__obj), messageId);
13641 };
13642 Discord_Client_SendUserMessageWithMetadata(&instance_,
13643 recipientId,
13644 content__str,
13645 metadata__convert.Properties,
13646 (cb__userData->delegate ? cb__native : nullptr),
13647 Tcb__UserData::Free,
13648 cb__userData);
13649}
13650void Client::SetMessageCreatedCallback(discordpp::Client::MessageCreatedCallback cb)
13651{
13652 assert(state_ == DiscordObjectState::Owned);
13653 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13654 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13655 Discord_Client_MessageCreatedCallback cb__native = [](auto messageId, void* userData__) {
13656 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13657 userData__typed->delegate(messageId);
13658 };
13659 Discord_Client_SetMessageCreatedCallback(&instance_,
13660 (cb__userData->delegate ? cb__native : nullptr),
13661 Tcb__UserData::Free,
13662 cb__userData);
13663}
13664void Client::SetMessageDeletedCallback(discordpp::Client::MessageDeletedCallback cb)
13665{
13666 assert(state_ == DiscordObjectState::Owned);
13667 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13668 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13669 Discord_Client_MessageDeletedCallback cb__native =
13670 [](auto messageId, auto channelId, void* userData__) {
13671 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13672 userData__typed->delegate(messageId, channelId);
13673 };
13674 Discord_Client_SetMessageDeletedCallback(&instance_,
13675 (cb__userData->delegate ? cb__native : nullptr),
13676 Tcb__UserData::Free,
13677 cb__userData);
13678}
13679void Client::SetMessageUpdatedCallback(discordpp::Client::MessageUpdatedCallback cb)
13680{
13681 assert(state_ == DiscordObjectState::Owned);
13682 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13683 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13684 Discord_Client_MessageUpdatedCallback cb__native = [](auto messageId, void* userData__) {
13685 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13686 userData__typed->delegate(messageId);
13687 };
13688 Discord_Client_SetMessageUpdatedCallback(&instance_,
13689 (cb__userData->delegate ? cb__native : nullptr),
13690 Tcb__UserData::Free,
13691 cb__userData);
13692}
13693void Client::SetShowingChat(bool showingChat)
13694{
13695 assert(state_ == DiscordObjectState::Owned);
13696 Discord_Client_SetShowingChat(&instance_, showingChat);
13697}
13698void Client::AddLogCallback(discordpp::Client::LogCallback callback,
13699 discordpp::LoggingSeverity minSeverity)
13700{
13701 assert(state_ == DiscordObjectState::Owned);
13702 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
13703 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
13704 Discord_Client_LogCallback callback__native = [](
13705 auto message, auto severity, void* userData__) {
13706 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
13707 discordpp::String message__str(reinterpret_cast<char*>(message.ptr), message.size);
13708 userData__typed->delegate(std::move(message__str),
13709 static_cast<discordpp::LoggingSeverity>(severity));
13710 Discord_Free(message.ptr);
13711 };
13712 Discord_Client_AddLogCallback(&instance_,
13713 (callback__userData->delegate ? callback__native : nullptr),
13714 Tcallback__UserData::Free,
13715 callback__userData,
13716 static_cast<Discord_LoggingSeverity>(minSeverity));
13717}
13718void Client::AddVoiceLogCallback(discordpp::Client::LogCallback callback,
13719 discordpp::LoggingSeverity minSeverity)
13720{
13721 assert(state_ == DiscordObjectState::Owned);
13722 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
13723 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
13724 Discord_Client_LogCallback callback__native = [](
13725 auto message, auto severity, void* userData__) {
13726 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
13727 discordpp::String message__str(reinterpret_cast<char*>(message.ptr), message.size);
13728 userData__typed->delegate(std::move(message__str),
13729 static_cast<discordpp::LoggingSeverity>(severity));
13730 Discord_Free(message.ptr);
13731 };
13732 Discord_Client_AddVoiceLogCallback(&instance_,
13733 (callback__userData->delegate ? callback__native : nullptr),
13734 Tcallback__UserData::Free,
13735 callback__userData,
13736 static_cast<Discord_LoggingSeverity>(minSeverity));
13737}
13738void Client::Connect()
13739{
13740 assert(state_ == DiscordObjectState::Owned);
13741 Discord_Client_Connect(&instance_);
13742}
13743void Client::Disconnect()
13744{
13745 assert(state_ == DiscordObjectState::Owned);
13746 Discord_Client_Disconnect(&instance_);
13747}
13748discordpp::Client::Status Client::GetStatus() const
13749{
13750 assert(state_ == DiscordObjectState::Owned);
13751 Discord_Client_Status returnValue__;
13752 returnValue__ = Discord_Client_GetStatus(&instance_);
13753 return static_cast<discordpp::Client::Status>(returnValue__);
13754}
13755void Client::OpenConnectedGamesSettingsInDiscord(
13757{
13758 assert(state_ == DiscordObjectState::Owned);
13759 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
13760 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
13761 Discord_Client_OpenConnectedGamesSettingsInDiscordCallback callback__native =
13762 [](auto result, void* userData__) {
13763 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
13764 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13765 userData__typed->delegate(std::move(result__obj));
13766 };
13767 Discord_Client_OpenConnectedGamesSettingsInDiscord(
13768 &instance_,
13769 (callback__userData->delegate ? callback__native : nullptr),
13770 Tcallback__UserData::Free,
13771 callback__userData);
13772}
13773void Client::SetApplicationId(uint64_t applicationId)
13774{
13775 assert(state_ == DiscordObjectState::Owned);
13776 Discord_Client_SetApplicationId(&instance_, applicationId);
13777}
13778bool Client::SetLogDir(std::string_view path, discordpp::LoggingSeverity minSeverity)
13779{
13780 assert(state_ == DiscordObjectState::Owned);
13781 bool returnValue__;
13782 Discord_String path__str{(uint8_t*)(path.data() != nullptr ? path.data() : ""), path.size()};
13783 returnValue__ = Discord_Client_SetLogDir(
13784 &instance_, path__str, static_cast<Discord_LoggingSeverity>(minSeverity));
13785 return returnValue__;
13786}
13787void Client::SetStatusChangedCallback(discordpp::Client::OnStatusChanged cb)
13788{
13789 assert(state_ == DiscordObjectState::Owned);
13790 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13791 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13792 Discord_Client_OnStatusChanged cb__native =
13793 [](auto status, auto error, auto errorDetail, void* userData__) {
13794 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13795 userData__typed->delegate(static_cast<discordpp::Client::Status>(status),
13796 static_cast<discordpp::Client::Error>(error),
13797 errorDetail);
13798 };
13799 Discord_Client_SetStatusChangedCallback(&instance_,
13800 (cb__userData->delegate ? cb__native : nullptr),
13801 Tcb__UserData::Free,
13802 cb__userData);
13803}
13804void Client::SetVoiceLogDir(std::string_view path, discordpp::LoggingSeverity minSeverity)
13805{
13806 assert(state_ == DiscordObjectState::Owned);
13807 Discord_String path__str{(uint8_t*)(path.data() != nullptr ? path.data() : ""), path.size()};
13808 Discord_Client_SetVoiceLogDir(
13809 &instance_, path__str, static_cast<Discord_LoggingSeverity>(minSeverity));
13810}
13811bool Client::CanManageGameOrganizationLink(discordpp::UserGuild guild) const
13812{
13813 assert(state_ == DiscordObjectState::Owned);
13814 bool returnValue__;
13815 returnValue__ = Discord_Client_CanManageGameOrganizationLink(&instance_, guild.instance());
13816 return returnValue__;
13817}
13818void Client::FetchUserGuilds(discordpp::Client::FetchUserGuildsCallback cb)
13819{
13820 assert(state_ == DiscordObjectState::Owned);
13821 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13822 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13823 Discord_Client_FetchUserGuildsCallback cb__native =
13824 [](auto result, auto guilds, void* userData__) {
13825 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13826 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13828 guilds__vec.reserve(guilds.size);
13829 for (size_t i__ = 0; i__ < guilds.size; ++i__) {
13830 guilds__vec.emplace_back(guilds.ptr[i__], DiscordObjectState::Owned);
13831 }
13832 Discord_Free(guilds.ptr);
13833 userData__typed->delegate(std::move(result__obj), std::move(guilds__vec));
13834 };
13835 Discord_Client_FetchUserGuilds(&instance_,
13836 (cb__userData->delegate ? cb__native : nullptr),
13837 Tcb__UserData::Free,
13838 cb__userData);
13839}
13840void Client::LinkGameOrganization(uint64_t guildId,
13841 std::string_view gameOrganizationId,
13843{
13844 assert(state_ == DiscordObjectState::Owned);
13845 Discord_String gameOrganizationId__str{
13846 (uint8_t*)(gameOrganizationId.data() != nullptr ? gameOrganizationId.data() : ""),
13847 gameOrganizationId.size()};
13848 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13849 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13850 Discord_Client_LinkGameOrganizationCallback cb__native = [](auto result, void* userData__) {
13851 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13852 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13853 userData__typed->delegate(std::move(result__obj));
13854 };
13855 Discord_Client_LinkGameOrganization(&instance_,
13856 guildId,
13857 gameOrganizationId__str,
13858 (cb__userData->delegate ? cb__native : nullptr),
13859 Tcb__UserData::Free,
13860 cb__userData);
13861}
13862void Client::UnlinkGameOrganization(std::string_view gameOrganizationId,
13864{
13865 assert(state_ == DiscordObjectState::Owned);
13866 Discord_String gameOrganizationId__str{
13867 (uint8_t*)(gameOrganizationId.data() != nullptr ? gameOrganizationId.data() : ""),
13868 gameOrganizationId.size()};
13869 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13870 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13871 Discord_Client_UnlinkGameOrganizationCallback cb__native = [](auto result, void* userData__) {
13872 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13873 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13874 userData__typed->delegate(std::move(result__obj));
13875 };
13876 Discord_Client_UnlinkGameOrganization(&instance_,
13877 gameOrganizationId__str,
13878 (cb__userData->delegate ? cb__native : nullptr),
13879 Tcb__UserData::Free,
13880 cb__userData);
13881}
13882void Client::CreateOrJoinLobby(std::string_view secret,
13884{
13885 assert(state_ == DiscordObjectState::Owned);
13886 Discord_String secret__str{(uint8_t*)(secret.data() != nullptr ? secret.data() : ""),
13887 secret.size()};
13888 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
13889 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
13890 Discord_Client_CreateOrJoinLobbyCallback callback__native =
13891 [](auto result, auto lobbyId, void* userData__) {
13892 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
13893 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13894 userData__typed->delegate(std::move(result__obj), lobbyId);
13895 };
13896 Discord_Client_CreateOrJoinLobby(&instance_,
13897 secret__str,
13898 (callback__userData->delegate ? callback__native : nullptr),
13899 Tcallback__UserData::Free,
13900 callback__userData);
13901}
13902void Client::CreateOrJoinLobbyWithMetadata(std::string_view secret,
13903 discordpp::StringMap const& lobbyMetadata,
13904 discordpp::StringMap const& memberMetadata,
13906{
13907 assert(state_ == DiscordObjectState::Owned);
13908 Discord_String secret__str{(uint8_t*)(secret.data() != nullptr ? secret.data() : ""),
13909 secret.size()};
13910 ConvertedProperties lobbyMetadata__convert(lobbyMetadata);
13911 ConvertedProperties memberMetadata__convert(memberMetadata);
13912 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
13913 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
13914 Discord_Client_CreateOrJoinLobbyCallback callback__native =
13915 [](auto result, auto lobbyId, void* userData__) {
13916 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
13917 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13918 userData__typed->delegate(std::move(result__obj), lobbyId);
13919 };
13920 Discord_Client_CreateOrJoinLobbyWithMetadata(
13921 &instance_,
13922 secret__str,
13923 lobbyMetadata__convert.Properties,
13924 memberMetadata__convert.Properties,
13925 (callback__userData->delegate ? callback__native : nullptr),
13926 Tcallback__UserData::Free,
13927 callback__userData);
13928}
13929void Client::GetGuildChannels(uint64_t guildId, discordpp::Client::GetGuildChannelsCallback cb)
13930{
13931 assert(state_ == DiscordObjectState::Owned);
13932 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13933 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13934 Discord_Client_GetGuildChannelsCallback cb__native =
13935 [](auto result, auto guildChannels, void* userData__) {
13936 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13937 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13939 guildChannels__vec.reserve(guildChannels.size);
13940 for (size_t i__ = 0; i__ < guildChannels.size; ++i__) {
13941 guildChannels__vec.emplace_back(guildChannels.ptr[i__], DiscordObjectState::Owned);
13942 }
13943 Discord_Free(guildChannels.ptr);
13944 userData__typed->delegate(std::move(result__obj), std::move(guildChannels__vec));
13945 };
13946 Discord_Client_GetGuildChannels(&instance_,
13947 guildId,
13948 (cb__userData->delegate ? cb__native : nullptr),
13949 Tcb__UserData::Free,
13950 cb__userData);
13951}
13952std::optional<discordpp::LobbyHandle> Client::GetLobbyHandle(uint64_t lobbyId) const
13953{
13954 assert(state_ == DiscordObjectState::Owned);
13955 bool returnIsNonNull__;
13956 Discord_LobbyHandle returnValueNative__;
13957 returnIsNonNull__ = Discord_Client_GetLobbyHandle(&instance_, lobbyId, &returnValueNative__);
13958 if (!returnIsNonNull__) {
13959 return {};
13960 }
13961 discordpp::LobbyHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
13962 return returnValue__;
13963}
13964discordpp::Vector<uint64_t> Client::GetLobbyIds() const
13965{
13966 assert(state_ == DiscordObjectState::Owned);
13967 Discord_UInt64Span returnValueNative__;
13968 Discord_Client_GetLobbyIds(&instance_, &returnValueNative__);
13969 discordpp::Vector<uint64_t> returnValue__(returnValueNative__.ptr,
13970 returnValueNative__.ptr + returnValueNative__.size);
13971 Discord_Free(returnValueNative__.ptr);
13972 return returnValue__;
13973}
13974void Client::GetUserGuilds(discordpp::Client::GetUserGuildsCallback cb)
13975{
13976 assert(state_ == DiscordObjectState::Owned);
13977 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
13978 auto cb__userData = Tcb__UserData::Create(std::move(cb));
13979 Discord_Client_GetUserGuildsCallback cb__native =
13980 [](auto result, auto guilds, void* userData__) {
13981 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
13982 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
13984 guilds__vec.reserve(guilds.size);
13985 for (size_t i__ = 0; i__ < guilds.size; ++i__) {
13986 guilds__vec.emplace_back(guilds.ptr[i__], DiscordObjectState::Owned);
13987 }
13988 Discord_Free(guilds.ptr);
13989 userData__typed->delegate(std::move(result__obj), std::move(guilds__vec));
13990 };
13991 Discord_Client_GetUserGuilds(&instance_,
13992 (cb__userData->delegate ? cb__native : nullptr),
13993 Tcb__UserData::Free,
13994 cb__userData);
13995}
13996void Client::JoinLinkedLobbyGuild(
13997 uint64_t lobbyId,
13998 discordpp::Client::ProvisionalUserMergeRequiredCallback provisionalUserMergeRequiredCallback,
14000{
14001 assert(state_ == DiscordObjectState::Owned);
14002 using TprovisionalUserMergeRequiredCallback__UserData =
14003 TDelegateUserData<std::remove_reference_t<decltype(provisionalUserMergeRequiredCallback)>>;
14004 auto provisionalUserMergeRequiredCallback__userData =
14005 TprovisionalUserMergeRequiredCallback__UserData::Create(
14006 std::move(provisionalUserMergeRequiredCallback));
14007 Discord_Client_ProvisionalUserMergeRequiredCallback
14008 provisionalUserMergeRequiredCallback__native = [](void* userData__) {
14009 auto userData__typed =
14010 static_cast<TprovisionalUserMergeRequiredCallback__UserData*>(userData__);
14011 userData__typed->delegate();
14012 };
14013 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
14014 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
14015 Discord_Client_JoinLinkedLobbyGuildCallback callback__native =
14016 [](auto result, auto inviteUrl, void* userData__) {
14017 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
14018 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14019 discordpp::String inviteUrl__str(reinterpret_cast<char*>(inviteUrl.ptr), inviteUrl.size);
14020 userData__typed->delegate(std::move(result__obj), std::move(inviteUrl__str));
14021 Discord_Free(inviteUrl.ptr);
14022 };
14023 Discord_Client_JoinLinkedLobbyGuild(&instance_,
14024 lobbyId,
14025 (provisionalUserMergeRequiredCallback__userData->delegate
14026 ? provisionalUserMergeRequiredCallback__native
14027 : nullptr),
14028 TprovisionalUserMergeRequiredCallback__UserData::Free,
14029 provisionalUserMergeRequiredCallback__userData,
14030 (callback__userData->delegate ? callback__native : nullptr),
14031 Tcallback__UserData::Free,
14032 callback__userData);
14033}
14034void Client::LeaveLobby(uint64_t lobbyId, discordpp::Client::LeaveLobbyCallback callback)
14035{
14036 assert(state_ == DiscordObjectState::Owned);
14037 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
14038 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
14039 Discord_Client_LeaveLobbyCallback callback__native = [](auto result, void* userData__) {
14040 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
14041 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14042 userData__typed->delegate(std::move(result__obj));
14043 };
14044 Discord_Client_LeaveLobby(&instance_,
14045 lobbyId,
14046 (callback__userData->delegate ? callback__native : nullptr),
14047 Tcallback__UserData::Free,
14048 callback__userData);
14049}
14050void Client::LinkChannelToLobby(uint64_t lobbyId,
14051 uint64_t channelId,
14053{
14054 assert(state_ == DiscordObjectState::Owned);
14055 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
14056 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
14057 Discord_Client_LinkOrUnlinkChannelCallback callback__native = [](auto result,
14058 void* userData__) {
14059 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
14060 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14061 userData__typed->delegate(std::move(result__obj));
14062 };
14063 Discord_Client_LinkChannelToLobby(&instance_,
14064 lobbyId,
14065 channelId,
14066 (callback__userData->delegate ? callback__native : nullptr),
14067 Tcallback__UserData::Free,
14068 callback__userData);
14069}
14070void Client::SetLobbyCreatedCallback(discordpp::Client::LobbyCreatedCallback cb)
14071{
14072 assert(state_ == DiscordObjectState::Owned);
14073 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14074 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14075 Discord_Client_LobbyCreatedCallback cb__native = [](auto lobbyId, void* userData__) {
14076 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14077 userData__typed->delegate(lobbyId);
14078 };
14079 Discord_Client_SetLobbyCreatedCallback(&instance_,
14080 (cb__userData->delegate ? cb__native : nullptr),
14081 Tcb__UserData::Free,
14082 cb__userData);
14083}
14084void Client::SetLobbyDeletedCallback(discordpp::Client::LobbyDeletedCallback cb)
14085{
14086 assert(state_ == DiscordObjectState::Owned);
14087 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14088 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14089 Discord_Client_LobbyDeletedCallback cb__native = [](auto lobbyId, void* userData__) {
14090 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14091 userData__typed->delegate(lobbyId);
14092 };
14093 Discord_Client_SetLobbyDeletedCallback(&instance_,
14094 (cb__userData->delegate ? cb__native : nullptr),
14095 Tcb__UserData::Free,
14096 cb__userData);
14097}
14098void Client::SetLobbyMemberAddedCallback(discordpp::Client::LobbyMemberAddedCallback cb)
14099{
14100 assert(state_ == DiscordObjectState::Owned);
14101 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14102 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14103 Discord_Client_LobbyMemberAddedCallback cb__native =
14104 [](auto lobbyId, auto memberId, void* userData__) {
14105 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14106 userData__typed->delegate(lobbyId, memberId);
14107 };
14108 Discord_Client_SetLobbyMemberAddedCallback(&instance_,
14109 (cb__userData->delegate ? cb__native : nullptr),
14110 Tcb__UserData::Free,
14111 cb__userData);
14112}
14113void Client::SetLobbyMemberRemovedCallback(discordpp::Client::LobbyMemberRemovedCallback cb)
14114{
14115 assert(state_ == DiscordObjectState::Owned);
14116 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14117 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14118 Discord_Client_LobbyMemberRemovedCallback cb__native =
14119 [](auto lobbyId, auto memberId, void* userData__) {
14120 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14121 userData__typed->delegate(lobbyId, memberId);
14122 };
14123 Discord_Client_SetLobbyMemberRemovedCallback(&instance_,
14124 (cb__userData->delegate ? cb__native : nullptr),
14125 Tcb__UserData::Free,
14126 cb__userData);
14127}
14128void Client::SetLobbyMemberUpdatedCallback(discordpp::Client::LobbyMemberUpdatedCallback cb)
14129{
14130 assert(state_ == DiscordObjectState::Owned);
14131 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14132 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14133 Discord_Client_LobbyMemberUpdatedCallback cb__native =
14134 [](auto lobbyId, auto memberId, void* userData__) {
14135 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14136 userData__typed->delegate(lobbyId, memberId);
14137 };
14138 Discord_Client_SetLobbyMemberUpdatedCallback(&instance_,
14139 (cb__userData->delegate ? cb__native : nullptr),
14140 Tcb__UserData::Free,
14141 cb__userData);
14142}
14143void Client::SetLobbyUpdatedCallback(discordpp::Client::LobbyUpdatedCallback cb)
14144{
14145 assert(state_ == DiscordObjectState::Owned);
14146 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14147 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14148 Discord_Client_LobbyUpdatedCallback cb__native = [](auto lobbyId, void* userData__) {
14149 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14150 userData__typed->delegate(lobbyId);
14151 };
14152 Discord_Client_SetLobbyUpdatedCallback(&instance_,
14153 (cb__userData->delegate ? cb__native : nullptr),
14154 Tcb__UserData::Free,
14155 cb__userData);
14156}
14157void Client::UnlinkChannelFromLobby(uint64_t lobbyId,
14159{
14160 assert(state_ == DiscordObjectState::Owned);
14161 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
14162 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
14163 Discord_Client_LinkOrUnlinkChannelCallback callback__native = [](auto result,
14164 void* userData__) {
14165 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
14166 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14167 userData__typed->delegate(std::move(result__obj));
14168 };
14169 Discord_Client_UnlinkChannelFromLobby(
14170 &instance_,
14171 lobbyId,
14172 (callback__userData->delegate ? callback__native : nullptr),
14173 Tcallback__UserData::Free,
14174 callback__userData);
14175}
14176void Client::IsDiscordAppInstalled(discordpp::Client::IsDiscordAppInstalledCallback callback)
14177{
14178 assert(state_ == DiscordObjectState::Owned);
14179 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
14180 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
14181 Discord_Client_IsDiscordAppInstalledCallback callback__native = [](auto installed,
14182 void* userData__) {
14183 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
14184 userData__typed->delegate(installed);
14185 };
14186 Discord_Client_IsDiscordAppInstalled(
14187 &instance_,
14188 (callback__userData->delegate ? callback__native : nullptr),
14189 Tcallback__UserData::Free,
14190 callback__userData);
14191}
14192void Client::AcceptActivityInvite(discordpp::ActivityInvite invite,
14194{
14195 assert(state_ == DiscordObjectState::Owned);
14196 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14197 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14198 Discord_Client_AcceptActivityInviteCallback cb__native = [](auto result,
14199 auto joinSecret,
14200 void* userData__) {
14201 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14202 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14203 discordpp::String joinSecret__str(reinterpret_cast<char*>(joinSecret.ptr), joinSecret.size);
14204 userData__typed->delegate(std::move(result__obj), std::move(joinSecret__str));
14205 Discord_Free(joinSecret.ptr);
14206 };
14207 Discord_Client_AcceptActivityInvite(&instance_,
14208 invite.instance(),
14209 (cb__userData->delegate ? cb__native : nullptr),
14210 Tcb__UserData::Free,
14211 cb__userData);
14212}
14213void Client::ClearRichPresence()
14214{
14215 assert(state_ == DiscordObjectState::Owned);
14216 Discord_Client_ClearRichPresence(&instance_);
14217}
14218bool Client::RegisterLaunchCommand(uint64_t applicationId, std::string_view command)
14219{
14220 assert(state_ == DiscordObjectState::Owned);
14221 bool returnValue__;
14222 Discord_String command__str{(uint8_t*)(command.data() != nullptr ? command.data() : ""),
14223 command.size()};
14224 returnValue__ = Discord_Client_RegisterLaunchCommand(&instance_, applicationId, command__str);
14225 return returnValue__;
14226}
14227bool Client::RegisterLaunchSteamApplication(uint64_t applicationId, uint32_t steamAppId)
14228{
14229 assert(state_ == DiscordObjectState::Owned);
14230 bool returnValue__;
14231 returnValue__ =
14232 Discord_Client_RegisterLaunchSteamApplication(&instance_, applicationId, steamAppId);
14233 return returnValue__;
14234}
14235void Client::SendActivityInvite(uint64_t userId,
14236 std::string_view content,
14238{
14239 assert(state_ == DiscordObjectState::Owned);
14240 Discord_String content__str{(uint8_t*)(content.data() != nullptr ? content.data() : ""),
14241 content.size()};
14242 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14243 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14244 Discord_Client_SendActivityInviteCallback cb__native = [](auto result, void* userData__) {
14245 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14246 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14247 userData__typed->delegate(std::move(result__obj));
14248 };
14249 Discord_Client_SendActivityInvite(&instance_,
14250 userId,
14251 content__str,
14252 (cb__userData->delegate ? cb__native : nullptr),
14253 Tcb__UserData::Free,
14254 cb__userData);
14255}
14256void Client::SendActivityJoinRequest(uint64_t userId,
14258{
14259 assert(state_ == DiscordObjectState::Owned);
14260 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14261 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14262 Discord_Client_SendActivityInviteCallback cb__native = [](auto result, void* userData__) {
14263 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14264 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14265 userData__typed->delegate(std::move(result__obj));
14266 };
14267 Discord_Client_SendActivityJoinRequest(&instance_,
14268 userId,
14269 (cb__userData->delegate ? cb__native : nullptr),
14270 Tcb__UserData::Free,
14271 cb__userData);
14272}
14273void Client::SendActivityJoinRequestReply(discordpp::ActivityInvite invite,
14275{
14276 assert(state_ == DiscordObjectState::Owned);
14277 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14278 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14279 Discord_Client_SendActivityInviteCallback cb__native = [](auto result, void* userData__) {
14280 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14281 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14282 userData__typed->delegate(std::move(result__obj));
14283 };
14284 Discord_Client_SendActivityJoinRequestReply(&instance_,
14285 invite.instance(),
14286 (cb__userData->delegate ? cb__native : nullptr),
14287 Tcb__UserData::Free,
14288 cb__userData);
14289}
14290void Client::SetActivityInviteCreatedCallback(discordpp::Client::ActivityInviteCallback cb)
14291{
14292 assert(state_ == DiscordObjectState::Owned);
14293 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14294 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14295 Discord_Client_ActivityInviteCallback cb__native = [](auto invite, void* userData__) {
14296 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14297 discordpp::ActivityInvite invite__obj(*invite, DiscordObjectState::Owned);
14298 userData__typed->delegate(std::move(invite__obj));
14299 };
14300 Discord_Client_SetActivityInviteCreatedCallback(&instance_,
14301 (cb__userData->delegate ? cb__native : nullptr),
14302 Tcb__UserData::Free,
14303 cb__userData);
14304}
14305void Client::SetActivityInviteUpdatedCallback(discordpp::Client::ActivityInviteCallback cb)
14306{
14307 assert(state_ == DiscordObjectState::Owned);
14308 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14309 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14310 Discord_Client_ActivityInviteCallback cb__native = [](auto invite, void* userData__) {
14311 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14312 discordpp::ActivityInvite invite__obj(*invite, DiscordObjectState::Owned);
14313 userData__typed->delegate(std::move(invite__obj));
14314 };
14315 Discord_Client_SetActivityInviteUpdatedCallback(&instance_,
14316 (cb__userData->delegate ? cb__native : nullptr),
14317 Tcb__UserData::Free,
14318 cb__userData);
14319}
14320void Client::SetActivityJoinCallback(discordpp::Client::ActivityJoinCallback cb)
14321{
14322 assert(state_ == DiscordObjectState::Owned);
14323 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14324 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14325 Discord_Client_ActivityJoinCallback cb__native = [](auto joinSecret, void* userData__) {
14326 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14327 discordpp::String joinSecret__str(reinterpret_cast<char*>(joinSecret.ptr), joinSecret.size);
14328 userData__typed->delegate(std::move(joinSecret__str));
14329 Discord_Free(joinSecret.ptr);
14330 };
14331 Discord_Client_SetActivityJoinCallback(&instance_,
14332 (cb__userData->delegate ? cb__native : nullptr),
14333 Tcb__UserData::Free,
14334 cb__userData);
14335}
14336void Client::SetActivityJoinWithApplicationCallback(
14338{
14339 assert(state_ == DiscordObjectState::Owned);
14340 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14341 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14342 Discord_Client_ActivityJoinWithApplicationCallback cb__native = [](auto applicationId,
14343 auto joinSecret,
14344 void* userData__) {
14345 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14346 discordpp::String joinSecret__str(reinterpret_cast<char*>(joinSecret.ptr), joinSecret.size);
14347 userData__typed->delegate(applicationId, std::move(joinSecret__str));
14348 Discord_Free(joinSecret.ptr);
14349 };
14350 Discord_Client_SetActivityJoinWithApplicationCallback(
14351 &instance_,
14352 (cb__userData->delegate ? cb__native : nullptr),
14353 Tcb__UserData::Free,
14354 cb__userData);
14355}
14356void Client::SetOnlineStatus(discordpp::StatusType status,
14358{
14359 assert(state_ == DiscordObjectState::Owned);
14360 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
14361 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
14362 Discord_Client_UpdateStatusCallback callback__native = [](auto result, void* userData__) {
14363 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
14364 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14365 userData__typed->delegate(std::move(result__obj));
14366 };
14367 Discord_Client_SetOnlineStatus(&instance_,
14368 static_cast<Discord_StatusType>(status),
14369 (callback__userData->delegate ? callback__native : nullptr),
14370 Tcallback__UserData::Free,
14371 callback__userData);
14372}
14373void Client::UpdateRichPresence(discordpp::Activity activity,
14375{
14376 assert(state_ == DiscordObjectState::Owned);
14377 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14378 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14379 Discord_Client_UpdateRichPresenceCallback cb__native = [](auto result, void* userData__) {
14380 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14381 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14382 userData__typed->delegate(std::move(result__obj));
14383 };
14384 Discord_Client_UpdateRichPresence(&instance_,
14385 activity.instance(),
14386 (cb__userData->delegate ? cb__native : nullptr),
14387 Tcb__UserData::Free,
14388 cb__userData);
14389}
14390void Client::AcceptDiscordFriendRequest(uint64_t userId,
14392{
14393 assert(state_ == DiscordObjectState::Owned);
14394 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14395 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14396 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
14397 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14398 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14399 userData__typed->delegate(std::move(result__obj));
14400 };
14401 Discord_Client_AcceptDiscordFriendRequest(&instance_,
14402 userId,
14403 (cb__userData->delegate ? cb__native : nullptr),
14404 Tcb__UserData::Free,
14405 cb__userData);
14406}
14407void Client::AcceptGameFriendRequest(uint64_t userId,
14409{
14410 assert(state_ == DiscordObjectState::Owned);
14411 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14412 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14413 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
14414 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14415 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14416 userData__typed->delegate(std::move(result__obj));
14417 };
14418 Discord_Client_AcceptGameFriendRequest(&instance_,
14419 userId,
14420 (cb__userData->delegate ? cb__native : nullptr),
14421 Tcb__UserData::Free,
14422 cb__userData);
14423}
14424void Client::BlockUser(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
14425{
14426 assert(state_ == DiscordObjectState::Owned);
14427 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14428 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14429 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
14430 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14431 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14432 userData__typed->delegate(std::move(result__obj));
14433 };
14434 Discord_Client_BlockUser(&instance_,
14435 userId,
14436 (cb__userData->delegate ? cb__native : nullptr),
14437 Tcb__UserData::Free,
14438 cb__userData);
14439}
14440void Client::CancelDiscordFriendRequest(uint64_t userId,
14442{
14443 assert(state_ == DiscordObjectState::Owned);
14444 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14445 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14446 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
14447 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14448 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14449 userData__typed->delegate(std::move(result__obj));
14450 };
14451 Discord_Client_CancelDiscordFriendRequest(&instance_,
14452 userId,
14453 (cb__userData->delegate ? cb__native : nullptr),
14454 Tcb__UserData::Free,
14455 cb__userData);
14456}
14457void Client::CancelGameFriendRequest(uint64_t userId,
14459{
14460 assert(state_ == DiscordObjectState::Owned);
14461 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14462 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14463 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
14464 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14465 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14466 userData__typed->delegate(std::move(result__obj));
14467 };
14468 Discord_Client_CancelGameFriendRequest(&instance_,
14469 userId,
14470 (cb__userData->delegate ? cb__native : nullptr),
14471 Tcb__UserData::Free,
14472 cb__userData);
14473}
14474discordpp::RelationshipHandle Client::GetRelationshipHandle(uint64_t userId) const
14475{
14476 assert(state_ == DiscordObjectState::Owned);
14477 Discord_RelationshipHandle returnValueNative__{};
14478 Discord_Client_GetRelationshipHandle(&instance_, userId, &returnValueNative__);
14479 discordpp::RelationshipHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
14480 return returnValue__;
14481}
14482discordpp::Vector<discordpp::RelationshipHandle> Client::GetRelationships() const
14483{
14484 assert(state_ == DiscordObjectState::Owned);
14485 Discord_RelationshipHandleSpan returnValueNative__;
14486 Discord_Client_GetRelationships(&instance_, &returnValueNative__);
14488 returnValue__.reserve(returnValueNative__.size);
14489 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
14490 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
14491 }
14492 Discord_Free(returnValueNative__.ptr);
14493 return returnValue__;
14494}
14495discordpp::Vector<discordpp::RelationshipHandle> Client::GetRelationshipsByGroup(
14496 discordpp::RelationshipGroupType groupType) const
14497{
14498 assert(state_ == DiscordObjectState::Owned);
14499 Discord_RelationshipHandleSpan returnValueNative__;
14500 Discord_Client_GetRelationshipsByGroup(
14501 &instance_, static_cast<Discord_RelationshipGroupType>(groupType), &returnValueNative__);
14503 returnValue__.reserve(returnValueNative__.size);
14504 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
14505 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
14506 }
14507 Discord_Free(returnValueNative__.ptr);
14508 return returnValue__;
14509}
14510void Client::RejectDiscordFriendRequest(uint64_t userId,
14512{
14513 assert(state_ == DiscordObjectState::Owned);
14514 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14515 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14516 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
14517 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14518 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14519 userData__typed->delegate(std::move(result__obj));
14520 };
14521 Discord_Client_RejectDiscordFriendRequest(&instance_,
14522 userId,
14523 (cb__userData->delegate ? cb__native : nullptr),
14524 Tcb__UserData::Free,
14525 cb__userData);
14526}
14527void Client::RejectGameFriendRequest(uint64_t userId,
14529{
14530 assert(state_ == DiscordObjectState::Owned);
14531 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14532 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14533 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
14534 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14535 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14536 userData__typed->delegate(std::move(result__obj));
14537 };
14538 Discord_Client_RejectGameFriendRequest(&instance_,
14539 userId,
14540 (cb__userData->delegate ? cb__native : nullptr),
14541 Tcb__UserData::Free,
14542 cb__userData);
14543}
14544void Client::RemoveDiscordAndGameFriend(uint64_t userId,
14546{
14547 assert(state_ == DiscordObjectState::Owned);
14548 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14549 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14550 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
14551 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14552 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14553 userData__typed->delegate(std::move(result__obj));
14554 };
14555 Discord_Client_RemoveDiscordAndGameFriend(&instance_,
14556 userId,
14557 (cb__userData->delegate ? cb__native : nullptr),
14558 Tcb__UserData::Free,
14559 cb__userData);
14560}
14561void Client::RemoveGameFriend(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
14562{
14563 assert(state_ == DiscordObjectState::Owned);
14564 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14565 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14566 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
14567 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14568 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14569 userData__typed->delegate(std::move(result__obj));
14570 };
14571 Discord_Client_RemoveGameFriend(&instance_,
14572 userId,
14573 (cb__userData->delegate ? cb__native : nullptr),
14574 Tcb__UserData::Free,
14575 cb__userData);
14576}
14577discordpp::Vector<discordpp::UserHandle> Client::SearchFriendsByUsername(
14578 std::string_view searchStr) const
14579{
14580 assert(state_ == DiscordObjectState::Owned);
14581 Discord_UserHandleSpan returnValueNative__;
14582 Discord_String searchStr__str{(uint8_t*)(searchStr.data() != nullptr ? searchStr.data() : ""),
14583 searchStr.size()};
14584 Discord_Client_SearchFriendsByUsername(&instance_, searchStr__str, &returnValueNative__);
14586 returnValue__.reserve(returnValueNative__.size);
14587 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
14588 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
14589 }
14590 Discord_Free(returnValueNative__.ptr);
14591 return returnValue__;
14592}
14593void Client::SendDiscordFriendRequest(std::string_view username,
14595{
14596 assert(state_ == DiscordObjectState::Owned);
14597 Discord_String username__str{(uint8_t*)(username.data() != nullptr ? username.data() : ""),
14598 username.size()};
14599 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14600 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14601 Discord_Client_SendFriendRequestCallback cb__native = [](auto result, void* userData__) {
14602 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14603 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14604 userData__typed->delegate(std::move(result__obj));
14605 };
14606 Discord_Client_SendDiscordFriendRequest(&instance_,
14607 username__str,
14608 (cb__userData->delegate ? cb__native : nullptr),
14609 Tcb__UserData::Free,
14610 cb__userData);
14611}
14612void Client::SendDiscordFriendRequestById(uint64_t userId,
14614{
14615 assert(state_ == DiscordObjectState::Owned);
14616 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14617 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14618 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
14619 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14620 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14621 userData__typed->delegate(std::move(result__obj));
14622 };
14623 Discord_Client_SendDiscordFriendRequestById(&instance_,
14624 userId,
14625 (cb__userData->delegate ? cb__native : nullptr),
14626 Tcb__UserData::Free,
14627 cb__userData);
14628}
14629void Client::SendGameFriendRequest(std::string_view username,
14631{
14632 assert(state_ == DiscordObjectState::Owned);
14633 Discord_String username__str{(uint8_t*)(username.data() != nullptr ? username.data() : ""),
14634 username.size()};
14635 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14636 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14637 Discord_Client_SendFriendRequestCallback cb__native = [](auto result, void* userData__) {
14638 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14639 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14640 userData__typed->delegate(std::move(result__obj));
14641 };
14642 Discord_Client_SendGameFriendRequest(&instance_,
14643 username__str,
14644 (cb__userData->delegate ? cb__native : nullptr),
14645 Tcb__UserData::Free,
14646 cb__userData);
14647}
14648void Client::SendGameFriendRequestById(uint64_t userId,
14650{
14651 assert(state_ == DiscordObjectState::Owned);
14652 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14653 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14654 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
14655 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14656 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14657 userData__typed->delegate(std::move(result__obj));
14658 };
14659 Discord_Client_SendGameFriendRequestById(&instance_,
14660 userId,
14661 (cb__userData->delegate ? cb__native : nullptr),
14662 Tcb__UserData::Free,
14663 cb__userData);
14664}
14665void Client::SetRelationshipCreatedCallback(discordpp::Client::RelationshipCreatedCallback cb)
14666{
14667 assert(state_ == DiscordObjectState::Owned);
14668 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14669 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14670 Discord_Client_RelationshipCreatedCallback cb__native =
14671 [](auto userId, auto isDiscordRelationshipUpdate, void* userData__) {
14672 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14673 userData__typed->delegate(userId, isDiscordRelationshipUpdate);
14674 };
14675 Discord_Client_SetRelationshipCreatedCallback(&instance_,
14676 (cb__userData->delegate ? cb__native : nullptr),
14677 Tcb__UserData::Free,
14678 cb__userData);
14679}
14680void Client::SetRelationshipDeletedCallback(discordpp::Client::RelationshipDeletedCallback cb)
14681{
14682 assert(state_ == DiscordObjectState::Owned);
14683 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14684 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14685 Discord_Client_RelationshipDeletedCallback cb__native =
14686 [](auto userId, auto isDiscordRelationshipUpdate, void* userData__) {
14687 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14688 userData__typed->delegate(userId, isDiscordRelationshipUpdate);
14689 };
14690 Discord_Client_SetRelationshipDeletedCallback(&instance_,
14691 (cb__userData->delegate ? cb__native : nullptr),
14692 Tcb__UserData::Free,
14693 cb__userData);
14694}
14695void Client::UnblockUser(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
14696{
14697 assert(state_ == DiscordObjectState::Owned);
14698 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14699 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14700 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
14701 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14702 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14703 userData__typed->delegate(std::move(result__obj));
14704 };
14705 Discord_Client_UnblockUser(&instance_,
14706 userId,
14707 (cb__userData->delegate ? cb__native : nullptr),
14708 Tcb__UserData::Free,
14709 cb__userData);
14710}
14711std::optional<discordpp::UserHandle> Client::GetCurrentUserV2() const
14712{
14713 assert(state_ == DiscordObjectState::Owned);
14714 bool returnIsNonNull__;
14715 Discord_UserHandle returnValueNative__;
14716 returnIsNonNull__ = Discord_Client_GetCurrentUserV2(&instance_, &returnValueNative__);
14717 if (!returnIsNonNull__) {
14718 return {};
14719 }
14720 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
14721 return returnValue__;
14722}
14723void Client::GetDiscordClientConnectedUser(
14724 uint64_t applicationId,
14726{
14727 assert(state_ == DiscordObjectState::Owned);
14728 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
14729 auto callback__userData = Tcallback__UserData::Create(std::move(callback));
14730 Discord_Client_GetDiscordClientConnectedUserCallback callback__native =
14731 [](auto result, auto user, void* userData__) {
14732 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
14733 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
14734 std::optional<discordpp::UserHandle> user__opt{};
14735 if (user) {
14736 user__opt = discordpp::UserHandle(*user, DiscordObjectState::Owned);
14737 }
14738 userData__typed->delegate(std::move(result__obj), std::move(user__opt));
14739 };
14740 Discord_Client_GetDiscordClientConnectedUser(
14741 &instance_,
14742 applicationId,
14743 (callback__userData->delegate ? callback__native : nullptr),
14744 Tcallback__UserData::Free,
14745 callback__userData);
14746}
14747std::optional<discordpp::UserHandle> Client::GetUser(uint64_t userId) const
14748{
14749 assert(state_ == DiscordObjectState::Owned);
14750 bool returnIsNonNull__;
14751 Discord_UserHandle returnValueNative__;
14752 returnIsNonNull__ = Discord_Client_GetUser(&instance_, userId, &returnValueNative__);
14753 if (!returnIsNonNull__) {
14754 return {};
14755 }
14756 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
14757 return returnValue__;
14758}
14759void Client::SetRelationshipGroupsUpdatedCallback(
14761{
14762 assert(state_ == DiscordObjectState::Owned);
14763 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14764 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14765 Discord_Client_RelationshipGroupsUpdatedCallback cb__native = [](auto userId,
14766 void* userData__) {
14767 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14768 userData__typed->delegate(userId);
14769 };
14770 Discord_Client_SetRelationshipGroupsUpdatedCallback(
14771 &instance_,
14772 (cb__userData->delegate ? cb__native : nullptr),
14773 Tcb__UserData::Free,
14774 cb__userData);
14775}
14776void Client::SetUserUpdatedCallback(discordpp::Client::UserUpdatedCallback cb)
14777{
14778 assert(state_ == DiscordObjectState::Owned);
14779 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
14780 auto cb__userData = Tcb__UserData::Create(std::move(cb));
14781 Discord_Client_UserUpdatedCallback cb__native = [](auto userId, void* userData__) {
14782 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
14783 userData__typed->delegate(userId);
14784 };
14785 Discord_Client_SetUserUpdatedCallback(&instance_,
14786 (cb__userData->delegate ? cb__native : nullptr),
14787 Tcb__UserData::Free,
14788 cb__userData);
14789}
14790const CallInfoHandle CallInfoHandle::nullobj{{}, DiscordObjectState::Invalid};
14791CallInfoHandle::~CallInfoHandle()
14792{
14793 if (state_ == DiscordObjectState::Owned) {
14794 Drop();
14795 state_ = DiscordObjectState::Invalid;
14796 }
14797}
14798CallInfoHandle::CallInfoHandle(CallInfoHandle&& other) noexcept
14799 : instance_(other.instance_)
14800 , state_(other.state_)
14801{
14802 other.state_ = DiscordObjectState::Invalid;
14803}
14804CallInfoHandle& CallInfoHandle::operator=(CallInfoHandle&& other) noexcept
14805{
14806 if (this != &other) {
14807 if (state_ == DiscordObjectState::Owned) {
14808 Drop();
14809 }
14810 instance_ = other.instance_;
14811 state_ = other.state_;
14812 other.state_ = DiscordObjectState::Invalid;
14813 }
14814 return *this;
14815}
14816CallInfoHandle::CallInfoHandle(const CallInfoHandle& other)
14817 : instance_{}
14818 , state_(DiscordObjectState::Invalid)
14819{
14820 if (other.state_ == DiscordObjectState::Owned) {
14821 Discord_CallInfoHandle_Clone(&instance_, other.instance());
14822
14823 state_ = DiscordObjectState::Owned;
14824 }
14825}
14826CallInfoHandle& CallInfoHandle::operator=(const CallInfoHandle& other)
14827{
14828 if (this != &other) {
14829 if (state_ == DiscordObjectState::Owned) {
14830 Drop();
14831 state_ = DiscordObjectState::Invalid;
14832 }
14833 if (other.state_ == DiscordObjectState::Owned) {
14834 Discord_CallInfoHandle_Clone(&instance_, other.instance());
14835
14836 state_ = DiscordObjectState::Owned;
14837 }
14838 }
14839 return *this;
14840}
14841CallInfoHandle::CallInfoHandle(Discord_CallInfoHandle instance, DiscordObjectState state)
14842 : instance_(instance)
14843 , state_(state)
14844{
14845}
14846void CallInfoHandle::Drop()
14847{
14848 if (state_ != DiscordObjectState::Owned) {
14849 return;
14850 }
14851 Discord_CallInfoHandle_Drop(&instance_);
14852 state_ = DiscordObjectState::Invalid;
14853}
14854uint64_t CallInfoHandle::ChannelId() const
14855{
14856 assert(state_ == DiscordObjectState::Owned);
14857 uint64_t returnValue__;
14858 returnValue__ = Discord_CallInfoHandle_ChannelId(&instance_);
14859 return returnValue__;
14860}
14861discordpp::Vector<uint64_t> CallInfoHandle::GetParticipants() const
14862{
14863 assert(state_ == DiscordObjectState::Owned);
14864 Discord_UInt64Span returnValueNative__;
14865 Discord_CallInfoHandle_GetParticipants(&instance_, &returnValueNative__);
14866 discordpp::Vector<uint64_t> returnValue__(returnValueNative__.ptr,
14867 returnValueNative__.ptr + returnValueNative__.size);
14868 Discord_Free(returnValueNative__.ptr);
14869 return returnValue__;
14870}
14871std::optional<discordpp::VoiceStateHandle> CallInfoHandle::GetVoiceStateHandle(
14872 uint64_t userId) const
14873{
14874 assert(state_ == DiscordObjectState::Owned);
14875 bool returnIsNonNull__;
14876 Discord_VoiceStateHandle returnValueNative__;
14877 returnIsNonNull__ =
14878 Discord_CallInfoHandle_GetVoiceStateHandle(&instance_, userId, &returnValueNative__);
14879 if (!returnIsNonNull__) {
14880 return {};
14881 }
14882 discordpp::VoiceStateHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
14883 return returnValue__;
14884}
14885uint64_t CallInfoHandle::GuildId() const
14886{
14887 assert(state_ == DiscordObjectState::Owned);
14888 uint64_t returnValue__;
14889 returnValue__ = Discord_CallInfoHandle_GuildId(&instance_);
14890 return returnValue__;
14891}
14892} // namespace discordpp
14893
14894#endif // DISCORDPP_IMPLEMENTATION
Struct which controls what your rich presence looks like in the Discord client. If you don't specify ...
Definition discordpp.h:1164
void SetLargeText(std::optional< std::string_view > LargeText)
Setter for ActivityAssets::LargeText.
void SetInviteCoverImage(std::optional< std::string_view > InviteCoverImage)
Setter for ActivityAssets::InviteCoverImage.
ActivityAssets(ActivityAssets &&other) noexcept
Move constructor for ActivityAssets.
std::optional< discordpp::String > SmallText() const
A tooltip string that is shown when the user hovers over the small image.
void SetLargeImage(std::optional< std::string_view > LargeImage)
Setter for ActivityAssets::LargeImage.
ActivityAssets(const ActivityAssets &arg0)
Copy constructor for ActivityAssets.
std::optional< discordpp::String > SmallUrl() const
A URL that opens when the user clicks/taps the small image.
void SetLargeUrl(std::optional< std::string_view > LargeUrl)
Setter for ActivityAssets::LargeUrl.
std::optional< discordpp::String > InviteCoverImage() const
The invite cover image identifier or URL, rendered as a banner image on activity invites.
std::optional< discordpp::String > LargeUrl() const
A URL that opens when the user clicks/taps the large image.
void SetSmallText(std::optional< std::string_view > SmallText)
Setter for ActivityAssets::SmallText.
ActivityAssets & operator=(const ActivityAssets &arg0)
Copy assignment operator for ActivityAssets.
static const ActivityAssets nullobj
Uninitialized instance of ActivityAssets.
Definition discordpp.h:1183
void SetSmallUrl(std::optional< std::string_view > SmallUrl)
Setter for ActivityAssets::SmallUrl.
std::optional< discordpp::String > LargeText() const
A tooltip string that is shown when the user hovers over the large image.
std::optional< discordpp::String > LargeImage() const
The primary image identifier or URL, rendered as a large square icon on a user's rich presence.
void SetSmallImage(std::optional< std::string_view > SmallImage)
Setter for ActivityAssets::SmallImage.
std::optional< discordpp::String > SmallImage() const
The secondary image, rendered as a small circle over the largeImage.
ActivityAssets & operator=(ActivityAssets &&other) noexcept
Move assignment operator for ActivityAssets.
Definition discordpp.h:1411
void SetLabel(std::string_view Label)
Setter for ActivityButton::Label.
ActivityButton(ActivityButton &&other) noexcept
Move constructor for ActivityButton.
static const ActivityButton nullobj
Uninitialized instance of ActivityButton.
Definition discordpp.h:1430
ActivityButton & operator=(ActivityButton &&other) noexcept
Move assignment operator for ActivityButton.
void SetUrl(std::string_view Url)
Setter for ActivityButton::Url.
discordpp::String Url() const
The url of the button.
ActivityButton & operator=(const ActivityButton &arg0)
Copy assignment operator for ActivityButton.
ActivityButton(const ActivityButton &arg0)
Copy constructor for ActivityButton.
discordpp::String Label() const
The label of the button.
When one user invites another to join their game on Discord, it will send a message to that user....
Definition discordpp.h:1066
static const ActivityInvite nullobj
Uninitialized instance of ActivityInvite.
Definition discordpp.h:1085
void SetIsValid(bool IsValid)
Setter for ActivityInvite::IsValid.
uint64_t ApplicationId() const
The target application of the invite.
void SetSessionId(std::string_view SessionId)
Setter for ActivityInvite::SessionId.
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 SetPartyId(std::string_view PartyId)
Setter for ActivityInvite::PartyId.
discordpp::String PartyId() const
The id of the party the invite was sent for.
discordpp::String SessionId() const
The session id of the user who sent the invite.
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.
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...
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:1305
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.
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 SetId(std::string_view Id)
Setter for ActivityParty::Id.
void SetPrivacy(discordpp::ActivityPartyPrivacy Privacy)
Setter for ActivityParty::Privacy.
discordpp::String Id() const
Specifies the id of the party. "Party" is used colloquially to refer to a group of players in a share...
discordpp::ActivityPartyPrivacy Privacy() const
The privacy of the party.
static const ActivityParty nullobj
Uninitialized instance of ActivityParty.
Definition discordpp.h:1324
ActivityParty & operator=(const ActivityParty &arg0)
Copy assignment operator for ActivityParty.
Definition discordpp.h:1367
ActivitySecrets & operator=(ActivitySecrets &&other) noexcept
Move assignment operator for ActivitySecrets.
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_view Join)
Setter for ActivitySecrets::Join.
static const ActivitySecrets nullobj
Uninitialized instance of ActivitySecrets.
Definition discordpp.h:1386
discordpp::String Join() const
A secret string that is shared with users who are accepted into the party so the game knows how to jo...
Definition discordpp.h:1251
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:1270
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:1636
void SetState(std::optional< std::string_view > State)
Setter for Activity::State.
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:1655
void SetDetailsUrl(std::optional< std::string_view > DetailsUrl)
Setter for Activity::DetailsUrl.
std::optional< uint64_t > ApplicationId() const
The application ID of the game that the activity is associated with.
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.
std::optional< discordpp::String > DetailsUrl() const
A URL that opens when the user clicks/taps the details text.
discordpp::Vector< discordpp::ActivityButton > GetButtons() const
Returns the custom buttons for the rich presence.
std::optional< discordpp::String > Details() const
The state of the what the user is doing for this activity.
void SetSecrets(std::optional< discordpp::ActivitySecrets > Secrets)
Setter for Activity::Secrets.
Activity(const Activity &arg0)
Copy constructor for Activity.
discordpp::String Name() const
The name of the game or application that the activity is associated with.
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::String > State() const
The state of the party for this activity.
void SetName(std::string_view Name)
Setter for Activity::Name.
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 SetDetails(std::optional< std::string_view > Details)
Setter for Activity::Details.
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.
void SetStateUrl(std::optional< std::string_view > StateUrl)
Setter for Activity::StateUrl.
void SetSupportedPlatforms(discordpp::ActivityGamePlatforms SupportedPlatforms)
Setter for Activity::SupportedPlatforms.
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< discordpp::ActivitySecrets > Secrets() const
The secrets struct is used in combination with the party struct to make an Activity joinable.
std::optional< discordpp::String > StateUrl() const
A URL that opens when the user clicks/taps the state text.
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:3367
std::optional< discordpp::String > Title() const
When the additional content is a poll or thread, this field will contain the name of the poll or thre...
AdditionalContent & operator=(AdditionalContent &&other) noexcept
Move assignment operator for AdditionalContent.
void SetTitle(std::optional< std::string_view > Title)
Setter for AdditionalContent::Title.
void SetCount(uint8_t Count)
Setter for AdditionalContent::Count.
void SetType(discordpp::AdditionalContentType Type)
Setter for AdditionalContent::Type.
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.
static discordpp::String TypeToString(discordpp::AdditionalContentType type)
Converts the AdditionalContentType enum to a string.
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.
static const AdditionalContent nullobj
Uninitialized instance of AdditionalContent.
Definition discordpp.h:3386
Represents a single input or output audio device available to the user.
Definition discordpp.h:3606
AudioDevice & operator=(const AudioDevice &arg0)
Copy assignment operator for AudioDevice.
bool Equals(discordpp::AudioDevice rhs)
Compares the ID of two AudioDevice objects for equality.
bool IsDefault() const
Whether the audio device is the system default device.
void SetId(std::string_view Id)
Setter for AudioDevice::Id.
AudioDevice(AudioDevice &&other) noexcept
Move constructor for AudioDevice.
AudioDevice & operator=(AudioDevice &&other) noexcept
Move assignment operator for AudioDevice.
discordpp::String Id() const
The ID of the audio device.
static const AudioDevice nullobj
Uninitialized instance of AudioDevice.
Definition discordpp.h:3625
void SetIsDefault(bool IsDefault)
Setter for AudioDevice::IsDefault.
void SetName(std::string_view Name)
Setter for AudioDevice::Name.
AudioDevice(const AudioDevice &arg0)
Copy constructor for AudioDevice.
discordpp::String Name() const
The display name of the audio device.
Arguments to the Client::Authorize function.
Definition discordpp.h:1977
void SetIntegrationType(std::optional< discordpp::IntegrationType > IntegrationType)
Setter for AuthorizationArgs::IntegrationType.
AuthorizationArgs & operator=(AuthorizationArgs &&other) noexcept
Move assignment operator for AuthorizationArgs.
std::optional< discordpp::String > Nonce() const
The nonce field is generally only useful for backend integrations using ID tokens.
void SetState(std::optional< std::string_view > State)
Setter for AuthorizationArgs::State.
discordpp::String Scopes() const
Scopes is a space separated string of the oauth scopes your game is requesting.
std::optional< discordpp::AuthorizationCodeChallenge > CodeChallenge() const
If using the Client::GetToken flow, you will need to generate a code challenge and verifier.
std::optional< discordpp::String > State() const
See https://discord.com/developers/docs/topics/oauth2#state-and-security for details on this field.
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.
static const AuthorizationArgs nullobj
Uninitialized instance of AuthorizationArgs.
Definition discordpp.h:1996
void SetClientId(uint64_t ClientId)
Setter for AuthorizationArgs::ClientId.
void SetNonce(std::optional< std::string_view > Nonce)
Setter for AuthorizationArgs::Nonce.
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.
void SetCustomSchemeParam(std::optional< std::string_view > CustomSchemeParam)
Setter for AuthorizationArgs::CustomSchemeParam.
std::optional< discordpp::String > CustomSchemeParam() const
Custom URI scheme for mobile redirects.
void SetScopes(std::string_view Scopes)
Setter for AuthorizationArgs::Scopes.
Struct that encapsulates the challenge part of the code verification flow.
Definition discordpp.h:1885
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.
AuthorizationCodeChallenge & operator=(AuthorizationCodeChallenge &&other) noexcept
Move assignment operator for AuthorizationCodeChallenge.
void SetChallenge(std::string_view Challenge)
Setter for AuthorizationCodeChallenge::Challenge.
void SetMethod(discordpp::AuthenticationCodeChallengeMethod Method)
Setter for AuthorizationCodeChallenge::Method.
static const AuthorizationCodeChallenge nullobj
Uninitialized instance of AuthorizationCodeChallenge.
Definition discordpp.h:1905
AuthorizationCodeChallenge & operator=(const AuthorizationCodeChallenge &arg0)
Copy assignment operator for AuthorizationCodeChallenge.
AuthorizationCodeChallenge(AuthorizationCodeChallenge &&other) noexcept
Move constructor for AuthorizationCodeChallenge.
discordpp::String Challenge() const
The challenge value.
Struct that encapsulates both parts of the code verification flow.
Definition discordpp.h:1932
AuthorizationCodeVerifier(const AuthorizationCodeVerifier &arg0)
Copy constructor for AuthorizationCodeVerifier.
AuthorizationCodeVerifier & operator=(const AuthorizationCodeVerifier &arg0)
Copy assignment operator for AuthorizationCodeVerifier.
AuthorizationCodeVerifier(AuthorizationCodeVerifier &&other) noexcept
Move constructor for AuthorizationCodeVerifier.
void SetChallenge(discordpp::AuthorizationCodeChallenge Challenge)
Setter for AuthorizationCodeVerifier::Challenge.
static const AuthorizationCodeVerifier nullobj
Uninitialized instance of AuthorizationCodeVerifier.
Definition discordpp.h:1952
void SetVerifier(std::string_view Verifier)
Setter for AuthorizationCodeVerifier::Verifier.
discordpp::AuthorizationCodeChallenge Challenge() const
The challenge part of the code verification flow.
discordpp::String Verifier() const
The verifier 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:6113
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.
CallInfoHandle & operator=(const CallInfoHandle &other)
Copy assignment operator for CallInfoHandle.
CallInfoHandle(const CallInfoHandle &other)
Copy constructor for CallInfoHandle.
discordpp::Vector< uint64_t > GetParticipants() const
Returns a list of the user IDs of the participants in the call.
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:6132
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:2237
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...
static discordpp::String ErrorToString(discordpp::Call::Error type)
Converts the Error enum to a string.
static const Call nullobj
Uninitialized instance of Call.
Definition discordpp.h:2315
Call(Call &&other) noexcept
Move constructor for Call.
discordpp::Function< void(uint64_t userId, bool added)> OnParticipantChanged
Callback function for Call::SetParticipantChangedCallback.
Definition discordpp.h:2295
void SetOnVoiceStateChangedCallback(discordpp::Call::OnVoiceStateChanged cb)
Sets a callback function to generally be invoked whenever a field on a VoiceStateHandle object for a ...
discordpp::Function< void(uint64_t userId, bool isPlayingSound)> OnSpeakingStatusChanged
Callback function for Call::SetSpeakingStatusChangedCallback.
Definition discordpp.h:2298
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::Vector< uint64_t > GetParticipants() const
Returns a list of all of the user IDs of the participants in the call.
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.
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:2245
@ None
None.
Definition discordpp.h:2248
@ Forbidden
Forbidden.
Definition discordpp.h:2263
@ SignalingConnectionFailed
SignalingConnectionFailed.
Definition discordpp.h:2251
@ SignalingUnexpectedClose
SignalingUnexpectedClose.
Definition discordpp.h:2254
@ JoinTimeout
JoinTimeout.
Definition discordpp.h:2260
@ VoiceConnectionFailed
VoiceConnectionFailed.
Definition discordpp.h:2257
Status
Enum that respresents the state of the Call's network connection.
Definition discordpp.h:2267
@ Disconnecting
Disconnecting.
Definition discordpp.h:2288
@ Connected
Connected.
Definition discordpp.h:2282
@ Reconnecting
Reconnecting.
Definition discordpp.h:2285
@ Connecting
Connecting.
Definition discordpp.h:2276
@ SignalingConnected
SignalingConnected.
Definition discordpp.h:2279
@ Disconnected
Disconnected.
Definition discordpp.h:2270
@ Joining
Joining.
Definition discordpp.h:2273
void SetLocalMute(uint64_t userId, bool mute)
Locally mutes the given userId, so that the current user cannot hear them anymore.
discordpp::Function< void(discordpp::Call::Status status, discordpp::Call::Error error, int32_t errorDetail)> OnStatusChanged
Callback function for Call::SetStatusChangedCallback.
Definition discordpp.h:2301
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 ...
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.
static discordpp::String StatusToString(discordpp::Call::Status type)
Converts the Status enum to a string.
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.
bool GetSelfMute()
Returns whether the current user's microphone is muted.
discordpp::Function< void(uint64_t userId)> OnVoiceStateChanged
Callback function for Call::SetOnVoiceStateChangedCallback.
Definition discordpp.h:2292
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.
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.
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:2464
ChannelHandle(const ChannelHandle &other)
Copy constructor for ChannelHandle.
ChannelHandle & operator=(const ChannelHandle &other)
Copy assignment operator for ChannelHandle.
discordpp::Vector< uint64_t > Recipients() const
For DMs and GroupDMs, returns the user IDs of the members of the channel. For all other channels retu...
static const ChannelHandle nullobj
Uninitialized instance of ChannelHandle.
Definition discordpp.h:2483
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.
discordpp::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:3923
discordpp::String ApiBase() const
The base URL for the Discord API.
void SetApiBase(std::string_view ApiBase)
Setter for ClientCreateOptions::ApiBase.
void SetCpuAffinityMask(std::optional< uint64_t > CpuAffinityMask)
Setter for ClientCreateOptions::CpuAffinityMask.
discordpp::AudioSystem ExperimentalAudioSystem() const
The audio system to use. Defaults to AudioSystem::Standard.
static const ClientCreateOptions nullobj
Uninitialized instance of ClientCreateOptions.
Definition discordpp.h:3942
void SetWebBase(std::string_view WebBase)
Setter for ClientCreateOptions::WebBase.
ClientCreateOptions & operator=(const ClientCreateOptions &arg0)
Copy assignment operator for ClientCreateOptions.
bool ExperimentalAndroidPreventCommsForBluetooth() const
Whether to prevent communications mode on Android when Bluetooth is connected.
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.
std::optional< uint64_t > CpuAffinityMask() const
CPU affinity mask hint for certain platforms. Depending on platform support, may or may not be ignore...
discordpp::String WebBase() const
The base URL for the Discord web application.
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:1792
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.
discordpp::String ToString() const
Returns the error message if any of the ClientResult.
void SetErrorCode(int32_t ErrorCode)
Setter for ClientResult::ErrorCode.
discordpp::String ResponseBody() const
The full HTTP response body, which will usually be a JSON string.
discordpp::String Error() const
A description of the error that occurred.
ClientResult & operator=(const ClientResult &arg0)
Copy assignment operator for ClientResult.
void SetStatus(discordpp::HttpStatusCode Status)
Setter for ClientResult::Status.
discordpp::ErrorType Type() const
The type of error that occurred. See ErrorType for more information.
ClientResult(ClientResult &&other) noexcept
Move constructor for ClientResult.
void SetResponseBody(std::string_view ResponseBody)
Setter for ClientResult::ResponseBody.
void SetSuccessful(bool Successful)
Setter for ClientResult::Successful.
static const ClientResult nullobj
Uninitialized instance of ClientResult.
Definition discordpp.h:1811
void SetError(std::string_view Error)
Setter for ClientResult::Error.
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 ...
discordpp::HttpStatusCode Status() const
The HTTP status code of the API call.
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:4004
discordpp::Function< void()> AuthorizeDeviceScreenClosedCallback
Callback function for Client::SetAuthorizeDeviceScreenClosedCallback.
Definition discordpp.h:4232
discordpp::Function< void(uint64_t channelId, uint64_t userId)> DiscordClientGuildVoiceMemberUpdatedCallback
A member changed.
Definition discordpp.h:4111
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 GetTokenFromProvisionalMerge(uint64_t applicationId, std::string_view code, std::string_view codeVerifier, std::string_view redirectUri, discordpp::AuthenticationExternalAuthType externalAuthType, std::string_view externalAuthToken, discordpp::Client::TokenExchangeCallback callback)
This function should be used with the Client::Authorize function whenever a user with a provisional a...
void GetLobbyMessagesWithLimit(uint64_t lobbyId, int32_t limit, discordpp::Client::GetLobbyMessagesCallback cb)
Retrieves recent messages from the specified lobby.
void FetchUserGuilds(discordpp::Client::FetchUserGuildsCallback cb)
Fetches all of the guilds (also known as Discord servers) that the current user is a member Use this ...
void CreateOrJoinLobbyWithMetadata(std::string_view secret, discordpp::StringMap const &lobbyMetadata, discordpp::StringMap const &memberMetadata, discordpp::Client::CreateOrJoinLobbyCallback callback)
Variant of Client::CreateOrJoinLobby that also accepts developer-supplied metadata.
void SetVoiceLogDir(std::string_view path, discordpp::LoggingSeverity minSeverity)
Causes logs generated by the voice subsystem of the SDK to be written to disk in the specified direct...
discordpp::Function< void(discordpp::ClientResult result, uint64_t id, discordpp::String name)> FetchCurrentUserCallback
Callback function for Client::FetchCurrentUser.
Definition discordpp.h:4209
discordpp::Vector< uint64_t > GetLobbyIds() const
Returns a list of all the lobbies that the user is a member of and the SDK has loaded.
discordpp::Function< void()> AuthorizeRequestCallback
Callback invoked when a user requests to initiate the authorization flow from the discord app.
Definition discordpp.h:4226
void GetToken(uint64_t applicationId, std::string_view code, std::string_view codeVerifier, std::string_view redirectUri, discordpp::Client::TokenExchangeCallback callback)
Exchanges an authorization code that was returned from the Client::Authorize function for an access t...
discordpp::Call GetCall(uint64_t channelId)
Returns a reference to the currently active call, if any.
discordpp::Function< void(uint64_t messageId, uint64_t channelId)> MessageDeletedCallback
Callback function for Client::SetMessageDeletedCallback.
Definition discordpp.h:4286
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...
void UpdateProvisionalAccountDisplayName(std::string_view name, discordpp::Client::UpdateProvisionalAccountDisplayNameCallback callback)
Updates the display name of a provisional account to the specified name.
discordpp::Function< void(discordpp::Vector< discordpp::AudioDevice > inputDevices, discordpp::Vector< discordpp::AudioDevice > outputDevices)> DeviceChangeCallback
Callback function for Client::SetDeviceChangeCallback.
Definition discordpp.h:4154
void Disconnect()
Asynchronously disconnects the client.
discordpp::Function< void()> TokenExpirationCallback
Callback function for Client::SetTokenExpirationCallback.
Definition discordpp.h:4235
void SetDiscordClientVoiceChannelSelectedCallback(discordpp::Client::DiscordClientVoiceChannelSelectedCallback cb)
Sets the channel-selected callback. !group GuildVoice.
discordpp::Function< void(uint64_t channelId, uint64_t userId)> DiscordClientGuildVoiceSpeakingStoppedCallback
A member stopped speaking.
Definition discordpp.h:4119
discordpp::Function< void(discordpp::ClientResult result, discordpp::VoiceSettings settings)> GetVoiceSettingsCallback
Callback function for Client::GetVoiceSettings.
Definition discordpp.h:4150
void SetDiscordClientGuildVoiceSpeakingStoppedCallback(discordpp::Client::DiscordClientGuildVoiceSpeakingStoppedCallback cb)
Sets the speaking-stopped callback. !group GuildVoice.
void SetInputDevice(std::string_view deviceId, discordpp::Client::SetInputDeviceCallback cb)
Asynchronously changes the audio input device in use by the client to the specified device....
void JoinDiscordClientGuildVoiceChannel(uint64_t channelId, bool force, discordpp::Client::DiscordClientGuildVoiceResultCallback callback)
Joins desktop voice. Requires CONNECT. !group GuildVoice.
void OpenAuthorizeDeviceScreen(uint64_t clientId, std::string_view userCode)
This function is used to show the device authorization screen and is used for the case where the user...
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.
discordpp::Function< void(discordpp::AudioDevice device)> GetCurrentOutputDeviceCallback
Callback function for Client::GetCurrentOutputDevice.
Definition discordpp.h:4139
void SetVoiceSettingsUpdatedCallback(discordpp::Client::VoiceSettingsUpdatedCallback callback)
Sets a callback to be invoked whenever the user's voice settings change in the connected Discord clie...
void CancelGameFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Cancels an outgoing game friend request to the target user.
discordpp::Function< void(discordpp::VoiceSettings settings)> VoiceSettingsUpdatedCallback
Callback function for Client::SetVoiceSettingsUpdatedCallback.
Definition discordpp.h:4172
discordpp::Function< void(uint64_t messageId)> MessageCreatedCallback
Callback function for Client::SetMessageCreatedCallback.
Definition discordpp.h:4283
void AbortGetTokenFromDevice()
This function is used to abort/cleanup the device authorization flow.
discordpp::Function< void(uint64_t applicationId, discordpp::String joinSecret)> ActivityJoinWithApplicationCallback
Callback function for Client::SetActivityJoinWithApplicationCallback.
Definition discordpp.h:4382
discordpp::Function< void(discordpp::String state)> DiscordClientVoiceConnectionStatusChangedCallback
The voice connection changed.
Definition discordpp.h:4126
void OpenConnectedGamesSettingsInDiscord(discordpp::Client::OpenConnectedGamesSettingsInDiscordCallback callback)
Opens the Connected Games settings in the Discord client, which is where users can manage their setti...
void UnmergeIntoProvisionalAccount(uint64_t applicationId, discordpp::AuthenticationExternalAuthType externalAuthType, std::string_view externalAuthToken, discordpp::Client::UnmergeIntoProvisionalAccountCallback callback)
This function is used to unlink/unmerge a external identity from a Discord account....
void SetDiscordClientGuildVoiceMemberAddedCallback(discordpp::Client::DiscordClientGuildVoiceMemberAddedCallback cb)
Sets the member-added callback. !group GuildVoice.
discordpp::Function< void(uint64_t lobbyId, uint64_t memberId, bool added)> VoiceParticipantChangedCallback
Callback function for Client::SetVoiceParticipantChangedCallback.
Definition discordpp.h:4168
void SetAuthorizeDeviceScreenClosedCallback(discordpp::Client::AuthorizeDeviceScreenClosedCallback cb)
Sets a callback function to be invoked when the device authorization screen is closed.
discordpp::Function< void(discordpp::ClientResult result)> UpdateRichPresenceCallback
Callback function for when Client::UpdateRichPresence completes.
Definition discordpp.h:4389
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.
void UnlinkChannelFromLobby(uint64_t lobbyId, discordpp::Client::LinkOrUnlinkChannelCallback callback)
Removes any existing channel link from the specified lobby.
discordpp::Function< void(discordpp::Vector< discordpp::AudioDevice > devices)> GetOutputDevicesCallback
Callback function for Client::GetOutputDevices.
Definition discordpp.h:4146
discordpp::Vector< discordpp::UserHandle > SearchFriendsByUsername(std::string_view searchStr) const
Searches all of your friends by both username and display name, returning a list of all friends that ...
discordpp::Function< void(discordpp::ClientResult result)> LinkOrUnlinkChannelCallback
Callback function for Client::LinkChannelToLobby.
Definition discordpp.h:4341
discordpp::Function< void(discordpp::ClientResult result)> EditUserMessageCallback
Callback function for Client::EditUserMessage.
Definition discordpp.h:4253
void SetMessageDeletedCallback(discordpp::Client::MessageDeletedCallback cb)
Sets a callback to be invoked whenever a message is deleted.
void FetchCurrentUser(discordpp::AuthorizationTokenType tokenType, std::string_view token, discordpp::Client::FetchCurrentUserCallback callback)
Fetches basic information about the user associated with the given auth token.
void GetProvisionalToken(uint64_t applicationId, discordpp::AuthenticationExternalAuthType externalAuthType, std::string_view 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 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.
discordpp::Function< void()> EndCallCallback
Callback invoked when Client::EndCall completes.
Definition discordpp.h:4130
discordpp::Function< void(discordpp::ClientResult result, discordpp::String accessToken, discordpp::String refreshToken, discordpp::AuthorizationTokenType tokenType, int32_t expiresIn, discordpp::String scopes)> TokenExchangeCallback
Callback function for the token exchange APIs such as Client::GetToken.
Definition discordpp.h:4213
discordpp::Function< void(uint64_t channelId, uint64_t userId)> DiscordClientGuildVoiceMemberAddedCallback
A member joined.
Definition discordpp.h:4103
discordpp::Function< void(discordpp::ClientResult result, discordpp::String accessToken, discordpp::AuthorizationTokenType tokenType, int32_t expiresIn, discordpp::String scopes)> ExchangeChildTokenCallback
Callback function for Client::ExchangeChildToken.
Definition discordpp.h:4201
discordpp::Function< void(discordpp::ClientResult result)> UpdateStatusCallback
Callback function for when Client::SetOnlineStatus completes.
Definition discordpp.h:4386
void LinkChannelToLobby(uint64_t lobbyId, uint64_t channelId, discordpp::Client::LinkOrUnlinkChannelCallback callback)
Links the specified channel on Discord to the specified in-game lobby.
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.
discordpp::Function< void(uint64_t userId, bool isDiscordRelationshipUpdate)> RelationshipDeletedCallback
Callback function for Client::SetRelationshipDeletedCallback.
Definition discordpp.h:4410
void RefreshToken(uint64_t applicationId, std::string_view refreshToken, discordpp::Client::TokenExchangeCallback callback)
Generates a new access token for the current user from a refresh token.
bool SetLogDir(std::string_view path, discordpp::LoggingSeverity minSeverity)
Causes logs generated by the SDK to be written to disk in the specified directory.
discordpp::Function< void(discordpp::ClientResult result)> SendFriendRequestCallback
Callback function for Client::SendDiscordFriendRequest and Client::SendGameFriendRequest.
Definition discordpp.h:4397
void SetUserUpdatedCallback(discordpp::Client::UserUpdatedCallback cb)
The UserUpdatedCallback is invoked whenever any user the current session knows about changes,...
discordpp::Function< void(discordpp::ClientResult result)> UpdateProvisionalAccountDisplayNameCallback
Callback function for Client::UpdateProvisionalAccountDisplayName.
Definition discordpp.h:4242
discordpp::Function< void()> ProvisionalUserMergeRequiredCallback
Callback function for when Client::ProvisionalUserMergeCompleted completes.
Definition discordpp.h:4271
void SetAecDump(bool on)
Enables or disables AEC diagnostic recording.
void SetActivityInviteCreatedCallback(discordpp::Client::ActivityInviteCallback cb)
Sets a callback function that is invoked when the current user receives an activity invite from anoth...
void GetVoiceSettings(discordpp::Client::GetVoiceSettingsCallback cb)
Asynchronously fetches the user's current voice settings from the connected Discord client.
discordpp::Function< void(discordpp::ClientResult result, discordpp::DiscordClientGuildVoiceSnapshot snapshot)> GetDiscordClientGuildVoiceChannelCallback
Receives a channel snapshot.
Definition discordpp.h:4085
discordpp::Function< void()> EndCallsCallback
Callback invoked when Client::EndCalls completes.
Definition discordpp.h:4133
Client & operator=(Client &&other) noexcept
Move assignment operator for Client.
void RevokeToken(uint64_t applicationId, std::string_view token, discordpp::Client::RevokeTokenCallback callback)
Revoke all application access/refresh tokens associated with a user with any valid access/refresh tok...
void GetDiscordClientGuildVoiceChannel(uint64_t channelId, discordpp::Client::GetDiscordClientGuildVoiceChannelCallback callback)
Gets watched state, fetching unwatched channels. !group GuildVoice.
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...
discordpp::Function< void(discordpp::ClientResult result)> LeaveLobbyCallback
Callback function for Client::LeaveLobby.
Definition discordpp.h:4338
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...
void SetDiscordClientGuildVoiceMemberUpdatedCallback(discordpp::Client::DiscordClientGuildVoiceMemberUpdatedCallback cb)
Sets the member-updated callback. !group GuildVoice.
void ExchangeChildToken(std::string_view parentApplicationToken, uint64_t childApplicationId, discordpp::Client::ExchangeChildTokenCallback callback)
Exchanges a parent application token for a child application token.
discordpp::Function< void(discordpp::ClientResult result)> SendActivityInviteCallback
Callback function for Client::SendActivityInvite, Client::SendActivityJoinRequest,...
Definition discordpp.h:4372
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...
discordpp::Function< void(discordpp::ClientResult result)> OpenMessageInDiscordCallback
Callback function for when Client::OpenMessageInDiscord completes.
Definition discordpp.h:4274
discordpp::Function< void(discordpp::String joinSecret)> ActivityJoinCallback
Callback function for Client::SetActivityJoinCallback.
Definition discordpp.h:4379
bool CanManageGameOrganizationLink(discordpp::UserGuild guild) const
Returns true if the current user has permission to link or unlink the given Discord guild to or from ...
void CloseAuthorizeDeviceScreen()
This function is used to hide the device authorization screen and is used for the case where the user...
void SetDiscordClientGuildVoiceMemberRemovedCallback(discordpp::Client::DiscordClientGuildVoiceMemberRemovedCallback cb)
Sets the member-removed callback. !group GuildVoice.
void SetOpusHardwareCoding(bool encode, bool decode)
Enables or disables hardware encoding and decoding for audio, if it is available.
discordpp::Function< void(uint64_t channelId, discordpp::ClientResult result)> DiscordClientGuildVoiceChannelErrorCallback
A channel subscription ended.
Definition discordpp.h:4099
discordpp::Function< void(discordpp::ClientResult result, discordpp::String joinSecret)> AcceptActivityInviteCallback
Callback function for Client::AcceptActivityInvite.
Definition discordpp.h:4367
void SetNoiseCancellation(bool on)
Enables or disables Krisp noise cancellation.
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.
discordpp::Function< void(discordpp::Client::Status status, discordpp::Client::Error error, int32_t errorDetail)> OnStatusChanged
Callback function for Client::SetStatusChangedCallback.
Definition discordpp.h:4304
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.
void SetSelfDeafAll(bool deaf)
Mutes all audio from the currently active call for the current user in all calls. They will not be ab...
discordpp::Function< void(bool installed)> IsDiscordAppInstalledCallback
Callback invoked when the IsDiscordAppInstalled function completes.
Definition discordpp.h:4364
discordpp::Function< void(int16_t *data, uint64_t samplesPerChannel, int32_t sampleRate, uint64_t channels)> UserAudioCapturedCallback
Callback function for Client::StartCallWithAudioCallbacks.
Definition discordpp.h:4188
void SendDiscordFriendRequest(std::string_view username, discordpp::Client::SendFriendRequestCallback cb)
Sends a Discord friend request to the target user.
static discordpp::String GetDefaultPresenceScopes()
Returns the default set of OAuth2 scopes that should be used with the Discord SDK when leveraging bas...
Client()
Creates a new instance of the Client.
discordpp::Function< void(discordpp::ClientResult result, discordpp::String inviteUrl)> JoinLinkedLobbyGuildCallback
Callback function for Client::JoinLinkedLobbyGuild.
Definition discordpp.h:4334
void RegisterAuthorizeRequestCallback(discordpp::Client::AuthorizeRequestCallback callback)
Registers a callback to be invoked when a user requests to initiate the authorization flow.
void LeaveDiscordClientGuildVoiceChannel(uint64_t channelId, discordpp::Client::DiscordClientGuildVoiceResultCallback callback)
Leaves the specified desktop voice channel. !group GuildVoice.
discordpp::Function< void(uint64_t channelId, uint64_t userId)> DiscordClientGuildVoiceSpeakingStartedCallback
A member started speaking.
Definition discordpp.h:4115
void SetOutputVolume(float outputVolume)
Sets the speaker volume for the current user.
void UpdateToken(discordpp::AuthorizationTokenType tokenType, std::string_view token, discordpp::Client::UpdateTokenCallback callback)
Asynchronously sets a new auth token for this client to use.
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.
void UnsubscribeDiscordClientGuildVoiceChannel(uint64_t channelId)
Unsubscribes from channel events. !group GuildVoice.
std::optional< discordpp::ChannelHandle > GetChannelHandle(uint64_t channelId) const
Returns a reference to the Discord channel object for the given ID.
void SendActivityJoinRequest(uint64_t userId, discordpp::Client::SendActivityInviteCallback cb)
Requests to join the activity of the specified user.
discordpp::Function< void(discordpp::ClientResult result)> DiscordClientGuildVoiceResultCallback
Receives a voice result.
Definition discordpp.h:4095
discordpp::Function< void(discordpp::ClientResult result, discordpp::Vector< discordpp::GuildMinimal > guilds)> GetUserGuildsCallback
Callback function for Client::GetUserGuilds.
Definition discordpp.h:4329
discordpp::Function< void(uint64_t channelId, uint64_t userId)> DiscordClientGuildVoiceMemberRemovedCallback
A member left.
Definition discordpp.h:4107
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:4047
@ Disconnecting
Disconnecting.
Definition discordpp.h:4065
@ Connected
Connected.
Definition discordpp.h:4056
@ HttpWait
HttpWait.
Definition discordpp.h:4068
@ Reconnecting
Reconnecting.
Definition discordpp.h:4062
@ Connecting
Connecting.
Definition discordpp.h:4053
@ Ready
Ready.
Definition discordpp.h:4059
@ Disconnected
Disconnected.
Definition discordpp.h:4050
discordpp::Function< void(discordpp::ActivityInvite invite)> ActivityInviteCallback
Callback function for Client::SetActivityInviteCreatedCallback and Client::SetActivityInviteUpdatedCa...
Definition discordpp.h:4376
discordpp::Vector< discordpp::RelationshipHandle > GetRelationships() const
Returns a list of all of the relationships the current user has with others, including all Discord re...
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...
discordpp::Function< void(uint64_t channelId)> DiscordClientVoiceChannelSelectedCallback
The selected channel changed.
Definition discordpp.h:4123
discordpp::Function< void(discordpp::ClientResult result)> UpdateRelationshipCallback
Callback function for most other Relationship functions such as Client::SendDiscordFriendRequestById.
Definition discordpp.h:4393
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.
discordpp::Function< void(discordpp::ClientResult result, discordpp::Vector< discordpp::GuildChannel > channels)> GetDiscordClientGuildVoiceChannelsCallback
Receives voice channels.
Definition discordpp.h:4090
void SetThreadPriority(discordpp::Client::Thread thread, int32_t priority)
Allows setting the priority of various SDK threads.
discordpp::UserHandle GetCurrentUser() const
(deprecated)
static discordpp::String ErrorToString(discordpp::Client::Error type)
Converts the Error enum to a string.
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.
discordpp::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:4178
void SendLobbyMessageWithMetadata(uint64_t lobbyId, std::string_view content, discordpp::StringMap const &metadata, discordpp::Client::SendUserMessageCallback cb)
Variant of Client::SendLobbyMessage that also accepts metadata to be sent with the message.
void SendActivityInvite(uint64_t userId, std::string_view content, discordpp::Client::SendActivityInviteCallback cb)
Sends a Discord activity invite to the specified user.
void Connect()
Asynchronously connects the client to Discord.
discordpp::Vector< discordpp::RelationshipHandle > GetRelationshipsByGroup(discordpp::RelationshipGroupType groupType) const
Returns a list of relationships that belong to the specified relationship group type....
discordpp::Function< void(discordpp::ClientResult result, std::optional< discordpp::UserHandle > user)> GetDiscordClientConnectedUserCallback
Callback function for when Client::GetDiscordClientConnectedUser completes.
Definition discordpp.h:4414
discordpp::Function< void(discordpp::ClientResult result)> SetInputDeviceCallback
Callback function for Client::SetInputDevice.
Definition discordpp.h:4159
discordpp::Function< void(discordpp::ClientResult result, discordpp::Vector< discordpp::MessageHandle > messages)> GetLobbyMessagesCallback
Callback function for Client::GetLobbyMessagesWithLimit.
Definition discordpp.h:4256
void SetOutputDevice(std::string_view deviceId, discordpp::Client::SetOutputDeviceCallback cb)
Asynchronously changes the audio output device in use by the client to the specified device....
static discordpp::String ThreadToString(discordpp::Client::Thread type)
Converts the Thread enum to a string.
void SetLobbyDeletedCallback(discordpp::Client::LobbyDeletedCallback cb)
Sets a callback to be invoked when a lobby is no longer available.
discordpp::Function< void(discordpp::ClientResult result, discordpp::Vector< discordpp::UserGuild > guilds)> FetchUserGuildsCallback
Callback function for Client::FetchUserGuilds.
Definition discordpp.h:4308
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,...
void SetDiscordClientGuildVoiceSpeakingStartedCallback(discordpp::Client::DiscordClientGuildVoiceSpeakingStartedCallback cb)
Sets the speaking-started callback. !group GuildVoice.
void LinkGameOrganization(uint64_t guildId, std::string_view gameOrganizationId, discordpp::Client::LinkGameOrganizationCallback cb)
Links a Discord guild to an in-game organization (a "game organization").
static int32_t GetVersionPatch()
Returns the patch version of the Discord Social SDK.
void EditUserMessage(uint64_t recipientId, uint64_t messageId, std::string_view content, discordpp::Client::EditUserMessageCallback cb)
Edits the specified message sent by the current user to the specified recipient.
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.
discordpp::Function< void(discordpp::ClientResult result)> LinkGameOrganizationCallback
Callback function for Client::LinkGameOrganization.
Definition discordpp.h:4313
void SetDiscordClientVoiceConnectionStatusChangedCallback(discordpp::Client::DiscordClientVoiceConnectionStatusChangedCallback cb)
Sets the connection-status callback. !group GuildVoice.
discordpp::Function< void(discordpp::ClientResult result, discordpp::String code, discordpp::String redirectUri)> AuthorizationCallback
Callback invoked when the Authorize function completes.
Definition discordpp.h:4197
static discordpp::String StatusToString(discordpp::Client::Status type)
Converts the Status enum to a string.
discordpp::Function< void(discordpp::AudioDevice device)> GetCurrentInputDeviceCallback
Callback function for Client::GetCurrentInputDevice.
Definition discordpp.h:4136
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.
void GetDiscordClientGuildVoiceChannels(uint64_t guildId, discordpp::Client::GetDiscordClientGuildVoiceChannelsCallback callback)
Lists desktop guild voice channels. Requires GetDefaultCommunicationScopes() (sdk....
discordpp::Function< void(discordpp::ClientResult result)> DeleteUserMessageCallback
Callback function for Client::DeleteUserMessage.
Definition discordpp.h:4250
discordpp::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:4279
void CancelDiscordFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Cancels an outgoing Discord friend request to the target user.
void IsDiscordAppInstalled(discordpp::Client::IsDiscordAppInstalledCallback callback)
Checks whether the Discord mobile app is installed on this device. On desktop platforms,...
discordpp::Function< void(discordpp::ClientResult result)> UnmergeIntoProvisionalAccountCallback
Callback function for the Client::UnmergeIntoProvisionalAccount method.
Definition discordpp.h:4238
discordpp::Function< void(discordpp::ClientResult result, discordpp::Vector< discordpp::GuildChannel > guildChannels)> GetGuildChannelsCallback
Callback function for Client::GetGuildChannels.
Definition discordpp.h:4324
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.
discordpp::Function< void(uint64_t userId)> UserUpdatedCallback
Callback function for Client::SetUserUpdatedCallback.
Definition discordpp.h:4422
void SendUserMessageWithMetadata(uint64_t recipientId, std::string_view content, discordpp::StringMap const &metadata, discordpp::Client::SendUserMessageCallback cb)
Variant of Client::SendUserMessage that also accepts metadata to be sent with the message.
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.
discordpp::Function< void(uint64_t lobbyId)> LobbyCreatedCallback
Callback function for Client::SetLobbyCreatedCallback.
Definition discordpp.h:4344
discordpp::Function< void(discordpp::ClientResult result)> RevokeTokenCallback
Callback function for the Client::RevokeToken method.
Definition discordpp.h:4229
void SetMessageUpdatedCallback(discordpp::Client::MessageUpdatedCallback cb)
Sets a callback to be invoked whenever a message is edited.
void SendGameFriendRequest(std::string_view username, discordpp::Client::SendFriendRequestCallback cb)
Sends (or accepts) a game friend request to the target user.
void SendLobbyMessage(uint64_t lobbyId, std::string_view content, discordpp::Client::SendUserMessageCallback cb)
Sends a message in a lobby chat to all members of the lobby.
discordpp::Function< void(discordpp::ClientResult result)> OpenConnectedGamesSettingsInDiscordCallback
Callback function for when Client::OpenConnectedGamesSettingsInDiscord completes.
Definition discordpp.h:4297
discordpp::Function< void(discordpp::ClientResult result, uint64_t lobbyId)> CreateOrJoinLobbyCallback
Callback function for Client::CreateOrJoinLobby.
Definition discordpp.h:4320
void UnlinkGameOrganization(std::string_view gameOrganizationId, discordpp::Client::UnlinkGameOrganizationCallback cb)
Unlinks a Discord guild from an in-game organization (a "game organization").
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...
discordpp::Function< void(uint64_t lobbyId, uint64_t memberId)> LobbyMemberAddedCallback
Callback function for Client::SetLobbyMemberAddedCallback.
Definition discordpp.h:4350
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.
discordpp::Function< void(uint64_t lobbyId, uint64_t memberId)> LobbyMemberUpdatedCallback
Callback function for Client::SetLobbyMemberUpdatedCallback.
Definition discordpp.h:4357
discordpp::Function< void(uint64_t messageId)> MessageUpdatedCallback
Callback function for Client::SetMessageUpdatedCallback.
Definition discordpp.h:4290
void SetGameWindowPid(int32_t pid)
When users are linking their account with Discord, which involves an OAuth2 flow, the SDK can streaml...
void SetDiscordClientGuildVoiceChannelErrorCallback(discordpp::Client::DiscordClientGuildVoiceChannelErrorCallback cb)
Sets the channel-error callback. !group GuildVoice.
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::optional< discordpp::UserHandle > GetUser(uint64_t userId) const
Returns the UserHandle associated with the given user ID.
void RemoveAuthorizeRequestCallback()
Stops listening for the AUTHORIZE_REQUEST event and removes the registered callback.
discordpp::Function< void(discordpp::ClientResult result, discordpp::Vector< discordpp::MessageHandle > messages)> UserMessagesWithLimitCallback
Callback function for Client::GetUserMessagesWithLimit.
Definition discordpp.h:4266
void SendUserMessage(uint64_t recipientId, std::string_view content, discordpp::Client::SendUserMessageCallback cb)
Sends a direct message to the specified user.
discordpp::RelationshipHandle GetRelationshipHandle(uint64_t userId) const
Returns the RelationshipHandle that corresponds to the relationship between the current user and the ...
bool RegisterLaunchCommand(uint64_t applicationId, std::string_view command)
When a user accepts an activity invite for your game within the Discord client, Discord needs to know...
discordpp::AuthorizationCodeVerifier CreateAuthorizationCodeVerifier()
Helper function that can create a code challenge and verifier for use in the Client::Authorize + Clie...
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...
discordpp::Vector< discordpp::Call > GetCalls()
Returns a reference to all currently active calls, if any.
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.
discordpp::Function< void(discordpp::Vector< discordpp::AudioDevice > devices)> GetInputDevicesCallback
Callback function for Client::GetInputDevices.
Definition discordpp.h:4142
Client(std::string_view apiBase, std::string_view webBase)
Creates a new instance of the Client but allows customizing the Discord URL to use.
void SubscribeDiscordClientGuildVoiceChannel(uint64_t channelId, discordpp::Client::DiscordClientGuildVoiceResultCallback callback)
Subscribes to channel events. Requires full social access. !group GuildVoice.
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...
discordpp::Function< void(discordpp::String message, discordpp::LoggingSeverity severity)> LogCallback
Callback function invoked when a new log message is generated.
Definition discordpp.h:4293
void AbortAuthorize()
This will abort the authorize flow if it is in progress and tear down any associated state.
discordpp::Function< void(bool inputDetected)> NoAudioInputCallback
Callback function for Client::SetNoAudioInputCallback.
Definition discordpp.h:4162
Error
Represents an error state for the socket connection that the Discord SDK maintains with the Discord b...
Definition discordpp.h:4018
@ None
None.
Definition discordpp.h:4021
@ ConnectionCanceled
ConnectionCanceled.
Definition discordpp.h:4030
@ ConnectionFailed
ConnectionFailed.
Definition discordpp.h:4024
@ UnexpectedClose
UnexpectedClose.
Definition discordpp.h:4027
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.
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 ...
void CreateOrJoinLobby(std::string_view secret, discordpp::Client::CreateOrJoinLobbyCallback callback)
Joins the user to the specified lobby, creating one if it does not exist.
discordpp::Function< void(discordpp::ClientResult result)> SetOutputDeviceCallback
Callback function for Client::SetOutputDevice.
Definition discordpp.h:4165
void AcceptActivityInvite(discordpp::ActivityInvite invite, discordpp::Client::AcceptActivityInviteCallback cb)
Accepts an activity invite that the current user has received.
discordpp::Function< void(uint64_t userId)> RelationshipGroupsUpdatedCallback
Callback function for Client::SetRelationshipGroupsUpdatedCallback.
Definition discordpp.h:4419
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...
discordpp::Function< void(discordpp::ClientResult result)> UnlinkGameOrganizationCallback
Callback function for Client::UnlinkGameOrganization.
Definition discordpp.h:4316
discordpp::Function< void(uint64_t lobbyId, uint64_t memberId)> LobbyMemberRemovedCallback
Callback function for Client::SetLobbyMemberRemovedCallback.
Definition discordpp.h:4353
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.
Thread
Represents the type of thread to control thread priority on.
Definition discordpp.h:4072
@ Client
Client.
Definition discordpp.h:4075
@ Voice
Voice.
Definition discordpp.h:4078
@ Network
Network.
Definition discordpp.h:4081
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. Channels are sorted ...
discordpp::Function< void(discordpp::ClientResult result, discordpp::Vector< discordpp::UserMessageSummary > summaries)> UserMessageSummariesCallback
Callback function for Client::GetUserMessageSummaries.
Definition discordpp.h:4261
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...
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.
static discordpp::String GetDefaultAudioDeviceId()
Returns the ID of the system default audio device if the user has not explicitly chosen one.
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
Unlike GetCurrentUser(), this method returns std::nullopt instead of a dummy object when no user is a...
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.
static discordpp::String GetVersionHash()
Returns the git commit hash this version was built from.
void GetTokenFromDeviceProvisionalMerge(discordpp::DeviceAuthorizationArgs args, discordpp::AuthenticationExternalAuthType externalAuthType, std::string_view externalAuthToken, discordpp::Client::TokenExchangeCallback callback)
This function is a combination of Client::Authorize and Client::GetTokenFromProvisionalMerge,...
discordpp::Function< void(uint64_t lobbyId)> LobbyUpdatedCallback
Callback function for Client::SetLobbyUpdatedCallback.
Definition discordpp.h:4361
std::optional< discordpp::LobbyHandle > GetLobbyHandle(uint64_t lobbyId) const
Returns a reference to the Discord lobby object for the given ID.
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.
static discordpp::String GetDefaultCommunicationScopes()
Returns the default set of OAuth2 scopes that should be used with the Discord SDK when making use of ...
discordpp::Function< void(uint64_t lobbyId)> LobbyDeletedCallback
Callback function for Client::SetLobbyDeletedCallback.
Definition discordpp.h:4347
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...
discordpp::Function< void(uint64_t userId, bool isDiscordRelationshipUpdate)> RelationshipCreatedCallback
Callback function for Client::SetRelationshipCreatedCallback.
Definition discordpp.h:4403
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.
discordpp::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:4247
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:4435
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:2083
discordpp::String Scopes() const
Scopes is a space separated string of the oauth scopes your game is requesting.
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:2103
void SetClientId(uint64_t ClientId)
Setter for DeviceAuthorizationArgs::ClientId.
DeviceAuthorizationArgs & operator=(const DeviceAuthorizationArgs &arg0)
Copy assignment operator for DeviceAuthorizationArgs.
void SetScopes(std::string_view Scopes)
Setter for DeviceAuthorizationArgs::Scopes.
DeviceAuthorizationArgs & operator=(DeviceAuthorizationArgs &&other) noexcept
Move assignment operator for DeviceAuthorizationArgs.
void SetAvatarHash(std::optional< std::string_view > AvatarHash)
Setter for DiscordClientGuildVoiceMember::AvatarHash.
DiscordClientGuildVoiceMember(const DiscordClientGuildVoiceMember &arg0)
Copy constructor for DiscordClientGuildVoiceMember.
discordpp::String DisplayName() const
Display name.
DiscordClientGuildVoiceMember(DiscordClientGuildVoiceMember &&other) noexcept
Move constructor for DiscordClientGuildVoiceMember.
void SetSpeaking(discordpp::DiscordClientGuildVoiceSpeakingState Speaking)
Setter for DiscordClientGuildVoiceMember::Speaking.
DiscordClientGuildVoiceMember & operator=(DiscordClientGuildVoiceMember &&other) noexcept
Move assignment operator for DiscordClientGuildVoiceMember.
void SetDeaf(bool Deaf)
Setter for DiscordClientGuildVoiceMember::Deaf.
DiscordClientGuildVoiceMember & operator=(const DiscordClientGuildVoiceMember &arg0)
Copy assignment operator for DiscordClientGuildVoiceMember.
discordpp::String Username() const
Username.
void SetMute(bool Mute)
Setter for DiscordClientGuildVoiceMember::Mute.
std::optional< discordpp::String > AvatarHash() const
Avatar hash.
void SetUsername(std::string_view Username)
Setter for DiscordClientGuildVoiceMember::Username.
void SetSelfMute(bool SelfMute)
Setter for DiscordClientGuildVoiceMember::SelfMute.
void SetDisplayName(std::string_view DisplayName)
Setter for DiscordClientGuildVoiceMember::DisplayName.
void SetSelfDeaf(bool SelfDeaf)
Setter for DiscordClientGuildVoiceMember::SelfDeaf.
void SetUserId(uint64_t UserId)
Setter for DiscordClientGuildVoiceMember::UserId.
static const DiscordClientGuildVoiceMember nullobj
Uninitialized instance of DiscordClientGuildVoiceMember.
Definition discordpp.h:3766
discordpp::DiscordClientGuildVoiceSpeakingState Speaking() const
Speaking state.
Channel snapshot.
Definition discordpp.h:3828
DiscordClientGuildVoiceSnapshot(const DiscordClientGuildVoiceSnapshot &arg0)
Copy constructor for DiscordClientGuildVoiceSnapshot.
void SetChannel(discordpp::GuildChannel Channel)
Setter for DiscordClientGuildVoiceSnapshot::Channel.
void SetSpeakingAvailable(bool SpeakingAvailable)
Setter for DiscordClientGuildVoiceSnapshot::SpeakingAvailable.
static const DiscordClientGuildVoiceSnapshot nullobj
Uninitialized instance of DiscordClientGuildVoiceSnapshot.
Definition discordpp.h:3848
DiscordClientGuildVoiceSnapshot & operator=(const DiscordClientGuildVoiceSnapshot &arg0)
Copy assignment operator for DiscordClientGuildVoiceSnapshot.
DiscordClientGuildVoiceSnapshot & operator=(DiscordClientGuildVoiceSnapshot &&other) noexcept
Move assignment operator for DiscordClientGuildVoiceSnapshot.
bool SpeakingAvailable() const
Speaking available.
discordpp::Vector< discordpp::DiscordClientGuildVoiceMember > Members() const
Channel members.
void SetSelected(bool Selected)
Setter for DiscordClientGuildVoiceSnapshot::Selected.
DiscordClientGuildVoiceSnapshot(DiscordClientGuildVoiceSnapshot &&other) noexcept
Move constructor for DiscordClientGuildVoiceSnapshot.
discordpp::GuildChannel Channel() const
Voice channel.
bool Selected() const
Channel selected.
Represents a channel in a guild that the current user is a member of and may be able to be linked to ...
Definition discordpp.h:2684
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.
GuildChannel(const GuildChannel &arg0)
Copy constructor for GuildChannel.
void SetId(uint64_t Id)
Setter for GuildChannel::Id.
std::optional< uint64_t > ParentId() const
The id of the parent category channel, if any.
void SetType(discordpp::ChannelType Type)
Setter for GuildChannel::Type.
void SetName(std::string_view Name)
Setter for GuildChannel::Name.
void SetPosition(int32_t Position)
Setter for GuildChannel::Position.
discordpp::ChannelType Type() const
The type of the channel.
GuildChannel & operator=(const GuildChannel &arg0)
Copy assignment operator for GuildChannel.
discordpp::String Name() const
The name of the channel.
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.
int32_t Position() const
The position of the channel in the guild's channel list.
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:2703
void SetParentId(std::optional< uint64_t > ParentId)
Setter for GuildChannel::ParentId.
void SetId(uint64_t Id)
Setter for GuildMinimal::Id.
static const GuildMinimal nullobj
Uninitialized instance of GuildMinimal.
Definition discordpp.h:2534
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.
discordpp::String Name() const
The name of the guild.
void SetName(std::string_view Name)
Setter for GuildMinimal::Name.
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:2826
uint64_t GuildId() const
The id of the guild (aka server) that owns the linked channel.
void SetName(std::string_view 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.
void SetGuildId(uint64_t GuildId)
Setter for LinkedChannel::GuildId.
static const LinkedChannel nullobj
Uninitialized instance of LinkedChannel.
Definition discordpp.h:2845
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.
discordpp::String Name() const
The name of the linked channel.
Struct that stores information about the game organization linked to a guild.
Definition discordpp.h:2636
static const LinkedGameOrganization nullobj
Uninitialized instance of LinkedGameOrganization.
Definition discordpp.h:2656
void SetApplicationId(std::optional< uint64_t > ApplicationId)
Setter for LinkedGameOrganization::ApplicationId.
LinkedGameOrganization(const LinkedGameOrganization &arg0)
Copy constructor for LinkedGameOrganization.
LinkedGameOrganization & operator=(LinkedGameOrganization &&other) noexcept
Move assignment operator for LinkedGameOrganization.
void SetGameOrganizationId(std::optional< std::string_view > GameOrganizationId)
Setter for LinkedGameOrganization::GameOrganizationId.
std::optional< discordpp::String > GameOrganizationId() const
The ID of the game organization.
std::optional< uint64_t > ApplicationId() const
The ID of the application that owns the game organization.
LinkedGameOrganization(LinkedGameOrganization &&other) noexcept
Move constructor for LinkedGameOrganization.
LinkedGameOrganization & operator=(const LinkedGameOrganization &arg0)
Copy assignment operator for LinkedGameOrganization.
Struct that stores information about the lobby linked to a channel.
Definition discordpp.h:2780
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:2799
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:3303
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:3322
discordpp::Vector< discordpp::LobbyMemberHandle > LobbyMembers() const
Returns a list of the LobbyMemberHandle objects for each member of this lobby.
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::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.
discordpp::Vector< uint64_t > LobbyMemberIds() const
Returns a list of the user IDs that are members of this lobby.
uint64_t Id() const
Returns the id of the lobby.
discordpp::StringMap Metadata() const
Returns any developer supplied metadata for 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:3158
LobbyMemberHandle & operator=(const LobbyMemberHandle &other)
Copy assignment operator for LobbyMemberHandle.
static const LobbyMemberHandle nullobj
Uninitialized instance of LobbyMemberHandle.
Definition discordpp.h:3177
uint64_t Id() const
The user id of the lobby member.
LobbyMemberHandle(const LobbyMemberHandle &other)
Copy constructor for LobbyMemberHandle.
discordpp::StringMap Metadata() const
Metadata is a set of string key/value pairs that the game developer can use.
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.
A MessageHandle represents a single message received by the SDK.
Definition discordpp.h:3479
uint64_t AuthorId() const
Returns the user ID of the user who sent this message.
discordpp::StringMap ModerationMetadata() const
Returns any moderation metadata the developer set on 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:3498
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 ...
discordpp::String RawContent() const
Returns the content of this message, if any, but without replacing any markup from emojis and mention...
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::optional< discordpp::String > AdditionalName() const
Returns an additional display name for this message, if one was set.
discordpp::StringMap Metadata() const
Returns any metadata the developer included with this message.
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)....
discordpp::String Content() const
Returns the content of this message, if any.
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:2909
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:2928
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 copyable type-erased callable. See the R(Args...) specialization.
Definition discordpp.h:159
friend bool operator!=(const SdkFunction &function, std::nullptr_t) noexcept
Returns true if the function stores a callable.
Definition discordpp.h:252
SdkFunction & operator=(const SdkFunction &other)
Copy assignment. Copies the stored callable.
Definition discordpp.h:204
~SdkFunction()
Destroys the stored callable and returns its memory to the SDK's allocation backend.
Definition discordpp.h:201
friend bool operator==(std::nullptr_t, const SdkFunction &function) noexcept
Returns true if the function is empty.
Definition discordpp.h:247
SdkFunction(const SdkFunction &other)
Copy constructor. Copies the stored callable.
Definition discordpp.h:188
SdkFunction(F &&function)
Definition discordpp.h:176
SdkFunction(SdkFunction &&other) noexcept
Move constructor. Leaves other empty.
Definition discordpp.h:194
SdkFunction & operator=(std::nullptr_t) noexcept
Destroys the stored callable, leaving the function empty.
Definition discordpp.h:225
friend bool operator==(const SdkFunction &function, std::nullptr_t) noexcept
Returns true if the function is empty.
Definition discordpp.h:242
friend bool operator!=(std::nullptr_t, const SdkFunction &function) noexcept
Returns true if the function stores a callable.
Definition discordpp.h:257
SdkFunction & operator=(SdkFunction &&other) noexcept
Move assignment. Leaves other empty.
Definition discordpp.h:214
R operator()(Args... args) const
Invokes the stored callable. The function must not be empty.
Definition discordpp.h:235
SdkFunction() noexcept=default
Constructs an empty function.
static const UserApplicationProfileHandle nullobj
Uninitialized instance of UserApplicationProfileHandle.
Definition discordpp.h:2986
discordpp::String Username() const
Returns the user's in-game username.
discordpp::String Metadata() const
Returns any metadata set by the developer.
discordpp::String ProviderIssuedUserId() const
Returns the user's external identity provider issued user ID.
UserApplicationProfileHandle(UserApplicationProfileHandle &&other) noexcept
Move constructor for UserApplicationProfileHandle.
UserApplicationProfileHandle & operator=(const UserApplicationProfileHandle &other)
Copy assignment operator for UserApplicationProfileHandle.
discordpp::String AvatarHash() const
Returns the user's in-game avatar hash.
UserApplicationProfileHandle & operator=(UserApplicationProfileHandle &&other) noexcept
Move assignment operator for UserApplicationProfileHandle.
UserApplicationProfileHandle(const UserApplicationProfileHandle &other)
Copy constructor for UserApplicationProfileHandle.
std::optional< discordpp::String > ProviderId() const
Returns the user's external identity provider ID if it exists.
discordpp::ExternalIdentityProviderType ProviderType() const
Returns the type of the external identity provider.
Represents a guild (also known as a Discord server) that the current user is a member of,...
Definition discordpp.h:2560
UserGuild & operator=(const UserGuild &arg0)
Copy assignment operator for UserGuild.
void SetName(std::string_view Name)
Setter for UserGuild::Name.
UserGuild(UserGuild &&other) noexcept
Move constructor for UserGuild.
void SetPermissions(uint64_t Permissions)
Setter for UserGuild::Permissions.
UserGuild(const UserGuild &arg0)
Copy constructor for UserGuild.
discordpp::String Name() const
The name of the guild.
std::optional< discordpp::String > Icon() const
The hash of the guild's icon, if it has one.
std::optional< discordpp::LinkedGameOrganization > LinkedGameOrganization() const
Information about the game organization linked to this guild, if any.
void SetOwner(bool Owner)
Setter for UserGuild::Owner.
UserGuild & operator=(UserGuild &&other) noexcept
Move assignment operator for UserGuild.
void SetBanner(std::optional< std::string_view > Banner)
Setter for UserGuild::Banner.
static const UserGuild nullobj
Uninitialized instance of UserGuild.
Definition discordpp.h:2579
void SetIcon(std::optional< std::string_view > Icon)
Setter for UserGuild::Icon.
void SetLinkedGameOrganization(std::optional< discordpp::LinkedGameOrganization > LinkedGameOrganization)
Setter for UserGuild::LinkedGameOrganization.
std::optional< discordpp::String > Banner() const
The hash of the guild's banner, if it has one.
uint64_t Permissions() const
The current user's permissions in the guild, as a bitfield of Discord permission flags.
bool Owner() const
Whether the current user is the owner of the guild.
void SetId(uint64_t Id)
Setter for UserGuild::Id.
uint64_t Id() const
The id of the guild.
A UserHandle represents a single user on Discord that the SDK knows about and contains basic account ...
Definition discordpp.h:3028
uint64_t Id() const
Returns the ID of this user.
UserHandle & operator=(UserHandle &&other) noexcept
Move assignment operator for UserHandle.
static const UserHandle nullobj
Uninitialized instance of UserHandle.
Definition discordpp.h:3062
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.
discordpp::String AvatarUrl(discordpp::UserHandle::AvatarType animatedType, discordpp::UserHandle::AvatarType staticType) const
Returns a CDN url to the user's Discord profile avatar.
std::optional< discordpp::String > Avatar() const
Returns the hash of the user's Discord profile avatar, if one is set.
AvatarType
The desired type of avatar url to generate for a User.
Definition discordpp.h:3036
@ Jpeg
Jpeg.
Definition discordpp.h:3048
@ Gif
Gif.
Definition discordpp.h:3039
@ Webp
Webp.
Definition discordpp.h:3042
@ Png
Png.
Definition discordpp.h:3045
bool IsProvisional() const
Returns true if this user is a provisional account.
static discordpp::String AvatarTypeToString(discordpp::UserHandle::AvatarType type)
Converts the AvatarType enum to a string.
discordpp::String Username() const
Returns the globally unique username of this user.
std::optional< discordpp::String > GlobalName() const
Returns the preferred display name of this user, if one is set.
discordpp::Vector< discordpp::UserApplicationProfileHandle > UserApplicationProfiles() const
Returns a list of UserApplicationProfileHandles for this user. Currently, a user can only have a sing...
discordpp::String DisplayName() const
Returns the user's preferred name, if one is set, otherwise returns their unique username.
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.
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:3900
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:2193
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:2212
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 read-only snapshot of the user's voice settings in the connected Discord desktop client.
Definition discordpp.h:3661
VoiceSettings & operator=(const VoiceSettings &arg0)
Copy assignment operator for VoiceSettings.
float InputVolume() const
Microphone volume, ranging from 0 to 100.
void SetSelfMute(bool SelfMute)
Setter for VoiceSettings::SelfMute.
float OutputVolume() const
Speaker volume, ranging from 0 to 200.
void SetPttKey(std::string_view PttKey)
Setter for VoiceSettings::PttKey.
bool NoiseSuppression() const
Noise suppression state.
discordpp::VoiceInputModeType InputMode() const
When the client transmits microphone audio.
void SetNoiseSuppression(bool NoiseSuppression)
Setter for VoiceSettings::NoiseSuppression.
bool EchoCancellation() const
Echo cancellation state.
void SetOutputVolume(float OutputVolume)
Setter for VoiceSettings::OutputVolume.
VoiceSettings & operator=(VoiceSettings &&other) noexcept
Move assignment operator for VoiceSettings.
void SetInputMode(discordpp::VoiceInputModeType InputMode)
Setter for VoiceSettings::InputMode.
VoiceSettings(VoiceSettings &&other) noexcept
Move constructor for VoiceSettings.
static const VoiceSettings nullobj
Uninitialized instance of VoiceSettings.
Definition discordpp.h:3680
discordpp::String PttKey() const
Display string for the push-to-talk key, such as "SHIFT + F". Empty when nothing is bound.
VoiceSettings(const VoiceSettings &arg0)
Copy constructor for VoiceSettings.
bool SelfMute() const
Self-mute state.
bool AutomaticGainControl() const
Automatic gain control state.
void SetEchoCancellation(bool EchoCancellation)
Setter for VoiceSettings::EchoCancellation.
bool SelfDeaf() const
Self-deafen state.
void SetInputVolume(float InputVolume)
Setter for VoiceSettings::InputVolume.
void SetSelfDeaf(bool SelfDeaf)
Setter for VoiceSettings::SelfDeaf.
void SetNoiseCancellation(bool NoiseCancellation)
Setter for VoiceSettings::NoiseCancellation.
bool NoiseCancellation() const
Noise cancellation state.
void SetAutomaticGainControl(bool AutomaticGainControl)
Setter for VoiceSettings::AutomaticGainControl.
A VoiceStateHandle represents the state of a single participant in a Discord voice call.
Definition discordpp.h:2151
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:2170
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:22
ActivityPartyPrivacy
Allows your game to control the privacy of the party the user is in.
Definition discordpp.h:374
@ Public
The party is public, which means that the user is in a party which could be joinable by either friend...
Definition discordpp.h:388
@ 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:382
DisclosureTypes
Enum that represents various informational disclosures that Discord may make to users,...
Definition discordpp.h:944
@ MessageDataVisibleOnDiscord
This disclosure type happens the first time a user sends a message in game, and that message will be ...
Definition discordpp.h:950
const char * EnumToString(discordpp::ActivityActionTypes value)
Converts a discordpp::ActivityActionTypes to a string.
Definition discordpp.h:6159
std::function< Signature > Function
The callback type used throughout the discordpp API.
Definition discordpp.h:351
HttpStatusCode
Enum that represents the various HTTP status codes that can be returned.
Definition discordpp.h:527
@ RequestHeaderFieldsTooLarge
RequestHeaderFieldsTooLarge.
Definition discordpp.h:674
@ PayloadTooLarge
PayloadTooLarge.
Definition discordpp.h:635
@ MultiStatus
MultiStatus.
Definition discordpp.h:566
@ VariantAlsoNegotiates
VariantAlsoNegotiates.
Definition discordpp.h:695
@ Gone
Gone.
Definition discordpp.h:626
@ BadGateway
BadGateway.
Definition discordpp.h:683
@ Created
Created.
Definition discordpp.h:548
@ TemporaryRedirect
TemporaryRedirect.
Definition discordpp.h:590
@ ServiceUnavailable
ServiceUnavailable.
Definition discordpp.h:686
@ MovedPermanently
MovedPermanently.
Definition discordpp.h:578
@ PreconditionFailed
PreconditionFailed.
Definition discordpp.h:632
@ RequestTimeout
RequestTimeout.
Definition discordpp.h:620
@ Accepted
Accepted.
Definition discordpp.h:551
@ NonAuthoritativeInfo
NonAuthoritativeInfo.
Definition discordpp.h:554
@ NotFound
NotFound.
Definition discordpp.h:608
@ FailedDependency
FailedDependency.
Definition discordpp.h:659
@ PaymentRequired
PaymentRequired.
Definition discordpp.h:602
@ PreconditionRequired
PreconditionRequired.
Definition discordpp.h:668
@ ResetContent
ResetContent.
Definition discordpp.h:560
@ SwitchingProtocols
SwitchingProtocols.
Definition discordpp.h:536
@ HttpVersionNotSupported
HttpVersionNotSupported.
Definition discordpp.h:692
@ Found
Found.
Definition discordpp.h:581
@ Processing
Processing.
Definition discordpp.h:539
@ None
None.
Definition discordpp.h:530
@ ExpectationFailed
ExpectationFailed.
Definition discordpp.h:647
@ Forbidden
Forbidden.
Definition discordpp.h:605
@ PartialContent
PartialContent.
Definition discordpp.h:563
@ SeeOther
SeeOther.
Definition discordpp.h:584
@ EarlyHints
EarlyHints.
Definition discordpp.h:542
@ LengthRequired
LengthRequired.
Definition discordpp.h:629
@ MethodNotAllowed
MethodNotAllowed.
Definition discordpp.h:611
@ NotExtended
NotExtended.
Definition discordpp.h:704
@ RangeNotSatisfiable
RangeNotSatisfiable.
Definition discordpp.h:644
@ NotImplemented
NotImplemented.
Definition discordpp.h:680
@ BadRequest
BadRequest.
Definition discordpp.h:596
@ Continue
Continue.
Definition discordpp.h:533
@ LoopDetected
LoopDetected.
Definition discordpp.h:701
@ UnsupportedMediaType
UnsupportedMediaType.
Definition discordpp.h:641
@ NetworkAuthorizationRequired
NetworkAuthorizationRequired.
Definition discordpp.h:707
@ ImUsed
ImUsed.
Definition discordpp.h:572
@ MultipleChoices
MultipleChoices.
Definition discordpp.h:575
@ Ok
Ok.
Definition discordpp.h:545
@ TooManyRequests
TooManyRequests.
Definition discordpp.h:671
@ ProxyAuthRequired
ProxyAuthRequired.
Definition discordpp.h:617
@ UnprocessableEntity
UnprocessableEntity.
Definition discordpp.h:653
@ MisdirectedRequest
MisdirectedRequest.
Definition discordpp.h:650
@ PermanentRedirect
PermanentRedirect.
Definition discordpp.h:593
@ NotModified
NotModified.
Definition discordpp.h:587
@ AlreadyReported
AlreadyReported.
Definition discordpp.h:569
@ NoContent
NoContent.
Definition discordpp.h:557
@ Locked
Locked.
Definition discordpp.h:656
@ GatewayTimeout
GatewayTimeout.
Definition discordpp.h:689
@ Unauthorized
Unauthorized.
Definition discordpp.h:599
@ UpgradeRequired
UpgradeRequired.
Definition discordpp.h:665
@ InsufficientStorage
InsufficientStorage.
Definition discordpp.h:698
@ InternalServerError
InternalServerError.
Definition discordpp.h:677
@ TooEarly
TooEarly.
Definition discordpp.h:662
@ Conflict
Conflict.
Definition discordpp.h:623
@ UriTooLong
UriTooLong.
Definition discordpp.h:638
@ NotAcceptable
NotAcceptable.
Definition discordpp.h:614
AuthorizationTokenType
Represents the type of auth token used by the SDK, either the normal tokens produced by the Discord d...
Definition discordpp.h:955
@ Bearer
Bearer.
Definition discordpp.h:961
@ User
User.
Definition discordpp.h:958
ChannelType
Enum that represents the various channel types on Discord.
Definition discordpp.h:732
@ GuildForum
GuildForum.
Definition discordpp.h:771
@ Dm
Dm.
Definition discordpp.h:738
@ Lobby
Lobby.
Definition discordpp.h:777
@ GuildNews
GuildNews.
Definition discordpp.h:750
@ GuildVoice
GuildVoice.
Definition discordpp.h:741
@ GuildPublicThread
GuildPublicThread.
Definition discordpp.h:759
@ GuildNewsThread
GuildNewsThread.
Definition discordpp.h:756
@ GuildDirectory
GuildDirectory.
Definition discordpp.h:768
@ GuildCategory
GuildCategory.
Definition discordpp.h:747
@ GuildStageVoice
GuildStageVoice.
Definition discordpp.h:765
@ GuildMedia
GuildMedia.
Definition discordpp.h:774
@ GuildStore
GuildStore.
Definition discordpp.h:753
@ GuildText
GuildText.
Definition discordpp.h:735
@ GroupDm
GroupDm.
Definition discordpp.h:744
@ EphemeralDm
EphemeralDm.
Definition discordpp.h:780
@ GuildPrivateThread
GuildPrivateThread.
Definition discordpp.h:762
AuthenticationCodeChallengeMethod
Represents the crypto method used to generate a code challenge.
Definition discordpp.h:713
@ S256
S256.
Definition discordpp.h:716
RelationshipType
Enum that represents the possible types of relationships that can exist between two users.
Definition discordpp.h:855
@ PendingIncoming
The current user has received a friend request from the target user, but it is not yet accepted.
Definition discordpp.h:870
@ Implicit
The Implicit type is documented for visibility, but should be unused in the SDK.
Definition discordpp.h:877
@ Suggestion
The Suggestion type is documented for visibility, but should be unused in the SDK.
Definition discordpp.h:880
@ PendingOutgoing
The current user has sent a friend request to the target user, but it is not yet accepted.
Definition discordpp.h:874
@ Blocked
The current user has blocked the target user, and so certain actions such as sending messages between...
Definition discordpp.h:865
@ None
The user has no relationship with the other user.
Definition discordpp.h:858
@ Friend
The user is friends with the other user.
Definition discordpp.h:861
DiscordClientGuildVoiceSpeakingState
Speaking state.
Definition discordpp.h:819
@ Speaking
Speaking.
Definition discordpp.h:828
@ Silent
Silent.
Definition discordpp.h:825
@ Unavailable
Unavailable.
Definition discordpp.h:822
bool operator!=(const SdkAllocator< T > &, const SdkAllocator< U > &) noexcept
SdkAllocator instances never compare unequal.
Definition discordpp.h:129
std::vector< T, SdkAllocator< T > > SdkVector
A vector whose storage comes from the SDK's allocation backend.
Definition discordpp.h:139
AuthenticationExternalAuthType
Represents the various identity providers that can be used to authenticate a provisional account user...
Definition discordpp.h:966
@ EpicOnlineServicesIdToken
EpicOnlineServicesIdToken.
Definition discordpp.h:975
@ DiscordBotIssuedAccessToken
DiscordBotIssuedAccessToken.
Definition discordpp.h:984
@ EpicOnlineServicesAccessToken
EpicOnlineServicesAccessToken.
Definition discordpp.h:972
@ SteamSessionTicket
SteamSessionTicket.
Definition discordpp.h:978
@ OIDC
OIDC.
Definition discordpp.h:969
@ UnityServicesIdToken
UnityServicesIdToken.
Definition discordpp.h:981
@ PlayStationNetworkIdToken
PlayStationNetworkIdToken.
Definition discordpp.h:990
@ AppleIdToken
AppleIdToken.
Definition discordpp.h:987
LoggingSeverity
Enum that represents the various log levels supported by the SDK.
Definition discordpp.h:994
@ Warning
Warning.
Definition discordpp.h:1003
@ Info
Info.
Definition discordpp.h:1000
@ None
None.
Definition discordpp.h:1009
@ Error
Error.
Definition discordpp.h:1006
@ Verbose
Verbose.
Definition discordpp.h:997
RelationshipGroupType
Enum that represents the logical groups of relationships based on online status and game activity.
Definition discordpp.h:1014
@ OnlinePlayingGame
Users who are online and currently playing the game.
Definition discordpp.h:1017
@ Offline
Users who are offline.
Definition discordpp.h:1023
@ OnlineElsewhere
Users who are online but not playing the game.
Definition discordpp.h:1020
IntegrationType
Represents the type of integration the app will be installed as.
Definition discordpp.h:720
@ GuildInstall
GuildInstall.
Definition discordpp.h:723
@ UserInstall
UserInstall.
Definition discordpp.h:726
AudioSystem
The Discord Voice audio system to use.
Definition discordpp.h:832
@ Game
Use the game audio system.
Definition discordpp.h:838
@ Standard
Use the standard audio system.
Definition discordpp.h:835
ActivityGamePlatforms
Represents the type of platforms that an activity invite can be accepted on.
Definition discordpp.h:437
@ Embedded
Embedded.
Definition discordpp.h:455
@ Xbox
Xbox.
Definition discordpp.h:443
@ Desktop
Desktop.
Definition discordpp.h:440
@ Samsung
Samsung.
Definition discordpp.h:446
@ PS5
PS5.
Definition discordpp.h:461
@ PS4
PS4.
Definition discordpp.h:458
@ IOS
IOS.
Definition discordpp.h:449
@ Android
Android.
Definition discordpp.h:452
std::string String
Definition discordpp.h:343
std::unordered_map< SdkString, SdkString, SdkStringHash, std::equal_to< SdkString >, SdkAllocator< std::pair< const SdkString, SdkString > > > SdkStringMap
A string-to-string map whose nodes and strings come from the SDK's allocation backend.
Definition discordpp.h:151
VoiceInputModeType
Describes how the Discord client decides when to transmit the user's microphone audio.
Definition discordpp.h:809
@ PushToTalk
Transmit while the push-to-talk shortcut is held.
Definition discordpp.h:815
@ VoiceActivity
Transmit when voice activity is detected.
Definition discordpp.h:812
ActivityTypes
Discord RichPresence supports multiple types of activities that a user can be doing.
Definition discordpp.h:397
@ Watching
Watching.
Definition discordpp.h:409
@ Competing
Competing.
Definition discordpp.h:415
@ HangStatus
HangStatus.
Definition discordpp.h:418
@ Listening
Listening.
Definition discordpp.h:406
@ Streaming
Streaming.
Definition discordpp.h:403
@ CustomStatus
CustomStatus.
Definition discordpp.h:412
@ Playing
Playing.
Definition discordpp.h:400
StatusType
Enum that specifies the various online statuses for a user.
Definition discordpp.h:912
@ Blocked
Blocked.
Definition discordpp.h:921
@ Online
The user is online and recently active.
Definition discordpp.h:915
@ Dnd
The user is online, but wishes to suppress notifications for the time being.
Definition discordpp.h:928
@ Unknown
Unknown.
Definition discordpp.h:937
@ Invisible
The user is online, but wishes to appear as if they are offline to other users.
Definition discordpp.h:931
@ Offline
The user is offline and not connected to Discord.
Definition discordpp.h:918
@ Streaming
The user is online and is actively streaming content.
Definition discordpp.h:934
@ Idle
The user is online, but has not been active for a while and may be away from their computer.
Definition discordpp.h:925
std::unordered_map< std::string, std::string > StringMap
The string map type used throughout the discordpp API.
Definition discordpp.h:348
StatusDisplayTypes
Controls which Discord RichPresence field is displayed in the user's status.
Definition discordpp.h:424
@ Details
Details.
Definition discordpp.h:433
@ State
State.
Definition discordpp.h:430
@ Name
Name.
Definition discordpp.h:427
ExternalIdentityProviderType
The type of external identity provider.
Definition discordpp.h:884
@ EpicOnlineServices
EpicOnlineServices.
Definition discordpp.h:890
@ OIDC
OIDC.
Definition discordpp.h:887
@ Steam
Steam.
Definition discordpp.h:893
@ None
None.
Definition discordpp.h:902
@ Unity
Unity.
Definition discordpp.h:896
@ Unknown
Unknown.
Definition discordpp.h:905
@ DiscordBot
DiscordBot.
Definition discordpp.h:899
void RunCallbacks()
Definition discordpp.h:35
bool operator==(const SdkAllocator< T > &, const SdkAllocator< U > &) noexcept
SdkAllocator instances always compare equal, since memory from one can be freed by any other.
Definition discordpp.h:122
AudioModeType
Represents whether a voice call is using push to talk or auto voice detection.
Definition discordpp.h:842
@ MODE_PTT
MODE_PTT.
Definition discordpp.h:851
@ MODE_VAD
MODE_VAD.
Definition discordpp.h:848
@ MODE_UNINIT
MODE_UNINIT.
Definition discordpp.h:845
Discord_AllocatorInstallStatus InstallAllocator(const Discord_Allocator &allocator)
Definition discordpp.h:48
ErrorType
Enum representing various types of errors the SDK returns.
Definition discordpp.h:465
@ HTTPError
An HTTP call was made to Discord's servers but a non success HTTP status code was returned....
Definition discordpp.h:480
@ NetworkError
The user is offline or there was some network issue that prevented an underlying HTTP call from succe...
Definition discordpp.h:472
@ AuthorizationFailed
An authorization function failed, but not necessarily as the result of an HTTP call that returned an ...
Definition discordpp.h:514
@ ClientNotReady
An operation such as sending a friend request or joining a lobby was attempted but the Client is not ...
Definition discordpp.h:490
@ None
No error, the operation was successful.
Definition discordpp.h:468
@ Aborted
The user or developer aborted an operation, such as an authorization flow.
Definition discordpp.h:509
@ RPCError
An RPC call was made to Discord's desktop application, but it returned a non-success result....
Definition discordpp.h:519
@ ValidationError
Used when an SDK method is called but the inputs don't pass local validation. For example if one atte...
Definition discordpp.h:506
@ ClientDestroyed
The Client has been destroyed and so this operation cannot complete.
Definition discordpp.h:496
@ Disabled
An operation was temporarily disabled for stability reasons.
Definition discordpp.h:493
std::basic_string< char, std::char_traits< char >, SdkAllocator< char > > SdkString
A string whose storage comes from the SDK's allocation backend.
Definition discordpp.h:135
DiscordObjectState
Represents the memory state of a Discord object.
Definition discordpp.h:25
@ Invalid
The object has been freed.
Definition discordpp.h:27
@ Owned
The object is owned by the C++ wrapper and methods can be called on it.
Definition discordpp.h:29
AdditionalContentType
Represents the type of additional content contained in a message.
Definition discordpp.h:784
@ Sticker
Sticker.
Definition discordpp.h:805
@ VoiceMessage
VoiceMessage.
Definition discordpp.h:796
@ Other
Other.
Definition discordpp.h:787
@ Poll
Poll.
Definition discordpp.h:793
@ Thread
Thread.
Definition discordpp.h:799
@ Attachment
Attachment.
Definition discordpp.h:790
@ Embed
Embed.
Definition discordpp.h:802
std::vector< T > Vector
The vector type used throughout the discordpp API.
Definition discordpp.h:346
ActivityActionTypes
ActivityActionTypes represents the type of invite being sent to a user.
Definition discordpp.h:361
@ Invalid
Invalid.
Definition discordpp.h:364
@ Join
Join.
Definition discordpp.h:367
@ JoinRequest
JoinRequest.
Definition discordpp.h:370
Definition discordpp.h:93
T value_type
The type of object this allocator allocates.
Definition discordpp.h:95
SdkAllocator() noexcept=default
Constructs an allocator. The allocator is stateless, so all instances are interchangeable.
T * allocate(size_t count)
Allocates storage for count objects of type T from the SDK's allocation backend.
Definition discordpp.h:106
void deallocate(T *ptr, size_t) noexcept
Returns storage obtained from allocate to the SDK's allocation backend.
Definition discordpp.h:117
Hashes an SdkString by its contents.
Definition discordpp.h:142
size_t operator()(const SdkString &value) const noexcept
Returns the hash of the string's characters.
Definition discordpp.h:144