Discord Social SDK
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
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 <cstring>
8#include <functional>
9#include <memory>
10#include <optional>
11#include <string>
12#include <unordered_map>
13#include <vector>
14
16namespace discordpp {
17
25
29inline void RunCallbacks()
30{
31 Discord_RunCallbacks();
32}
33
42
44 Join = 1,
45
48};
49
52
60
65 Public = 1,
66};
67
74enum class ActivityTypes {
75
78
81
84
87
90
93
96};
97
100
103
105 Xbox = 2,
106
109
111 IOS = 8,
112
115
118
120 PS4 = 64,
121
123 PS5 = 128,
124};
125
127enum class ErrorType {
128
130 None = 0,
131
135
143
153
156
159
169
172
177
182};
183
189enum class HttpStatusCode {
190
192 None = 0,
193
195 Continue = 100,
196
199
202
205
207 Ok = 200,
208
210 Created = 201,
211
213 Accepted = 202,
214
217
220
223
226
229
232
234 ImUsed = 209,
235
238
241
243 Found = 302,
244
246 SeeOther = 303,
247
250
253
256
259
262
265
268
270 NotFound = 404,
271
274
277
280
283
285 Conflict = 409,
286
288 Gone = 410,
289
292
295
298
301
304
307
310
313
316
318 Locked = 423,
319
322
324 TooEarly = 425,
325
328
331
334
337
340
343
346
349
352
355
358
361
364
367
370};
371
376
378 S256 = 0,
379};
380
382enum class IntegrationType {
383
386
389};
390
393
395 Other = 0,
396
399
401 Poll = 2,
402
405
408
410 Embed = 5,
411
414};
415
417enum class AudioSystem {
418
421
423 Game = 1,
424};
425
427enum class AudioModeType {
428
431
434
437};
438
442enum class ChannelType {
443
446
448 Dm = 1,
449
452
455
458
461
464
467
470
473
476
479
482
485
487 Lobby = 17,
488
491};
492
495
497 None = 0,
498
501
505
510
514
517
520};
521
526enum class StatusType {
527
530
533
536
539 Idle = 3,
540
542 Dnd = 4,
543
546
549
552};
553
566
570
572 User = 0,
573
576};
577
597
599enum class LoggingSeverity {
600
603
605 Info = 2,
606
609
611 Error = 4,
612
614 None = 5,
615};
616
630class ActivityInvite;
631class ActivityAssets;
632class ActivityTimestamps;
633class ActivityParty;
634class ActivitySecrets;
635class ActivityButton;
636class Activity;
637class ClientResult;
638class AuthorizationCodeChallenge;
639class AuthorizationCodeVerifier;
640class AuthorizationArgs;
641class DeviceAuthorizationArgs;
642class VoiceStateHandle;
643class VADThresholdSettings;
644class Call;
645class ChannelHandle;
646class GuildMinimal;
647class GuildChannel;
648class LinkedLobby;
649class LinkedChannel;
650class RelationshipHandle;
651class UserHandle;
652class LobbyMemberHandle;
653class LobbyHandle;
654class AdditionalContent;
655class MessageHandle;
656class AudioDevice;
657class ClientCreateOptions;
658class Client;
659class CallInfoHandle;
660
666 mutable Discord_ActivityInvite instance_{};
669
670public:
672 Discord_ActivityInvite* instance() const { return &instance_; }
675 explicit ActivityInvite(Discord_ActivityInvite instance, DiscordObjectState state);
685 operator bool() const { return state_ != DiscordObjectState::Invalid; }
686
691
692 explicit ActivityInvite();
693
695 void Drop();
697
699 uint64_t SenderId() const;
701 void SetSenderId(uint64_t SenderId);
702
704 uint64_t ChannelId() const;
706 void SetChannelId(uint64_t ChannelId);
707
709 uint64_t MessageId() const;
711 void SetMessageId(uint64_t MessageId);
712
717
719 uint64_t ApplicationId() const;
722
725 uint64_t ParentApplicationId() const;
728
730 std::string PartyId() const;
732 void SetPartyId(std::string PartyId);
733
735 std::string SessionId() const;
737 void SetSessionId(std::string SessionId);
738
741 bool IsValid() const;
743 void SetIsValid(bool IsValid);
744};
745
764 mutable Discord_ActivityAssets instance_{};
767
768public:
770 Discord_ActivityAssets* instance() const { return &instance_; }
773 explicit ActivityAssets(Discord_ActivityAssets instance, DiscordObjectState state);
783 operator bool() const { return state_ != DiscordObjectState::Invalid; }
784
789
790 explicit ActivityAssets();
791
793 void Drop();
795
800 std::optional<std::string> LargeImage() const;
802 void SetLargeImage(std::optional<std::string> LargeImage);
803
807 std::optional<std::string> LargeText() const;
809 void SetLargeText(std::optional<std::string> LargeText);
810
814 std::optional<std::string> SmallImage() const;
816 void SetSmallImage(std::optional<std::string> SmallImage);
817
821 std::optional<std::string> SmallText() const;
823 void SetSmallText(std::optional<std::string> SmallText);
824};
825
829 mutable Discord_ActivityTimestamps instance_{};
832
833public:
835 Discord_ActivityTimestamps* instance() const { return &instance_; }
838 explicit ActivityTimestamps(Discord_ActivityTimestamps instance, DiscordObjectState state);
848 operator bool() const { return state_ != DiscordObjectState::Invalid; }
849
854
855 explicit ActivityTimestamps();
856
858 void Drop();
860
866 uint64_t Start() const;
868 void SetStart(uint64_t Start);
869
875 uint64_t End() const;
877 void SetEnd(uint64_t End);
878};
879
883 mutable Discord_ActivityParty instance_{};
886
887public:
889 Discord_ActivityParty* instance() const { return &instance_; }
892 explicit ActivityParty(Discord_ActivityParty instance, DiscordObjectState state);
896 ActivityParty(ActivityParty&& other) noexcept;
900 static const ActivityParty nullobj;
902 operator bool() const { return state_ != DiscordObjectState::Invalid; }
903
908
909 explicit ActivityParty();
910
912 void Drop();
914
921 std::string Id() const;
923 void SetId(std::string Id);
924
926 int32_t CurrentSize() const;
929
932 int32_t MaxSize() const;
934 void SetMaxSize(int32_t MaxSize);
935
940};
941
945 mutable Discord_ActivitySecrets instance_{};
948
949public:
951 Discord_ActivitySecrets* instance() const { return &instance_; }
954 explicit ActivitySecrets(Discord_ActivitySecrets instance, DiscordObjectState state);
964 operator bool() const { return state_ != DiscordObjectState::Invalid; }
965
970
971 explicit ActivitySecrets();
972
974 void Drop();
976
981 std::string Join() const;
983 void SetJoin(std::string Join);
984};
985
989 mutable Discord_ActivityButton instance_{};
992
993public:
995 Discord_ActivityButton* instance() const { return &instance_; }
998 explicit ActivityButton(Discord_ActivityButton instance, DiscordObjectState state);
1008 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1009
1014
1015 explicit ActivityButton();
1016
1018 void Drop();
1020
1022 std::string Label() const;
1024 void SetLabel(std::string Label);
1025
1027 std::string Url() const;
1029 void SetUrl(std::string Url);
1030};
1031
1214 mutable Discord_Activity instance_{};
1217
1218public:
1220 Discord_Activity* instance() const { return &instance_; }
1223 explicit Activity(Discord_Activity instance, DiscordObjectState state);
1224 ~Activity();
1227 Activity(Activity&& other) noexcept;
1229 Activity& operator=(Activity&& other) noexcept;
1231 static const Activity nullobj;
1233 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1234
1236 Activity(const Activity& arg0);
1239
1240 explicit Activity();
1241
1243 void Drop();
1245
1248
1250 bool Equals(discordpp::Activity other) const;
1251
1253 std::vector<discordpp::ActivityButton> GetButtons() const;
1254
1258 std::string Name() const;
1260 void SetName(std::string Name);
1261
1268
1273 std::optional<std::string> State() const;
1275 void SetState(std::optional<std::string> State);
1276
1281 std::optional<std::string> Details() const;
1283 void SetDetails(std::optional<std::string> Details);
1284
1289 std::optional<uint64_t> ApplicationId() const;
1291 void SetApplicationId(std::optional<uint64_t> ApplicationId);
1292
1298 std::optional<uint64_t> ParentApplicationId() const;
1300 void SetParentApplicationId(std::optional<uint64_t> ParentApplicationId);
1301
1303 std::optional<discordpp::ActivityAssets> Assets() const;
1305 void SetAssets(std::optional<discordpp::ActivityAssets> Assets);
1306
1310 std::optional<discordpp::ActivityTimestamps> Timestamps() const;
1312 void SetTimestamps(std::optional<discordpp::ActivityTimestamps> Timestamps);
1313
1316 std::optional<discordpp::ActivityParty> Party() const;
1318 void SetParty(std::optional<discordpp::ActivityParty> Party);
1319
1322 std::optional<discordpp::ActivitySecrets> Secrets() const;
1324 void SetSecrets(std::optional<discordpp::ActivitySecrets> Secrets);
1325
1334};
1335
1347 mutable Discord_ClientResult instance_{};
1350
1351public:
1353 Discord_ClientResult* instance() const { return &instance_; }
1356 explicit ClientResult(Discord_ClientResult instance, DiscordObjectState state);
1357 ~ClientResult();
1360 ClientResult(ClientResult&& other) noexcept;
1364 static const ClientResult nullobj;
1366 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1367
1372
1374 void Drop();
1376
1378 std::string ToString() const;
1379
1384
1386 std::string Error() const;
1388 void SetError(std::string Error);
1389
1398 int32_t ErrorCode() const;
1401
1408
1416 std::string ResponseBody() const;
1419
1421 bool Successful() const;
1424
1426 bool Retryable() const;
1429
1432 float RetryAfter() const;
1435};
1436
1440 mutable Discord_AuthorizationCodeChallenge instance_{};
1443
1444public:
1446 Discord_AuthorizationCodeChallenge* instance() const { return &instance_; }
1449 explicit AuthorizationCodeChallenge(Discord_AuthorizationCodeChallenge instance,
1450 DiscordObjectState state);
1460 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1461
1466
1467 explicit AuthorizationCodeChallenge();
1468
1470 void Drop();
1472
1477
1479 std::string Challenge() const;
1481 void SetChallenge(std::string Challenge);
1482};
1483
1487 mutable Discord_AuthorizationCodeVerifier instance_{};
1490
1491public:
1493 Discord_AuthorizationCodeVerifier* instance() const { return &instance_; }
1496 explicit AuthorizationCodeVerifier(Discord_AuthorizationCodeVerifier instance,
1497 DiscordObjectState state);
1507 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1508
1513
1515 void Drop();
1517
1522
1524 std::string Verifier() const;
1526 void SetVerifier(std::string Verifier);
1527};
1528
1532 mutable Discord_AuthorizationArgs instance_{};
1535
1536public:
1538 Discord_AuthorizationArgs* instance() const { return &instance_; }
1541 explicit AuthorizationArgs(Discord_AuthorizationArgs instance, DiscordObjectState state);
1551 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1552
1557
1558 explicit AuthorizationArgs();
1559
1561 void Drop();
1563
1566 uint64_t ClientId() const;
1568 void SetClientId(uint64_t ClientId);
1569
1582 std::string Scopes() const;
1584 void SetScopes(std::string Scopes);
1585
1591 std::optional<std::string> State() const;
1593 void SetState(std::optional<std::string> State);
1594
1599 std::optional<std::string> Nonce() const;
1601 void SetNonce(std::optional<std::string> Nonce);
1602
1608 std::optional<discordpp::AuthorizationCodeChallenge> CodeChallenge() const;
1610 void SetCodeChallenge(std::optional<discordpp::AuthorizationCodeChallenge> CodeChallenge);
1611
1615 std::optional<discordpp::IntegrationType> IntegrationType() const;
1617 void SetIntegrationType(std::optional<discordpp::IntegrationType> IntegrationType);
1618};
1619
1623 mutable Discord_DeviceAuthorizationArgs instance_{};
1626
1627public:
1629 Discord_DeviceAuthorizationArgs* instance() const { return &instance_; }
1632 explicit DeviceAuthorizationArgs(Discord_DeviceAuthorizationArgs instance,
1633 DiscordObjectState state);
1643 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1644
1649
1650 explicit DeviceAuthorizationArgs();
1651
1653 void Drop();
1655
1658 uint64_t ClientId() const;
1660 void SetClientId(uint64_t ClientId);
1661
1674 std::string Scopes() const;
1676 void SetScopes(std::string Scopes);
1677};
1678
1691 mutable Discord_VoiceStateHandle instance_{};
1694
1695public:
1697 Discord_VoiceStateHandle* instance() const { return &instance_; }
1700 explicit VoiceStateHandle(Discord_VoiceStateHandle instance, DiscordObjectState state);
1710 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1711
1716
1718 void Drop();
1720
1723 bool SelfDeaf() const;
1724
1727 bool SelfMute() const;
1728};
1729
1733 mutable Discord_VADThresholdSettings instance_{};
1736
1737public:
1739 Discord_VADThresholdSettings* instance() const { return &instance_; }
1742 explicit VADThresholdSettings(Discord_VADThresholdSettings instance, DiscordObjectState state);
1752 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1753
1756
1758 void Drop();
1760
1763 float VadThreshold() const;
1766
1769 bool Automatic() const;
1772};
1773
1775class Call {
1777 mutable Discord_Call instance_{};
1780
1781public:
1803
1805 enum class Status {
1806
1809
1812
1815
1818
1821
1824
1827 };
1828
1830 using OnVoiceStateChanged = std::function<void(uint64_t userId)>;
1831
1833 using OnParticipantChanged = std::function<void(uint64_t userId, bool added)>;
1834
1836 using OnSpeakingStatusChanged = std::function<void(uint64_t userId, bool isPlayingSound)>;
1837
1839 using OnStatusChanged = std::function<
1840 void(discordpp::Call::Status status, discordpp::Call::Error error, int32_t errorDetail)>;
1842 Discord_Call* instance() const { return &instance_; }
1845 explicit Call(Discord_Call instance, DiscordObjectState state);
1846 ~Call();
1849 Call(Call&& other) noexcept;
1851 Call& operator=(Call&& other) noexcept;
1853 static const Call nullobj;
1855 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1856
1858 Call(const Call& other);
1860 Call& operator=(const Call& other);
1861
1863 void Drop();
1865
1867 static std::string ErrorToString(discordpp::Call::Error type);
1868
1872
1874 uint64_t GetChannelId() const;
1875
1877 uint64_t GetGuildId() const;
1878
1880 bool GetLocalMute(uint64_t userId);
1881
1883 std::vector<uint64_t> GetParticipants() const;
1884
1889 float GetParticipantVolume(uint64_t userId);
1890
1894
1898
1901
1904
1909
1913
1919 std::optional<discordpp::VoiceStateHandle> GetVoiceStateHandle(uint64_t userId) const;
1920
1927
1931 void SetLocalMute(uint64_t userId, bool mute);
1932
1940
1943
1948 void SetParticipantVolume(uint64_t userId, float volume);
1949
1953 void SetPTTActive(bool active);
1954
1959 void SetPTTReleaseDelay(uint32_t releaseDelayMs);
1960
1964 void SetSelfDeaf(bool deaf);
1965
1968 void SetSelfMute(bool mute);
1969
1976
1980
1987 void SetVADThreshold(bool automatic, float threshold);
1988
1990 static std::string StatusToString(discordpp::Call::Status type);
1991};
1992
2004 mutable Discord_ChannelHandle instance_{};
2007
2008public:
2010 Discord_ChannelHandle* instance() const { return &instance_; }
2013 explicit ChannelHandle(Discord_ChannelHandle instance, DiscordObjectState state);
2017 ChannelHandle(ChannelHandle&& other) noexcept;
2023 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2024
2029
2031 void Drop();
2033
2035 uint64_t Id() const;
2036
2041 std::string Name() const;
2042
2045 std::vector<uint64_t> Recipients() const;
2046
2049};
2050
2055 mutable Discord_GuildMinimal instance_{};
2058
2059public:
2061 Discord_GuildMinimal* instance() const { return &instance_; }
2064 explicit GuildMinimal(Discord_GuildMinimal instance, DiscordObjectState state);
2065 ~GuildMinimal();
2068 GuildMinimal(GuildMinimal&& other) noexcept;
2072 static const GuildMinimal nullobj;
2074 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2075
2080
2082 void Drop();
2084
2086 uint64_t Id() const;
2088 void SetId(uint64_t Id);
2089
2091 std::string Name() const;
2093 void SetName(std::string Name);
2094};
2095
2100 mutable Discord_GuildChannel instance_{};
2103
2104public:
2106 Discord_GuildChannel* instance() const { return &instance_; }
2109 explicit GuildChannel(Discord_GuildChannel instance, DiscordObjectState state);
2110 ~GuildChannel();
2113 GuildChannel(GuildChannel&& other) noexcept;
2117 static const GuildChannel nullobj;
2119 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2120
2125
2127 void Drop();
2129
2131 uint64_t Id() const;
2133 void SetId(uint64_t Id);
2134
2136 std::string Name() const;
2138 void SetName(std::string Name);
2139
2150 bool IsLinkable() const;
2153
2170
2173 std::optional<discordpp::LinkedLobby> LinkedLobby() const;
2175 void SetLinkedLobby(std::optional<discordpp::LinkedLobby> LinkedLobby);
2176};
2177
2181 mutable Discord_LinkedLobby instance_{};
2184
2185public:
2187 Discord_LinkedLobby* instance() const { return &instance_; }
2190 explicit LinkedLobby(Discord_LinkedLobby instance, DiscordObjectState state);
2191 ~LinkedLobby();
2194 LinkedLobby(LinkedLobby&& other) noexcept;
2198 static const LinkedLobby nullobj;
2200 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2201
2206
2207 explicit LinkedLobby();
2208
2210 void Drop();
2212
2214 uint64_t ApplicationId() const;
2217
2219 uint64_t LobbyId() const;
2221 void SetLobbyId(uint64_t LobbyId);
2222};
2223
2227 mutable Discord_LinkedChannel instance_{};
2230
2231public:
2233 Discord_LinkedChannel* instance() const { return &instance_; }
2236 explicit LinkedChannel(Discord_LinkedChannel instance, DiscordObjectState state);
2240 LinkedChannel(LinkedChannel&& other) noexcept;
2246 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2247
2252
2254 void Drop();
2256
2258 uint64_t Id() const;
2260 void SetId(uint64_t Id);
2261
2263 std::string Name() const;
2265 void SetName(std::string Name);
2266
2268 uint64_t GuildId() const;
2270 void SetGuildId(uint64_t GuildId);
2271};
2272
2309 mutable Discord_RelationshipHandle instance_{};
2312
2313public:
2315 Discord_RelationshipHandle* instance() const { return &instance_; }
2318 explicit RelationshipHandle(Discord_RelationshipHandle instance, DiscordObjectState state);
2328 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2329
2334
2336 void Drop();
2338
2341
2344
2346 uint64_t Id() const;
2347
2349 bool IsSpamRequest() const;
2350
2353 std::optional<discordpp::UserHandle> User() const;
2354};
2355
2368 mutable Discord_UserHandle instance_{};
2371
2372public:
2374 enum class AvatarType {
2375
2377 Gif = 0,
2378
2380 Webp = 1,
2381
2383 Png = 2,
2384
2386 Jpeg = 3,
2387 };
2388
2389 Discord_UserHandle* instance() const { return &instance_; }
2392 explicit UserHandle(Discord_UserHandle instance, DiscordObjectState state);
2393 ~UserHandle();
2396 UserHandle(UserHandle&& other) noexcept;
2398 UserHandle& operator=(UserHandle&& other) noexcept;
2400 static const UserHandle nullobj;
2402 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2403
2408
2410 void Drop();
2412
2414 std::optional<std::string> Avatar() const;
2415
2418
2424 discordpp::UserHandle::AvatarType staticType) const;
2425
2428 std::string DisplayName() const;
2429
2439 std::optional<discordpp::Activity> GameActivity() const;
2440
2449 std::optional<std::string> GlobalName() const;
2450
2454 uint64_t Id() const;
2455
2457 bool IsProvisional() const;
2458
2462
2465
2472 std::string Username() const;
2473};
2474
2493 mutable Discord_LobbyMemberHandle instance_{};
2496
2497public:
2499 Discord_LobbyMemberHandle* instance() const { return &instance_; }
2502 explicit LobbyMemberHandle(Discord_LobbyMemberHandle instance, DiscordObjectState state);
2512 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2513
2518
2520 void Drop();
2522
2529 bool CanLinkLobby() const;
2530
2532 bool Connected() const;
2533
2535 uint64_t Id() const;
2536
2542 std::unordered_map<std::string, std::string> Metadata() const;
2543
2545 std::optional<discordpp::UserHandle> User() const;
2546};
2547
2636 mutable Discord_LobbyHandle instance_{};
2639
2640public:
2642 Discord_LobbyHandle* instance() const { return &instance_; }
2645 explicit LobbyHandle(Discord_LobbyHandle instance, DiscordObjectState state);
2646 ~LobbyHandle();
2649 LobbyHandle(LobbyHandle&& other) noexcept;
2653 static const LobbyHandle nullobj;
2655 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2656
2661
2663 void Drop();
2665
2671 std::optional<discordpp::CallInfoHandle> GetCallInfoHandle() const;
2672
2675 std::optional<discordpp::LobbyMemberHandle> GetLobbyMemberHandle(uint64_t memberId) const;
2676
2678 uint64_t Id() const;
2679
2681 std::optional<discordpp::LinkedChannel> LinkedChannel() const;
2682
2684 std::vector<uint64_t> LobbyMemberIds() const;
2685
2687 std::vector<discordpp::LobbyMemberHandle> LobbyMembers() const;
2688
2693 std::unordered_map<std::string, std::string> Metadata() const;
2694};
2695
2700 mutable Discord_AdditionalContent instance_{};
2703
2704public:
2706 Discord_AdditionalContent* instance() const { return &instance_; }
2709 explicit AdditionalContent(Discord_AdditionalContent instance, DiscordObjectState state);
2719 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2720
2725
2726 explicit AdditionalContent();
2727
2729 void Drop();
2731
2734
2737
2742
2745 std::optional<std::string> Title() const;
2747 void SetTitle(std::optional<std::string> Title);
2748
2751 uint8_t Count() const;
2753 void SetCount(uint8_t Count);
2754};
2755
2812 mutable Discord_MessageHandle instance_{};
2815
2816public:
2818 Discord_MessageHandle* instance() const { return &instance_; }
2821 explicit MessageHandle(Discord_MessageHandle instance, DiscordObjectState state);
2825 MessageHandle(MessageHandle&& other) noexcept;
2831 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2832
2837
2839 void Drop();
2841
2844 std::optional<discordpp::AdditionalContent> AdditionalContent() const;
2845
2852 std::optional<uint64_t> ApplicationId() const;
2853
2855 std::optional<discordpp::UserHandle> Author() const;
2856
2858 uint64_t AuthorId() const;
2859
2861 std::optional<discordpp::ChannelHandle> Channel() const;
2862
2864 uint64_t ChannelId() const;
2865
2871 std::string Content() const;
2872
2875 std::optional<discordpp::DisclosureTypes> DisclosureType() const;
2876
2880 uint64_t EditedTimestamp() const;
2881
2883 uint64_t Id() const;
2884
2886 std::optional<discordpp::LobbyHandle> Lobby() const;
2887
2893 std::unordered_map<std::string, std::string> Metadata() const;
2894
2900 std::string RawContent() const;
2901
2904 std::optional<discordpp::UserHandle> Recipient() const;
2905
2908 uint64_t RecipientId() const;
2909
2913 bool SentFromGame() const;
2914
2916 uint64_t SentTimestamp() const;
2917};
2918
2925 mutable Discord_AudioDevice instance_{};
2928
2929public:
2931 Discord_AudioDevice* instance() const { return &instance_; }
2934 explicit AudioDevice(Discord_AudioDevice instance, DiscordObjectState state);
2935 ~AudioDevice();
2938 AudioDevice(AudioDevice&& other) noexcept;
2942 static const AudioDevice nullobj;
2944 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2945
2950
2952 void Drop();
2954
2957
2959 std::string Id() const;
2961 void SetId(std::string Id);
2962
2964 std::string Name() const;
2966 void SetName(std::string Name);
2967
2969 bool IsDefault() const;
2972};
2973
2979 mutable Discord_ClientCreateOptions instance_{};
2982
2983public:
2985 Discord_ClientCreateOptions* instance() const { return &instance_; }
2988 explicit ClientCreateOptions(Discord_ClientCreateOptions instance, DiscordObjectState state);
2998 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2999
3004
3005 explicit ClientCreateOptions();
3006
3008 void Drop();
3010
3012 std::string WebBase() const;
3014 void SetWebBase(std::string WebBase);
3015
3017 std::string ApiBase() const;
3019 void SetApiBase(std::string ApiBase);
3020
3033};
3034
3039class Client {
3041 mutable Discord_Client instance_{};
3044
3045public:
3053 enum class Error {
3054
3056 None = 0,
3057
3060
3063
3066 };
3067
3082 enum class Status {
3083
3086
3089
3092
3095
3098
3101
3104 };
3105
3107 enum class Thread {
3108
3111
3114
3117 };
3118
3120 using EndCallCallback = std::function<void()>;
3121
3123 using EndCallsCallback = std::function<void()>;
3124
3126 using GetCurrentInputDeviceCallback = std::function<void(discordpp::AudioDevice device)>;
3127
3129 using GetCurrentOutputDeviceCallback = std::function<void(discordpp::AudioDevice device)>;
3130
3133 std::function<void(std::vector<discordpp::AudioDevice> devices)>;
3134
3137 std::function<void(std::vector<discordpp::AudioDevice> devices)>;
3138
3141 std::function<void(std::vector<discordpp::AudioDevice> inputDevices,
3142 std::vector<discordpp::AudioDevice> outputDevices)>;
3143
3145 using SetInputDeviceCallback = std::function<void(discordpp::ClientResult result)>;
3146
3148 using NoAudioInputCallback = std::function<void(bool inputDetected)>;
3149
3151 using SetOutputDeviceCallback = std::function<void(discordpp::ClientResult result)>;
3152
3155 std::function<void(uint64_t lobbyId, uint64_t memberId, bool added)>;
3156
3160 using UserAudioReceivedCallback = std::function<void(uint64_t userId,
3161 int16_t* data,
3162 uint64_t samplesPerChannel,
3163 int32_t sampleRate,
3164 uint64_t channels,
3165 bool& outShouldMute)>;
3166
3170 using UserAudioCapturedCallback = std::function<
3171 void(int16_t* data, uint64_t samplesPerChannel, int32_t sampleRate, uint64_t channels)>;
3172
3179 using AuthorizationCallback = std::function<
3180 void(discordpp::ClientResult result, std::string code, std::string redirectUri)>;
3181
3184 std::function<void(discordpp::ClientResult result,
3185 std::string accessToken,
3187 int32_t expiresIn,
3188 std::string scopes)>;
3189
3192 std::function<void(discordpp::ClientResult result, uint64_t id, std::string name)>;
3193
3195 using TokenExchangeCallback = std::function<void(discordpp::ClientResult result,
3196 std::string accessToken,
3197 std::string refreshToken,
3199 int32_t expiresIn,
3200 std::string scopes)>;
3201
3203 using RevokeTokenCallback = std::function<void(discordpp::ClientResult result)>;
3204
3206 using AuthorizeDeviceScreenClosedCallback = std::function<void()>;
3207
3209 using TokenExpirationCallback = std::function<void()>;
3210
3213 std::function<void(discordpp::ClientResult result)>;
3214
3217 std::function<void(discordpp::ClientResult result)>;
3218
3221 using UpdateTokenCallback = std::function<void(discordpp::ClientResult result)>;
3222
3224 using DeleteUserMessageCallback = std::function<void(discordpp::ClientResult result)>;
3225
3227 using EditUserMessageCallback = std::function<void(discordpp::ClientResult result)>;
3228
3231 std::function<void(discordpp::ClientResult result,
3232 std::vector<discordpp::MessageHandle> messages)>;
3233
3235 using ProvisionalUserMergeRequiredCallback = std::function<void()>;
3236
3238 using OpenMessageInDiscordCallback = std::function<void(discordpp::ClientResult result)>;
3239
3244 std::function<void(discordpp::ClientResult result, uint64_t messageId)>;
3245
3247 using MessageCreatedCallback = std::function<void(uint64_t messageId)>;
3248
3250 using MessageDeletedCallback = std::function<void(uint64_t messageId, uint64_t channelId)>;
3251
3253 using MessageUpdatedCallback = std::function<void(uint64_t messageId)>;
3254
3257 std::function<void(std::string message, discordpp::LoggingSeverity severity)>;
3258
3261 std::function<void(discordpp::ClientResult result)>;
3262
3267 using OnStatusChanged = std::function<
3268 void(discordpp::Client::Status status, discordpp::Client::Error error, int32_t errorDetail)>;
3269
3272 std::function<void(discordpp::ClientResult result, uint64_t lobbyId)>;
3273
3276 std::function<void(discordpp::ClientResult result,
3277 std::vector<discordpp::GuildChannel> guildChannels)>;
3278
3280 using GetUserGuildsCallback = std::function<void(discordpp::ClientResult result,
3281 std::vector<discordpp::GuildMinimal> guilds)>;
3282
3284 using LeaveLobbyCallback = std::function<void(discordpp::ClientResult result)>;
3285
3287 using LinkOrUnlinkChannelCallback = std::function<void(discordpp::ClientResult result)>;
3288
3290 using LobbyCreatedCallback = std::function<void(uint64_t lobbyId)>;
3291
3293 using LobbyDeletedCallback = std::function<void(uint64_t lobbyId)>;
3294
3296 using LobbyMemberAddedCallback = std::function<void(uint64_t lobbyId, uint64_t memberId)>;
3297
3299 using LobbyMemberRemovedCallback = std::function<void(uint64_t lobbyId, uint64_t memberId)>;
3300
3302 using LobbyMemberUpdatedCallback = std::function<void(uint64_t lobbyId, uint64_t memberId)>;
3303
3305 using LobbyUpdatedCallback = std::function<void(uint64_t lobbyId)>;
3306
3309 std::function<void(discordpp::ClientResult result, std::string joinSecret)>;
3310
3313 using SendActivityInviteCallback = std::function<void(discordpp::ClientResult result)>;
3314
3317 using ActivityInviteCallback = std::function<void(discordpp::ActivityInvite invite)>;
3318
3320 using ActivityJoinCallback = std::function<void(std::string joinSecret)>;
3321
3323 using UpdateStatusCallback = std::function<void(discordpp::ClientResult result)>;
3324
3326 using UpdateRichPresenceCallback = std::function<void(discordpp::ClientResult result)>;
3327
3330 using UpdateRelationshipCallback = std::function<void(discordpp::ClientResult result)>;
3331
3334 using SendFriendRequestCallback = std::function<void(discordpp::ClientResult result)>;
3335
3341 std::function<void(uint64_t userId, bool isDiscordRelationshipUpdate)>;
3342
3348 std::function<void(uint64_t userId, bool isDiscordRelationshipUpdate)>;
3349
3352 std::function<void(discordpp::ClientResult result,
3353 std::optional<discordpp::UserHandle> user)>;
3354
3356 using RelationshipGroupsUpdatedCallback = std::function<void(uint64_t userId)>;
3357
3359 using UserUpdatedCallback = std::function<void(uint64_t userId)>;
3361 Discord_Client* instance() const { return &instance_; }
3364 explicit Client(Discord_Client instance, DiscordObjectState state);
3365 ~Client();
3368 Client(Client&& other) noexcept;
3370 Client& operator=(Client&& other) noexcept;
3372 static const Client nullobj;
3374 operator bool() const { return state_ != DiscordObjectState::Invalid; }
3375
3376 Client(const Client&) = delete;
3377 Client& operator=(const Client&) = delete;
3378
3380 explicit Client();
3381
3383 explicit Client(std::string apiBase, std::string webBase);
3384
3387
3389 void Drop();
3391
3393 static std::string ErrorToString(discordpp::Client::Error type);
3394
3400
3403 static std::string GetDefaultAudioDeviceId();
3404
3419 static std::string GetDefaultCommunicationScopes();
3420
3431 static std::string GetDefaultPresenceScopes();
3432
3434 static std::string GetVersionHash();
3435
3437 static int32_t GetVersionMajor();
3438
3440 static int32_t GetVersionMinor();
3441
3443 static int32_t GetVersionPatch();
3444
3446 void SetHttpRequestTimeout(int32_t httpTimeoutInMilliseconds);
3447
3450
3453
3456
3459 void EndCall(uint64_t channelId, discordpp::Client::EndCallCallback callback);
3460
3464
3466 discordpp::Call GetCall(uint64_t channelId);
3467
3469 std::vector<discordpp::Call> GetCalls();
3470
3473
3476
3479
3485
3488
3494
3496 bool GetSelfDeafAll() const;
3497
3499 bool GetSelfMuteAll() const;
3500
3505 void SetAecDump(bool on);
3506
3515
3519
3526 void SetEchoCancellation(bool on);
3527
3538 void SetEngineManagedAudioSession(bool isEngineManaged);
3539
3544
3549 void SetInputVolume(float inputVolume);
3550
3554
3563 void SetNoAudioInputThreshold(float dBFSThreshold);
3564
3571 void SetNoiseSuppression(bool on);
3572
3579 void SetOpusHardwareCoding(bool encode, bool decode);
3580
3585
3590 void SetOutputVolume(float outputVolume);
3591
3596 void SetSelfDeafAll(bool deaf);
3597
3600 void SetSelfMuteAll(bool mute);
3601
3605 [[deprecated("Calling Client::SetSpeakerMode is DEPRECATED.")]]
3606 bool SetSpeakerMode(bool speakerMode);
3607
3614 void SetThreadPriority(discordpp::Client::Thread thread, int32_t priority);
3615
3622
3625
3636 discordpp::Call StartCall(uint64_t channelId);
3637
3657 uint64_t lobbyId,
3661
3664
3670
3673
3769
3776
3782
3798 void ExchangeChildToken(std::string const& parentApplicationToken,
3799 uint64_t childApplicationId,
3801
3808 std::string const& token,
3810
3844 void GetProvisionalToken(uint64_t applicationId,
3846 std::string const& externalAuthToken,
3848
3872 void GetToken(uint64_t applicationId,
3873 std::string const& code,
3874 std::string const& codeVerifier,
3875 std::string const& redirectUri,
3877
3905
3945 std::string const& externalAuthToken,
3947
3978 void GetTokenFromProvisionalMerge(uint64_t applicationId,
3979 std::string const& code,
3980 std::string const& codeVerifier,
3981 std::string const& redirectUri,
3983 std::string const& externalAuthToken,
3985
3989
3994 void OpenAuthorizeDeviceScreen(uint64_t clientId, std::string const& userCode);
3995
4003
4018 void RefreshToken(uint64_t applicationId,
4019 std::string const& refreshToken,
4021
4034 void RevokeToken(uint64_t applicationId,
4035 std::string const& token,
4037
4042
4048 void SetGameWindowPid(int32_t pid);
4049
4063
4081 uint64_t applicationId,
4083 std::string const& externalAuthToken,
4085
4092 std::string const& name,
4094
4102 std::string token,
4105
4108
4114 bool CanOpenMessageInDiscord(uint64_t messageId);
4115
4117 void DeleteUserMessage(uint64_t recipientId,
4118 uint64_t messageId,
4120
4124 void EditUserMessage(uint64_t recipientId,
4125 uint64_t messageId,
4126 std::string const& content,
4128
4135 std::optional<discordpp::ChannelHandle> GetChannelHandle(uint64_t channelId) const;
4136
4148 void GetLobbyMessagesWithLimit(uint64_t lobbyId,
4149 int32_t limit,
4151
4156 std::optional<discordpp::MessageHandle> GetMessageHandle(uint64_t messageId) const;
4157
4164 uint64_t messageId,
4165 discordpp::Client::ProvisionalUserMergeRequiredCallback provisionalUserMergeRequiredCallback,
4167
4178 void SendLobbyMessage(uint64_t lobbyId,
4179 std::string const& content,
4181
4188 void SendLobbyMessageWithMetadata(uint64_t lobbyId,
4189 std::string const& content,
4190 std::unordered_map<std::string, std::string> const& metadata,
4192
4205 void SendUserMessage(uint64_t recipientId,
4206 std::string const& content,
4208
4215 void SendUserMessageWithMetadata(uint64_t recipientId,
4216 std::string const& content,
4217 std::unordered_map<std::string, std::string> const& metadata,
4219
4232
4240
4248
4259 void SetShowingChat(bool showingChat);
4261
4264
4275 discordpp::LoggingSeverity minSeverity);
4276
4283 discordpp::LoggingSeverity minSeverity);
4284
4291 void Connect();
4292
4299
4303
4313
4318 void SetApplicationId(uint64_t applicationId);
4319
4334 bool SetLogDir(std::string const& path, discordpp::LoggingSeverity minSeverity);
4335
4338
4351 void SetVoiceLogDir(std::string const& path, discordpp::LoggingSeverity minSeverity);
4353
4356
4374 void CreateOrJoinLobby(std::string const& secret,
4376
4384 std::string const& secret,
4385 std::unordered_map<std::string, std::string> const& lobbyMetadata,
4386 std::unordered_map<std::string, std::string> const& memberMetadata,
4388
4395
4397 std::optional<discordpp::LobbyHandle> GetLobbyHandle(uint64_t lobbyId) const;
4398
4404 std::vector<uint64_t> GetLobbyIds() const;
4405
4413
4420 void LeaveLobby(uint64_t lobbyId, discordpp::Client::LeaveLobbyCallback callback);
4421
4426 void LinkChannelToLobby(uint64_t lobbyId,
4427 uint64_t channelId,
4429
4442
4453
4462
4471
4478
4482
4488 void UnlinkChannelFromLobby(uint64_t lobbyId,
4491
4494
4502
4505
4525 bool RegisterLaunchCommand(uint64_t applicationId, std::string command);
4526
4533 bool RegisterLaunchSteamApplication(uint64_t applicationId, uint32_t steamAppId);
4534
4545 void SendActivityInvite(uint64_t userId,
4546 std::string const& content,
4548
4556
4562
4572
4579
4587
4591
4611
4614
4620 void AcceptDiscordFriendRequest(uint64_t userId,
4622
4628
4636
4642 void CancelDiscordFriendRequest(uint64_t userId,
4644
4650
4654
4657 std::vector<discordpp::RelationshipHandle> GetRelationships() const;
4658
4666 std::vector<discordpp::RelationshipHandle> GetRelationshipsByGroup(
4667 discordpp::RelationshipGroupType groupType) const;
4668
4674 void RejectDiscordFriendRequest(uint64_t userId,
4676
4682
4687 void RemoveDiscordAndGameFriend(uint64_t userId,
4689
4694
4699 std::vector<discordpp::UserHandle> SearchFriendsByUsername(std::string searchStr) const;
4700
4716 void SendDiscordFriendRequest(std::string const& username,
4718
4734 void SendDiscordFriendRequestById(uint64_t userId,
4736
4752 void SendGameFriendRequest(std::string const& username,
4754
4770 void SendGameFriendRequestById(uint64_t userId,
4772
4779
4786
4793
4796
4804
4809 uint64_t applicationId,
4811
4817 std::optional<discordpp::UserHandle> GetUser(uint64_t userId) const;
4818
4825
4832};
4833
4837 mutable Discord_CallInfoHandle instance_{};
4840
4841public:
4843 Discord_CallInfoHandle* instance() const { return &instance_; }
4846 explicit CallInfoHandle(Discord_CallInfoHandle instance, DiscordObjectState state);
4856 operator bool() const { return state_ != DiscordObjectState::Invalid; }
4857
4862
4864 void Drop();
4866
4868 uint64_t ChannelId() const;
4869
4871 std::vector<uint64_t> GetParticipants() const;
4872
4875 std::optional<discordpp::VoiceStateHandle> GetVoiceStateHandle(uint64_t userId) const;
4876
4878 uint64_t GuildId() const;
4879};
4880
4882{
4883 switch (value) {
4885 return "Join";
4887 return "JoinRequest";
4888 default:
4889 return "unknown";
4890 }
4891}
4892
4894{
4895 switch (value) {
4897 return "Private";
4899 return "Public";
4900 default:
4901 return "unknown";
4902 }
4903}
4904
4906{
4907 switch (value) {
4909 return "Playing";
4911 return "Streaming";
4913 return "Listening";
4915 return "Watching";
4917 return "CustomStatus";
4919 return "Competing";
4921 return "HangStatus";
4922 default:
4923 return "unknown";
4924 }
4925}
4926
4928{
4929 switch (value) {
4931 return "Desktop";
4933 return "Xbox";
4935 return "Samsung";
4937 return "IOS";
4939 return "Android";
4941 return "Embedded";
4943 return "PS4";
4945 return "PS5";
4946 default:
4947 return "unknown";
4948 }
4949}
4950
4951inline const char* EnumToString(discordpp::ErrorType value)
4952{
4953 switch (value) {
4955 return "None";
4957 return "NetworkError";
4959 return "HTTPError";
4961 return "ClientNotReady";
4963 return "Disabled";
4965 return "ClientDestroyed";
4967 return "ValidationError";
4969 return "Aborted";
4971 return "AuthorizationFailed";
4973 return "RPCError";
4974 default:
4975 return "unknown";
4976 }
4977}
4978
4980{
4981 switch (value) {
4983 return "None";
4985 return "Continue";
4987 return "SwitchingProtocols";
4989 return "Processing";
4991 return "EarlyHints";
4993 return "Ok";
4995 return "Created";
4997 return "Accepted";
4999 return "NonAuthoritativeInfo";
5001 return "NoContent";
5003 return "ResetContent";
5005 return "PartialContent";
5007 return "MultiStatus";
5009 return "AlreadyReported";
5011 return "ImUsed";
5013 return "MultipleChoices";
5015 return "MovedPermanently";
5017 return "Found";
5019 return "SeeOther";
5021 return "NotModified";
5023 return "TemporaryRedirect";
5025 return "PermanentRedirect";
5027 return "BadRequest";
5029 return "Unauthorized";
5031 return "PaymentRequired";
5033 return "Forbidden";
5035 return "NotFound";
5037 return "MethodNotAllowed";
5039 return "NotAcceptable";
5041 return "ProxyAuthRequired";
5043 return "RequestTimeout";
5045 return "Conflict";
5047 return "Gone";
5049 return "LengthRequired";
5051 return "PreconditionFailed";
5053 return "PayloadTooLarge";
5055 return "UriTooLong";
5057 return "UnsupportedMediaType";
5059 return "RangeNotSatisfiable";
5061 return "ExpectationFailed";
5063 return "MisdirectedRequest";
5065 return "UnprocessableEntity";
5067 return "Locked";
5069 return "FailedDependency";
5071 return "TooEarly";
5073 return "UpgradeRequired";
5075 return "PreconditionRequired";
5077 return "TooManyRequests";
5079 return "RequestHeaderFieldsTooLarge";
5081 return "InternalServerError";
5083 return "NotImplemented";
5085 return "BadGateway";
5087 return "ServiceUnavailable";
5089 return "GatewayTimeout";
5091 return "HttpVersionNotSupported";
5093 return "VariantAlsoNegotiates";
5095 return "InsufficientStorage";
5097 return "LoopDetected";
5099 return "NotExtended";
5101 return "NetworkAuthorizationRequired";
5102 default:
5103 return "unknown";
5104 }
5105}
5106
5108{
5109 switch (value) {
5111 return "S256";
5112 default:
5113 return "unknown";
5114 }
5115}
5116
5118{
5119 switch (value) {
5121 return "GuildInstall";
5123 return "UserInstall";
5124 default:
5125 return "unknown";
5126 }
5127}
5128
5130{
5131 switch (value) {
5133 return "Other";
5135 return "Attachment";
5137 return "Poll";
5139 return "VoiceMessage";
5141 return "Thread";
5143 return "Embed";
5145 return "Sticker";
5146 default:
5147 return "unknown";
5148 }
5149}
5150
5151inline const char* EnumToString(discordpp::AudioSystem value)
5152{
5153 switch (value) {
5155 return "Standard";
5157 return "Game";
5158 default:
5159 return "unknown";
5160 }
5161}
5162
5163inline const char* EnumToString(discordpp::Call::Error value)
5164{
5165 switch (value) {
5167 return "None";
5169 return "SignalingConnectionFailed";
5171 return "SignalingUnexpectedClose";
5173 return "VoiceConnectionFailed";
5175 return "JoinTimeout";
5177 return "Forbidden";
5178 default:
5179 return "unknown";
5180 }
5181}
5182
5184{
5185 switch (value) {
5187 return "MODE_UNINIT";
5189 return "MODE_VAD";
5191 return "MODE_PTT";
5192 default:
5193 return "unknown";
5194 }
5195}
5196
5197inline const char* EnumToString(discordpp::Call::Status value)
5198{
5199 switch (value) {
5201 return "Disconnected";
5203 return "Joining";
5205 return "Connecting";
5207 return "SignalingConnected";
5209 return "Connected";
5211 return "Reconnecting";
5213 return "Disconnecting";
5214 default:
5215 return "unknown";
5216 }
5217}
5218
5219inline const char* EnumToString(discordpp::ChannelType value)
5220{
5221 switch (value) {
5223 return "GuildText";
5225 return "Dm";
5227 return "GuildVoice";
5229 return "GroupDm";
5231 return "GuildCategory";
5233 return "GuildNews";
5235 return "GuildStore";
5237 return "GuildNewsThread";
5239 return "GuildPublicThread";
5241 return "GuildPrivateThread";
5243 return "GuildStageVoice";
5245 return "GuildDirectory";
5247 return "GuildForum";
5249 return "GuildMedia";
5251 return "Lobby";
5253 return "EphemeralDm";
5254 default:
5255 return "unknown";
5256 }
5257}
5258
5260{
5261 switch (value) {
5263 return "None";
5265 return "Friend";
5267 return "Blocked";
5269 return "PendingIncoming";
5271 return "PendingOutgoing";
5273 return "Implicit";
5275 return "Suggestion";
5276 default:
5277 return "unknown";
5278 }
5279}
5280
5282{
5283 switch (value) {
5285 return "Gif";
5287 return "Webp";
5289 return "Png";
5291 return "Jpeg";
5292 default:
5293 return "unknown";
5294 }
5295}
5296
5297inline const char* EnumToString(discordpp::StatusType value)
5298{
5299 switch (value) {
5301 return "Online";
5303 return "Offline";
5305 return "Blocked";
5307 return "Idle";
5309 return "Dnd";
5311 return "Invisible";
5313 return "Streaming";
5315 return "Unknown";
5316 default:
5317 return "unknown";
5318 }
5319}
5320
5322{
5323 switch (value) {
5325 return "MessageDataVisibleOnDiscord";
5326 default:
5327 return "unknown";
5328 }
5329}
5330
5332{
5333 switch (value) {
5335 return "None";
5337 return "ConnectionFailed";
5339 return "UnexpectedClose";
5341 return "ConnectionCanceled";
5342 default:
5343 return "unknown";
5344 }
5345}
5346
5348{
5349 switch (value) {
5351 return "Disconnected";
5353 return "Connecting";
5355 return "Connected";
5357 return "Ready";
5359 return "Reconnecting";
5361 return "Disconnecting";
5363 return "HttpWait";
5364 default:
5365 return "unknown";
5366 }
5367}
5368
5370{
5371 switch (value) {
5373 return "Client";
5375 return "Voice";
5377 return "Network";
5378 default:
5379 return "unknown";
5380 }
5381}
5382
5384{
5385 switch (value) {
5387 return "User";
5389 return "Bearer";
5390 default:
5391 return "unknown";
5392 }
5393}
5394
5396{
5397 switch (value) {
5399 return "OIDC";
5401 return "EpicOnlineServicesAccessToken";
5403 return "EpicOnlineServicesIdToken";
5405 return "SteamSessionTicket";
5407 return "UnityServicesIdToken";
5408 default:
5409 return "unknown";
5410 }
5411}
5412
5414{
5415 switch (value) {
5417 return "Verbose";
5419 return "Info";
5421 return "Warning";
5423 return "Error";
5425 return "None";
5426 default:
5427 return "unknown";
5428 }
5429}
5430
5432{
5433 switch (value) {
5435 return "OnlinePlayingGame";
5437 return "OnlineElsewhere";
5439 return "Offline";
5440 default:
5441 return "unknown";
5442 }
5443}
5444} // namespace discordpp
5445#endif // DISCORD_HEADER_DISCORDPP_H_
5446#ifdef DISCORDPP_IMPLEMENTATION
5447#undef DISCORDPP_IMPLEMENTATION
5448#ifdef __clang__
5449#pragma clang diagnostic push
5450#pragma clang diagnostic ignored "-Wunused-parameter"
5451#endif
5452namespace discordpp {
5453std::function<void(std::function<void()>)> s_synchronizationContext;
5454
5455inline bool HasSynchronizationContext()
5456{
5457 return !!s_synchronizationContext;
5458}
5459
5460inline void PostTask(std::function<void()> task)
5461{
5462 assert(s_synchronizationContext);
5463 s_synchronizationContext(std::move(task));
5464}
5465
5466void SetSynchronizationContext(std::function<void(std::function<void()>)> executor)
5467{
5468 s_synchronizationContext = std::move(executor);
5469}
5470
5471template <typename T>
5472struct TDelegateUserData {
5473 T delegate;
5474 TDelegateUserData(T delegate)
5475 : delegate{delegate}
5476 {
5477 }
5478
5479 static void Free(void* ptr) { delete reinterpret_cast<TDelegateUserData*>(ptr); }
5480
5481 static T& Get(void* userData)
5482 {
5483 return reinterpret_cast<TDelegateUserData*>(userData)->delegate;
5484 }
5485};
5486
5487struct ConvertedProperties {
5488 ConvertedProperties(std::unordered_map<std::string, std::string> const& PropertyMap)
5489 {
5490 Properties.size = PropertyMap.size();
5491 Properties.keys = reinterpret_cast<Discord_String*>(
5492 Discord_Alloc(Properties.size * sizeof(Discord_String)));
5493 Properties.values = reinterpret_cast<Discord_String*>(
5494 Discord_Alloc(Properties.size * sizeof(Discord_String)));
5495 size_t i = 0;
5496 for (auto& pair : PropertyMap) {
5497 Properties.keys[i] = AllocateString(pair.first);
5498 Properties.values[i] = AllocateString(pair.second);
5499 ++i;
5500 }
5501 }
5502 ~ConvertedProperties() { Discord_FreeProperties(Properties); }
5503 Discord_Properties Properties{};
5504
5505private:
5506 Discord_String AllocateString(std::string const& str)
5507 {
5508 Discord_String result;
5509 result.ptr = reinterpret_cast<uint8_t*>(Discord_Alloc(str.size()));
5510 result.size = str.size();
5511 std::memcpy(result.ptr, str.data(), result.size);
5512 return result;
5513 }
5514};
5515
5516std::unordered_map<std::string, std::string> ConvertReturnedProperties(
5517 Discord_Properties const& Properties)
5518{
5519 std::unordered_map<std::string, std::string> result;
5520 for (size_t i = 0; i < Properties.size; ++i) {
5521 std::string key(reinterpret_cast<char*>(Properties.keys[i].ptr), Properties.keys[i].size);
5522 std::string value(reinterpret_cast<char*>(Properties.values[i].ptr),
5523 Properties.values[i].size);
5524 result.emplace(std::move(key), std::move(value));
5525 }
5526 return result;
5527}
5529ActivityInvite::~ActivityInvite()
5530{
5531 if (state_ == DiscordObjectState::Owned) {
5532 Drop();
5534 }
5535}
5537 : instance_(other.instance_)
5538 , state_(other.state_)
5539{
5540 other.state_ = DiscordObjectState::Invalid;
5541}
5543{
5544 if (this != &other) {
5545 if (state_ == DiscordObjectState::Owned) {
5546 Drop();
5547 }
5548 instance_ = other.instance_;
5549 state_ = other.state_;
5550 other.state_ = DiscordObjectState::Invalid;
5551 }
5552 return *this;
5553}
5555 : instance_{}
5556 , state_(DiscordObjectState::Invalid)
5557{
5558 if (rhs.state_ == DiscordObjectState::Owned) {
5559 Discord_ActivityInvite_Clone(&instance_, rhs.instance());
5560
5561 state_ = DiscordObjectState::Owned;
5562 }
5563}
5564ActivityInvite& ActivityInvite::operator=(const ActivityInvite& rhs)
5565{
5566 if (this != &rhs) {
5567 if (state_ == DiscordObjectState::Owned) {
5568 Drop();
5569 state_ = DiscordObjectState::Invalid;
5570 }
5571 if (rhs.state_ == DiscordObjectState::Owned) {
5572 Discord_ActivityInvite_Clone(&instance_, rhs.instance());
5573
5574 state_ = DiscordObjectState::Owned;
5575 }
5576 }
5577 return *this;
5578}
5579ActivityInvite::ActivityInvite(Discord_ActivityInvite instance, DiscordObjectState state)
5580 : instance_(instance)
5581 , state_(state)
5582{
5583}
5584ActivityInvite::ActivityInvite()
5585{
5586 assert(state_ == DiscordObjectState::Invalid);
5587 Discord_ActivityInvite_Init(&instance_);
5588 state_ = DiscordObjectState::Owned;
5589}
5590void ActivityInvite::Drop()
5591{
5592 if (state_ != DiscordObjectState::Owned) {
5593 return;
5594 }
5595 Discord_ActivityInvite_Drop(&instance_);
5596 state_ = DiscordObjectState::Invalid;
5597}
5598uint64_t ActivityInvite::SenderId() const
5599{
5600 assert(state_ == DiscordObjectState::Owned);
5601 uint64_t returnValue__;
5602 returnValue__ = Discord_ActivityInvite_SenderId(&instance_);
5603 return returnValue__;
5604}
5605void ActivityInvite::SetSenderId(uint64_t SenderId)
5606{
5607 assert(state_ == DiscordObjectState::Owned);
5608 Discord_ActivityInvite_SetSenderId(&instance_, SenderId);
5609}
5610uint64_t ActivityInvite::ChannelId() const
5611{
5612 assert(state_ == DiscordObjectState::Owned);
5613 uint64_t returnValue__;
5614 returnValue__ = Discord_ActivityInvite_ChannelId(&instance_);
5615 return returnValue__;
5616}
5617void ActivityInvite::SetChannelId(uint64_t ChannelId)
5618{
5619 assert(state_ == DiscordObjectState::Owned);
5620 Discord_ActivityInvite_SetChannelId(&instance_, ChannelId);
5621}
5622uint64_t ActivityInvite::MessageId() const
5623{
5624 assert(state_ == DiscordObjectState::Owned);
5625 uint64_t returnValue__;
5626 returnValue__ = Discord_ActivityInvite_MessageId(&instance_);
5627 return returnValue__;
5628}
5629void ActivityInvite::SetMessageId(uint64_t MessageId)
5630{
5631 assert(state_ == DiscordObjectState::Owned);
5632 Discord_ActivityInvite_SetMessageId(&instance_, MessageId);
5633}
5634discordpp::ActivityActionTypes ActivityInvite::Type() const
5635{
5636 assert(state_ == DiscordObjectState::Owned);
5637 Discord_ActivityActionTypes returnValue__;
5638 returnValue__ = Discord_ActivityInvite_Type(&instance_);
5639 return static_cast<discordpp::ActivityActionTypes>(returnValue__);
5640}
5641void ActivityInvite::SetType(discordpp::ActivityActionTypes Type)
5642{
5643 assert(state_ == DiscordObjectState::Owned);
5644 Discord_ActivityInvite_SetType(&instance_, static_cast<Discord_ActivityActionTypes>(Type));
5645}
5646uint64_t ActivityInvite::ApplicationId() const
5647{
5648 assert(state_ == DiscordObjectState::Owned);
5649 uint64_t returnValue__;
5650 returnValue__ = Discord_ActivityInvite_ApplicationId(&instance_);
5651 return returnValue__;
5652}
5653void ActivityInvite::SetApplicationId(uint64_t ApplicationId)
5654{
5655 assert(state_ == DiscordObjectState::Owned);
5656 Discord_ActivityInvite_SetApplicationId(&instance_, ApplicationId);
5657}
5658uint64_t ActivityInvite::ParentApplicationId() const
5659{
5660 assert(state_ == DiscordObjectState::Owned);
5661 uint64_t returnValue__;
5662 returnValue__ = Discord_ActivityInvite_ParentApplicationId(&instance_);
5663 return returnValue__;
5664}
5665void ActivityInvite::SetParentApplicationId(uint64_t ParentApplicationId)
5666{
5667 assert(state_ == DiscordObjectState::Owned);
5668 Discord_ActivityInvite_SetParentApplicationId(&instance_, ParentApplicationId);
5669}
5670std::string ActivityInvite::PartyId() const
5671{
5672 assert(state_ == DiscordObjectState::Owned);
5673 Discord_String returnValueNative__;
5674 Discord_ActivityInvite_PartyId(&instance_, &returnValueNative__);
5675 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5676 returnValueNative__.size);
5677 Discord_Free(returnValueNative__.ptr);
5678 return returnValue__;
5679}
5680void ActivityInvite::SetPartyId(std::string PartyId)
5681{
5682 assert(state_ == DiscordObjectState::Owned);
5683 Discord_String PartyId__str{(uint8_t*)(PartyId.data()), PartyId.size()};
5684 Discord_ActivityInvite_SetPartyId(&instance_, PartyId__str);
5685}
5686std::string ActivityInvite::SessionId() const
5687{
5688 assert(state_ == DiscordObjectState::Owned);
5689 Discord_String returnValueNative__;
5690 Discord_ActivityInvite_SessionId(&instance_, &returnValueNative__);
5691 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5692 returnValueNative__.size);
5693 Discord_Free(returnValueNative__.ptr);
5694 return returnValue__;
5695}
5696void ActivityInvite::SetSessionId(std::string SessionId)
5697{
5698 assert(state_ == DiscordObjectState::Owned);
5699 Discord_String SessionId__str{(uint8_t*)(SessionId.data()), SessionId.size()};
5700 Discord_ActivityInvite_SetSessionId(&instance_, SessionId__str);
5701}
5702bool ActivityInvite::IsValid() const
5703{
5704 assert(state_ == DiscordObjectState::Owned);
5705 bool returnValue__;
5706 returnValue__ = Discord_ActivityInvite_IsValid(&instance_);
5707 return returnValue__;
5708}
5709void ActivityInvite::SetIsValid(bool IsValid)
5710{
5711 assert(state_ == DiscordObjectState::Owned);
5712 Discord_ActivityInvite_SetIsValid(&instance_, IsValid);
5713}
5714const ActivityAssets ActivityAssets::nullobj{{}, DiscordObjectState::Invalid};
5715ActivityAssets::~ActivityAssets()
5716{
5717 if (state_ == DiscordObjectState::Owned) {
5718 Drop();
5719 state_ = DiscordObjectState::Invalid;
5720 }
5721}
5722ActivityAssets::ActivityAssets(ActivityAssets&& other) noexcept
5723 : instance_(other.instance_)
5724 , state_(other.state_)
5725{
5726 other.state_ = DiscordObjectState::Invalid;
5727}
5728ActivityAssets& ActivityAssets::operator=(ActivityAssets&& other) noexcept
5729{
5730 if (this != &other) {
5731 if (state_ == DiscordObjectState::Owned) {
5732 Drop();
5733 }
5734 instance_ = other.instance_;
5735 state_ = other.state_;
5736 other.state_ = DiscordObjectState::Invalid;
5737 }
5738 return *this;
5739}
5740ActivityAssets::ActivityAssets(const ActivityAssets& arg0)
5741 : instance_{}
5742 , state_(DiscordObjectState::Invalid)
5743{
5744 if (arg0.state_ == DiscordObjectState::Owned) {
5745 Discord_ActivityAssets_Clone(&instance_, arg0.instance());
5746
5747 state_ = DiscordObjectState::Owned;
5748 }
5749}
5750ActivityAssets& ActivityAssets::operator=(const ActivityAssets& arg0)
5751{
5752 if (this != &arg0) {
5753 if (state_ == DiscordObjectState::Owned) {
5754 Drop();
5755 state_ = DiscordObjectState::Invalid;
5756 }
5757 if (arg0.state_ == DiscordObjectState::Owned) {
5758 Discord_ActivityAssets_Clone(&instance_, arg0.instance());
5759
5760 state_ = DiscordObjectState::Owned;
5761 }
5762 }
5763 return *this;
5764}
5765ActivityAssets::ActivityAssets(Discord_ActivityAssets instance, DiscordObjectState state)
5766 : instance_(instance)
5767 , state_(state)
5768{
5769}
5770ActivityAssets::ActivityAssets()
5771{
5772 assert(state_ == DiscordObjectState::Invalid);
5773 Discord_ActivityAssets_Init(&instance_);
5774 state_ = DiscordObjectState::Owned;
5775}
5776void ActivityAssets::Drop()
5777{
5778 if (state_ != DiscordObjectState::Owned) {
5779 return;
5780 }
5781 Discord_ActivityAssets_Drop(&instance_);
5782 state_ = DiscordObjectState::Invalid;
5783}
5784std::optional<std::string> ActivityAssets::LargeImage() const
5785{
5786 assert(state_ == DiscordObjectState::Owned);
5787 bool returnIsNonNull__;
5788 Discord_String returnValueNative__;
5789 returnIsNonNull__ = Discord_ActivityAssets_LargeImage(&instance_, &returnValueNative__);
5790 if (!returnIsNonNull__) {
5791 return {};
5792 }
5793 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5794 returnValueNative__.size);
5795 Discord_Free(returnValueNative__.ptr);
5796 return returnValue__;
5797}
5798void ActivityAssets::SetLargeImage(std::optional<std::string> LargeImage)
5799{
5800 assert(state_ == DiscordObjectState::Owned);
5801 Discord_String LargeImage__str{};
5802 if (LargeImage.has_value()) {
5803 LargeImage__str.ptr = reinterpret_cast<uint8_t*>(LargeImage->data());
5804 LargeImage__str.size = LargeImage->size();
5805 }
5806 Discord_ActivityAssets_SetLargeImage(&instance_,
5807 (LargeImage.has_value() ? &LargeImage__str : nullptr));
5808}
5809std::optional<std::string> ActivityAssets::LargeText() const
5810{
5811 assert(state_ == DiscordObjectState::Owned);
5812 bool returnIsNonNull__;
5813 Discord_String returnValueNative__;
5814 returnIsNonNull__ = Discord_ActivityAssets_LargeText(&instance_, &returnValueNative__);
5815 if (!returnIsNonNull__) {
5816 return {};
5817 }
5818 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5819 returnValueNative__.size);
5820 Discord_Free(returnValueNative__.ptr);
5821 return returnValue__;
5822}
5823void ActivityAssets::SetLargeText(std::optional<std::string> LargeText)
5824{
5825 assert(state_ == DiscordObjectState::Owned);
5826 Discord_String LargeText__str{};
5827 if (LargeText.has_value()) {
5828 LargeText__str.ptr = reinterpret_cast<uint8_t*>(LargeText->data());
5829 LargeText__str.size = LargeText->size();
5830 }
5831 Discord_ActivityAssets_SetLargeText(&instance_,
5832 (LargeText.has_value() ? &LargeText__str : nullptr));
5833}
5834std::optional<std::string> ActivityAssets::SmallImage() const
5835{
5836 assert(state_ == DiscordObjectState::Owned);
5837 bool returnIsNonNull__;
5838 Discord_String returnValueNative__;
5839 returnIsNonNull__ = Discord_ActivityAssets_SmallImage(&instance_, &returnValueNative__);
5840 if (!returnIsNonNull__) {
5841 return {};
5842 }
5843 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5844 returnValueNative__.size);
5845 Discord_Free(returnValueNative__.ptr);
5846 return returnValue__;
5847}
5848void ActivityAssets::SetSmallImage(std::optional<std::string> SmallImage)
5849{
5850 assert(state_ == DiscordObjectState::Owned);
5851 Discord_String SmallImage__str{};
5852 if (SmallImage.has_value()) {
5853 SmallImage__str.ptr = reinterpret_cast<uint8_t*>(SmallImage->data());
5854 SmallImage__str.size = SmallImage->size();
5855 }
5856 Discord_ActivityAssets_SetSmallImage(&instance_,
5857 (SmallImage.has_value() ? &SmallImage__str : nullptr));
5858}
5859std::optional<std::string> ActivityAssets::SmallText() const
5860{
5861 assert(state_ == DiscordObjectState::Owned);
5862 bool returnIsNonNull__;
5863 Discord_String returnValueNative__;
5864 returnIsNonNull__ = Discord_ActivityAssets_SmallText(&instance_, &returnValueNative__);
5865 if (!returnIsNonNull__) {
5866 return {};
5867 }
5868 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5869 returnValueNative__.size);
5870 Discord_Free(returnValueNative__.ptr);
5871 return returnValue__;
5872}
5873void ActivityAssets::SetSmallText(std::optional<std::string> SmallText)
5874{
5875 assert(state_ == DiscordObjectState::Owned);
5876 Discord_String SmallText__str{};
5877 if (SmallText.has_value()) {
5878 SmallText__str.ptr = reinterpret_cast<uint8_t*>(SmallText->data());
5879 SmallText__str.size = SmallText->size();
5880 }
5881 Discord_ActivityAssets_SetSmallText(&instance_,
5882 (SmallText.has_value() ? &SmallText__str : nullptr));
5883}
5884const ActivityTimestamps ActivityTimestamps::nullobj{{}, DiscordObjectState::Invalid};
5885ActivityTimestamps::~ActivityTimestamps()
5886{
5887 if (state_ == DiscordObjectState::Owned) {
5888 Drop();
5889 state_ = DiscordObjectState::Invalid;
5890 }
5891}
5892ActivityTimestamps::ActivityTimestamps(ActivityTimestamps&& other) noexcept
5893 : instance_(other.instance_)
5894 , state_(other.state_)
5895{
5896 other.state_ = DiscordObjectState::Invalid;
5897}
5898ActivityTimestamps& ActivityTimestamps::operator=(ActivityTimestamps&& other) noexcept
5899{
5900 if (this != &other) {
5901 if (state_ == DiscordObjectState::Owned) {
5902 Drop();
5903 }
5904 instance_ = other.instance_;
5905 state_ = other.state_;
5906 other.state_ = DiscordObjectState::Invalid;
5907 }
5908 return *this;
5909}
5910ActivityTimestamps::ActivityTimestamps(const ActivityTimestamps& arg0)
5911 : instance_{}
5912 , state_(DiscordObjectState::Invalid)
5913{
5914 if (arg0.state_ == DiscordObjectState::Owned) {
5915 Discord_ActivityTimestamps_Clone(&instance_, arg0.instance());
5916
5917 state_ = DiscordObjectState::Owned;
5918 }
5919}
5920ActivityTimestamps& ActivityTimestamps::operator=(const ActivityTimestamps& arg0)
5921{
5922 if (this != &arg0) {
5923 if (state_ == DiscordObjectState::Owned) {
5924 Drop();
5925 state_ = DiscordObjectState::Invalid;
5926 }
5927 if (arg0.state_ == DiscordObjectState::Owned) {
5928 Discord_ActivityTimestamps_Clone(&instance_, arg0.instance());
5929
5930 state_ = DiscordObjectState::Owned;
5931 }
5932 }
5933 return *this;
5934}
5935ActivityTimestamps::ActivityTimestamps(Discord_ActivityTimestamps instance,
5936 DiscordObjectState state)
5937 : instance_(instance)
5938 , state_(state)
5939{
5940}
5941ActivityTimestamps::ActivityTimestamps()
5942{
5943 assert(state_ == DiscordObjectState::Invalid);
5944 Discord_ActivityTimestamps_Init(&instance_);
5945 state_ = DiscordObjectState::Owned;
5946}
5947void ActivityTimestamps::Drop()
5948{
5949 if (state_ != DiscordObjectState::Owned) {
5950 return;
5951 }
5952 Discord_ActivityTimestamps_Drop(&instance_);
5953 state_ = DiscordObjectState::Invalid;
5954}
5955uint64_t ActivityTimestamps::Start() const
5956{
5957 assert(state_ == DiscordObjectState::Owned);
5958 uint64_t returnValue__;
5959 returnValue__ = Discord_ActivityTimestamps_Start(&instance_);
5960 return returnValue__;
5961}
5962void ActivityTimestamps::SetStart(uint64_t Start)
5963{
5964 assert(state_ == DiscordObjectState::Owned);
5965 Discord_ActivityTimestamps_SetStart(&instance_, Start);
5966}
5967uint64_t ActivityTimestamps::End() const
5968{
5969 assert(state_ == DiscordObjectState::Owned);
5970 uint64_t returnValue__;
5971 returnValue__ = Discord_ActivityTimestamps_End(&instance_);
5972 return returnValue__;
5973}
5974void ActivityTimestamps::SetEnd(uint64_t End)
5975{
5976 assert(state_ == DiscordObjectState::Owned);
5977 Discord_ActivityTimestamps_SetEnd(&instance_, End);
5978}
5979const ActivityParty ActivityParty::nullobj{{}, DiscordObjectState::Invalid};
5980ActivityParty::~ActivityParty()
5981{
5982 if (state_ == DiscordObjectState::Owned) {
5983 Drop();
5984 state_ = DiscordObjectState::Invalid;
5985 }
5986}
5987ActivityParty::ActivityParty(ActivityParty&& other) noexcept
5988 : instance_(other.instance_)
5989 , state_(other.state_)
5990{
5991 other.state_ = DiscordObjectState::Invalid;
5992}
5993ActivityParty& ActivityParty::operator=(ActivityParty&& other) noexcept
5994{
5995 if (this != &other) {
5996 if (state_ == DiscordObjectState::Owned) {
5997 Drop();
5998 }
5999 instance_ = other.instance_;
6000 state_ = other.state_;
6001 other.state_ = DiscordObjectState::Invalid;
6002 }
6003 return *this;
6004}
6005ActivityParty::ActivityParty(const ActivityParty& arg0)
6006 : instance_{}
6007 , state_(DiscordObjectState::Invalid)
6008{
6009 if (arg0.state_ == DiscordObjectState::Owned) {
6010 Discord_ActivityParty_Clone(&instance_, arg0.instance());
6011
6012 state_ = DiscordObjectState::Owned;
6013 }
6014}
6015ActivityParty& ActivityParty::operator=(const ActivityParty& arg0)
6016{
6017 if (this != &arg0) {
6018 if (state_ == DiscordObjectState::Owned) {
6019 Drop();
6020 state_ = DiscordObjectState::Invalid;
6021 }
6022 if (arg0.state_ == DiscordObjectState::Owned) {
6023 Discord_ActivityParty_Clone(&instance_, arg0.instance());
6024
6025 state_ = DiscordObjectState::Owned;
6026 }
6027 }
6028 return *this;
6029}
6030ActivityParty::ActivityParty(Discord_ActivityParty instance, DiscordObjectState state)
6031 : instance_(instance)
6032 , state_(state)
6033{
6034}
6035ActivityParty::ActivityParty()
6036{
6037 assert(state_ == DiscordObjectState::Invalid);
6038 Discord_ActivityParty_Init(&instance_);
6039 state_ = DiscordObjectState::Owned;
6040}
6041void ActivityParty::Drop()
6042{
6043 if (state_ != DiscordObjectState::Owned) {
6044 return;
6045 }
6046 Discord_ActivityParty_Drop(&instance_);
6047 state_ = DiscordObjectState::Invalid;
6048}
6049std::string ActivityParty::Id() const
6050{
6051 assert(state_ == DiscordObjectState::Owned);
6052 Discord_String returnValueNative__;
6053 Discord_ActivityParty_Id(&instance_, &returnValueNative__);
6054 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6055 returnValueNative__.size);
6056 Discord_Free(returnValueNative__.ptr);
6057 return returnValue__;
6058}
6059void ActivityParty::SetId(std::string Id)
6060{
6061 assert(state_ == DiscordObjectState::Owned);
6062 Discord_String Id__str{(uint8_t*)(Id.data()), Id.size()};
6063 Discord_ActivityParty_SetId(&instance_, Id__str);
6064}
6065int32_t ActivityParty::CurrentSize() const
6066{
6067 assert(state_ == DiscordObjectState::Owned);
6068 int32_t returnValue__;
6069 returnValue__ = Discord_ActivityParty_CurrentSize(&instance_);
6070 return returnValue__;
6071}
6072void ActivityParty::SetCurrentSize(int32_t CurrentSize)
6073{
6074 assert(state_ == DiscordObjectState::Owned);
6075 Discord_ActivityParty_SetCurrentSize(&instance_, CurrentSize);
6076}
6077int32_t ActivityParty::MaxSize() const
6078{
6079 assert(state_ == DiscordObjectState::Owned);
6080 int32_t returnValue__;
6081 returnValue__ = Discord_ActivityParty_MaxSize(&instance_);
6082 return returnValue__;
6083}
6084void ActivityParty::SetMaxSize(int32_t MaxSize)
6085{
6086 assert(state_ == DiscordObjectState::Owned);
6087 Discord_ActivityParty_SetMaxSize(&instance_, MaxSize);
6088}
6089discordpp::ActivityPartyPrivacy ActivityParty::Privacy() const
6090{
6091 assert(state_ == DiscordObjectState::Owned);
6092 Discord_ActivityPartyPrivacy returnValue__;
6093 returnValue__ = Discord_ActivityParty_Privacy(&instance_);
6094 return static_cast<discordpp::ActivityPartyPrivacy>(returnValue__);
6095}
6096void ActivityParty::SetPrivacy(discordpp::ActivityPartyPrivacy Privacy)
6097{
6098 assert(state_ == DiscordObjectState::Owned);
6099 Discord_ActivityParty_SetPrivacy(&instance_,
6100 static_cast<Discord_ActivityPartyPrivacy>(Privacy));
6101}
6102const ActivitySecrets ActivitySecrets::nullobj{{}, DiscordObjectState::Invalid};
6103ActivitySecrets::~ActivitySecrets()
6104{
6105 if (state_ == DiscordObjectState::Owned) {
6106 Drop();
6107 state_ = DiscordObjectState::Invalid;
6108 }
6109}
6110ActivitySecrets::ActivitySecrets(ActivitySecrets&& other) noexcept
6111 : instance_(other.instance_)
6112 , state_(other.state_)
6113{
6114 other.state_ = DiscordObjectState::Invalid;
6115}
6116ActivitySecrets& ActivitySecrets::operator=(ActivitySecrets&& other) noexcept
6117{
6118 if (this != &other) {
6119 if (state_ == DiscordObjectState::Owned) {
6120 Drop();
6121 }
6122 instance_ = other.instance_;
6123 state_ = other.state_;
6124 other.state_ = DiscordObjectState::Invalid;
6125 }
6126 return *this;
6127}
6128ActivitySecrets::ActivitySecrets(const ActivitySecrets& arg0)
6129 : instance_{}
6130 , state_(DiscordObjectState::Invalid)
6131{
6132 if (arg0.state_ == DiscordObjectState::Owned) {
6133 Discord_ActivitySecrets_Clone(&instance_, arg0.instance());
6134
6135 state_ = DiscordObjectState::Owned;
6136 }
6137}
6138ActivitySecrets& ActivitySecrets::operator=(const ActivitySecrets& arg0)
6139{
6140 if (this != &arg0) {
6141 if (state_ == DiscordObjectState::Owned) {
6142 Drop();
6143 state_ = DiscordObjectState::Invalid;
6144 }
6145 if (arg0.state_ == DiscordObjectState::Owned) {
6146 Discord_ActivitySecrets_Clone(&instance_, arg0.instance());
6147
6148 state_ = DiscordObjectState::Owned;
6149 }
6150 }
6151 return *this;
6152}
6153ActivitySecrets::ActivitySecrets(Discord_ActivitySecrets instance, DiscordObjectState state)
6154 : instance_(instance)
6155 , state_(state)
6156{
6157}
6158ActivitySecrets::ActivitySecrets()
6159{
6160 assert(state_ == DiscordObjectState::Invalid);
6161 Discord_ActivitySecrets_Init(&instance_);
6162 state_ = DiscordObjectState::Owned;
6163}
6164void ActivitySecrets::Drop()
6165{
6166 if (state_ != DiscordObjectState::Owned) {
6167 return;
6168 }
6169 Discord_ActivitySecrets_Drop(&instance_);
6170 state_ = DiscordObjectState::Invalid;
6171}
6172std::string ActivitySecrets::Join() const
6173{
6174 assert(state_ == DiscordObjectState::Owned);
6175 Discord_String returnValueNative__;
6176 Discord_ActivitySecrets_Join(&instance_, &returnValueNative__);
6177 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6178 returnValueNative__.size);
6179 Discord_Free(returnValueNative__.ptr);
6180 return returnValue__;
6181}
6182void ActivitySecrets::SetJoin(std::string Join)
6183{
6184 assert(state_ == DiscordObjectState::Owned);
6185 Discord_String Join__str{(uint8_t*)(Join.data()), Join.size()};
6186 Discord_ActivitySecrets_SetJoin(&instance_, Join__str);
6187}
6188const ActivityButton ActivityButton::nullobj{{}, DiscordObjectState::Invalid};
6189ActivityButton::~ActivityButton()
6190{
6191 if (state_ == DiscordObjectState::Owned) {
6192 Drop();
6193 state_ = DiscordObjectState::Invalid;
6194 }
6195}
6196ActivityButton::ActivityButton(ActivityButton&& other) noexcept
6197 : instance_(other.instance_)
6198 , state_(other.state_)
6199{
6200 other.state_ = DiscordObjectState::Invalid;
6201}
6202ActivityButton& ActivityButton::operator=(ActivityButton&& other) noexcept
6203{
6204 if (this != &other) {
6205 if (state_ == DiscordObjectState::Owned) {
6206 Drop();
6207 }
6208 instance_ = other.instance_;
6209 state_ = other.state_;
6210 other.state_ = DiscordObjectState::Invalid;
6211 }
6212 return *this;
6213}
6214ActivityButton::ActivityButton(const ActivityButton& arg0)
6215 : instance_{}
6216 , state_(DiscordObjectState::Invalid)
6217{
6218 if (arg0.state_ == DiscordObjectState::Owned) {
6219 Discord_ActivityButton_Clone(&instance_, arg0.instance());
6220
6221 state_ = DiscordObjectState::Owned;
6222 }
6223}
6224ActivityButton& ActivityButton::operator=(const ActivityButton& arg0)
6225{
6226 if (this != &arg0) {
6227 if (state_ == DiscordObjectState::Owned) {
6228 Drop();
6229 state_ = DiscordObjectState::Invalid;
6230 }
6231 if (arg0.state_ == DiscordObjectState::Owned) {
6232 Discord_ActivityButton_Clone(&instance_, arg0.instance());
6233
6234 state_ = DiscordObjectState::Owned;
6235 }
6236 }
6237 return *this;
6238}
6239ActivityButton::ActivityButton(Discord_ActivityButton instance, DiscordObjectState state)
6240 : instance_(instance)
6241 , state_(state)
6242{
6243}
6244ActivityButton::ActivityButton()
6245{
6246 assert(state_ == DiscordObjectState::Invalid);
6247 Discord_ActivityButton_Init(&instance_);
6248 state_ = DiscordObjectState::Owned;
6249}
6250void ActivityButton::Drop()
6251{
6252 if (state_ != DiscordObjectState::Owned) {
6253 return;
6254 }
6255 Discord_ActivityButton_Drop(&instance_);
6256 state_ = DiscordObjectState::Invalid;
6257}
6258std::string ActivityButton::Label() const
6259{
6260 assert(state_ == DiscordObjectState::Owned);
6261 Discord_String returnValueNative__;
6262 Discord_ActivityButton_Label(&instance_, &returnValueNative__);
6263 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6264 returnValueNative__.size);
6265 Discord_Free(returnValueNative__.ptr);
6266 return returnValue__;
6267}
6268void ActivityButton::SetLabel(std::string Label)
6269{
6270 assert(state_ == DiscordObjectState::Owned);
6271 Discord_String Label__str{(uint8_t*)(Label.data()), Label.size()};
6272 Discord_ActivityButton_SetLabel(&instance_, Label__str);
6273}
6274std::string ActivityButton::Url() const
6275{
6276 assert(state_ == DiscordObjectState::Owned);
6277 Discord_String returnValueNative__;
6278 Discord_ActivityButton_Url(&instance_, &returnValueNative__);
6279 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6280 returnValueNative__.size);
6281 Discord_Free(returnValueNative__.ptr);
6282 return returnValue__;
6283}
6284void ActivityButton::SetUrl(std::string Url)
6285{
6286 assert(state_ == DiscordObjectState::Owned);
6287 Discord_String Url__str{(uint8_t*)(Url.data()), Url.size()};
6288 Discord_ActivityButton_SetUrl(&instance_, Url__str);
6289}
6290const Activity Activity::nullobj{{}, DiscordObjectState::Invalid};
6291Activity::~Activity()
6292{
6293 if (state_ == DiscordObjectState::Owned) {
6294 Drop();
6295 state_ = DiscordObjectState::Invalid;
6296 }
6297}
6298Activity::Activity(Activity&& other) noexcept
6299 : instance_(other.instance_)
6300 , state_(other.state_)
6301{
6302 other.state_ = DiscordObjectState::Invalid;
6303}
6304Activity& Activity::operator=(Activity&& other) noexcept
6305{
6306 if (this != &other) {
6307 if (state_ == DiscordObjectState::Owned) {
6308 Drop();
6309 }
6310 instance_ = other.instance_;
6311 state_ = other.state_;
6312 other.state_ = DiscordObjectState::Invalid;
6313 }
6314 return *this;
6315}
6316Activity::Activity(const Activity& arg0)
6317 : instance_{}
6318 , state_(DiscordObjectState::Invalid)
6319{
6320 if (arg0.state_ == DiscordObjectState::Owned) {
6321 Discord_Activity_Clone(&instance_, arg0.instance());
6322
6323 state_ = DiscordObjectState::Owned;
6324 }
6325}
6326Activity& Activity::operator=(const Activity& arg0)
6327{
6328 if (this != &arg0) {
6329 if (state_ == DiscordObjectState::Owned) {
6330 Drop();
6331 state_ = DiscordObjectState::Invalid;
6332 }
6333 if (arg0.state_ == DiscordObjectState::Owned) {
6334 Discord_Activity_Clone(&instance_, arg0.instance());
6335
6336 state_ = DiscordObjectState::Owned;
6337 }
6338 }
6339 return *this;
6340}
6341Activity::Activity(Discord_Activity instance, DiscordObjectState state)
6342 : instance_(instance)
6343 , state_(state)
6344{
6345}
6346Activity::Activity()
6347{
6348 assert(state_ == DiscordObjectState::Invalid);
6349 Discord_Activity_Init(&instance_);
6350 state_ = DiscordObjectState::Owned;
6351}
6352void Activity::Drop()
6353{
6354 if (state_ != DiscordObjectState::Owned) {
6355 return;
6356 }
6357 Discord_Activity_Drop(&instance_);
6358 state_ = DiscordObjectState::Invalid;
6359}
6360void Activity::AddButton(discordpp::ActivityButton button)
6361{
6362 assert(state_ == DiscordObjectState::Owned);
6363 Discord_Activity_AddButton(&instance_, button.instance());
6364}
6365bool Activity::Equals(discordpp::Activity other) const
6366{
6367 assert(state_ == DiscordObjectState::Owned);
6368 bool returnValue__;
6369 returnValue__ = Discord_Activity_Equals(&instance_, other.instance());
6370 return returnValue__;
6371}
6372std::vector<discordpp::ActivityButton> Activity::GetButtons() const
6373{
6374 assert(state_ == DiscordObjectState::Owned);
6375 Discord_ActivityButtonSpan returnValueNative__;
6376 Discord_Activity_GetButtons(&instance_, &returnValueNative__);
6377 std::vector<discordpp::ActivityButton> returnValue__;
6378 returnValue__.reserve(returnValueNative__.size);
6379 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
6380 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
6381 }
6382 Discord_Free(returnValueNative__.ptr);
6383 return returnValue__;
6384}
6385std::string Activity::Name() const
6386{
6387 assert(state_ == DiscordObjectState::Owned);
6388 Discord_String returnValueNative__;
6389 Discord_Activity_Name(&instance_, &returnValueNative__);
6390 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6391 returnValueNative__.size);
6392 Discord_Free(returnValueNative__.ptr);
6393 return returnValue__;
6394}
6395void Activity::SetName(std::string Name)
6396{
6397 assert(state_ == DiscordObjectState::Owned);
6398 Discord_String Name__str{(uint8_t*)(Name.data()), Name.size()};
6399 Discord_Activity_SetName(&instance_, Name__str);
6400}
6401discordpp::ActivityTypes Activity::Type() const
6402{
6403 assert(state_ == DiscordObjectState::Owned);
6404 Discord_ActivityTypes returnValue__;
6405 returnValue__ = Discord_Activity_Type(&instance_);
6406 return static_cast<discordpp::ActivityTypes>(returnValue__);
6407}
6408void Activity::SetType(discordpp::ActivityTypes Type)
6409{
6410 assert(state_ == DiscordObjectState::Owned);
6411 Discord_Activity_SetType(&instance_, static_cast<Discord_ActivityTypes>(Type));
6412}
6413std::optional<std::string> Activity::State() const
6414{
6415 assert(state_ == DiscordObjectState::Owned);
6416 bool returnIsNonNull__;
6417 Discord_String returnValueNative__;
6418 returnIsNonNull__ = Discord_Activity_State(&instance_, &returnValueNative__);
6419 if (!returnIsNonNull__) {
6420 return {};
6421 }
6422 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6423 returnValueNative__.size);
6424 Discord_Free(returnValueNative__.ptr);
6425 return returnValue__;
6426}
6427void Activity::SetState(std::optional<std::string> State)
6428{
6429 assert(state_ == DiscordObjectState::Owned);
6430 Discord_String State__str{};
6431 if (State.has_value()) {
6432 State__str.ptr = reinterpret_cast<uint8_t*>(State->data());
6433 State__str.size = State->size();
6434 }
6435 Discord_Activity_SetState(&instance_, (State.has_value() ? &State__str : nullptr));
6436}
6437std::optional<std::string> Activity::Details() const
6438{
6439 assert(state_ == DiscordObjectState::Owned);
6440 bool returnIsNonNull__;
6441 Discord_String returnValueNative__;
6442 returnIsNonNull__ = Discord_Activity_Details(&instance_, &returnValueNative__);
6443 if (!returnIsNonNull__) {
6444 return {};
6445 }
6446 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6447 returnValueNative__.size);
6448 Discord_Free(returnValueNative__.ptr);
6449 return returnValue__;
6450}
6451void Activity::SetDetails(std::optional<std::string> Details)
6452{
6453 assert(state_ == DiscordObjectState::Owned);
6454 Discord_String Details__str{};
6455 if (Details.has_value()) {
6456 Details__str.ptr = reinterpret_cast<uint8_t*>(Details->data());
6457 Details__str.size = Details->size();
6458 }
6459 Discord_Activity_SetDetails(&instance_, (Details.has_value() ? &Details__str : nullptr));
6460}
6461std::optional<uint64_t> Activity::ApplicationId() const
6462{
6463 assert(state_ == DiscordObjectState::Owned);
6464 bool returnIsNonNull__;
6465 uint64_t returnValue__;
6466 returnIsNonNull__ = Discord_Activity_ApplicationId(&instance_, &returnValue__);
6467 if (!returnIsNonNull__) {
6468 return std::nullopt;
6469 }
6470 return returnValue__;
6471}
6472void Activity::SetApplicationId(std::optional<uint64_t> ApplicationId)
6473{
6474 assert(state_ == DiscordObjectState::Owned);
6475 Discord_Activity_SetApplicationId(&instance_,
6476 (ApplicationId.has_value() ? &*ApplicationId : nullptr));
6477}
6478std::optional<uint64_t> Activity::ParentApplicationId() const
6479{
6480 assert(state_ == DiscordObjectState::Owned);
6481 bool returnIsNonNull__;
6482 uint64_t returnValue__;
6483 returnIsNonNull__ = Discord_Activity_ParentApplicationId(&instance_, &returnValue__);
6484 if (!returnIsNonNull__) {
6485 return std::nullopt;
6486 }
6487 return returnValue__;
6488}
6489void Activity::SetParentApplicationId(std::optional<uint64_t> ParentApplicationId)
6490{
6491 assert(state_ == DiscordObjectState::Owned);
6492 Discord_Activity_SetParentApplicationId(
6493 &instance_, (ParentApplicationId.has_value() ? &*ParentApplicationId : nullptr));
6494}
6495std::optional<discordpp::ActivityAssets> Activity::Assets() const
6496{
6497 assert(state_ == DiscordObjectState::Owned);
6498 bool returnIsNonNull__;
6499 Discord_ActivityAssets returnValueNative__;
6500 returnIsNonNull__ = Discord_Activity_Assets(&instance_, &returnValueNative__);
6501 if (!returnIsNonNull__) {
6502 return {};
6503 }
6504 discordpp::ActivityAssets returnValue__(returnValueNative__, DiscordObjectState::Owned);
6505 return returnValue__;
6506}
6507void Activity::SetAssets(std::optional<discordpp::ActivityAssets> Assets)
6508{
6509 assert(state_ == DiscordObjectState::Owned);
6510 Discord_Activity_SetAssets(&instance_, (Assets.has_value() ? Assets->instance() : nullptr));
6511}
6512std::optional<discordpp::ActivityTimestamps> Activity::Timestamps() const
6513{
6514 assert(state_ == DiscordObjectState::Owned);
6515 bool returnIsNonNull__;
6516 Discord_ActivityTimestamps returnValueNative__;
6517 returnIsNonNull__ = Discord_Activity_Timestamps(&instance_, &returnValueNative__);
6518 if (!returnIsNonNull__) {
6519 return {};
6520 }
6521 discordpp::ActivityTimestamps returnValue__(returnValueNative__, DiscordObjectState::Owned);
6522 return returnValue__;
6523}
6524void Activity::SetTimestamps(std::optional<discordpp::ActivityTimestamps> Timestamps)
6525{
6526 assert(state_ == DiscordObjectState::Owned);
6527 Discord_Activity_SetTimestamps(&instance_,
6528 (Timestamps.has_value() ? Timestamps->instance() : nullptr));
6529}
6530std::optional<discordpp::ActivityParty> Activity::Party() const
6531{
6532 assert(state_ == DiscordObjectState::Owned);
6533 bool returnIsNonNull__;
6534 Discord_ActivityParty returnValueNative__;
6535 returnIsNonNull__ = Discord_Activity_Party(&instance_, &returnValueNative__);
6536 if (!returnIsNonNull__) {
6537 return {};
6538 }
6539 discordpp::ActivityParty returnValue__(returnValueNative__, DiscordObjectState::Owned);
6540 return returnValue__;
6541}
6542void Activity::SetParty(std::optional<discordpp::ActivityParty> Party)
6543{
6544 assert(state_ == DiscordObjectState::Owned);
6545 Discord_Activity_SetParty(&instance_, (Party.has_value() ? Party->instance() : nullptr));
6546}
6547std::optional<discordpp::ActivitySecrets> Activity::Secrets() const
6548{
6549 assert(state_ == DiscordObjectState::Owned);
6550 bool returnIsNonNull__;
6551 Discord_ActivitySecrets returnValueNative__;
6552 returnIsNonNull__ = Discord_Activity_Secrets(&instance_, &returnValueNative__);
6553 if (!returnIsNonNull__) {
6554 return {};
6555 }
6556 discordpp::ActivitySecrets returnValue__(returnValueNative__, DiscordObjectState::Owned);
6557 return returnValue__;
6558}
6559void Activity::SetSecrets(std::optional<discordpp::ActivitySecrets> Secrets)
6560{
6561 assert(state_ == DiscordObjectState::Owned);
6562 Discord_Activity_SetSecrets(&instance_, (Secrets.has_value() ? Secrets->instance() : nullptr));
6563}
6564discordpp::ActivityGamePlatforms Activity::SupportedPlatforms() const
6565{
6566 assert(state_ == DiscordObjectState::Owned);
6567 Discord_ActivityGamePlatforms returnValue__;
6568 returnValue__ = Discord_Activity_SupportedPlatforms(&instance_);
6569 return static_cast<discordpp::ActivityGamePlatforms>(returnValue__);
6570}
6571void Activity::SetSupportedPlatforms(discordpp::ActivityGamePlatforms SupportedPlatforms)
6572{
6573 assert(state_ == DiscordObjectState::Owned);
6574 Discord_Activity_SetSupportedPlatforms(
6575 &instance_, static_cast<Discord_ActivityGamePlatforms>(SupportedPlatforms));
6576}
6577const ClientResult ClientResult::nullobj{{}, DiscordObjectState::Invalid};
6578ClientResult::~ClientResult()
6579{
6580 if (state_ == DiscordObjectState::Owned) {
6581 Drop();
6582 state_ = DiscordObjectState::Invalid;
6583 }
6584}
6585ClientResult::ClientResult(ClientResult&& other) noexcept
6586 : instance_(other.instance_)
6587 , state_(other.state_)
6588{
6589 other.state_ = DiscordObjectState::Invalid;
6590}
6591ClientResult& ClientResult::operator=(ClientResult&& other) noexcept
6592{
6593 if (this != &other) {
6594 if (state_ == DiscordObjectState::Owned) {
6595 Drop();
6596 }
6597 instance_ = other.instance_;
6598 state_ = other.state_;
6599 other.state_ = DiscordObjectState::Invalid;
6600 }
6601 return *this;
6602}
6603ClientResult::ClientResult(const ClientResult& arg0)
6604 : instance_{}
6605 , state_(DiscordObjectState::Invalid)
6606{
6607 if (arg0.state_ == DiscordObjectState::Owned) {
6608 Discord_ClientResult_Clone(&instance_, arg0.instance());
6609
6610 state_ = DiscordObjectState::Owned;
6611 }
6612}
6613ClientResult& ClientResult::operator=(const ClientResult& arg0)
6614{
6615 if (this != &arg0) {
6616 if (state_ == DiscordObjectState::Owned) {
6617 Drop();
6618 state_ = DiscordObjectState::Invalid;
6619 }
6620 if (arg0.state_ == DiscordObjectState::Owned) {
6621 Discord_ClientResult_Clone(&instance_, arg0.instance());
6622
6623 state_ = DiscordObjectState::Owned;
6624 }
6625 }
6626 return *this;
6627}
6628ClientResult::ClientResult(Discord_ClientResult instance, DiscordObjectState state)
6629 : instance_(instance)
6630 , state_(state)
6631{
6632}
6633void ClientResult::Drop()
6634{
6635 if (state_ != DiscordObjectState::Owned) {
6636 return;
6637 }
6638 Discord_ClientResult_Drop(&instance_);
6639 state_ = DiscordObjectState::Invalid;
6640}
6641std::string ClientResult::ToString() const
6642{
6643 assert(state_ == DiscordObjectState::Owned);
6644 Discord_String returnValueNative__;
6645 Discord_ClientResult_ToString(&instance_, &returnValueNative__);
6646 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6647 returnValueNative__.size);
6648 Discord_Free(returnValueNative__.ptr);
6649 return returnValue__;
6650}
6651discordpp::ErrorType ClientResult::Type() const
6652{
6653 assert(state_ == DiscordObjectState::Owned);
6654 Discord_ErrorType returnValue__;
6655 returnValue__ = Discord_ClientResult_Type(&instance_);
6656 return static_cast<discordpp::ErrorType>(returnValue__);
6657}
6658void ClientResult::SetType(discordpp::ErrorType Type)
6659{
6660 assert(state_ == DiscordObjectState::Owned);
6661 Discord_ClientResult_SetType(&instance_, static_cast<Discord_ErrorType>(Type));
6662}
6663std::string ClientResult::Error() const
6664{
6665 assert(state_ == DiscordObjectState::Owned);
6666 Discord_String returnValueNative__;
6667 Discord_ClientResult_Error(&instance_, &returnValueNative__);
6668 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6669 returnValueNative__.size);
6670 Discord_Free(returnValueNative__.ptr);
6671 return returnValue__;
6672}
6673void ClientResult::SetError(std::string Error)
6674{
6675 assert(state_ == DiscordObjectState::Owned);
6676 Discord_String Error__str{(uint8_t*)(Error.data()), Error.size()};
6677 Discord_ClientResult_SetError(&instance_, Error__str);
6678}
6679int32_t ClientResult::ErrorCode() const
6680{
6681 assert(state_ == DiscordObjectState::Owned);
6682 int32_t returnValue__;
6683 returnValue__ = Discord_ClientResult_ErrorCode(&instance_);
6684 return returnValue__;
6685}
6686void ClientResult::SetErrorCode(int32_t ErrorCode)
6687{
6688 assert(state_ == DiscordObjectState::Owned);
6689 Discord_ClientResult_SetErrorCode(&instance_, ErrorCode);
6690}
6691discordpp::HttpStatusCode ClientResult::Status() const
6692{
6693 assert(state_ == DiscordObjectState::Owned);
6694 Discord_HttpStatusCode returnValue__;
6695 returnValue__ = Discord_ClientResult_Status(&instance_);
6696 return static_cast<discordpp::HttpStatusCode>(returnValue__);
6697}
6698void ClientResult::SetStatus(discordpp::HttpStatusCode Status)
6699{
6700 assert(state_ == DiscordObjectState::Owned);
6701 Discord_ClientResult_SetStatus(&instance_, static_cast<Discord_HttpStatusCode>(Status));
6702}
6703std::string ClientResult::ResponseBody() const
6704{
6705 assert(state_ == DiscordObjectState::Owned);
6706 Discord_String returnValueNative__;
6707 Discord_ClientResult_ResponseBody(&instance_, &returnValueNative__);
6708 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6709 returnValueNative__.size);
6710 Discord_Free(returnValueNative__.ptr);
6711 return returnValue__;
6712}
6713void ClientResult::SetResponseBody(std::string ResponseBody)
6714{
6715 assert(state_ == DiscordObjectState::Owned);
6716 Discord_String ResponseBody__str{(uint8_t*)(ResponseBody.data()), ResponseBody.size()};
6717 Discord_ClientResult_SetResponseBody(&instance_, ResponseBody__str);
6718}
6719bool ClientResult::Successful() const
6720{
6721 assert(state_ == DiscordObjectState::Owned);
6722 bool returnValue__;
6723 returnValue__ = Discord_ClientResult_Successful(&instance_);
6724 return returnValue__;
6725}
6726void ClientResult::SetSuccessful(bool Successful)
6727{
6728 assert(state_ == DiscordObjectState::Owned);
6729 Discord_ClientResult_SetSuccessful(&instance_, Successful);
6730}
6731bool ClientResult::Retryable() const
6732{
6733 assert(state_ == DiscordObjectState::Owned);
6734 bool returnValue__;
6735 returnValue__ = Discord_ClientResult_Retryable(&instance_);
6736 return returnValue__;
6737}
6738void ClientResult::SetRetryable(bool Retryable)
6739{
6740 assert(state_ == DiscordObjectState::Owned);
6741 Discord_ClientResult_SetRetryable(&instance_, Retryable);
6742}
6743float ClientResult::RetryAfter() const
6744{
6745 assert(state_ == DiscordObjectState::Owned);
6746 float returnValue__;
6747 returnValue__ = Discord_ClientResult_RetryAfter(&instance_);
6748 return returnValue__;
6749}
6750void ClientResult::SetRetryAfter(float RetryAfter)
6751{
6752 assert(state_ == DiscordObjectState::Owned);
6753 Discord_ClientResult_SetRetryAfter(&instance_, RetryAfter);
6754}
6755const AuthorizationCodeChallenge AuthorizationCodeChallenge::nullobj{{},
6756 DiscordObjectState::Invalid};
6757AuthorizationCodeChallenge::~AuthorizationCodeChallenge()
6758{
6759 if (state_ == DiscordObjectState::Owned) {
6760 Drop();
6761 state_ = DiscordObjectState::Invalid;
6762 }
6763}
6764AuthorizationCodeChallenge::AuthorizationCodeChallenge(AuthorizationCodeChallenge&& other) noexcept
6765 : instance_(other.instance_)
6766 , state_(other.state_)
6767{
6768 other.state_ = DiscordObjectState::Invalid;
6769}
6770AuthorizationCodeChallenge& AuthorizationCodeChallenge::operator=(
6771 AuthorizationCodeChallenge&& other) noexcept
6772{
6773 if (this != &other) {
6774 if (state_ == DiscordObjectState::Owned) {
6775 Drop();
6776 }
6777 instance_ = other.instance_;
6778 state_ = other.state_;
6779 other.state_ = DiscordObjectState::Invalid;
6780 }
6781 return *this;
6782}
6783AuthorizationCodeChallenge::AuthorizationCodeChallenge(const AuthorizationCodeChallenge& arg0)
6784 : instance_{}
6785 , state_(DiscordObjectState::Invalid)
6786{
6787 if (arg0.state_ == DiscordObjectState::Owned) {
6788 Discord_AuthorizationCodeChallenge_Clone(&instance_, arg0.instance());
6789
6790 state_ = DiscordObjectState::Owned;
6791 }
6792}
6793AuthorizationCodeChallenge& AuthorizationCodeChallenge::operator=(
6794 const AuthorizationCodeChallenge& arg0)
6795{
6796 if (this != &arg0) {
6797 if (state_ == DiscordObjectState::Owned) {
6798 Drop();
6799 state_ = DiscordObjectState::Invalid;
6800 }
6801 if (arg0.state_ == DiscordObjectState::Owned) {
6802 Discord_AuthorizationCodeChallenge_Clone(&instance_, arg0.instance());
6803
6804 state_ = DiscordObjectState::Owned;
6805 }
6806 }
6807 return *this;
6808}
6809AuthorizationCodeChallenge::AuthorizationCodeChallenge(Discord_AuthorizationCodeChallenge instance,
6810 DiscordObjectState state)
6811 : instance_(instance)
6812 , state_(state)
6813{
6814}
6815AuthorizationCodeChallenge::AuthorizationCodeChallenge()
6816{
6817 assert(state_ == DiscordObjectState::Invalid);
6818 Discord_AuthorizationCodeChallenge_Init(&instance_);
6819 state_ = DiscordObjectState::Owned;
6820}
6821void AuthorizationCodeChallenge::Drop()
6822{
6823 if (state_ != DiscordObjectState::Owned) {
6824 return;
6825 }
6826 Discord_AuthorizationCodeChallenge_Drop(&instance_);
6827 state_ = DiscordObjectState::Invalid;
6828}
6829discordpp::AuthenticationCodeChallengeMethod AuthorizationCodeChallenge::Method() const
6830{
6831 assert(state_ == DiscordObjectState::Owned);
6832 Discord_AuthenticationCodeChallengeMethod returnValue__;
6833 returnValue__ = Discord_AuthorizationCodeChallenge_Method(&instance_);
6834 return static_cast<discordpp::AuthenticationCodeChallengeMethod>(returnValue__);
6835}
6836void AuthorizationCodeChallenge::SetMethod(discordpp::AuthenticationCodeChallengeMethod Method)
6837{
6838 assert(state_ == DiscordObjectState::Owned);
6839 Discord_AuthorizationCodeChallenge_SetMethod(
6840 &instance_, static_cast<Discord_AuthenticationCodeChallengeMethod>(Method));
6841}
6842std::string AuthorizationCodeChallenge::Challenge() const
6843{
6844 assert(state_ == DiscordObjectState::Owned);
6845 Discord_String returnValueNative__;
6846 Discord_AuthorizationCodeChallenge_Challenge(&instance_, &returnValueNative__);
6847 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6848 returnValueNative__.size);
6849 Discord_Free(returnValueNative__.ptr);
6850 return returnValue__;
6851}
6852void AuthorizationCodeChallenge::SetChallenge(std::string Challenge)
6853{
6854 assert(state_ == DiscordObjectState::Owned);
6855 Discord_String Challenge__str{(uint8_t*)(Challenge.data()), Challenge.size()};
6856 Discord_AuthorizationCodeChallenge_SetChallenge(&instance_, Challenge__str);
6857}
6858const AuthorizationCodeVerifier AuthorizationCodeVerifier::nullobj{{}, DiscordObjectState::Invalid};
6859AuthorizationCodeVerifier::~AuthorizationCodeVerifier()
6860{
6861 if (state_ == DiscordObjectState::Owned) {
6862 Drop();
6863 state_ = DiscordObjectState::Invalid;
6864 }
6865}
6866AuthorizationCodeVerifier::AuthorizationCodeVerifier(AuthorizationCodeVerifier&& other) noexcept
6867 : instance_(other.instance_)
6868 , state_(other.state_)
6869{
6870 other.state_ = DiscordObjectState::Invalid;
6871}
6872AuthorizationCodeVerifier& AuthorizationCodeVerifier::operator=(
6873 AuthorizationCodeVerifier&& other) noexcept
6874{
6875 if (this != &other) {
6876 if (state_ == DiscordObjectState::Owned) {
6877 Drop();
6878 }
6879 instance_ = other.instance_;
6880 state_ = other.state_;
6881 other.state_ = DiscordObjectState::Invalid;
6882 }
6883 return *this;
6884}
6885AuthorizationCodeVerifier::AuthorizationCodeVerifier(const AuthorizationCodeVerifier& arg0)
6886 : instance_{}
6887 , state_(DiscordObjectState::Invalid)
6888{
6889 if (arg0.state_ == DiscordObjectState::Owned) {
6890 Discord_AuthorizationCodeVerifier_Clone(&instance_, arg0.instance());
6891
6892 state_ = DiscordObjectState::Owned;
6893 }
6894}
6895AuthorizationCodeVerifier& AuthorizationCodeVerifier::operator=(
6896 const AuthorizationCodeVerifier& arg0)
6897{
6898 if (this != &arg0) {
6899 if (state_ == DiscordObjectState::Owned) {
6900 Drop();
6901 state_ = DiscordObjectState::Invalid;
6902 }
6903 if (arg0.state_ == DiscordObjectState::Owned) {
6904 Discord_AuthorizationCodeVerifier_Clone(&instance_, arg0.instance());
6905
6906 state_ = DiscordObjectState::Owned;
6907 }
6908 }
6909 return *this;
6910}
6911AuthorizationCodeVerifier::AuthorizationCodeVerifier(Discord_AuthorizationCodeVerifier instance,
6912 DiscordObjectState state)
6913 : instance_(instance)
6914 , state_(state)
6915{
6916}
6917void AuthorizationCodeVerifier::Drop()
6918{
6919 if (state_ != DiscordObjectState::Owned) {
6920 return;
6921 }
6922 Discord_AuthorizationCodeVerifier_Drop(&instance_);
6923 state_ = DiscordObjectState::Invalid;
6924}
6925discordpp::AuthorizationCodeChallenge AuthorizationCodeVerifier::Challenge() const
6926{
6927 assert(state_ == DiscordObjectState::Owned);
6928 Discord_AuthorizationCodeChallenge returnValueNative__{};
6929 Discord_AuthorizationCodeVerifier_Challenge(&instance_, &returnValueNative__);
6930 discordpp::AuthorizationCodeChallenge returnValue__(returnValueNative__,
6931 DiscordObjectState::Owned);
6932 return returnValue__;
6933}
6934void AuthorizationCodeVerifier::SetChallenge(discordpp::AuthorizationCodeChallenge Challenge)
6935{
6936 assert(state_ == DiscordObjectState::Owned);
6937 Discord_AuthorizationCodeVerifier_SetChallenge(&instance_, Challenge.instance());
6938}
6939std::string AuthorizationCodeVerifier::Verifier() const
6940{
6941 assert(state_ == DiscordObjectState::Owned);
6942 Discord_String returnValueNative__;
6943 Discord_AuthorizationCodeVerifier_Verifier(&instance_, &returnValueNative__);
6944 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6945 returnValueNative__.size);
6946 Discord_Free(returnValueNative__.ptr);
6947 return returnValue__;
6948}
6949void AuthorizationCodeVerifier::SetVerifier(std::string Verifier)
6950{
6951 assert(state_ == DiscordObjectState::Owned);
6952 Discord_String Verifier__str{(uint8_t*)(Verifier.data()), Verifier.size()};
6953 Discord_AuthorizationCodeVerifier_SetVerifier(&instance_, Verifier__str);
6954}
6955const AuthorizationArgs AuthorizationArgs::nullobj{{}, DiscordObjectState::Invalid};
6956AuthorizationArgs::~AuthorizationArgs()
6957{
6958 if (state_ == DiscordObjectState::Owned) {
6959 Drop();
6960 state_ = DiscordObjectState::Invalid;
6961 }
6962}
6963AuthorizationArgs::AuthorizationArgs(AuthorizationArgs&& other) noexcept
6964 : instance_(other.instance_)
6965 , state_(other.state_)
6966{
6967 other.state_ = DiscordObjectState::Invalid;
6968}
6969AuthorizationArgs& AuthorizationArgs::operator=(AuthorizationArgs&& other) noexcept
6970{
6971 if (this != &other) {
6972 if (state_ == DiscordObjectState::Owned) {
6973 Drop();
6974 }
6975 instance_ = other.instance_;
6976 state_ = other.state_;
6977 other.state_ = DiscordObjectState::Invalid;
6978 }
6979 return *this;
6980}
6981AuthorizationArgs::AuthorizationArgs(const AuthorizationArgs& arg0)
6982 : instance_{}
6983 , state_(DiscordObjectState::Invalid)
6984{
6985 if (arg0.state_ == DiscordObjectState::Owned) {
6986 Discord_AuthorizationArgs_Clone(&instance_, arg0.instance());
6987
6988 state_ = DiscordObjectState::Owned;
6989 }
6990}
6991AuthorizationArgs& AuthorizationArgs::operator=(const AuthorizationArgs& arg0)
6992{
6993 if (this != &arg0) {
6994 if (state_ == DiscordObjectState::Owned) {
6995 Drop();
6996 state_ = DiscordObjectState::Invalid;
6997 }
6998 if (arg0.state_ == DiscordObjectState::Owned) {
6999 Discord_AuthorizationArgs_Clone(&instance_, arg0.instance());
7000
7001 state_ = DiscordObjectState::Owned;
7002 }
7003 }
7004 return *this;
7005}
7006AuthorizationArgs::AuthorizationArgs(Discord_AuthorizationArgs instance, DiscordObjectState state)
7007 : instance_(instance)
7008 , state_(state)
7009{
7010}
7011AuthorizationArgs::AuthorizationArgs()
7012{
7013 assert(state_ == DiscordObjectState::Invalid);
7014 Discord_AuthorizationArgs_Init(&instance_);
7015 state_ = DiscordObjectState::Owned;
7016}
7017void AuthorizationArgs::Drop()
7018{
7019 if (state_ != DiscordObjectState::Owned) {
7020 return;
7021 }
7022 Discord_AuthorizationArgs_Drop(&instance_);
7023 state_ = DiscordObjectState::Invalid;
7024}
7025uint64_t AuthorizationArgs::ClientId() const
7026{
7027 assert(state_ == DiscordObjectState::Owned);
7028 uint64_t returnValue__;
7029 returnValue__ = Discord_AuthorizationArgs_ClientId(&instance_);
7030 return returnValue__;
7031}
7032void AuthorizationArgs::SetClientId(uint64_t ClientId)
7033{
7034 assert(state_ == DiscordObjectState::Owned);
7035 Discord_AuthorizationArgs_SetClientId(&instance_, ClientId);
7036}
7037std::string AuthorizationArgs::Scopes() const
7038{
7039 assert(state_ == DiscordObjectState::Owned);
7040 Discord_String returnValueNative__;
7041 Discord_AuthorizationArgs_Scopes(&instance_, &returnValueNative__);
7042 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7043 returnValueNative__.size);
7044 Discord_Free(returnValueNative__.ptr);
7045 return returnValue__;
7046}
7047void AuthorizationArgs::SetScopes(std::string Scopes)
7048{
7049 assert(state_ == DiscordObjectState::Owned);
7050 Discord_String Scopes__str{(uint8_t*)(Scopes.data()), Scopes.size()};
7051 Discord_AuthorizationArgs_SetScopes(&instance_, Scopes__str);
7052}
7053std::optional<std::string> AuthorizationArgs::State() const
7054{
7055 assert(state_ == DiscordObjectState::Owned);
7056 bool returnIsNonNull__;
7057 Discord_String returnValueNative__;
7058 returnIsNonNull__ = Discord_AuthorizationArgs_State(&instance_, &returnValueNative__);
7059 if (!returnIsNonNull__) {
7060 return {};
7061 }
7062 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7063 returnValueNative__.size);
7064 Discord_Free(returnValueNative__.ptr);
7065 return returnValue__;
7066}
7067void AuthorizationArgs::SetState(std::optional<std::string> State)
7068{
7069 assert(state_ == DiscordObjectState::Owned);
7070 Discord_String State__str{};
7071 if (State.has_value()) {
7072 State__str.ptr = reinterpret_cast<uint8_t*>(State->data());
7073 State__str.size = State->size();
7074 }
7075 Discord_AuthorizationArgs_SetState(&instance_, (State.has_value() ? &State__str : nullptr));
7076}
7077std::optional<std::string> AuthorizationArgs::Nonce() const
7078{
7079 assert(state_ == DiscordObjectState::Owned);
7080 bool returnIsNonNull__;
7081 Discord_String returnValueNative__;
7082 returnIsNonNull__ = Discord_AuthorizationArgs_Nonce(&instance_, &returnValueNative__);
7083 if (!returnIsNonNull__) {
7084 return {};
7085 }
7086 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7087 returnValueNative__.size);
7088 Discord_Free(returnValueNative__.ptr);
7089 return returnValue__;
7090}
7091void AuthorizationArgs::SetNonce(std::optional<std::string> Nonce)
7092{
7093 assert(state_ == DiscordObjectState::Owned);
7094 Discord_String Nonce__str{};
7095 if (Nonce.has_value()) {
7096 Nonce__str.ptr = reinterpret_cast<uint8_t*>(Nonce->data());
7097 Nonce__str.size = Nonce->size();
7098 }
7099 Discord_AuthorizationArgs_SetNonce(&instance_, (Nonce.has_value() ? &Nonce__str : nullptr));
7100}
7101std::optional<discordpp::AuthorizationCodeChallenge> AuthorizationArgs::CodeChallenge() const
7102{
7103 assert(state_ == DiscordObjectState::Owned);
7104 bool returnIsNonNull__;
7105 Discord_AuthorizationCodeChallenge returnValueNative__;
7106 returnIsNonNull__ = Discord_AuthorizationArgs_CodeChallenge(&instance_, &returnValueNative__);
7107 if (!returnIsNonNull__) {
7108 return {};
7109 }
7110 discordpp::AuthorizationCodeChallenge returnValue__(returnValueNative__,
7111 DiscordObjectState::Owned);
7112 return returnValue__;
7113}
7114void AuthorizationArgs::SetCodeChallenge(
7115 std::optional<discordpp::AuthorizationCodeChallenge> CodeChallenge)
7116{
7117 assert(state_ == DiscordObjectState::Owned);
7118 Discord_AuthorizationArgs_SetCodeChallenge(
7119 &instance_, (CodeChallenge.has_value() ? CodeChallenge->instance() : nullptr));
7120}
7121std::optional<discordpp::IntegrationType> AuthorizationArgs::IntegrationType() const
7122{
7123 assert(state_ == DiscordObjectState::Owned);
7124 bool returnIsNonNull__;
7125 Discord_IntegrationType returnValueNative__;
7126 returnIsNonNull__ = Discord_AuthorizationArgs_IntegrationType(&instance_, &returnValueNative__);
7127 if (!returnIsNonNull__) {
7128 return {};
7129 }
7130 auto returnValue__ = static_cast<discordpp::IntegrationType>(returnValueNative__);
7131 return returnValue__;
7132}
7133void AuthorizationArgs::SetIntegrationType(
7134 std::optional<discordpp::IntegrationType> IntegrationType)
7135{
7136 assert(state_ == DiscordObjectState::Owned);
7137 Discord_AuthorizationArgs_SetIntegrationType(
7138 &instance_,
7139 (IntegrationType.has_value() ? reinterpret_cast<Discord_IntegrationType*>(&*IntegrationType)
7140 : nullptr));
7141}
7142const DeviceAuthorizationArgs DeviceAuthorizationArgs::nullobj{{}, DiscordObjectState::Invalid};
7143DeviceAuthorizationArgs::~DeviceAuthorizationArgs()
7144{
7145 if (state_ == DiscordObjectState::Owned) {
7146 Drop();
7147 state_ = DiscordObjectState::Invalid;
7148 }
7149}
7150DeviceAuthorizationArgs::DeviceAuthorizationArgs(DeviceAuthorizationArgs&& other) noexcept
7151 : instance_(other.instance_)
7152 , state_(other.state_)
7153{
7154 other.state_ = DiscordObjectState::Invalid;
7155}
7156DeviceAuthorizationArgs& DeviceAuthorizationArgs::operator=(
7157 DeviceAuthorizationArgs&& other) noexcept
7158{
7159 if (this != &other) {
7160 if (state_ == DiscordObjectState::Owned) {
7161 Drop();
7162 }
7163 instance_ = other.instance_;
7164 state_ = other.state_;
7165 other.state_ = DiscordObjectState::Invalid;
7166 }
7167 return *this;
7168}
7169DeviceAuthorizationArgs::DeviceAuthorizationArgs(const DeviceAuthorizationArgs& arg0)
7170 : instance_{}
7171 , state_(DiscordObjectState::Invalid)
7172{
7173 if (arg0.state_ == DiscordObjectState::Owned) {
7174 Discord_DeviceAuthorizationArgs_Clone(&instance_, arg0.instance());
7175
7176 state_ = DiscordObjectState::Owned;
7177 }
7178}
7179DeviceAuthorizationArgs& DeviceAuthorizationArgs::operator=(const DeviceAuthorizationArgs& arg0)
7180{
7181 if (this != &arg0) {
7182 if (state_ == DiscordObjectState::Owned) {
7183 Drop();
7184 state_ = DiscordObjectState::Invalid;
7185 }
7186 if (arg0.state_ == DiscordObjectState::Owned) {
7187 Discord_DeviceAuthorizationArgs_Clone(&instance_, arg0.instance());
7188
7189 state_ = DiscordObjectState::Owned;
7190 }
7191 }
7192 return *this;
7193}
7194DeviceAuthorizationArgs::DeviceAuthorizationArgs(Discord_DeviceAuthorizationArgs instance,
7195 DiscordObjectState state)
7196 : instance_(instance)
7197 , state_(state)
7198{
7199}
7200DeviceAuthorizationArgs::DeviceAuthorizationArgs()
7201{
7202 assert(state_ == DiscordObjectState::Invalid);
7203 Discord_DeviceAuthorizationArgs_Init(&instance_);
7204 state_ = DiscordObjectState::Owned;
7205}
7206void DeviceAuthorizationArgs::Drop()
7207{
7208 if (state_ != DiscordObjectState::Owned) {
7209 return;
7210 }
7211 Discord_DeviceAuthorizationArgs_Drop(&instance_);
7212 state_ = DiscordObjectState::Invalid;
7213}
7214uint64_t DeviceAuthorizationArgs::ClientId() const
7215{
7216 assert(state_ == DiscordObjectState::Owned);
7217 uint64_t returnValue__;
7218 returnValue__ = Discord_DeviceAuthorizationArgs_ClientId(&instance_);
7219 return returnValue__;
7220}
7221void DeviceAuthorizationArgs::SetClientId(uint64_t ClientId)
7222{
7223 assert(state_ == DiscordObjectState::Owned);
7224 Discord_DeviceAuthorizationArgs_SetClientId(&instance_, ClientId);
7225}
7226std::string DeviceAuthorizationArgs::Scopes() const
7227{
7228 assert(state_ == DiscordObjectState::Owned);
7229 Discord_String returnValueNative__;
7230 Discord_DeviceAuthorizationArgs_Scopes(&instance_, &returnValueNative__);
7231 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7232 returnValueNative__.size);
7233 Discord_Free(returnValueNative__.ptr);
7234 return returnValue__;
7235}
7236void DeviceAuthorizationArgs::SetScopes(std::string Scopes)
7237{
7238 assert(state_ == DiscordObjectState::Owned);
7239 Discord_String Scopes__str{(uint8_t*)(Scopes.data()), Scopes.size()};
7240 Discord_DeviceAuthorizationArgs_SetScopes(&instance_, Scopes__str);
7241}
7242const VoiceStateHandle VoiceStateHandle::nullobj{{}, DiscordObjectState::Invalid};
7243VoiceStateHandle::~VoiceStateHandle()
7244{
7245 if (state_ == DiscordObjectState::Owned) {
7246 Drop();
7247 state_ = DiscordObjectState::Invalid;
7248 }
7249}
7250VoiceStateHandle::VoiceStateHandle(VoiceStateHandle&& other) noexcept
7251 : instance_(other.instance_)
7252 , state_(other.state_)
7253{
7254 other.state_ = DiscordObjectState::Invalid;
7255}
7256VoiceStateHandle& VoiceStateHandle::operator=(VoiceStateHandle&& other) noexcept
7257{
7258 if (this != &other) {
7259 if (state_ == DiscordObjectState::Owned) {
7260 Drop();
7261 }
7262 instance_ = other.instance_;
7263 state_ = other.state_;
7264 other.state_ = DiscordObjectState::Invalid;
7265 }
7266 return *this;
7267}
7268VoiceStateHandle::VoiceStateHandle(const VoiceStateHandle& other)
7269 : instance_{}
7270 , state_(DiscordObjectState::Invalid)
7271{
7272 if (other.state_ == DiscordObjectState::Owned) {
7273 Discord_VoiceStateHandle_Clone(&instance_, other.instance());
7274
7275 state_ = DiscordObjectState::Owned;
7276 }
7277}
7278VoiceStateHandle& VoiceStateHandle::operator=(const VoiceStateHandle& other)
7279{
7280 if (this != &other) {
7281 if (state_ == DiscordObjectState::Owned) {
7282 Drop();
7283 state_ = DiscordObjectState::Invalid;
7284 }
7285 if (other.state_ == DiscordObjectState::Owned) {
7286 Discord_VoiceStateHandle_Clone(&instance_, other.instance());
7287
7288 state_ = DiscordObjectState::Owned;
7289 }
7290 }
7291 return *this;
7292}
7293VoiceStateHandle::VoiceStateHandle(Discord_VoiceStateHandle instance, DiscordObjectState state)
7294 : instance_(instance)
7295 , state_(state)
7296{
7297}
7298void VoiceStateHandle::Drop()
7299{
7300 if (state_ != DiscordObjectState::Owned) {
7301 return;
7302 }
7303 Discord_VoiceStateHandle_Drop(&instance_);
7304 state_ = DiscordObjectState::Invalid;
7305}
7306bool VoiceStateHandle::SelfDeaf() const
7307{
7308 assert(state_ == DiscordObjectState::Owned);
7309 bool returnValue__;
7310 returnValue__ = Discord_VoiceStateHandle_SelfDeaf(&instance_);
7311 return returnValue__;
7312}
7313bool VoiceStateHandle::SelfMute() const
7314{
7315 assert(state_ == DiscordObjectState::Owned);
7316 bool returnValue__;
7317 returnValue__ = Discord_VoiceStateHandle_SelfMute(&instance_);
7318 return returnValue__;
7319}
7320const VADThresholdSettings VADThresholdSettings::nullobj{{}, DiscordObjectState::Invalid};
7321VADThresholdSettings::~VADThresholdSettings()
7322{
7323 if (state_ == DiscordObjectState::Owned) {
7324 Drop();
7325 state_ = DiscordObjectState::Invalid;
7326 }
7327}
7328VADThresholdSettings::VADThresholdSettings(VADThresholdSettings&& other) noexcept
7329 : instance_(other.instance_)
7330 , state_(other.state_)
7331{
7332 other.state_ = DiscordObjectState::Invalid;
7333}
7334VADThresholdSettings& VADThresholdSettings::operator=(VADThresholdSettings&& other) noexcept
7335{
7336 if (this != &other) {
7337 if (state_ == DiscordObjectState::Owned) {
7338 Drop();
7339 }
7340 instance_ = other.instance_;
7341 state_ = other.state_;
7342 other.state_ = DiscordObjectState::Invalid;
7343 }
7344 return *this;
7345}
7346VADThresholdSettings::VADThresholdSettings(Discord_VADThresholdSettings instance,
7347 DiscordObjectState state)
7348 : instance_(instance)
7349 , state_(state)
7350{
7351}
7352void VADThresholdSettings::Drop()
7353{
7354 if (state_ != DiscordObjectState::Owned) {
7355 return;
7356 }
7357 Discord_VADThresholdSettings_Drop(&instance_);
7358 state_ = DiscordObjectState::Invalid;
7359}
7360float VADThresholdSettings::VadThreshold() const
7361{
7362 assert(state_ == DiscordObjectState::Owned);
7363 float returnValue__;
7364 returnValue__ = Discord_VADThresholdSettings_VadThreshold(&instance_);
7365 return returnValue__;
7366}
7367void VADThresholdSettings::SetVadThreshold(float VadThreshold)
7368{
7369 assert(state_ == DiscordObjectState::Owned);
7370 Discord_VADThresholdSettings_SetVadThreshold(&instance_, VadThreshold);
7371}
7372bool VADThresholdSettings::Automatic() const
7373{
7374 assert(state_ == DiscordObjectState::Owned);
7375 bool returnValue__;
7376 returnValue__ = Discord_VADThresholdSettings_Automatic(&instance_);
7377 return returnValue__;
7378}
7379void VADThresholdSettings::SetAutomatic(bool Automatic)
7380{
7381 assert(state_ == DiscordObjectState::Owned);
7382 Discord_VADThresholdSettings_SetAutomatic(&instance_, Automatic);
7383}
7384const Call Call::nullobj{{}, DiscordObjectState::Invalid};
7385Call::~Call()
7386{
7387 if (state_ == DiscordObjectState::Owned) {
7388 Drop();
7389 state_ = DiscordObjectState::Invalid;
7390 }
7391}
7392Call::Call(Call&& other) noexcept
7393 : instance_(other.instance_)
7394 , state_(other.state_)
7395{
7396 other.state_ = DiscordObjectState::Invalid;
7397}
7398Call& Call::operator=(Call&& other) noexcept
7399{
7400 if (this != &other) {
7401 if (state_ == DiscordObjectState::Owned) {
7402 Drop();
7403 }
7404 instance_ = other.instance_;
7405 state_ = other.state_;
7406 other.state_ = DiscordObjectState::Invalid;
7407 }
7408 return *this;
7409}
7410Call::Call(const Call& other)
7411 : instance_{}
7412 , state_(DiscordObjectState::Invalid)
7413{
7414 if (other.state_ == DiscordObjectState::Owned) {
7415 Discord_Call_Clone(&instance_, other.instance());
7416
7417 state_ = DiscordObjectState::Owned;
7418 }
7419}
7420Call& Call::operator=(const Call& other)
7421{
7422 if (this != &other) {
7423 if (state_ == DiscordObjectState::Owned) {
7424 Drop();
7425 state_ = DiscordObjectState::Invalid;
7426 }
7427 if (other.state_ == DiscordObjectState::Owned) {
7428 Discord_Call_Clone(&instance_, other.instance());
7429
7430 state_ = DiscordObjectState::Owned;
7431 }
7432 }
7433 return *this;
7434}
7435Call::Call(Discord_Call instance, DiscordObjectState state)
7436 : instance_(instance)
7437 , state_(state)
7438{
7439}
7440void Call::Drop()
7441{
7442 if (state_ != DiscordObjectState::Owned) {
7443 return;
7444 }
7445 Discord_Call_Drop(&instance_);
7446 state_ = DiscordObjectState::Invalid;
7447}
7448std::string Call::ErrorToString(discordpp::Call::Error type)
7449{
7450 Discord_String returnValueNative__;
7451 Discord_Call_ErrorToString(static_cast<Discord_Call_Error>(type), &returnValueNative__);
7452 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7453 returnValueNative__.size);
7454 Discord_Free(returnValueNative__.ptr);
7455 return returnValue__;
7456}
7457discordpp::AudioModeType Call::GetAudioMode()
7458{
7459 assert(state_ == DiscordObjectState::Owned);
7460 Discord_AudioModeType returnValue__;
7461 returnValue__ = Discord_Call_GetAudioMode(&instance_);
7462 return static_cast<discordpp::AudioModeType>(returnValue__);
7463}
7464uint64_t Call::GetChannelId() const
7465{
7466 assert(state_ == DiscordObjectState::Owned);
7467 uint64_t returnValue__;
7468 returnValue__ = Discord_Call_GetChannelId(&instance_);
7469 return returnValue__;
7470}
7471uint64_t Call::GetGuildId() const
7472{
7473 assert(state_ == DiscordObjectState::Owned);
7474 uint64_t returnValue__;
7475 returnValue__ = Discord_Call_GetGuildId(&instance_);
7476 return returnValue__;
7477}
7478bool Call::GetLocalMute(uint64_t userId)
7479{
7480 assert(state_ == DiscordObjectState::Owned);
7481 bool returnValue__;
7482 returnValue__ = Discord_Call_GetLocalMute(&instance_, userId);
7483 return returnValue__;
7484}
7485std::vector<uint64_t> Call::GetParticipants() const
7486{
7487 assert(state_ == DiscordObjectState::Owned);
7488 Discord_UInt64Span returnValueNative__;
7489 Discord_Call_GetParticipants(&instance_, &returnValueNative__);
7490 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
7491 returnValueNative__.ptr + returnValueNative__.size);
7492 Discord_Free(returnValueNative__.ptr);
7493 return returnValue__;
7494}
7495float Call::GetParticipantVolume(uint64_t userId)
7496{
7497 assert(state_ == DiscordObjectState::Owned);
7498 float returnValue__;
7499 returnValue__ = Discord_Call_GetParticipantVolume(&instance_, userId);
7500 return returnValue__;
7501}
7502bool Call::GetPTTActive()
7503{
7504 assert(state_ == DiscordObjectState::Owned);
7505 bool returnValue__;
7506 returnValue__ = Discord_Call_GetPTTActive(&instance_);
7507 return returnValue__;
7508}
7509uint32_t Call::GetPTTReleaseDelay()
7510{
7511 assert(state_ == DiscordObjectState::Owned);
7512 uint32_t returnValue__;
7513 returnValue__ = Discord_Call_GetPTTReleaseDelay(&instance_);
7514 return returnValue__;
7515}
7516bool Call::GetSelfDeaf()
7517{
7518 assert(state_ == DiscordObjectState::Owned);
7519 bool returnValue__;
7520 returnValue__ = Discord_Call_GetSelfDeaf(&instance_);
7521 return returnValue__;
7522}
7523bool Call::GetSelfMute()
7524{
7525 assert(state_ == DiscordObjectState::Owned);
7526 bool returnValue__;
7527 returnValue__ = Discord_Call_GetSelfMute(&instance_);
7528 return returnValue__;
7529}
7530discordpp::Call::Status Call::GetStatus() const
7531{
7532 assert(state_ == DiscordObjectState::Owned);
7533 Discord_Call_Status returnValue__;
7534 returnValue__ = Discord_Call_GetStatus(&instance_);
7535 return static_cast<discordpp::Call::Status>(returnValue__);
7536}
7537discordpp::VADThresholdSettings Call::GetVADThreshold() const
7538{
7539 assert(state_ == DiscordObjectState::Owned);
7540 Discord_VADThresholdSettings returnValueNative__{};
7541 Discord_Call_GetVADThreshold(&instance_, &returnValueNative__);
7542 discordpp::VADThresholdSettings returnValue__(returnValueNative__, DiscordObjectState::Owned);
7543 return returnValue__;
7544}
7545std::optional<discordpp::VoiceStateHandle> Call::GetVoiceStateHandle(uint64_t userId) const
7546{
7547 assert(state_ == DiscordObjectState::Owned);
7548 bool returnIsNonNull__;
7549 Discord_VoiceStateHandle returnValueNative__;
7550 returnIsNonNull__ = Discord_Call_GetVoiceStateHandle(&instance_, userId, &returnValueNative__);
7551 if (!returnIsNonNull__) {
7552 return {};
7553 }
7554 discordpp::VoiceStateHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
7555 return returnValue__;
7556}
7557void Call::SetAudioMode(discordpp::AudioModeType audioMode)
7558{
7559 assert(state_ == DiscordObjectState::Owned);
7560 Discord_Call_SetAudioMode(&instance_, static_cast<Discord_AudioModeType>(audioMode));
7561}
7562void Call::SetLocalMute(uint64_t userId, bool mute)
7563{
7564 assert(state_ == DiscordObjectState::Owned);
7565 Discord_Call_SetLocalMute(&instance_, userId, mute);
7566}
7567void Call::SetOnVoiceStateChangedCallback(discordpp::Call::OnVoiceStateChanged cb)
7568{
7569 assert(state_ == DiscordObjectState::Owned);
7570 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
7571 auto cb__userData = new Tcb__UserData(cb);
7572 Discord_Call_OnVoiceStateChanged cb__native = [](auto userId, void* userData__) {
7573 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
7574 userData__typed->delegate(userId);
7575 };
7576 Discord_Call_SetOnVoiceStateChangedCallback(
7577 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
7578}
7579void Call::SetParticipantChangedCallback(discordpp::Call::OnParticipantChanged cb)
7580{
7581 assert(state_ == DiscordObjectState::Owned);
7582 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
7583 auto cb__userData = new Tcb__UserData(cb);
7584 Discord_Call_OnParticipantChanged cb__native = [](auto userId, auto added, void* userData__) {
7585 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
7586 userData__typed->delegate(userId, added);
7587 };
7588 Discord_Call_SetParticipantChangedCallback(
7589 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
7590}
7591void Call::SetParticipantVolume(uint64_t userId, float volume)
7592{
7593 assert(state_ == DiscordObjectState::Owned);
7594 Discord_Call_SetParticipantVolume(&instance_, userId, volume);
7595}
7596void Call::SetPTTActive(bool active)
7597{
7598 assert(state_ == DiscordObjectState::Owned);
7599 Discord_Call_SetPTTActive(&instance_, active);
7600}
7601void Call::SetPTTReleaseDelay(uint32_t releaseDelayMs)
7602{
7603 assert(state_ == DiscordObjectState::Owned);
7604 Discord_Call_SetPTTReleaseDelay(&instance_, releaseDelayMs);
7605}
7606void Call::SetSelfDeaf(bool deaf)
7607{
7608 assert(state_ == DiscordObjectState::Owned);
7609 Discord_Call_SetSelfDeaf(&instance_, deaf);
7610}
7611void Call::SetSelfMute(bool mute)
7612{
7613 assert(state_ == DiscordObjectState::Owned);
7614 Discord_Call_SetSelfMute(&instance_, mute);
7615}
7616void Call::SetSpeakingStatusChangedCallback(discordpp::Call::OnSpeakingStatusChanged cb)
7617{
7618 assert(state_ == DiscordObjectState::Owned);
7619 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
7620 auto cb__userData = new Tcb__UserData(cb);
7621 Discord_Call_OnSpeakingStatusChanged cb__native =
7622 [](auto userId, auto isPlayingSound, void* userData__) {
7623 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
7624 userData__typed->delegate(userId, isPlayingSound);
7625 };
7626 Discord_Call_SetSpeakingStatusChangedCallback(
7627 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
7628}
7629void Call::SetStatusChangedCallback(discordpp::Call::OnStatusChanged cb)
7630{
7631 assert(state_ == DiscordObjectState::Owned);
7632 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
7633 auto cb__userData = new Tcb__UserData(cb);
7634 Discord_Call_OnStatusChanged cb__native =
7635 [](auto status, auto error, auto errorDetail, void* userData__) {
7636 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
7637 userData__typed->delegate(static_cast<discordpp::Call::Status>(status),
7638 static_cast<discordpp::Call::Error>(error),
7639 errorDetail);
7640 };
7641 Discord_Call_SetStatusChangedCallback(
7642 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
7643}
7644void Call::SetVADThreshold(bool automatic, float threshold)
7645{
7646 assert(state_ == DiscordObjectState::Owned);
7647 Discord_Call_SetVADThreshold(&instance_, automatic, threshold);
7648}
7649std::string Call::StatusToString(discordpp::Call::Status type)
7650{
7651 Discord_String returnValueNative__;
7652 Discord_Call_StatusToString(static_cast<Discord_Call_Status>(type), &returnValueNative__);
7653 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7654 returnValueNative__.size);
7655 Discord_Free(returnValueNative__.ptr);
7656 return returnValue__;
7657}
7658const ChannelHandle ChannelHandle::nullobj{{}, DiscordObjectState::Invalid};
7659ChannelHandle::~ChannelHandle()
7660{
7661 if (state_ == DiscordObjectState::Owned) {
7662 Drop();
7663 state_ = DiscordObjectState::Invalid;
7664 }
7665}
7666ChannelHandle::ChannelHandle(ChannelHandle&& other) noexcept
7667 : instance_(other.instance_)
7668 , state_(other.state_)
7669{
7670 other.state_ = DiscordObjectState::Invalid;
7671}
7672ChannelHandle& ChannelHandle::operator=(ChannelHandle&& other) noexcept
7673{
7674 if (this != &other) {
7675 if (state_ == DiscordObjectState::Owned) {
7676 Drop();
7677 }
7678 instance_ = other.instance_;
7679 state_ = other.state_;
7680 other.state_ = DiscordObjectState::Invalid;
7681 }
7682 return *this;
7683}
7684ChannelHandle::ChannelHandle(const ChannelHandle& other)
7685 : instance_{}
7686 , state_(DiscordObjectState::Invalid)
7687{
7688 if (other.state_ == DiscordObjectState::Owned) {
7689 Discord_ChannelHandle_Clone(&instance_, other.instance());
7690
7691 state_ = DiscordObjectState::Owned;
7692 }
7693}
7694ChannelHandle& ChannelHandle::operator=(const ChannelHandle& other)
7695{
7696 if (this != &other) {
7697 if (state_ == DiscordObjectState::Owned) {
7698 Drop();
7699 state_ = DiscordObjectState::Invalid;
7700 }
7701 if (other.state_ == DiscordObjectState::Owned) {
7702 Discord_ChannelHandle_Clone(&instance_, other.instance());
7703
7704 state_ = DiscordObjectState::Owned;
7705 }
7706 }
7707 return *this;
7708}
7709ChannelHandle::ChannelHandle(Discord_ChannelHandle instance, DiscordObjectState state)
7710 : instance_(instance)
7711 , state_(state)
7712{
7713}
7714void ChannelHandle::Drop()
7715{
7716 if (state_ != DiscordObjectState::Owned) {
7717 return;
7718 }
7719 Discord_ChannelHandle_Drop(&instance_);
7720 state_ = DiscordObjectState::Invalid;
7721}
7722uint64_t ChannelHandle::Id() const
7723{
7724 assert(state_ == DiscordObjectState::Owned);
7725 uint64_t returnValue__;
7726 returnValue__ = Discord_ChannelHandle_Id(&instance_);
7727 return returnValue__;
7728}
7729std::string ChannelHandle::Name() const
7730{
7731 assert(state_ == DiscordObjectState::Owned);
7732 Discord_String returnValueNative__;
7733 Discord_ChannelHandle_Name(&instance_, &returnValueNative__);
7734 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7735 returnValueNative__.size);
7736 Discord_Free(returnValueNative__.ptr);
7737 return returnValue__;
7738}
7739std::vector<uint64_t> ChannelHandle::Recipients() const
7740{
7741 assert(state_ == DiscordObjectState::Owned);
7742 Discord_UInt64Span returnValueNative__;
7743 Discord_ChannelHandle_Recipients(&instance_, &returnValueNative__);
7744 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
7745 returnValueNative__.ptr + returnValueNative__.size);
7746 Discord_Free(returnValueNative__.ptr);
7747 return returnValue__;
7748}
7749discordpp::ChannelType ChannelHandle::Type() const
7750{
7751 assert(state_ == DiscordObjectState::Owned);
7752 Discord_ChannelType returnValue__;
7753 returnValue__ = Discord_ChannelHandle_Type(&instance_);
7754 return static_cast<discordpp::ChannelType>(returnValue__);
7755}
7756const GuildMinimal GuildMinimal::nullobj{{}, DiscordObjectState::Invalid};
7757GuildMinimal::~GuildMinimal()
7758{
7759 if (state_ == DiscordObjectState::Owned) {
7760 Drop();
7761 state_ = DiscordObjectState::Invalid;
7762 }
7763}
7764GuildMinimal::GuildMinimal(GuildMinimal&& other) noexcept
7765 : instance_(other.instance_)
7766 , state_(other.state_)
7767{
7768 other.state_ = DiscordObjectState::Invalid;
7769}
7770GuildMinimal& GuildMinimal::operator=(GuildMinimal&& other) noexcept
7771{
7772 if (this != &other) {
7773 if (state_ == DiscordObjectState::Owned) {
7774 Drop();
7775 }
7776 instance_ = other.instance_;
7777 state_ = other.state_;
7778 other.state_ = DiscordObjectState::Invalid;
7779 }
7780 return *this;
7781}
7782GuildMinimal::GuildMinimal(const GuildMinimal& arg0)
7783 : instance_{}
7784 , state_(DiscordObjectState::Invalid)
7785{
7786 if (arg0.state_ == DiscordObjectState::Owned) {
7787 Discord_GuildMinimal_Clone(&instance_, arg0.instance());
7788
7789 state_ = DiscordObjectState::Owned;
7790 }
7791}
7792GuildMinimal& GuildMinimal::operator=(const GuildMinimal& arg0)
7793{
7794 if (this != &arg0) {
7795 if (state_ == DiscordObjectState::Owned) {
7796 Drop();
7797 state_ = DiscordObjectState::Invalid;
7798 }
7799 if (arg0.state_ == DiscordObjectState::Owned) {
7800 Discord_GuildMinimal_Clone(&instance_, arg0.instance());
7801
7802 state_ = DiscordObjectState::Owned;
7803 }
7804 }
7805 return *this;
7806}
7807GuildMinimal::GuildMinimal(Discord_GuildMinimal instance, DiscordObjectState state)
7808 : instance_(instance)
7809 , state_(state)
7810{
7811}
7812void GuildMinimal::Drop()
7813{
7814 if (state_ != DiscordObjectState::Owned) {
7815 return;
7816 }
7817 Discord_GuildMinimal_Drop(&instance_);
7818 state_ = DiscordObjectState::Invalid;
7819}
7820uint64_t GuildMinimal::Id() const
7821{
7822 assert(state_ == DiscordObjectState::Owned);
7823 uint64_t returnValue__;
7824 returnValue__ = Discord_GuildMinimal_Id(&instance_);
7825 return returnValue__;
7826}
7827void GuildMinimal::SetId(uint64_t Id)
7828{
7829 assert(state_ == DiscordObjectState::Owned);
7830 Discord_GuildMinimal_SetId(&instance_, Id);
7831}
7832std::string GuildMinimal::Name() const
7833{
7834 assert(state_ == DiscordObjectState::Owned);
7835 Discord_String returnValueNative__;
7836 Discord_GuildMinimal_Name(&instance_, &returnValueNative__);
7837 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7838 returnValueNative__.size);
7839 Discord_Free(returnValueNative__.ptr);
7840 return returnValue__;
7841}
7842void GuildMinimal::SetName(std::string Name)
7843{
7844 assert(state_ == DiscordObjectState::Owned);
7845 Discord_String Name__str{(uint8_t*)(Name.data()), Name.size()};
7846 Discord_GuildMinimal_SetName(&instance_, Name__str);
7847}
7848const GuildChannel GuildChannel::nullobj{{}, DiscordObjectState::Invalid};
7849GuildChannel::~GuildChannel()
7850{
7851 if (state_ == DiscordObjectState::Owned) {
7852 Drop();
7853 state_ = DiscordObjectState::Invalid;
7854 }
7855}
7856GuildChannel::GuildChannel(GuildChannel&& other) noexcept
7857 : instance_(other.instance_)
7858 , state_(other.state_)
7859{
7860 other.state_ = DiscordObjectState::Invalid;
7861}
7862GuildChannel& GuildChannel::operator=(GuildChannel&& other) noexcept
7863{
7864 if (this != &other) {
7865 if (state_ == DiscordObjectState::Owned) {
7866 Drop();
7867 }
7868 instance_ = other.instance_;
7869 state_ = other.state_;
7870 other.state_ = DiscordObjectState::Invalid;
7871 }
7872 return *this;
7873}
7874GuildChannel::GuildChannel(const GuildChannel& arg0)
7875 : instance_{}
7876 , state_(DiscordObjectState::Invalid)
7877{
7878 if (arg0.state_ == DiscordObjectState::Owned) {
7879 Discord_GuildChannel_Clone(&instance_, arg0.instance());
7880
7881 state_ = DiscordObjectState::Owned;
7882 }
7883}
7884GuildChannel& GuildChannel::operator=(const GuildChannel& arg0)
7885{
7886 if (this != &arg0) {
7887 if (state_ == DiscordObjectState::Owned) {
7888 Drop();
7889 state_ = DiscordObjectState::Invalid;
7890 }
7891 if (arg0.state_ == DiscordObjectState::Owned) {
7892 Discord_GuildChannel_Clone(&instance_, arg0.instance());
7893
7894 state_ = DiscordObjectState::Owned;
7895 }
7896 }
7897 return *this;
7898}
7899GuildChannel::GuildChannel(Discord_GuildChannel instance, DiscordObjectState state)
7900 : instance_(instance)
7901 , state_(state)
7902{
7903}
7904void GuildChannel::Drop()
7905{
7906 if (state_ != DiscordObjectState::Owned) {
7907 return;
7908 }
7909 Discord_GuildChannel_Drop(&instance_);
7910 state_ = DiscordObjectState::Invalid;
7911}
7912uint64_t GuildChannel::Id() const
7913{
7914 assert(state_ == DiscordObjectState::Owned);
7915 uint64_t returnValue__;
7916 returnValue__ = Discord_GuildChannel_Id(&instance_);
7917 return returnValue__;
7918}
7919void GuildChannel::SetId(uint64_t Id)
7920{
7921 assert(state_ == DiscordObjectState::Owned);
7922 Discord_GuildChannel_SetId(&instance_, Id);
7923}
7924std::string GuildChannel::Name() const
7925{
7926 assert(state_ == DiscordObjectState::Owned);
7927 Discord_String returnValueNative__;
7928 Discord_GuildChannel_Name(&instance_, &returnValueNative__);
7929 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7930 returnValueNative__.size);
7931 Discord_Free(returnValueNative__.ptr);
7932 return returnValue__;
7933}
7934void GuildChannel::SetName(std::string Name)
7935{
7936 assert(state_ == DiscordObjectState::Owned);
7937 Discord_String Name__str{(uint8_t*)(Name.data()), Name.size()};
7938 Discord_GuildChannel_SetName(&instance_, Name__str);
7939}
7940bool GuildChannel::IsLinkable() const
7941{
7942 assert(state_ == DiscordObjectState::Owned);
7943 bool returnValue__;
7944 returnValue__ = Discord_GuildChannel_IsLinkable(&instance_);
7945 return returnValue__;
7946}
7947void GuildChannel::SetIsLinkable(bool IsLinkable)
7948{
7949 assert(state_ == DiscordObjectState::Owned);
7950 Discord_GuildChannel_SetIsLinkable(&instance_, IsLinkable);
7951}
7952bool GuildChannel::IsViewableAndWriteableByAllMembers() const
7953{
7954 assert(state_ == DiscordObjectState::Owned);
7955 bool returnValue__;
7956 returnValue__ = Discord_GuildChannel_IsViewableAndWriteableByAllMembers(&instance_);
7957 return returnValue__;
7958}
7959void GuildChannel::SetIsViewableAndWriteableByAllMembers(bool IsViewableAndWriteableByAllMembers)
7960{
7961 assert(state_ == DiscordObjectState::Owned);
7962 Discord_GuildChannel_SetIsViewableAndWriteableByAllMembers(&instance_,
7963 IsViewableAndWriteableByAllMembers);
7964}
7965std::optional<discordpp::LinkedLobby> GuildChannel::LinkedLobby() const
7966{
7967 assert(state_ == DiscordObjectState::Owned);
7968 bool returnIsNonNull__;
7969 Discord_LinkedLobby returnValueNative__;
7970 returnIsNonNull__ = Discord_GuildChannel_LinkedLobby(&instance_, &returnValueNative__);
7971 if (!returnIsNonNull__) {
7972 return {};
7973 }
7974 discordpp::LinkedLobby returnValue__(returnValueNative__, DiscordObjectState::Owned);
7975 return returnValue__;
7976}
7977void GuildChannel::SetLinkedLobby(std::optional<discordpp::LinkedLobby> LinkedLobby)
7978{
7979 assert(state_ == DiscordObjectState::Owned);
7980 Discord_GuildChannel_SetLinkedLobby(
7981 &instance_, (LinkedLobby.has_value() ? LinkedLobby->instance() : nullptr));
7982}
7983const LinkedLobby LinkedLobby::nullobj{{}, DiscordObjectState::Invalid};
7984LinkedLobby::~LinkedLobby()
7985{
7986 if (state_ == DiscordObjectState::Owned) {
7987 Drop();
7988 state_ = DiscordObjectState::Invalid;
7989 }
7990}
7991LinkedLobby::LinkedLobby(LinkedLobby&& other) noexcept
7992 : instance_(other.instance_)
7993 , state_(other.state_)
7994{
7995 other.state_ = DiscordObjectState::Invalid;
7996}
7997LinkedLobby& LinkedLobby::operator=(LinkedLobby&& other) noexcept
7998{
7999 if (this != &other) {
8000 if (state_ == DiscordObjectState::Owned) {
8001 Drop();
8002 }
8003 instance_ = other.instance_;
8004 state_ = other.state_;
8005 other.state_ = DiscordObjectState::Invalid;
8006 }
8007 return *this;
8008}
8009LinkedLobby::LinkedLobby(const LinkedLobby& arg0)
8010 : instance_{}
8011 , state_(DiscordObjectState::Invalid)
8012{
8013 if (arg0.state_ == DiscordObjectState::Owned) {
8014 Discord_LinkedLobby_Clone(&instance_, arg0.instance());
8015
8016 state_ = DiscordObjectState::Owned;
8017 }
8018}
8019LinkedLobby& LinkedLobby::operator=(const LinkedLobby& arg0)
8020{
8021 if (this != &arg0) {
8022 if (state_ == DiscordObjectState::Owned) {
8023 Drop();
8024 state_ = DiscordObjectState::Invalid;
8025 }
8026 if (arg0.state_ == DiscordObjectState::Owned) {
8027 Discord_LinkedLobby_Clone(&instance_, arg0.instance());
8028
8029 state_ = DiscordObjectState::Owned;
8030 }
8031 }
8032 return *this;
8033}
8034LinkedLobby::LinkedLobby(Discord_LinkedLobby instance, DiscordObjectState state)
8035 : instance_(instance)
8036 , state_(state)
8037{
8038}
8039LinkedLobby::LinkedLobby()
8040{
8041 assert(state_ == DiscordObjectState::Invalid);
8042 Discord_LinkedLobby_Init(&instance_);
8043 state_ = DiscordObjectState::Owned;
8044}
8045void LinkedLobby::Drop()
8046{
8047 if (state_ != DiscordObjectState::Owned) {
8048 return;
8049 }
8050 Discord_LinkedLobby_Drop(&instance_);
8051 state_ = DiscordObjectState::Invalid;
8052}
8053uint64_t LinkedLobby::ApplicationId() const
8054{
8055 assert(state_ == DiscordObjectState::Owned);
8056 uint64_t returnValue__;
8057 returnValue__ = Discord_LinkedLobby_ApplicationId(&instance_);
8058 return returnValue__;
8059}
8060void LinkedLobby::SetApplicationId(uint64_t ApplicationId)
8061{
8062 assert(state_ == DiscordObjectState::Owned);
8063 Discord_LinkedLobby_SetApplicationId(&instance_, ApplicationId);
8064}
8065uint64_t LinkedLobby::LobbyId() const
8066{
8067 assert(state_ == DiscordObjectState::Owned);
8068 uint64_t returnValue__;
8069 returnValue__ = Discord_LinkedLobby_LobbyId(&instance_);
8070 return returnValue__;
8071}
8072void LinkedLobby::SetLobbyId(uint64_t LobbyId)
8073{
8074 assert(state_ == DiscordObjectState::Owned);
8075 Discord_LinkedLobby_SetLobbyId(&instance_, LobbyId);
8076}
8077const LinkedChannel LinkedChannel::nullobj{{}, DiscordObjectState::Invalid};
8078LinkedChannel::~LinkedChannel()
8079{
8080 if (state_ == DiscordObjectState::Owned) {
8081 Drop();
8082 state_ = DiscordObjectState::Invalid;
8083 }
8084}
8085LinkedChannel::LinkedChannel(LinkedChannel&& other) noexcept
8086 : instance_(other.instance_)
8087 , state_(other.state_)
8088{
8089 other.state_ = DiscordObjectState::Invalid;
8090}
8091LinkedChannel& LinkedChannel::operator=(LinkedChannel&& other) noexcept
8092{
8093 if (this != &other) {
8094 if (state_ == DiscordObjectState::Owned) {
8095 Drop();
8096 }
8097 instance_ = other.instance_;
8098 state_ = other.state_;
8099 other.state_ = DiscordObjectState::Invalid;
8100 }
8101 return *this;
8102}
8103LinkedChannel::LinkedChannel(const LinkedChannel& arg0)
8104 : instance_{}
8105 , state_(DiscordObjectState::Invalid)
8106{
8107 if (arg0.state_ == DiscordObjectState::Owned) {
8108 Discord_LinkedChannel_Clone(&instance_, arg0.instance());
8109
8110 state_ = DiscordObjectState::Owned;
8111 }
8112}
8113LinkedChannel& LinkedChannel::operator=(const LinkedChannel& arg0)
8114{
8115 if (this != &arg0) {
8116 if (state_ == DiscordObjectState::Owned) {
8117 Drop();
8118 state_ = DiscordObjectState::Invalid;
8119 }
8120 if (arg0.state_ == DiscordObjectState::Owned) {
8121 Discord_LinkedChannel_Clone(&instance_, arg0.instance());
8122
8123 state_ = DiscordObjectState::Owned;
8124 }
8125 }
8126 return *this;
8127}
8128LinkedChannel::LinkedChannel(Discord_LinkedChannel instance, DiscordObjectState state)
8129 : instance_(instance)
8130 , state_(state)
8131{
8132}
8133void LinkedChannel::Drop()
8134{
8135 if (state_ != DiscordObjectState::Owned) {
8136 return;
8137 }
8138 Discord_LinkedChannel_Drop(&instance_);
8139 state_ = DiscordObjectState::Invalid;
8140}
8141uint64_t LinkedChannel::Id() const
8142{
8143 assert(state_ == DiscordObjectState::Owned);
8144 uint64_t returnValue__;
8145 returnValue__ = Discord_LinkedChannel_Id(&instance_);
8146 return returnValue__;
8147}
8148void LinkedChannel::SetId(uint64_t Id)
8149{
8150 assert(state_ == DiscordObjectState::Owned);
8151 Discord_LinkedChannel_SetId(&instance_, Id);
8152}
8153std::string LinkedChannel::Name() const
8154{
8155 assert(state_ == DiscordObjectState::Owned);
8156 Discord_String returnValueNative__;
8157 Discord_LinkedChannel_Name(&instance_, &returnValueNative__);
8158 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8159 returnValueNative__.size);
8160 Discord_Free(returnValueNative__.ptr);
8161 return returnValue__;
8162}
8163void LinkedChannel::SetName(std::string Name)
8164{
8165 assert(state_ == DiscordObjectState::Owned);
8166 Discord_String Name__str{(uint8_t*)(Name.data()), Name.size()};
8167 Discord_LinkedChannel_SetName(&instance_, Name__str);
8168}
8169uint64_t LinkedChannel::GuildId() const
8170{
8171 assert(state_ == DiscordObjectState::Owned);
8172 uint64_t returnValue__;
8173 returnValue__ = Discord_LinkedChannel_GuildId(&instance_);
8174 return returnValue__;
8175}
8176void LinkedChannel::SetGuildId(uint64_t GuildId)
8177{
8178 assert(state_ == DiscordObjectState::Owned);
8179 Discord_LinkedChannel_SetGuildId(&instance_, GuildId);
8180}
8181const RelationshipHandle RelationshipHandle::nullobj{{}, DiscordObjectState::Invalid};
8182RelationshipHandle::~RelationshipHandle()
8183{
8184 if (state_ == DiscordObjectState::Owned) {
8185 Drop();
8186 state_ = DiscordObjectState::Invalid;
8187 }
8188}
8189RelationshipHandle::RelationshipHandle(RelationshipHandle&& other) noexcept
8190 : instance_(other.instance_)
8191 , state_(other.state_)
8192{
8193 other.state_ = DiscordObjectState::Invalid;
8194}
8195RelationshipHandle& RelationshipHandle::operator=(RelationshipHandle&& other) noexcept
8196{
8197 if (this != &other) {
8198 if (state_ == DiscordObjectState::Owned) {
8199 Drop();
8200 }
8201 instance_ = other.instance_;
8202 state_ = other.state_;
8203 other.state_ = DiscordObjectState::Invalid;
8204 }
8205 return *this;
8206}
8207RelationshipHandle::RelationshipHandle(const RelationshipHandle& other)
8208 : instance_{}
8209 , state_(DiscordObjectState::Invalid)
8210{
8211 if (other.state_ == DiscordObjectState::Owned) {
8212 Discord_RelationshipHandle_Clone(&instance_, other.instance());
8213
8214 state_ = DiscordObjectState::Owned;
8215 }
8216}
8217RelationshipHandle& RelationshipHandle::operator=(const RelationshipHandle& other)
8218{
8219 if (this != &other) {
8220 if (state_ == DiscordObjectState::Owned) {
8221 Drop();
8222 state_ = DiscordObjectState::Invalid;
8223 }
8224 if (other.state_ == DiscordObjectState::Owned) {
8225 Discord_RelationshipHandle_Clone(&instance_, other.instance());
8226
8227 state_ = DiscordObjectState::Owned;
8228 }
8229 }
8230 return *this;
8231}
8232RelationshipHandle::RelationshipHandle(Discord_RelationshipHandle instance,
8233 DiscordObjectState state)
8234 : instance_(instance)
8235 , state_(state)
8236{
8237}
8238void RelationshipHandle::Drop()
8239{
8240 if (state_ != DiscordObjectState::Owned) {
8241 return;
8242 }
8243 Discord_RelationshipHandle_Drop(&instance_);
8244 state_ = DiscordObjectState::Invalid;
8245}
8246discordpp::RelationshipType RelationshipHandle::DiscordRelationshipType() const
8247{
8248 assert(state_ == DiscordObjectState::Owned);
8249 Discord_RelationshipType returnValue__;
8250 returnValue__ = Discord_RelationshipHandle_DiscordRelationshipType(&instance_);
8251 return static_cast<discordpp::RelationshipType>(returnValue__);
8252}
8253discordpp::RelationshipType RelationshipHandle::GameRelationshipType() const
8254{
8255 assert(state_ == DiscordObjectState::Owned);
8256 Discord_RelationshipType returnValue__;
8257 returnValue__ = Discord_RelationshipHandle_GameRelationshipType(&instance_);
8258 return static_cast<discordpp::RelationshipType>(returnValue__);
8259}
8260uint64_t RelationshipHandle::Id() const
8261{
8262 assert(state_ == DiscordObjectState::Owned);
8263 uint64_t returnValue__;
8264 returnValue__ = Discord_RelationshipHandle_Id(&instance_);
8265 return returnValue__;
8266}
8267bool RelationshipHandle::IsSpamRequest() const
8268{
8269 assert(state_ == DiscordObjectState::Owned);
8270 bool returnValue__;
8271 returnValue__ = Discord_RelationshipHandle_IsSpamRequest(&instance_);
8272 return returnValue__;
8273}
8274std::optional<discordpp::UserHandle> RelationshipHandle::User() const
8275{
8276 assert(state_ == DiscordObjectState::Owned);
8277 bool returnIsNonNull__;
8278 Discord_UserHandle returnValueNative__;
8279 returnIsNonNull__ = Discord_RelationshipHandle_User(&instance_, &returnValueNative__);
8280 if (!returnIsNonNull__) {
8281 return {};
8282 }
8283 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8284 return returnValue__;
8285}
8286const UserHandle UserHandle::nullobj{{}, DiscordObjectState::Invalid};
8287UserHandle::~UserHandle()
8288{
8289 if (state_ == DiscordObjectState::Owned) {
8290 Drop();
8291 state_ = DiscordObjectState::Invalid;
8292 }
8293}
8294UserHandle::UserHandle(UserHandle&& other) noexcept
8295 : instance_(other.instance_)
8296 , state_(other.state_)
8297{
8298 other.state_ = DiscordObjectState::Invalid;
8299}
8300UserHandle& UserHandle::operator=(UserHandle&& other) noexcept
8301{
8302 if (this != &other) {
8303 if (state_ == DiscordObjectState::Owned) {
8304 Drop();
8305 }
8306 instance_ = other.instance_;
8307 state_ = other.state_;
8308 other.state_ = DiscordObjectState::Invalid;
8309 }
8310 return *this;
8311}
8312UserHandle::UserHandle(const UserHandle& arg0)
8313 : instance_{}
8314 , state_(DiscordObjectState::Invalid)
8315{
8316 if (arg0.state_ == DiscordObjectState::Owned) {
8317 Discord_UserHandle_Clone(&instance_, arg0.instance());
8318
8319 state_ = DiscordObjectState::Owned;
8320 }
8321}
8322UserHandle& UserHandle::operator=(const UserHandle& arg0)
8323{
8324 if (this != &arg0) {
8325 if (state_ == DiscordObjectState::Owned) {
8326 Drop();
8327 state_ = DiscordObjectState::Invalid;
8328 }
8329 if (arg0.state_ == DiscordObjectState::Owned) {
8330 Discord_UserHandle_Clone(&instance_, arg0.instance());
8331
8332 state_ = DiscordObjectState::Owned;
8333 }
8334 }
8335 return *this;
8336}
8337UserHandle::UserHandle(Discord_UserHandle instance, DiscordObjectState state)
8338 : instance_(instance)
8339 , state_(state)
8340{
8341}
8342void UserHandle::Drop()
8343{
8344 if (state_ != DiscordObjectState::Owned) {
8345 return;
8346 }
8347 Discord_UserHandle_Drop(&instance_);
8348 state_ = DiscordObjectState::Invalid;
8349}
8350std::optional<std::string> UserHandle::Avatar() const
8351{
8352 assert(state_ == DiscordObjectState::Owned);
8353 bool returnIsNonNull__;
8354 Discord_String returnValueNative__;
8355 returnIsNonNull__ = Discord_UserHandle_Avatar(&instance_, &returnValueNative__);
8356 if (!returnIsNonNull__) {
8357 return {};
8358 }
8359 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8360 returnValueNative__.size);
8361 Discord_Free(returnValueNative__.ptr);
8362 return returnValue__;
8363}
8364std::string UserHandle::AvatarTypeToString(discordpp::UserHandle::AvatarType type)
8365{
8366 Discord_String returnValueNative__;
8367 Discord_UserHandle_AvatarTypeToString(static_cast<Discord_UserHandle_AvatarType>(type),
8368 &returnValueNative__);
8369 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8370 returnValueNative__.size);
8371 Discord_Free(returnValueNative__.ptr);
8372 return returnValue__;
8373}
8374std::string UserHandle::AvatarUrl(discordpp::UserHandle::AvatarType animatedType,
8375 discordpp::UserHandle::AvatarType staticType) const
8376{
8377 assert(state_ == DiscordObjectState::Owned);
8378 Discord_String returnValueNative__;
8379 Discord_UserHandle_AvatarUrl(&instance_,
8380 static_cast<Discord_UserHandle_AvatarType>(animatedType),
8381 static_cast<Discord_UserHandle_AvatarType>(staticType),
8382 &returnValueNative__);
8383 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8384 returnValueNative__.size);
8385 Discord_Free(returnValueNative__.ptr);
8386 return returnValue__;
8387}
8388std::string UserHandle::DisplayName() const
8389{
8390 assert(state_ == DiscordObjectState::Owned);
8391 Discord_String returnValueNative__;
8392 Discord_UserHandle_DisplayName(&instance_, &returnValueNative__);
8393 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8394 returnValueNative__.size);
8395 Discord_Free(returnValueNative__.ptr);
8396 return returnValue__;
8397}
8398std::optional<discordpp::Activity> UserHandle::GameActivity() const
8399{
8400 assert(state_ == DiscordObjectState::Owned);
8401 bool returnIsNonNull__;
8402 Discord_Activity returnValueNative__;
8403 returnIsNonNull__ = Discord_UserHandle_GameActivity(&instance_, &returnValueNative__);
8404 if (!returnIsNonNull__) {
8405 return {};
8406 }
8407 discordpp::Activity returnValue__(returnValueNative__, DiscordObjectState::Owned);
8408 return returnValue__;
8409}
8410std::optional<std::string> UserHandle::GlobalName() const
8411{
8412 assert(state_ == DiscordObjectState::Owned);
8413 bool returnIsNonNull__;
8414 Discord_String returnValueNative__;
8415 returnIsNonNull__ = Discord_UserHandle_GlobalName(&instance_, &returnValueNative__);
8416 if (!returnIsNonNull__) {
8417 return {};
8418 }
8419 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8420 returnValueNative__.size);
8421 Discord_Free(returnValueNative__.ptr);
8422 return returnValue__;
8423}
8424uint64_t UserHandle::Id() const
8425{
8426 assert(state_ == DiscordObjectState::Owned);
8427 uint64_t returnValue__;
8428 returnValue__ = Discord_UserHandle_Id(&instance_);
8429 return returnValue__;
8430}
8431bool UserHandle::IsProvisional() const
8432{
8433 assert(state_ == DiscordObjectState::Owned);
8434 bool returnValue__;
8435 returnValue__ = Discord_UserHandle_IsProvisional(&instance_);
8436 return returnValue__;
8437}
8438discordpp::RelationshipHandle UserHandle::Relationship() const
8439{
8440 assert(state_ == DiscordObjectState::Owned);
8441 Discord_RelationshipHandle returnValueNative__{};
8442 Discord_UserHandle_Relationship(&instance_, &returnValueNative__);
8443 discordpp::RelationshipHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8444 return returnValue__;
8445}
8446discordpp::StatusType UserHandle::Status() const
8447{
8448 assert(state_ == DiscordObjectState::Owned);
8449 Discord_StatusType returnValue__;
8450 returnValue__ = Discord_UserHandle_Status(&instance_);
8451 return static_cast<discordpp::StatusType>(returnValue__);
8452}
8453std::string UserHandle::Username() const
8454{
8455 assert(state_ == DiscordObjectState::Owned);
8456 Discord_String returnValueNative__;
8457 Discord_UserHandle_Username(&instance_, &returnValueNative__);
8458 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8459 returnValueNative__.size);
8460 Discord_Free(returnValueNative__.ptr);
8461 return returnValue__;
8462}
8463const LobbyMemberHandle LobbyMemberHandle::nullobj{{}, DiscordObjectState::Invalid};
8464LobbyMemberHandle::~LobbyMemberHandle()
8465{
8466 if (state_ == DiscordObjectState::Owned) {
8467 Drop();
8468 state_ = DiscordObjectState::Invalid;
8469 }
8470}
8471LobbyMemberHandle::LobbyMemberHandle(LobbyMemberHandle&& other) noexcept
8472 : instance_(other.instance_)
8473 , state_(other.state_)
8474{
8475 other.state_ = DiscordObjectState::Invalid;
8476}
8477LobbyMemberHandle& LobbyMemberHandle::operator=(LobbyMemberHandle&& other) noexcept
8478{
8479 if (this != &other) {
8480 if (state_ == DiscordObjectState::Owned) {
8481 Drop();
8482 }
8483 instance_ = other.instance_;
8484 state_ = other.state_;
8485 other.state_ = DiscordObjectState::Invalid;
8486 }
8487 return *this;
8488}
8489LobbyMemberHandle::LobbyMemberHandle(const LobbyMemberHandle& other)
8490 : instance_{}
8491 , state_(DiscordObjectState::Invalid)
8492{
8493 if (other.state_ == DiscordObjectState::Owned) {
8494 Discord_LobbyMemberHandle_Clone(&instance_, other.instance());
8495
8496 state_ = DiscordObjectState::Owned;
8497 }
8498}
8499LobbyMemberHandle& LobbyMemberHandle::operator=(const LobbyMemberHandle& other)
8500{
8501 if (this != &other) {
8502 if (state_ == DiscordObjectState::Owned) {
8503 Drop();
8504 state_ = DiscordObjectState::Invalid;
8505 }
8506 if (other.state_ == DiscordObjectState::Owned) {
8507 Discord_LobbyMemberHandle_Clone(&instance_, other.instance());
8508
8509 state_ = DiscordObjectState::Owned;
8510 }
8511 }
8512 return *this;
8513}
8514LobbyMemberHandle::LobbyMemberHandle(Discord_LobbyMemberHandle instance, DiscordObjectState state)
8515 : instance_(instance)
8516 , state_(state)
8517{
8518}
8519void LobbyMemberHandle::Drop()
8520{
8521 if (state_ != DiscordObjectState::Owned) {
8522 return;
8523 }
8524 Discord_LobbyMemberHandle_Drop(&instance_);
8525 state_ = DiscordObjectState::Invalid;
8526}
8527bool LobbyMemberHandle::CanLinkLobby() const
8528{
8529 assert(state_ == DiscordObjectState::Owned);
8530 bool returnValue__;
8531 returnValue__ = Discord_LobbyMemberHandle_CanLinkLobby(&instance_);
8532 return returnValue__;
8533}
8534bool LobbyMemberHandle::Connected() const
8535{
8536 assert(state_ == DiscordObjectState::Owned);
8537 bool returnValue__;
8538 returnValue__ = Discord_LobbyMemberHandle_Connected(&instance_);
8539 return returnValue__;
8540}
8541uint64_t LobbyMemberHandle::Id() const
8542{
8543 assert(state_ == DiscordObjectState::Owned);
8544 uint64_t returnValue__;
8545 returnValue__ = Discord_LobbyMemberHandle_Id(&instance_);
8546 return returnValue__;
8547}
8548std::unordered_map<std::string, std::string> LobbyMemberHandle::Metadata() const
8549{
8550 assert(state_ == DiscordObjectState::Owned);
8551 Discord_Properties returnValueNative__;
8552 Discord_LobbyMemberHandle_Metadata(&instance_, &returnValueNative__);
8553 std::unordered_map<std::string, std::string> returnValue__ =
8554 ConvertReturnedProperties(returnValueNative__);
8555 Discord_FreeProperties(returnValueNative__);
8556 return returnValue__;
8557}
8558std::optional<discordpp::UserHandle> LobbyMemberHandle::User() const
8559{
8560 assert(state_ == DiscordObjectState::Owned);
8561 bool returnIsNonNull__;
8562 Discord_UserHandle returnValueNative__;
8563 returnIsNonNull__ = Discord_LobbyMemberHandle_User(&instance_, &returnValueNative__);
8564 if (!returnIsNonNull__) {
8565 return {};
8566 }
8567 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8568 return returnValue__;
8569}
8570const LobbyHandle LobbyHandle::nullobj{{}, DiscordObjectState::Invalid};
8571LobbyHandle::~LobbyHandle()
8572{
8573 if (state_ == DiscordObjectState::Owned) {
8574 Drop();
8575 state_ = DiscordObjectState::Invalid;
8576 }
8577}
8578LobbyHandle::LobbyHandle(LobbyHandle&& other) noexcept
8579 : instance_(other.instance_)
8580 , state_(other.state_)
8581{
8582 other.state_ = DiscordObjectState::Invalid;
8583}
8584LobbyHandle& LobbyHandle::operator=(LobbyHandle&& other) noexcept
8585{
8586 if (this != &other) {
8587 if (state_ == DiscordObjectState::Owned) {
8588 Drop();
8589 }
8590 instance_ = other.instance_;
8591 state_ = other.state_;
8592 other.state_ = DiscordObjectState::Invalid;
8593 }
8594 return *this;
8595}
8596LobbyHandle::LobbyHandle(const LobbyHandle& other)
8597 : instance_{}
8598 , state_(DiscordObjectState::Invalid)
8599{
8600 if (other.state_ == DiscordObjectState::Owned) {
8601 Discord_LobbyHandle_Clone(&instance_, other.instance());
8602
8603 state_ = DiscordObjectState::Owned;
8604 }
8605}
8606LobbyHandle& LobbyHandle::operator=(const LobbyHandle& other)
8607{
8608 if (this != &other) {
8609 if (state_ == DiscordObjectState::Owned) {
8610 Drop();
8611 state_ = DiscordObjectState::Invalid;
8612 }
8613 if (other.state_ == DiscordObjectState::Owned) {
8614 Discord_LobbyHandle_Clone(&instance_, other.instance());
8615
8616 state_ = DiscordObjectState::Owned;
8617 }
8618 }
8619 return *this;
8620}
8621LobbyHandle::LobbyHandle(Discord_LobbyHandle instance, DiscordObjectState state)
8622 : instance_(instance)
8623 , state_(state)
8624{
8625}
8626void LobbyHandle::Drop()
8627{
8628 if (state_ != DiscordObjectState::Owned) {
8629 return;
8630 }
8631 Discord_LobbyHandle_Drop(&instance_);
8632 state_ = DiscordObjectState::Invalid;
8633}
8634std::optional<discordpp::CallInfoHandle> LobbyHandle::GetCallInfoHandle() const
8635{
8636 assert(state_ == DiscordObjectState::Owned);
8637 bool returnIsNonNull__;
8638 Discord_CallInfoHandle returnValueNative__;
8639 returnIsNonNull__ = Discord_LobbyHandle_GetCallInfoHandle(&instance_, &returnValueNative__);
8640 if (!returnIsNonNull__) {
8641 return {};
8642 }
8643 discordpp::CallInfoHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8644 return returnValue__;
8645}
8646std::optional<discordpp::LobbyMemberHandle> LobbyHandle::GetLobbyMemberHandle(
8647 uint64_t memberId) const
8648{
8649 assert(state_ == DiscordObjectState::Owned);
8650 bool returnIsNonNull__;
8651 Discord_LobbyMemberHandle returnValueNative__;
8652 returnIsNonNull__ =
8653 Discord_LobbyHandle_GetLobbyMemberHandle(&instance_, memberId, &returnValueNative__);
8654 if (!returnIsNonNull__) {
8655 return {};
8656 }
8657 discordpp::LobbyMemberHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8658 return returnValue__;
8659}
8660uint64_t LobbyHandle::Id() const
8661{
8662 assert(state_ == DiscordObjectState::Owned);
8663 uint64_t returnValue__;
8664 returnValue__ = Discord_LobbyHandle_Id(&instance_);
8665 return returnValue__;
8666}
8667std::optional<discordpp::LinkedChannel> LobbyHandle::LinkedChannel() const
8668{
8669 assert(state_ == DiscordObjectState::Owned);
8670 bool returnIsNonNull__;
8671 Discord_LinkedChannel returnValueNative__;
8672 returnIsNonNull__ = Discord_LobbyHandle_LinkedChannel(&instance_, &returnValueNative__);
8673 if (!returnIsNonNull__) {
8674 return {};
8675 }
8676 discordpp::LinkedChannel returnValue__(returnValueNative__, DiscordObjectState::Owned);
8677 return returnValue__;
8678}
8679std::vector<uint64_t> LobbyHandle::LobbyMemberIds() const
8680{
8681 assert(state_ == DiscordObjectState::Owned);
8682 Discord_UInt64Span returnValueNative__;
8683 Discord_LobbyHandle_LobbyMemberIds(&instance_, &returnValueNative__);
8684 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
8685 returnValueNative__.ptr + returnValueNative__.size);
8686 Discord_Free(returnValueNative__.ptr);
8687 return returnValue__;
8688}
8689std::vector<discordpp::LobbyMemberHandle> LobbyHandle::LobbyMembers() const
8690{
8691 assert(state_ == DiscordObjectState::Owned);
8692 Discord_LobbyMemberHandleSpan returnValueNative__;
8693 Discord_LobbyHandle_LobbyMembers(&instance_, &returnValueNative__);
8694 std::vector<discordpp::LobbyMemberHandle> returnValue__;
8695 returnValue__.reserve(returnValueNative__.size);
8696 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
8697 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
8698 }
8699 Discord_Free(returnValueNative__.ptr);
8700 return returnValue__;
8701}
8702std::unordered_map<std::string, std::string> LobbyHandle::Metadata() const
8703{
8704 assert(state_ == DiscordObjectState::Owned);
8705 Discord_Properties returnValueNative__;
8706 Discord_LobbyHandle_Metadata(&instance_, &returnValueNative__);
8707 std::unordered_map<std::string, std::string> returnValue__ =
8708 ConvertReturnedProperties(returnValueNative__);
8709 Discord_FreeProperties(returnValueNative__);
8710 return returnValue__;
8711}
8712const AdditionalContent AdditionalContent::nullobj{{}, DiscordObjectState::Invalid};
8713AdditionalContent::~AdditionalContent()
8714{
8715 if (state_ == DiscordObjectState::Owned) {
8716 Drop();
8717 state_ = DiscordObjectState::Invalid;
8718 }
8719}
8720AdditionalContent::AdditionalContent(AdditionalContent&& other) noexcept
8721 : instance_(other.instance_)
8722 , state_(other.state_)
8723{
8724 other.state_ = DiscordObjectState::Invalid;
8725}
8726AdditionalContent& AdditionalContent::operator=(AdditionalContent&& other) noexcept
8727{
8728 if (this != &other) {
8729 if (state_ == DiscordObjectState::Owned) {
8730 Drop();
8731 }
8732 instance_ = other.instance_;
8733 state_ = other.state_;
8734 other.state_ = DiscordObjectState::Invalid;
8735 }
8736 return *this;
8737}
8738AdditionalContent::AdditionalContent(const AdditionalContent& arg0)
8739 : instance_{}
8740 , state_(DiscordObjectState::Invalid)
8741{
8742 if (arg0.state_ == DiscordObjectState::Owned) {
8743 Discord_AdditionalContent_Clone(&instance_, arg0.instance());
8744
8745 state_ = DiscordObjectState::Owned;
8746 }
8747}
8748AdditionalContent& AdditionalContent::operator=(const AdditionalContent& arg0)
8749{
8750 if (this != &arg0) {
8751 if (state_ == DiscordObjectState::Owned) {
8752 Drop();
8753 state_ = DiscordObjectState::Invalid;
8754 }
8755 if (arg0.state_ == DiscordObjectState::Owned) {
8756 Discord_AdditionalContent_Clone(&instance_, arg0.instance());
8757
8758 state_ = DiscordObjectState::Owned;
8759 }
8760 }
8761 return *this;
8762}
8763AdditionalContent::AdditionalContent(Discord_AdditionalContent instance, DiscordObjectState state)
8764 : instance_(instance)
8765 , state_(state)
8766{
8767}
8768AdditionalContent::AdditionalContent()
8769{
8770 assert(state_ == DiscordObjectState::Invalid);
8771 Discord_AdditionalContent_Init(&instance_);
8772 state_ = DiscordObjectState::Owned;
8773}
8774void AdditionalContent::Drop()
8775{
8776 if (state_ != DiscordObjectState::Owned) {
8777 return;
8778 }
8779 Discord_AdditionalContent_Drop(&instance_);
8780 state_ = DiscordObjectState::Invalid;
8781}
8782bool AdditionalContent::Equals(discordpp::AdditionalContent rhs) const
8783{
8784 assert(state_ == DiscordObjectState::Owned);
8785 bool returnValue__;
8786 returnValue__ = Discord_AdditionalContent_Equals(&instance_, rhs.instance());
8787 return returnValue__;
8788}
8789std::string AdditionalContent::TypeToString(discordpp::AdditionalContentType type)
8790{
8791 Discord_String returnValueNative__;
8792 Discord_AdditionalContent_TypeToString(static_cast<Discord_AdditionalContentType>(type),
8793 &returnValueNative__);
8794 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8795 returnValueNative__.size);
8796 Discord_Free(returnValueNative__.ptr);
8797 return returnValue__;
8798}
8799discordpp::AdditionalContentType AdditionalContent::Type() const
8800{
8801 assert(state_ == DiscordObjectState::Owned);
8802 Discord_AdditionalContentType returnValue__;
8803 returnValue__ = Discord_AdditionalContent_Type(&instance_);
8804 return static_cast<discordpp::AdditionalContentType>(returnValue__);
8805}
8806void AdditionalContent::SetType(discordpp::AdditionalContentType Type)
8807{
8808 assert(state_ == DiscordObjectState::Owned);
8809 Discord_AdditionalContent_SetType(&instance_, static_cast<Discord_AdditionalContentType>(Type));
8810}
8811std::optional<std::string> AdditionalContent::Title() const
8812{
8813 assert(state_ == DiscordObjectState::Owned);
8814 bool returnIsNonNull__;
8815 Discord_String returnValueNative__;
8816 returnIsNonNull__ = Discord_AdditionalContent_Title(&instance_, &returnValueNative__);
8817 if (!returnIsNonNull__) {
8818 return {};
8819 }
8820 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8821 returnValueNative__.size);
8822 Discord_Free(returnValueNative__.ptr);
8823 return returnValue__;
8824}
8825void AdditionalContent::SetTitle(std::optional<std::string> Title)
8826{
8827 assert(state_ == DiscordObjectState::Owned);
8828 Discord_String Title__str{};
8829 if (Title.has_value()) {
8830 Title__str.ptr = reinterpret_cast<uint8_t*>(Title->data());
8831 Title__str.size = Title->size();
8832 }
8833 Discord_AdditionalContent_SetTitle(&instance_, (Title.has_value() ? &Title__str : nullptr));
8834}
8835uint8_t AdditionalContent::Count() const
8836{
8837 assert(state_ == DiscordObjectState::Owned);
8838 uint8_t returnValue__;
8839 returnValue__ = Discord_AdditionalContent_Count(&instance_);
8840 return returnValue__;
8841}
8842void AdditionalContent::SetCount(uint8_t Count)
8843{
8844 assert(state_ == DiscordObjectState::Owned);
8845 Discord_AdditionalContent_SetCount(&instance_, Count);
8846}
8847const MessageHandle MessageHandle::nullobj{{}, DiscordObjectState::Invalid};
8848MessageHandle::~MessageHandle()
8849{
8850 if (state_ == DiscordObjectState::Owned) {
8851 Drop();
8852 state_ = DiscordObjectState::Invalid;
8853 }
8854}
8855MessageHandle::MessageHandle(MessageHandle&& other) noexcept
8856 : instance_(other.instance_)
8857 , state_(other.state_)
8858{
8859 other.state_ = DiscordObjectState::Invalid;
8860}
8861MessageHandle& MessageHandle::operator=(MessageHandle&& other) noexcept
8862{
8863 if (this != &other) {
8864 if (state_ == DiscordObjectState::Owned) {
8865 Drop();
8866 }
8867 instance_ = other.instance_;
8868 state_ = other.state_;
8869 other.state_ = DiscordObjectState::Invalid;
8870 }
8871 return *this;
8872}
8873MessageHandle::MessageHandle(const MessageHandle& other)
8874 : instance_{}
8875 , state_(DiscordObjectState::Invalid)
8876{
8877 if (other.state_ == DiscordObjectState::Owned) {
8878 Discord_MessageHandle_Clone(&instance_, other.instance());
8879
8880 state_ = DiscordObjectState::Owned;
8881 }
8882}
8883MessageHandle& MessageHandle::operator=(const MessageHandle& other)
8884{
8885 if (this != &other) {
8886 if (state_ == DiscordObjectState::Owned) {
8887 Drop();
8888 state_ = DiscordObjectState::Invalid;
8889 }
8890 if (other.state_ == DiscordObjectState::Owned) {
8891 Discord_MessageHandle_Clone(&instance_, other.instance());
8892
8893 state_ = DiscordObjectState::Owned;
8894 }
8895 }
8896 return *this;
8897}
8898MessageHandle::MessageHandle(Discord_MessageHandle instance, DiscordObjectState state)
8899 : instance_(instance)
8900 , state_(state)
8901{
8902}
8903void MessageHandle::Drop()
8904{
8905 if (state_ != DiscordObjectState::Owned) {
8906 return;
8907 }
8908 Discord_MessageHandle_Drop(&instance_);
8909 state_ = DiscordObjectState::Invalid;
8910}
8911std::optional<discordpp::AdditionalContent> MessageHandle::AdditionalContent() const
8912{
8913 assert(state_ == DiscordObjectState::Owned);
8914 bool returnIsNonNull__;
8915 Discord_AdditionalContent returnValueNative__;
8916 returnIsNonNull__ = Discord_MessageHandle_AdditionalContent(&instance_, &returnValueNative__);
8917 if (!returnIsNonNull__) {
8918 return {};
8919 }
8920 discordpp::AdditionalContent returnValue__(returnValueNative__, DiscordObjectState::Owned);
8921 return returnValue__;
8922}
8923std::optional<uint64_t> MessageHandle::ApplicationId() const
8924{
8925 assert(state_ == DiscordObjectState::Owned);
8926 bool returnIsNonNull__;
8927 uint64_t returnValue__;
8928 returnIsNonNull__ = Discord_MessageHandle_ApplicationId(&instance_, &returnValue__);
8929 if (!returnIsNonNull__) {
8930 return std::nullopt;
8931 }
8932 return returnValue__;
8933}
8934std::optional<discordpp::UserHandle> MessageHandle::Author() const
8935{
8936 assert(state_ == DiscordObjectState::Owned);
8937 bool returnIsNonNull__;
8938 Discord_UserHandle returnValueNative__;
8939 returnIsNonNull__ = Discord_MessageHandle_Author(&instance_, &returnValueNative__);
8940 if (!returnIsNonNull__) {
8941 return {};
8942 }
8943 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8944 return returnValue__;
8945}
8946uint64_t MessageHandle::AuthorId() const
8947{
8948 assert(state_ == DiscordObjectState::Owned);
8949 uint64_t returnValue__;
8950 returnValue__ = Discord_MessageHandle_AuthorId(&instance_);
8951 return returnValue__;
8952}
8953std::optional<discordpp::ChannelHandle> MessageHandle::Channel() const
8954{
8955 assert(state_ == DiscordObjectState::Owned);
8956 bool returnIsNonNull__;
8957 Discord_ChannelHandle returnValueNative__;
8958 returnIsNonNull__ = Discord_MessageHandle_Channel(&instance_, &returnValueNative__);
8959 if (!returnIsNonNull__) {
8960 return {};
8961 }
8962 discordpp::ChannelHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8963 return returnValue__;
8964}
8965uint64_t MessageHandle::ChannelId() const
8966{
8967 assert(state_ == DiscordObjectState::Owned);
8968 uint64_t returnValue__;
8969 returnValue__ = Discord_MessageHandle_ChannelId(&instance_);
8970 return returnValue__;
8971}
8972std::string MessageHandle::Content() const
8973{
8974 assert(state_ == DiscordObjectState::Owned);
8975 Discord_String returnValueNative__;
8976 Discord_MessageHandle_Content(&instance_, &returnValueNative__);
8977 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8978 returnValueNative__.size);
8979 Discord_Free(returnValueNative__.ptr);
8980 return returnValue__;
8981}
8982std::optional<discordpp::DisclosureTypes> MessageHandle::DisclosureType() const
8983{
8984 assert(state_ == DiscordObjectState::Owned);
8985 bool returnIsNonNull__;
8986 Discord_DisclosureTypes returnValueNative__;
8987 returnIsNonNull__ = Discord_MessageHandle_DisclosureType(&instance_, &returnValueNative__);
8988 if (!returnIsNonNull__) {
8989 return {};
8990 }
8991 auto returnValue__ = static_cast<discordpp::DisclosureTypes>(returnValueNative__);
8992 return returnValue__;
8993}
8994uint64_t MessageHandle::EditedTimestamp() const
8995{
8996 assert(state_ == DiscordObjectState::Owned);
8997 uint64_t returnValue__;
8998 returnValue__ = Discord_MessageHandle_EditedTimestamp(&instance_);
8999 return returnValue__;
9000}
9001uint64_t MessageHandle::Id() const
9002{
9003 assert(state_ == DiscordObjectState::Owned);
9004 uint64_t returnValue__;
9005 returnValue__ = Discord_MessageHandle_Id(&instance_);
9006 return returnValue__;
9007}
9008std::optional<discordpp::LobbyHandle> MessageHandle::Lobby() const
9009{
9010 assert(state_ == DiscordObjectState::Owned);
9011 bool returnIsNonNull__;
9012 Discord_LobbyHandle returnValueNative__;
9013 returnIsNonNull__ = Discord_MessageHandle_Lobby(&instance_, &returnValueNative__);
9014 if (!returnIsNonNull__) {
9015 return {};
9016 }
9017 discordpp::LobbyHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
9018 return returnValue__;
9019}
9020std::unordered_map<std::string, std::string> MessageHandle::Metadata() const
9021{
9022 assert(state_ == DiscordObjectState::Owned);
9023 Discord_Properties returnValueNative__;
9024 Discord_MessageHandle_Metadata(&instance_, &returnValueNative__);
9025 std::unordered_map<std::string, std::string> returnValue__ =
9026 ConvertReturnedProperties(returnValueNative__);
9027 Discord_FreeProperties(returnValueNative__);
9028 return returnValue__;
9029}
9030std::string MessageHandle::RawContent() const
9031{
9032 assert(state_ == DiscordObjectState::Owned);
9033 Discord_String returnValueNative__;
9034 Discord_MessageHandle_RawContent(&instance_, &returnValueNative__);
9035 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9036 returnValueNative__.size);
9037 Discord_Free(returnValueNative__.ptr);
9038 return returnValue__;
9039}
9040std::optional<discordpp::UserHandle> MessageHandle::Recipient() const
9041{
9042 assert(state_ == DiscordObjectState::Owned);
9043 bool returnIsNonNull__;
9044 Discord_UserHandle returnValueNative__;
9045 returnIsNonNull__ = Discord_MessageHandle_Recipient(&instance_, &returnValueNative__);
9046 if (!returnIsNonNull__) {
9047 return {};
9048 }
9049 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
9050 return returnValue__;
9051}
9052uint64_t MessageHandle::RecipientId() const
9053{
9054 assert(state_ == DiscordObjectState::Owned);
9055 uint64_t returnValue__;
9056 returnValue__ = Discord_MessageHandle_RecipientId(&instance_);
9057 return returnValue__;
9058}
9059bool MessageHandle::SentFromGame() const
9060{
9061 assert(state_ == DiscordObjectState::Owned);
9062 bool returnValue__;
9063 returnValue__ = Discord_MessageHandle_SentFromGame(&instance_);
9064 return returnValue__;
9065}
9066uint64_t MessageHandle::SentTimestamp() const
9067{
9068 assert(state_ == DiscordObjectState::Owned);
9069 uint64_t returnValue__;
9070 returnValue__ = Discord_MessageHandle_SentTimestamp(&instance_);
9071 return returnValue__;
9072}
9073const AudioDevice AudioDevice::nullobj{{}, DiscordObjectState::Invalid};
9074AudioDevice::~AudioDevice()
9075{
9076 if (state_ == DiscordObjectState::Owned) {
9077 Drop();
9078 state_ = DiscordObjectState::Invalid;
9079 }
9080}
9081AudioDevice::AudioDevice(AudioDevice&& other) noexcept
9082 : instance_(other.instance_)
9083 , state_(other.state_)
9084{
9085 other.state_ = DiscordObjectState::Invalid;
9086}
9087AudioDevice& AudioDevice::operator=(AudioDevice&& other) noexcept
9088{
9089 if (this != &other) {
9090 if (state_ == DiscordObjectState::Owned) {
9091 Drop();
9092 }
9093 instance_ = other.instance_;
9094 state_ = other.state_;
9095 other.state_ = DiscordObjectState::Invalid;
9096 }
9097 return *this;
9098}
9099AudioDevice::AudioDevice(const AudioDevice& arg0)
9100 : instance_{}
9101 , state_(DiscordObjectState::Invalid)
9102{
9103 if (arg0.state_ == DiscordObjectState::Owned) {
9104 Discord_AudioDevice_Clone(&instance_, arg0.instance());
9105
9106 state_ = DiscordObjectState::Owned;
9107 }
9108}
9109AudioDevice& AudioDevice::operator=(const AudioDevice& arg0)
9110{
9111 if (this != &arg0) {
9112 if (state_ == DiscordObjectState::Owned) {
9113 Drop();
9114 state_ = DiscordObjectState::Invalid;
9115 }
9116 if (arg0.state_ == DiscordObjectState::Owned) {
9117 Discord_AudioDevice_Clone(&instance_, arg0.instance());
9118
9119 state_ = DiscordObjectState::Owned;
9120 }
9121 }
9122 return *this;
9123}
9124AudioDevice::AudioDevice(Discord_AudioDevice instance, DiscordObjectState state)
9125 : instance_(instance)
9126 , state_(state)
9127{
9128}
9129void AudioDevice::Drop()
9130{
9131 if (state_ != DiscordObjectState::Owned) {
9132 return;
9133 }
9134 Discord_AudioDevice_Drop(&instance_);
9135 state_ = DiscordObjectState::Invalid;
9136}
9137bool AudioDevice::Equals(discordpp::AudioDevice rhs)
9138{
9139 assert(state_ == DiscordObjectState::Owned);
9140 bool returnValue__;
9141 returnValue__ = Discord_AudioDevice_Equals(&instance_, rhs.instance());
9142 return returnValue__;
9143}
9144std::string AudioDevice::Id() const
9145{
9146 assert(state_ == DiscordObjectState::Owned);
9147 Discord_String returnValueNative__;
9148 Discord_AudioDevice_Id(&instance_, &returnValueNative__);
9149 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9150 returnValueNative__.size);
9151 Discord_Free(returnValueNative__.ptr);
9152 return returnValue__;
9153}
9154void AudioDevice::SetId(std::string Id)
9155{
9156 assert(state_ == DiscordObjectState::Owned);
9157 Discord_String Id__str{(uint8_t*)(Id.data()), Id.size()};
9158 Discord_AudioDevice_SetId(&instance_, Id__str);
9159}
9160std::string AudioDevice::Name() const
9161{
9162 assert(state_ == DiscordObjectState::Owned);
9163 Discord_String returnValueNative__;
9164 Discord_AudioDevice_Name(&instance_, &returnValueNative__);
9165 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9166 returnValueNative__.size);
9167 Discord_Free(returnValueNative__.ptr);
9168 return returnValue__;
9169}
9170void AudioDevice::SetName(std::string Name)
9171{
9172 assert(state_ == DiscordObjectState::Owned);
9173 Discord_String Name__str{(uint8_t*)(Name.data()), Name.size()};
9174 Discord_AudioDevice_SetName(&instance_, Name__str);
9175}
9176bool AudioDevice::IsDefault() const
9177{
9178 assert(state_ == DiscordObjectState::Owned);
9179 bool returnValue__;
9180 returnValue__ = Discord_AudioDevice_IsDefault(&instance_);
9181 return returnValue__;
9182}
9183void AudioDevice::SetIsDefault(bool IsDefault)
9184{
9185 assert(state_ == DiscordObjectState::Owned);
9186 Discord_AudioDevice_SetIsDefault(&instance_, IsDefault);
9187}
9188const ClientCreateOptions ClientCreateOptions::nullobj{{}, DiscordObjectState::Invalid};
9189ClientCreateOptions::~ClientCreateOptions()
9190{
9191 if (state_ == DiscordObjectState::Owned) {
9192 Drop();
9193 state_ = DiscordObjectState::Invalid;
9194 }
9195}
9196ClientCreateOptions::ClientCreateOptions(ClientCreateOptions&& other) noexcept
9197 : instance_(other.instance_)
9198 , state_(other.state_)
9199{
9200 other.state_ = DiscordObjectState::Invalid;
9201}
9202ClientCreateOptions& ClientCreateOptions::operator=(ClientCreateOptions&& other) noexcept
9203{
9204 if (this != &other) {
9205 if (state_ == DiscordObjectState::Owned) {
9206 Drop();
9207 }
9208 instance_ = other.instance_;
9209 state_ = other.state_;
9210 other.state_ = DiscordObjectState::Invalid;
9211 }
9212 return *this;
9213}
9214ClientCreateOptions::ClientCreateOptions(const ClientCreateOptions& arg0)
9215 : instance_{}
9216 , state_(DiscordObjectState::Invalid)
9217{
9218 if (arg0.state_ == DiscordObjectState::Owned) {
9219 Discord_ClientCreateOptions_Clone(&instance_, arg0.instance());
9220
9221 state_ = DiscordObjectState::Owned;
9222 }
9223}
9224ClientCreateOptions& ClientCreateOptions::operator=(const ClientCreateOptions& arg0)
9225{
9226 if (this != &arg0) {
9227 if (state_ == DiscordObjectState::Owned) {
9228 Drop();
9229 state_ = DiscordObjectState::Invalid;
9230 }
9231 if (arg0.state_ == DiscordObjectState::Owned) {
9232 Discord_ClientCreateOptions_Clone(&instance_, arg0.instance());
9233
9234 state_ = DiscordObjectState::Owned;
9235 }
9236 }
9237 return *this;
9238}
9239ClientCreateOptions::ClientCreateOptions(Discord_ClientCreateOptions instance,
9240 DiscordObjectState state)
9241 : instance_(instance)
9242 , state_(state)
9243{
9244}
9245ClientCreateOptions::ClientCreateOptions()
9246{
9247 assert(state_ == DiscordObjectState::Invalid);
9248 Discord_ClientCreateOptions_Init(&instance_);
9249 state_ = DiscordObjectState::Owned;
9250}
9251void ClientCreateOptions::Drop()
9252{
9253 if (state_ != DiscordObjectState::Owned) {
9254 return;
9255 }
9256 Discord_ClientCreateOptions_Drop(&instance_);
9257 state_ = DiscordObjectState::Invalid;
9258}
9259std::string ClientCreateOptions::WebBase() const
9260{
9261 assert(state_ == DiscordObjectState::Owned);
9262 Discord_String returnValueNative__;
9263 Discord_ClientCreateOptions_WebBase(&instance_, &returnValueNative__);
9264 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9265 returnValueNative__.size);
9266 Discord_Free(returnValueNative__.ptr);
9267 return returnValue__;
9268}
9269void ClientCreateOptions::SetWebBase(std::string WebBase)
9270{
9271 assert(state_ == DiscordObjectState::Owned);
9272 Discord_String WebBase__str{(uint8_t*)(WebBase.data()), WebBase.size()};
9273 Discord_ClientCreateOptions_SetWebBase(&instance_, WebBase__str);
9274}
9275std::string ClientCreateOptions::ApiBase() const
9276{
9277 assert(state_ == DiscordObjectState::Owned);
9278 Discord_String returnValueNative__;
9279 Discord_ClientCreateOptions_ApiBase(&instance_, &returnValueNative__);
9280 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9281 returnValueNative__.size);
9282 Discord_Free(returnValueNative__.ptr);
9283 return returnValue__;
9284}
9285void ClientCreateOptions::SetApiBase(std::string ApiBase)
9286{
9287 assert(state_ == DiscordObjectState::Owned);
9288 Discord_String ApiBase__str{(uint8_t*)(ApiBase.data()), ApiBase.size()};
9289 Discord_ClientCreateOptions_SetApiBase(&instance_, ApiBase__str);
9290}
9291discordpp::AudioSystem ClientCreateOptions::ExperimentalAudioSystem() const
9292{
9293 assert(state_ == DiscordObjectState::Owned);
9294 Discord_AudioSystem returnValue__;
9295 returnValue__ = Discord_ClientCreateOptions_ExperimentalAudioSystem(&instance_);
9296 return static_cast<discordpp::AudioSystem>(returnValue__);
9297}
9298void ClientCreateOptions::SetExperimentalAudioSystem(discordpp::AudioSystem ExperimentalAudioSystem)
9299{
9300 assert(state_ == DiscordObjectState::Owned);
9301 Discord_ClientCreateOptions_SetExperimentalAudioSystem(
9302 &instance_, static_cast<Discord_AudioSystem>(ExperimentalAudioSystem));
9303}
9304const Client Client::nullobj{{}, DiscordObjectState::Invalid};
9305Client::~Client()
9306{
9307 if (state_ == DiscordObjectState::Owned) {
9308 Drop();
9309 state_ = DiscordObjectState::Invalid;
9310 }
9311}
9312Client::Client(Client&& other) noexcept
9313 : instance_(other.instance_)
9314 , state_(other.state_)
9315{
9316 other.state_ = DiscordObjectState::Invalid;
9317}
9318Client& Client::operator=(Client&& other) noexcept
9319{
9320 if (this != &other) {
9321 if (state_ == DiscordObjectState::Owned) {
9322 Drop();
9323 }
9324 instance_ = other.instance_;
9325 state_ = other.state_;
9326 other.state_ = DiscordObjectState::Invalid;
9327 }
9328 return *this;
9329}
9330Client::Client(Discord_Client instance, DiscordObjectState state)
9331 : instance_(instance)
9332 , state_(state)
9333{
9334}
9335Client::Client()
9336{
9337 assert(state_ == DiscordObjectState::Invalid);
9338 Discord_Client_Init(&instance_);
9339 state_ = DiscordObjectState::Owned;
9340}
9341Client::Client(std::string apiBase, std::string webBase)
9342{
9343 assert(state_ == DiscordObjectState::Invalid);
9344 Discord_String apiBase__str{(uint8_t*)(apiBase.data()), apiBase.size()};
9345 Discord_String webBase__str{(uint8_t*)(webBase.data()), webBase.size()};
9346 Discord_Client_InitWithBases(&instance_, apiBase__str, webBase__str);
9347 state_ = DiscordObjectState::Owned;
9348}
9349Client::Client(discordpp::ClientCreateOptions options)
9350{
9351 assert(state_ == DiscordObjectState::Invalid);
9352 Discord_Client_InitWithOptions(&instance_, options.instance());
9353 state_ = DiscordObjectState::Owned;
9354}
9355void Client::Drop()
9356{
9357 if (state_ != DiscordObjectState::Owned) {
9358 return;
9359 }
9360 Discord_Client_Drop(&instance_);
9361 state_ = DiscordObjectState::Invalid;
9362}
9363std::string Client::ErrorToString(discordpp::Client::Error type)
9364{
9365 Discord_String returnValueNative__;
9366 Discord_Client_ErrorToString(static_cast<Discord_Client_Error>(type), &returnValueNative__);
9367 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9368 returnValueNative__.size);
9369 Discord_Free(returnValueNative__.ptr);
9370 return returnValue__;
9371}
9372uint64_t Client::GetApplicationId()
9373{
9374 assert(state_ == DiscordObjectState::Owned);
9375 uint64_t returnValue__;
9376 returnValue__ = Discord_Client_GetApplicationId(&instance_);
9377 return returnValue__;
9378}
9379std::string Client::GetDefaultAudioDeviceId()
9380{
9381 Discord_String returnValueNative__;
9382 Discord_Client_GetDefaultAudioDeviceId(&returnValueNative__);
9383 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9384 returnValueNative__.size);
9385 Discord_Free(returnValueNative__.ptr);
9386 return returnValue__;
9387}
9388std::string Client::GetDefaultCommunicationScopes()
9389{
9390 Discord_String returnValueNative__;
9391 Discord_Client_GetDefaultCommunicationScopes(&returnValueNative__);
9392 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9393 returnValueNative__.size);
9394 Discord_Free(returnValueNative__.ptr);
9395 return returnValue__;
9396}
9397std::string Client::GetDefaultPresenceScopes()
9398{
9399 Discord_String returnValueNative__;
9400 Discord_Client_GetDefaultPresenceScopes(&returnValueNative__);
9401 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9402 returnValueNative__.size);
9403 Discord_Free(returnValueNative__.ptr);
9404 return returnValue__;
9405}
9406std::string Client::GetVersionHash()
9407{
9408 Discord_String returnValueNative__;
9409 Discord_Client_GetVersionHash(&returnValueNative__);
9410 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9411 returnValueNative__.size);
9412 Discord_Free(returnValueNative__.ptr);
9413 return returnValue__;
9414}
9415int32_t Client::GetVersionMajor()
9416{
9417 int32_t returnValue__;
9418 returnValue__ = Discord_Client_GetVersionMajor();
9419 return returnValue__;
9420}
9421int32_t Client::GetVersionMinor()
9422{
9423 int32_t returnValue__;
9424 returnValue__ = Discord_Client_GetVersionMinor();
9425 return returnValue__;
9426}
9427int32_t Client::GetVersionPatch()
9428{
9429 int32_t returnValue__;
9430 returnValue__ = Discord_Client_GetVersionPatch();
9431 return returnValue__;
9432}
9433void Client::SetHttpRequestTimeout(int32_t httpTimeoutInMilliseconds)
9434{
9435 assert(state_ == DiscordObjectState::Owned);
9436 Discord_Client_SetHttpRequestTimeout(&instance_, httpTimeoutInMilliseconds);
9437}
9438std::string Client::StatusToString(discordpp::Client::Status type)
9439{
9440 Discord_String returnValueNative__;
9441 Discord_Client_StatusToString(static_cast<Discord_Client_Status>(type), &returnValueNative__);
9442 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9443 returnValueNative__.size);
9444 Discord_Free(returnValueNative__.ptr);
9445 return returnValue__;
9446}
9447std::string Client::ThreadToString(discordpp::Client::Thread type)
9448{
9449 Discord_String returnValueNative__;
9450 Discord_Client_ThreadToString(static_cast<Discord_Client_Thread>(type), &returnValueNative__);
9451 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9452 returnValueNative__.size);
9453 Discord_Free(returnValueNative__.ptr);
9454 return returnValue__;
9455}
9456void Client::EndCall(uint64_t channelId, discordpp::Client::EndCallCallback callback)
9457{
9458 assert(state_ == DiscordObjectState::Owned);
9459 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9460 auto callback__userData = new Tcallback__UserData(callback);
9461 Discord_Client_EndCallCallback callback__native = [](void* userData__) {
9462 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9463 userData__typed->delegate();
9464 };
9465 Discord_Client_EndCall(
9466 &instance_, channelId, callback__native, Tcallback__UserData::Free, callback__userData);
9467}
9468void Client::EndCalls(discordpp::Client::EndCallsCallback callback)
9469{
9470 assert(state_ == DiscordObjectState::Owned);
9471 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9472 auto callback__userData = new Tcallback__UserData(callback);
9473 Discord_Client_EndCallsCallback callback__native = [](void* userData__) {
9474 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9475 userData__typed->delegate();
9476 };
9477 Discord_Client_EndCalls(
9478 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
9479}
9480discordpp::Call Client::GetCall(uint64_t channelId)
9481{
9482 assert(state_ == DiscordObjectState::Owned);
9483 bool returnIsNonNull__;
9484 Discord_Call returnValueNative__{};
9485 returnIsNonNull__ = Discord_Client_GetCall(&instance_, channelId, &returnValueNative__);
9486 discordpp::Call returnValue__(
9487 returnValueNative__,
9488 returnIsNonNull__ ? DiscordObjectState::Owned : DiscordObjectState::Invalid);
9489 return returnValue__;
9490}
9491std::vector<discordpp::Call> Client::GetCalls()
9492{
9493 assert(state_ == DiscordObjectState::Owned);
9494 Discord_CallSpan returnValueNative__;
9495 Discord_Client_GetCalls(&instance_, &returnValueNative__);
9496 std::vector<discordpp::Call> returnValue__;
9497 returnValue__.reserve(returnValueNative__.size);
9498 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
9499 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
9500 }
9501 Discord_Free(returnValueNative__.ptr);
9502 return returnValue__;
9503}
9504void Client::GetCurrentInputDevice(discordpp::Client::GetCurrentInputDeviceCallback cb)
9505{
9506 assert(state_ == DiscordObjectState::Owned);
9507 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9508 auto cb__userData = new Tcb__UserData(cb);
9509 Discord_Client_GetCurrentInputDeviceCallback cb__native = [](auto device, void* userData__) {
9510 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9511 discordpp::AudioDevice device__obj(*device, DiscordObjectState::Owned);
9512 userData__typed->delegate(std::move(device__obj));
9513 };
9514 Discord_Client_GetCurrentInputDevice(&instance_, cb__native, Tcb__UserData::Free, cb__userData);
9515}
9516void Client::GetCurrentOutputDevice(discordpp::Client::GetCurrentOutputDeviceCallback cb)
9517{
9518 assert(state_ == DiscordObjectState::Owned);
9519 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9520 auto cb__userData = new Tcb__UserData(cb);
9521 Discord_Client_GetCurrentOutputDeviceCallback cb__native = [](auto device, void* userData__) {
9522 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9523 discordpp::AudioDevice device__obj(*device, DiscordObjectState::Owned);
9524 userData__typed->delegate(std::move(device__obj));
9525 };
9526 Discord_Client_GetCurrentOutputDevice(
9527 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
9528}
9529void Client::GetInputDevices(discordpp::Client::GetInputDevicesCallback cb)
9530{
9531 assert(state_ == DiscordObjectState::Owned);
9532 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9533 auto cb__userData = new Tcb__UserData(cb);
9534 Discord_Client_GetInputDevicesCallback cb__native = [](auto devices, void* userData__) {
9535 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9536 std::vector<discordpp::AudioDevice> devices__vec;
9537 devices__vec.reserve(devices.size);
9538 for (size_t i__ = 0; i__ < devices.size; ++i__) {
9539 devices__vec.emplace_back(devices.ptr[i__], DiscordObjectState::Owned);
9540 }
9541 Discord_Free(devices.ptr);
9542 userData__typed->delegate(std::move(devices__vec));
9543 };
9544 Discord_Client_GetInputDevices(&instance_, cb__native, Tcb__UserData::Free, cb__userData);
9545}
9546float Client::GetInputVolume()
9547{
9548 assert(state_ == DiscordObjectState::Owned);
9549 float returnValue__;
9550 returnValue__ = Discord_Client_GetInputVolume(&instance_);
9551 return returnValue__;
9552}
9553void Client::GetOutputDevices(discordpp::Client::GetOutputDevicesCallback cb)
9554{
9555 assert(state_ == DiscordObjectState::Owned);
9556 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9557 auto cb__userData = new Tcb__UserData(cb);
9558 Discord_Client_GetOutputDevicesCallback cb__native = [](auto devices, void* userData__) {
9559 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9560 std::vector<discordpp::AudioDevice> devices__vec;
9561 devices__vec.reserve(devices.size);
9562 for (size_t i__ = 0; i__ < devices.size; ++i__) {
9563 devices__vec.emplace_back(devices.ptr[i__], DiscordObjectState::Owned);
9564 }
9565 Discord_Free(devices.ptr);
9566 userData__typed->delegate(std::move(devices__vec));
9567 };
9568 Discord_Client_GetOutputDevices(&instance_, cb__native, Tcb__UserData::Free, cb__userData);
9569}
9570float Client::GetOutputVolume()
9571{
9572 assert(state_ == DiscordObjectState::Owned);
9573 float returnValue__;
9574 returnValue__ = Discord_Client_GetOutputVolume(&instance_);
9575 return returnValue__;
9576}
9577bool Client::GetSelfDeafAll() const
9578{
9579 assert(state_ == DiscordObjectState::Owned);
9580 bool returnValue__;
9581 returnValue__ = Discord_Client_GetSelfDeafAll(&instance_);
9582 return returnValue__;
9583}
9584bool Client::GetSelfMuteAll() const
9585{
9586 assert(state_ == DiscordObjectState::Owned);
9587 bool returnValue__;
9588 returnValue__ = Discord_Client_GetSelfMuteAll(&instance_);
9589 return returnValue__;
9590}
9591void Client::SetAecDump(bool on)
9592{
9593 assert(state_ == DiscordObjectState::Owned);
9594 Discord_Client_SetAecDump(&instance_, on);
9595}
9596void Client::SetAutomaticGainControl(bool on)
9597{
9598 assert(state_ == DiscordObjectState::Owned);
9599 Discord_Client_SetAutomaticGainControl(&instance_, on);
9600}
9601void Client::SetDeviceChangeCallback(discordpp::Client::DeviceChangeCallback callback)
9602{
9603 assert(state_ == DiscordObjectState::Owned);
9604 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9605 auto callback__userData = new Tcallback__UserData(callback);
9606 Discord_Client_DeviceChangeCallback callback__native =
9607 [](auto inputDevices, auto outputDevices, void* userData__) {
9608 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9609 std::vector<discordpp::AudioDevice> inputDevices__vec;
9610 inputDevices__vec.reserve(inputDevices.size);
9611 for (size_t i__ = 0; i__ < inputDevices.size; ++i__) {
9612 inputDevices__vec.emplace_back(inputDevices.ptr[i__], DiscordObjectState::Owned);
9613 }
9614 Discord_Free(inputDevices.ptr);
9615 std::vector<discordpp::AudioDevice> outputDevices__vec;
9616 outputDevices__vec.reserve(outputDevices.size);
9617 for (size_t i__ = 0; i__ < outputDevices.size; ++i__) {
9618 outputDevices__vec.emplace_back(outputDevices.ptr[i__], DiscordObjectState::Owned);
9619 }
9620 Discord_Free(outputDevices.ptr);
9621 userData__typed->delegate(std::move(inputDevices__vec), std::move(outputDevices__vec));
9622 };
9623 Discord_Client_SetDeviceChangeCallback(
9624 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
9625}
9626void Client::SetEchoCancellation(bool on)
9627{
9628 assert(state_ == DiscordObjectState::Owned);
9629 Discord_Client_SetEchoCancellation(&instance_, on);
9630}
9631void Client::SetEngineManagedAudioSession(bool isEngineManaged)
9632{
9633 assert(state_ == DiscordObjectState::Owned);
9634 Discord_Client_SetEngineManagedAudioSession(&instance_, isEngineManaged);
9635}
9636void Client::SetInputDevice(std::string deviceId, discordpp::Client::SetInputDeviceCallback cb)
9637{
9638 assert(state_ == DiscordObjectState::Owned);
9639 Discord_String deviceId__str{(uint8_t*)(deviceId.data()), deviceId.size()};
9640 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9641 auto cb__userData = new Tcb__UserData(cb);
9642 Discord_Client_SetInputDeviceCallback cb__native = [](auto result, void* userData__) {
9643 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9644 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9645 userData__typed->delegate(std::move(result__obj));
9646 };
9647 Discord_Client_SetInputDevice(
9648 &instance_, deviceId__str, cb__native, Tcb__UserData::Free, cb__userData);
9649}
9650void Client::SetInputVolume(float inputVolume)
9651{
9652 assert(state_ == DiscordObjectState::Owned);
9653 Discord_Client_SetInputVolume(&instance_, inputVolume);
9654}
9655void Client::SetNoAudioInputCallback(discordpp::Client::NoAudioInputCallback callback)
9656{
9657 assert(state_ == DiscordObjectState::Owned);
9658 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9659 auto callback__userData = new Tcallback__UserData(callback);
9660 Discord_Client_NoAudioInputCallback callback__native = [](auto inputDetected,
9661 void* userData__) {
9662 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9663 userData__typed->delegate(inputDetected);
9664 };
9665 Discord_Client_SetNoAudioInputCallback(
9666 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
9667}
9668void Client::SetNoAudioInputThreshold(float dBFSThreshold)
9669{
9670 assert(state_ == DiscordObjectState::Owned);
9671 Discord_Client_SetNoAudioInputThreshold(&instance_, dBFSThreshold);
9672}
9673void Client::SetNoiseSuppression(bool on)
9674{
9675 assert(state_ == DiscordObjectState::Owned);
9676 Discord_Client_SetNoiseSuppression(&instance_, on);
9677}
9678void Client::SetOpusHardwareCoding(bool encode, bool decode)
9679{
9680 assert(state_ == DiscordObjectState::Owned);
9681 Discord_Client_SetOpusHardwareCoding(&instance_, encode, decode);
9682}
9683void Client::SetOutputDevice(std::string deviceId, discordpp::Client::SetOutputDeviceCallback cb)
9684{
9685 assert(state_ == DiscordObjectState::Owned);
9686 Discord_String deviceId__str{(uint8_t*)(deviceId.data()), deviceId.size()};
9687 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9688 auto cb__userData = new Tcb__UserData(cb);
9689 Discord_Client_SetOutputDeviceCallback cb__native = [](auto result, void* userData__) {
9690 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9691 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9692 userData__typed->delegate(std::move(result__obj));
9693 };
9694 Discord_Client_SetOutputDevice(
9695 &instance_, deviceId__str, cb__native, Tcb__UserData::Free, cb__userData);
9696}
9697void Client::SetOutputVolume(float outputVolume)
9698{
9699 assert(state_ == DiscordObjectState::Owned);
9700 Discord_Client_SetOutputVolume(&instance_, outputVolume);
9701}
9702void Client::SetSelfDeafAll(bool deaf)
9703{
9704 assert(state_ == DiscordObjectState::Owned);
9705 Discord_Client_SetSelfDeafAll(&instance_, deaf);
9706}
9707void Client::SetSelfMuteAll(bool mute)
9708{
9709 assert(state_ == DiscordObjectState::Owned);
9710 Discord_Client_SetSelfMuteAll(&instance_, mute);
9711}
9712bool Client::SetSpeakerMode(bool speakerMode)
9713{
9714 assert(state_ == DiscordObjectState::Owned);
9715 bool returnValue__;
9716 returnValue__ = Discord_Client_SetSpeakerMode(&instance_, speakerMode);
9717 return returnValue__;
9718}
9719void Client::SetThreadPriority(discordpp::Client::Thread thread, int32_t priority)
9720{
9721 assert(state_ == DiscordObjectState::Owned);
9722 Discord_Client_SetThreadPriority(
9723 &instance_, static_cast<Discord_Client_Thread>(thread), priority);
9724}
9725void Client::SetVoiceParticipantChangedCallback(
9727{
9728 assert(state_ == DiscordObjectState::Owned);
9729 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9730 auto cb__userData = new Tcb__UserData(cb);
9731 Discord_Client_VoiceParticipantChangedCallback cb__native =
9732 [](auto lobbyId, auto memberId, auto added, void* userData__) {
9733 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9734 userData__typed->delegate(lobbyId, memberId, added);
9735 };
9736 Discord_Client_SetVoiceParticipantChangedCallback(
9737 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
9738}
9739bool Client::ShowAudioRoutePicker()
9740{
9741 assert(state_ == DiscordObjectState::Owned);
9742 bool returnValue__;
9743 returnValue__ = Discord_Client_ShowAudioRoutePicker(&instance_);
9744 return returnValue__;
9745}
9746discordpp::Call Client::StartCall(uint64_t channelId)
9747{
9748 assert(state_ == DiscordObjectState::Owned);
9749 bool returnIsNonNull__;
9750 Discord_Call returnValueNative__{};
9751 returnIsNonNull__ = Discord_Client_StartCall(&instance_, channelId, &returnValueNative__);
9752 discordpp::Call returnValue__(
9753 returnValueNative__,
9754 returnIsNonNull__ ? DiscordObjectState::Owned : DiscordObjectState::Invalid);
9755 return returnValue__;
9756}
9757discordpp::Call Client::StartCallWithAudioCallbacks(
9758 uint64_t lobbyId,
9761{
9762 assert(state_ == DiscordObjectState::Owned);
9763 bool returnIsNonNull__;
9764 Discord_Call returnValueNative__{};
9765 using TreceivedCb__UserData = TDelegateUserData<std::remove_reference_t<decltype(receivedCb)>>;
9766 auto receivedCb__userData = new TreceivedCb__UserData(receivedCb);
9767 Discord_Client_UserAudioReceivedCallback receivedCb__native = [](auto userId,
9768 auto data,
9769 auto samplesPerChannel,
9770 auto sampleRate,
9771 auto channels,
9772 auto outShouldMute,
9773 void* userData__) {
9774 auto userData__typed = static_cast<TreceivedCb__UserData*>(userData__);
9775 userData__typed->delegate(
9776 userId, data, samplesPerChannel, sampleRate, channels, *outShouldMute);
9777 };
9778 using TcapturedCb__UserData = TDelegateUserData<std::remove_reference_t<decltype(capturedCb)>>;
9779 auto capturedCb__userData = new TcapturedCb__UserData(capturedCb);
9780 Discord_Client_UserAudioCapturedCallback capturedCb__native =
9781 [](auto data, auto samplesPerChannel, auto sampleRate, auto channels, void* userData__) {
9782 auto userData__typed = static_cast<TcapturedCb__UserData*>(userData__);
9783 userData__typed->delegate(data, samplesPerChannel, sampleRate, channels);
9784 };
9785 returnIsNonNull__ = Discord_Client_StartCallWithAudioCallbacks(&instance_,
9786 lobbyId,
9787 receivedCb__native,
9788 TreceivedCb__UserData::Free,
9789 receivedCb__userData,
9790 capturedCb__native,
9791 TcapturedCb__UserData::Free,
9792 capturedCb__userData,
9793 &returnValueNative__);
9794 discordpp::Call returnValue__(
9795 returnValueNative__,
9796 returnIsNonNull__ ? DiscordObjectState::Owned : DiscordObjectState::Invalid);
9797 return returnValue__;
9798}
9799void Client::AbortAuthorize()
9800{
9801 assert(state_ == DiscordObjectState::Owned);
9802 Discord_Client_AbortAuthorize(&instance_);
9803}
9804void Client::AbortGetTokenFromDevice()
9805{
9806 assert(state_ == DiscordObjectState::Owned);
9807 Discord_Client_AbortGetTokenFromDevice(&instance_);
9808}
9809void Client::Authorize(discordpp::AuthorizationArgs args,
9811{
9812 assert(state_ == DiscordObjectState::Owned);
9813 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9814 auto callback__userData = new Tcallback__UserData(callback);
9815 Discord_Client_AuthorizationCallback callback__native =
9816 [](auto result, auto code, auto redirectUri, void* userData__) {
9817 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9818 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9819 std::string code__str(reinterpret_cast<char*>(code.ptr), code.size);
9820 std::string redirectUri__str(reinterpret_cast<char*>(redirectUri.ptr), redirectUri.size);
9821 userData__typed->delegate(
9822 std::move(result__obj), std::move(code__str), std::move(redirectUri__str));
9823 Discord_Free(redirectUri.ptr);
9824 Discord_Free(code.ptr);
9825 };
9826 Discord_Client_Authorize(
9827 &instance_, args.instance(), callback__native, Tcallback__UserData::Free, callback__userData);
9828}
9829void Client::CloseAuthorizeDeviceScreen()
9830{
9831 assert(state_ == DiscordObjectState::Owned);
9832 Discord_Client_CloseAuthorizeDeviceScreen(&instance_);
9833}
9834discordpp::AuthorizationCodeVerifier Client::CreateAuthorizationCodeVerifier()
9835{
9836 assert(state_ == DiscordObjectState::Owned);
9837 Discord_AuthorizationCodeVerifier returnValueNative__{};
9838 Discord_Client_CreateAuthorizationCodeVerifier(&instance_, &returnValueNative__);
9839 discordpp::AuthorizationCodeVerifier returnValue__(returnValueNative__,
9840 DiscordObjectState::Owned);
9841 return returnValue__;
9842}
9843void Client::ExchangeChildToken(std::string const& parentApplicationToken,
9844 uint64_t childApplicationId,
9846{
9847 assert(state_ == DiscordObjectState::Owned);
9848 Discord_String parentApplicationToken__str{(uint8_t*)(parentApplicationToken.data()),
9849 parentApplicationToken.size()};
9850 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9851 auto callback__userData = new Tcallback__UserData(callback);
9852 Discord_Client_ExchangeChildTokenCallback callback__native = [](auto result,
9853 auto accessToken,
9854 auto tokenType,
9855 auto expiresIn,
9856 auto scopes,
9857 void* userData__) {
9858 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9859 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9860 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
9861 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
9862 userData__typed->delegate(std::move(result__obj),
9863 std::move(accessToken__str),
9864 static_cast<discordpp::AuthorizationTokenType>(tokenType),
9865 expiresIn,
9866 std::move(scopes__str));
9867 Discord_Free(scopes.ptr);
9868 Discord_Free(accessToken.ptr);
9869 };
9870 Discord_Client_ExchangeChildToken(&instance_,
9871 parentApplicationToken__str,
9872 childApplicationId,
9873 callback__native,
9874 Tcallback__UserData::Free,
9875 callback__userData);
9876}
9877void Client::FetchCurrentUser(discordpp::AuthorizationTokenType tokenType,
9878 std::string const& token,
9880{
9881 assert(state_ == DiscordObjectState::Owned);
9882 Discord_String token__str{(uint8_t*)(token.data()), token.size()};
9883 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9884 auto callback__userData = new Tcallback__UserData(callback);
9885 Discord_Client_FetchCurrentUserCallback callback__native =
9886 [](auto result, auto id, auto name, void* userData__) {
9887 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9888 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9889 std::string name__str(reinterpret_cast<char*>(name.ptr), name.size);
9890 userData__typed->delegate(std::move(result__obj), id, std::move(name__str));
9891 Discord_Free(name.ptr);
9892 };
9893 Discord_Client_FetchCurrentUser(&instance_,
9894 static_cast<Discord_AuthorizationTokenType>(tokenType),
9895 token__str,
9896 callback__native,
9897 Tcallback__UserData::Free,
9898 callback__userData);
9899}
9900void Client::GetProvisionalToken(uint64_t applicationId,
9902 std::string const& externalAuthToken,
9904{
9905 assert(state_ == DiscordObjectState::Owned);
9906 Discord_String externalAuthToken__str{(uint8_t*)(externalAuthToken.data()),
9907 externalAuthToken.size()};
9908 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9909 auto callback__userData = new Tcallback__UserData(callback);
9910 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
9911 auto accessToken,
9912 auto refreshToken,
9913 auto tokenType,
9914 auto expiresIn,
9915 auto scopes,
9916 void* userData__) {
9917 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9918 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9919 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
9920 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
9921 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
9922 userData__typed->delegate(std::move(result__obj),
9923 std::move(accessToken__str),
9924 std::move(refreshToken__str),
9925 static_cast<discordpp::AuthorizationTokenType>(tokenType),
9926 expiresIn,
9927 std::move(scopes__str));
9928 Discord_Free(scopes.ptr);
9929 Discord_Free(refreshToken.ptr);
9930 Discord_Free(accessToken.ptr);
9931 };
9932 Discord_Client_GetProvisionalToken(
9933 &instance_,
9934 applicationId,
9935 static_cast<Discord_AuthenticationExternalAuthType>(externalAuthType),
9936 externalAuthToken__str,
9937 callback__native,
9938 Tcallback__UserData::Free,
9939 callback__userData);
9940}
9941void Client::GetToken(uint64_t applicationId,
9942 std::string const& code,
9943 std::string const& codeVerifier,
9944 std::string const& redirectUri,
9946{
9947 assert(state_ == DiscordObjectState::Owned);
9948 Discord_String code__str{(uint8_t*)(code.data()), code.size()};
9949 Discord_String codeVerifier__str{(uint8_t*)(codeVerifier.data()), codeVerifier.size()};
9950 Discord_String redirectUri__str{(uint8_t*)(redirectUri.data()), redirectUri.size()};
9951 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9952 auto callback__userData = new Tcallback__UserData(callback);
9953 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
9954 auto accessToken,
9955 auto refreshToken,
9956 auto tokenType,
9957 auto expiresIn,
9958 auto scopes,
9959 void* userData__) {
9960 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9961 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9962 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
9963 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
9964 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
9965 userData__typed->delegate(std::move(result__obj),
9966 std::move(accessToken__str),
9967 std::move(refreshToken__str),
9968 static_cast<discordpp::AuthorizationTokenType>(tokenType),
9969 expiresIn,
9970 std::move(scopes__str));
9971 Discord_Free(scopes.ptr);
9972 Discord_Free(refreshToken.ptr);
9973 Discord_Free(accessToken.ptr);
9974 };
9975 Discord_Client_GetToken(&instance_,
9976 applicationId,
9977 code__str,
9978 codeVerifier__str,
9979 redirectUri__str,
9980 callback__native,
9981 Tcallback__UserData::Free,
9982 callback__userData);
9983}
9984void Client::GetTokenFromDevice(discordpp::DeviceAuthorizationArgs args,
9986{
9987 assert(state_ == DiscordObjectState::Owned);
9988 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9989 auto callback__userData = new Tcallback__UserData(callback);
9990 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
9991 auto accessToken,
9992 auto refreshToken,
9993 auto tokenType,
9994 auto expiresIn,
9995 auto scopes,
9996 void* userData__) {
9997 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9998 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9999 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
10000 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
10001 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
10002 userData__typed->delegate(std::move(result__obj),
10003 std::move(accessToken__str),
10004 std::move(refreshToken__str),
10005 static_cast<discordpp::AuthorizationTokenType>(tokenType),
10006 expiresIn,
10007 std::move(scopes__str));
10008 Discord_Free(scopes.ptr);
10009 Discord_Free(refreshToken.ptr);
10010 Discord_Free(accessToken.ptr);
10011 };
10012 Discord_Client_GetTokenFromDevice(
10013 &instance_, args.instance(), callback__native, Tcallback__UserData::Free, callback__userData);
10014}
10015void Client::GetTokenFromDeviceProvisionalMerge(
10018 std::string const& externalAuthToken,
10020{
10021 assert(state_ == DiscordObjectState::Owned);
10022 Discord_String externalAuthToken__str{(uint8_t*)(externalAuthToken.data()),
10023 externalAuthToken.size()};
10024 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10025 auto callback__userData = new Tcallback__UserData(callback);
10026 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
10027 auto accessToken,
10028 auto refreshToken,
10029 auto tokenType,
10030 auto expiresIn,
10031 auto scopes,
10032 void* userData__) {
10033 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10034 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10035 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
10036 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
10037 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
10038 userData__typed->delegate(std::move(result__obj),
10039 std::move(accessToken__str),
10040 std::move(refreshToken__str),
10041 static_cast<discordpp::AuthorizationTokenType>(tokenType),
10042 expiresIn,
10043 std::move(scopes__str));
10044 Discord_Free(scopes.ptr);
10045 Discord_Free(refreshToken.ptr);
10046 Discord_Free(accessToken.ptr);
10047 };
10048 Discord_Client_GetTokenFromDeviceProvisionalMerge(
10049 &instance_,
10050 args.instance(),
10051 static_cast<Discord_AuthenticationExternalAuthType>(externalAuthType),
10052 externalAuthToken__str,
10053 callback__native,
10054 Tcallback__UserData::Free,
10055 callback__userData);
10056}
10057void Client::GetTokenFromProvisionalMerge(
10058 uint64_t applicationId,
10059 std::string const& code,
10060 std::string const& codeVerifier,
10061 std::string const& redirectUri,
10063 std::string const& externalAuthToken,
10065{
10066 assert(state_ == DiscordObjectState::Owned);
10067 Discord_String code__str{(uint8_t*)(code.data()), code.size()};
10068 Discord_String codeVerifier__str{(uint8_t*)(codeVerifier.data()), codeVerifier.size()};
10069 Discord_String redirectUri__str{(uint8_t*)(redirectUri.data()), redirectUri.size()};
10070 Discord_String externalAuthToken__str{(uint8_t*)(externalAuthToken.data()),
10071 externalAuthToken.size()};
10072 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10073 auto callback__userData = new Tcallback__UserData(callback);
10074 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
10075 auto accessToken,
10076 auto refreshToken,
10077 auto tokenType,
10078 auto expiresIn,
10079 auto scopes,
10080 void* userData__) {
10081 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10082 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10083 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
10084 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
10085 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
10086 userData__typed->delegate(std::move(result__obj),
10087 std::move(accessToken__str),
10088 std::move(refreshToken__str),
10089 static_cast<discordpp::AuthorizationTokenType>(tokenType),
10090 expiresIn,
10091 std::move(scopes__str));
10092 Discord_Free(scopes.ptr);
10093 Discord_Free(refreshToken.ptr);
10094 Discord_Free(accessToken.ptr);
10095 };
10096 Discord_Client_GetTokenFromProvisionalMerge(
10097 &instance_,
10098 applicationId,
10099 code__str,
10100 codeVerifier__str,
10101 redirectUri__str,
10102 static_cast<Discord_AuthenticationExternalAuthType>(externalAuthType),
10103 externalAuthToken__str,
10104 callback__native,
10105 Tcallback__UserData::Free,
10106 callback__userData);
10107}
10108bool Client::IsAuthenticated()
10109{
10110 assert(state_ == DiscordObjectState::Owned);
10111 bool returnValue__;
10112 returnValue__ = Discord_Client_IsAuthenticated(&instance_);
10113 return returnValue__;
10114}
10115void Client::OpenAuthorizeDeviceScreen(uint64_t clientId, std::string const& userCode)
10116{
10117 assert(state_ == DiscordObjectState::Owned);
10118 Discord_String userCode__str{(uint8_t*)(userCode.data()), userCode.size()};
10119 Discord_Client_OpenAuthorizeDeviceScreen(&instance_, clientId, userCode__str);
10120}
10121void Client::ProvisionalUserMergeCompleted(bool success)
10122{
10123 assert(state_ == DiscordObjectState::Owned);
10124 Discord_Client_ProvisionalUserMergeCompleted(&instance_, success);
10125}
10126void Client::RefreshToken(uint64_t applicationId,
10127 std::string const& refreshToken,
10129{
10130 assert(state_ == DiscordObjectState::Owned);
10131 Discord_String refreshToken__str{(uint8_t*)(refreshToken.data()), refreshToken.size()};
10132 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10133 auto callback__userData = new Tcallback__UserData(callback);
10134 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
10135 auto accessToken,
10136 auto refreshToken,
10137 auto tokenType,
10138 auto expiresIn,
10139 auto scopes,
10140 void* userData__) {
10141 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10142 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10143 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
10144 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
10145 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
10146 userData__typed->delegate(std::move(result__obj),
10147 std::move(accessToken__str),
10148 std::move(refreshToken__str),
10149 static_cast<discordpp::AuthorizationTokenType>(tokenType),
10150 expiresIn,
10151 std::move(scopes__str));
10152 Discord_Free(scopes.ptr);
10153 Discord_Free(refreshToken.ptr);
10154 Discord_Free(accessToken.ptr);
10155 };
10156 Discord_Client_RefreshToken(&instance_,
10157 applicationId,
10158 refreshToken__str,
10159 callback__native,
10160 Tcallback__UserData::Free,
10161 callback__userData);
10162}
10163void Client::RevokeToken(uint64_t applicationId,
10164 std::string const& token,
10166{
10167 assert(state_ == DiscordObjectState::Owned);
10168 Discord_String token__str{(uint8_t*)(token.data()), token.size()};
10169 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10170 auto callback__userData = new Tcallback__UserData(callback);
10171 Discord_Client_RevokeTokenCallback callback__native = [](auto result, void* userData__) {
10172 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10173 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10174 userData__typed->delegate(std::move(result__obj));
10175 };
10176 Discord_Client_RevokeToken(&instance_,
10177 applicationId,
10178 token__str,
10179 callback__native,
10180 Tcallback__UserData::Free,
10181 callback__userData);
10182}
10183void Client::SetAuthorizeDeviceScreenClosedCallback(
10185{
10186 assert(state_ == DiscordObjectState::Owned);
10187 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10188 auto cb__userData = new Tcb__UserData(cb);
10189 Discord_Client_AuthorizeDeviceScreenClosedCallback cb__native = [](void* userData__) {
10190 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10191 userData__typed->delegate();
10192 };
10193 Discord_Client_SetAuthorizeDeviceScreenClosedCallback(
10194 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10195}
10196void Client::SetGameWindowPid(int32_t pid)
10197{
10198 assert(state_ == DiscordObjectState::Owned);
10199 Discord_Client_SetGameWindowPid(&instance_, pid);
10200}
10201void Client::SetTokenExpirationCallback(discordpp::Client::TokenExpirationCallback callback)
10202{
10203 assert(state_ == DiscordObjectState::Owned);
10204 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10205 auto callback__userData = new Tcallback__UserData(callback);
10206 Discord_Client_TokenExpirationCallback callback__native = [](void* userData__) {
10207 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10208 userData__typed->delegate();
10209 };
10210 Discord_Client_SetTokenExpirationCallback(
10211 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
10212}
10213void Client::UnmergeIntoProvisionalAccount(
10214 uint64_t applicationId,
10216 std::string const& externalAuthToken,
10218{
10219 assert(state_ == DiscordObjectState::Owned);
10220 Discord_String externalAuthToken__str{(uint8_t*)(externalAuthToken.data()),
10221 externalAuthToken.size()};
10222 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10223 auto callback__userData = new Tcallback__UserData(callback);
10224 Discord_Client_UnmergeIntoProvisionalAccountCallback callback__native = [](auto result,
10225 void* userData__) {
10226 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10227 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10228 userData__typed->delegate(std::move(result__obj));
10229 };
10230 Discord_Client_UnmergeIntoProvisionalAccount(
10231 &instance_,
10232 applicationId,
10233 static_cast<Discord_AuthenticationExternalAuthType>(externalAuthType),
10234 externalAuthToken__str,
10235 callback__native,
10236 Tcallback__UserData::Free,
10237 callback__userData);
10238}
10239void Client::UpdateProvisionalAccountDisplayName(
10240 std::string const& name,
10242{
10243 assert(state_ == DiscordObjectState::Owned);
10244 Discord_String name__str{(uint8_t*)(name.data()), name.size()};
10245 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10246 auto callback__userData = new Tcallback__UserData(callback);
10247 Discord_Client_UpdateProvisionalAccountDisplayNameCallback callback__native =
10248 [](auto result, void* userData__) {
10249 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10250 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10251 userData__typed->delegate(std::move(result__obj));
10252 };
10253 Discord_Client_UpdateProvisionalAccountDisplayName(
10254 &instance_, name__str, callback__native, Tcallback__UserData::Free, callback__userData);
10255}
10256void Client::UpdateToken(discordpp::AuthorizationTokenType tokenType,
10257 std::string token,
10259{
10260 assert(state_ == DiscordObjectState::Owned);
10261 Discord_String token__str{(uint8_t*)(token.data()), token.size()};
10262 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10263 auto callback__userData = new Tcallback__UserData(callback);
10264 Discord_Client_UpdateTokenCallback callback__native = [](auto result, void* userData__) {
10265 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10266 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10267 userData__typed->delegate(std::move(result__obj));
10268 };
10269 Discord_Client_UpdateToken(&instance_,
10270 static_cast<Discord_AuthorizationTokenType>(tokenType),
10271 token__str,
10272 callback__native,
10273 Tcallback__UserData::Free,
10274 callback__userData);
10275}
10276bool Client::CanOpenMessageInDiscord(uint64_t messageId)
10277{
10278 assert(state_ == DiscordObjectState::Owned);
10279 bool returnValue__;
10280 returnValue__ = Discord_Client_CanOpenMessageInDiscord(&instance_, messageId);
10281 return returnValue__;
10282}
10283void Client::DeleteUserMessage(uint64_t recipientId,
10284 uint64_t messageId,
10286{
10287 assert(state_ == DiscordObjectState::Owned);
10288 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10289 auto cb__userData = new Tcb__UserData(cb);
10290 Discord_Client_DeleteUserMessageCallback cb__native = [](auto result, void* userData__) {
10291 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10292 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10293 userData__typed->delegate(std::move(result__obj));
10294 };
10295 Discord_Client_DeleteUserMessage(
10296 &instance_, recipientId, messageId, cb__native, Tcb__UserData::Free, cb__userData);
10297}
10298void Client::EditUserMessage(uint64_t recipientId,
10299 uint64_t messageId,
10300 std::string const& content,
10302{
10303 assert(state_ == DiscordObjectState::Owned);
10304 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
10305 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10306 auto cb__userData = new Tcb__UserData(cb);
10307 Discord_Client_EditUserMessageCallback cb__native = [](auto result, void* userData__) {
10308 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10309 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10310 userData__typed->delegate(std::move(result__obj));
10311 };
10312 Discord_Client_EditUserMessage(&instance_,
10313 recipientId,
10314 messageId,
10315 content__str,
10316 cb__native,
10317 Tcb__UserData::Free,
10318 cb__userData);
10319}
10320std::optional<discordpp::ChannelHandle> Client::GetChannelHandle(uint64_t channelId) const
10321{
10322 assert(state_ == DiscordObjectState::Owned);
10323 bool returnIsNonNull__;
10324 Discord_ChannelHandle returnValueNative__;
10325 returnIsNonNull__ =
10326 Discord_Client_GetChannelHandle(&instance_, channelId, &returnValueNative__);
10327 if (!returnIsNonNull__) {
10328 return {};
10329 }
10330 discordpp::ChannelHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
10331 return returnValue__;
10332}
10333void Client::GetLobbyMessagesWithLimit(uint64_t lobbyId,
10334 int32_t limit,
10336{
10337 assert(state_ == DiscordObjectState::Owned);
10338 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10339 auto cb__userData = new Tcb__UserData(cb);
10340 Discord_Client_GetLobbyMessagesCallback cb__native =
10341 [](auto result, auto messages, void* userData__) {
10342 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10343 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10344 std::vector<discordpp::MessageHandle> messages__vec;
10345 messages__vec.reserve(messages.size);
10346 for (size_t i__ = 0; i__ < messages.size; ++i__) {
10347 messages__vec.emplace_back(messages.ptr[i__], DiscordObjectState::Owned);
10348 }
10349 Discord_Free(messages.ptr);
10350 userData__typed->delegate(std::move(result__obj), std::move(messages__vec));
10351 };
10352 Discord_Client_GetLobbyMessagesWithLimit(
10353 &instance_, lobbyId, limit, cb__native, Tcb__UserData::Free, cb__userData);
10354}
10355std::optional<discordpp::MessageHandle> Client::GetMessageHandle(uint64_t messageId) const
10356{
10357 assert(state_ == DiscordObjectState::Owned);
10358 bool returnIsNonNull__;
10359 Discord_MessageHandle returnValueNative__;
10360 returnIsNonNull__ =
10361 Discord_Client_GetMessageHandle(&instance_, messageId, &returnValueNative__);
10362 if (!returnIsNonNull__) {
10363 return {};
10364 }
10365 discordpp::MessageHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
10366 return returnValue__;
10367}
10368void Client::OpenMessageInDiscord(
10369 uint64_t messageId,
10370 discordpp::Client::ProvisionalUserMergeRequiredCallback provisionalUserMergeRequiredCallback,
10372{
10373 assert(state_ == DiscordObjectState::Owned);
10374 using TprovisionalUserMergeRequiredCallback__UserData =
10375 TDelegateUserData<std::remove_reference_t<decltype(provisionalUserMergeRequiredCallback)>>;
10376 auto provisionalUserMergeRequiredCallback__userData =
10377 new TprovisionalUserMergeRequiredCallback__UserData(provisionalUserMergeRequiredCallback);
10378 Discord_Client_ProvisionalUserMergeRequiredCallback
10379 provisionalUserMergeRequiredCallback__native = [](void* userData__) {
10380 auto userData__typed =
10381 static_cast<TprovisionalUserMergeRequiredCallback__UserData*>(userData__);
10382 userData__typed->delegate();
10383 };
10384 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10385 auto callback__userData = new Tcallback__UserData(callback);
10386 Discord_Client_OpenMessageInDiscordCallback callback__native = [](auto result,
10387 void* userData__) {
10388 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10389 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10390 userData__typed->delegate(std::move(result__obj));
10391 };
10392 Discord_Client_OpenMessageInDiscord(&instance_,
10393 messageId,
10394 provisionalUserMergeRequiredCallback__native,
10395 TprovisionalUserMergeRequiredCallback__UserData::Free,
10396 provisionalUserMergeRequiredCallback__userData,
10397 callback__native,
10398 Tcallback__UserData::Free,
10399 callback__userData);
10400}
10401void Client::SendLobbyMessage(uint64_t lobbyId,
10402 std::string const& content,
10404{
10405 assert(state_ == DiscordObjectState::Owned);
10406 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
10407 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10408 auto cb__userData = new Tcb__UserData(cb);
10409 Discord_Client_SendUserMessageCallback cb__native =
10410 [](auto result, auto messageId, void* userData__) {
10411 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10412 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10413 userData__typed->delegate(std::move(result__obj), messageId);
10414 };
10415 Discord_Client_SendLobbyMessage(
10416 &instance_, lobbyId, content__str, cb__native, Tcb__UserData::Free, cb__userData);
10417}
10418void Client::SendLobbyMessageWithMetadata(
10419 uint64_t lobbyId,
10420 std::string const& content,
10421 std::unordered_map<std::string, std::string> const& metadata,
10423{
10424 assert(state_ == DiscordObjectState::Owned);
10425 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
10426 ConvertedProperties metadata__convert(metadata);
10427 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10428 auto cb__userData = new Tcb__UserData(cb);
10429 Discord_Client_SendUserMessageCallback cb__native =
10430 [](auto result, auto messageId, void* userData__) {
10431 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10432 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10433 userData__typed->delegate(std::move(result__obj), messageId);
10434 };
10435 Discord_Client_SendLobbyMessageWithMetadata(&instance_,
10436 lobbyId,
10437 content__str,
10438 metadata__convert.Properties,
10439 cb__native,
10440 Tcb__UserData::Free,
10441 cb__userData);
10442}
10443void Client::SendUserMessage(uint64_t recipientId,
10444 std::string const& content,
10446{
10447 assert(state_ == DiscordObjectState::Owned);
10448 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
10449 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10450 auto cb__userData = new Tcb__UserData(cb);
10451 Discord_Client_SendUserMessageCallback cb__native =
10452 [](auto result, auto messageId, void* userData__) {
10453 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10454 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10455 userData__typed->delegate(std::move(result__obj), messageId);
10456 };
10457 Discord_Client_SendUserMessage(
10458 &instance_, recipientId, content__str, cb__native, Tcb__UserData::Free, cb__userData);
10459}
10460void Client::SendUserMessageWithMetadata(
10461 uint64_t recipientId,
10462 std::string const& content,
10463 std::unordered_map<std::string, std::string> const& metadata,
10465{
10466 assert(state_ == DiscordObjectState::Owned);
10467 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
10468 ConvertedProperties metadata__convert(metadata);
10469 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10470 auto cb__userData = new Tcb__UserData(cb);
10471 Discord_Client_SendUserMessageCallback cb__native =
10472 [](auto result, auto messageId, void* userData__) {
10473 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10474 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10475 userData__typed->delegate(std::move(result__obj), messageId);
10476 };
10477 Discord_Client_SendUserMessageWithMetadata(&instance_,
10478 recipientId,
10479 content__str,
10480 metadata__convert.Properties,
10481 cb__native,
10482 Tcb__UserData::Free,
10483 cb__userData);
10484}
10485void Client::SetMessageCreatedCallback(discordpp::Client::MessageCreatedCallback cb)
10486{
10487 assert(state_ == DiscordObjectState::Owned);
10488 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10489 auto cb__userData = new Tcb__UserData(cb);
10490 Discord_Client_MessageCreatedCallback cb__native = [](auto messageId, void* userData__) {
10491 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10492 userData__typed->delegate(messageId);
10493 };
10494 Discord_Client_SetMessageCreatedCallback(
10495 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10496}
10497void Client::SetMessageDeletedCallback(discordpp::Client::MessageDeletedCallback cb)
10498{
10499 assert(state_ == DiscordObjectState::Owned);
10500 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10501 auto cb__userData = new Tcb__UserData(cb);
10502 Discord_Client_MessageDeletedCallback cb__native =
10503 [](auto messageId, auto channelId, void* userData__) {
10504 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10505 userData__typed->delegate(messageId, channelId);
10506 };
10507 Discord_Client_SetMessageDeletedCallback(
10508 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10509}
10510void Client::SetMessageUpdatedCallback(discordpp::Client::MessageUpdatedCallback cb)
10511{
10512 assert(state_ == DiscordObjectState::Owned);
10513 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10514 auto cb__userData = new Tcb__UserData(cb);
10515 Discord_Client_MessageUpdatedCallback cb__native = [](auto messageId, void* userData__) {
10516 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10517 userData__typed->delegate(messageId);
10518 };
10519 Discord_Client_SetMessageUpdatedCallback(
10520 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10521}
10522void Client::SetShowingChat(bool showingChat)
10523{
10524 assert(state_ == DiscordObjectState::Owned);
10525 Discord_Client_SetShowingChat(&instance_, showingChat);
10526}
10527void Client::AddLogCallback(discordpp::Client::LogCallback callback,
10528 discordpp::LoggingSeverity minSeverity)
10529{
10530 assert(state_ == DiscordObjectState::Owned);
10531 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10532 auto callback__userData = new Tcallback__UserData(callback);
10533 Discord_Client_LogCallback callback__native = [](
10534 auto message, auto severity, void* userData__) {
10535 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10536 std::string message__str(reinterpret_cast<char*>(message.ptr), message.size);
10537 userData__typed->delegate(std::move(message__str),
10538 static_cast<discordpp::LoggingSeverity>(severity));
10539 Discord_Free(message.ptr);
10540 };
10541 Discord_Client_AddLogCallback(&instance_,
10542 callback__native,
10543 Tcallback__UserData::Free,
10544 callback__userData,
10545 static_cast<Discord_LoggingSeverity>(minSeverity));
10546}
10547void Client::AddVoiceLogCallback(discordpp::Client::LogCallback callback,
10548 discordpp::LoggingSeverity minSeverity)
10549{
10550 assert(state_ == DiscordObjectState::Owned);
10551 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10552 auto callback__userData = new Tcallback__UserData(callback);
10553 Discord_Client_LogCallback callback__native = [](
10554 auto message, auto severity, void* userData__) {
10555 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10556 std::string message__str(reinterpret_cast<char*>(message.ptr), message.size);
10557 userData__typed->delegate(std::move(message__str),
10558 static_cast<discordpp::LoggingSeverity>(severity));
10559 Discord_Free(message.ptr);
10560 };
10561 Discord_Client_AddVoiceLogCallback(&instance_,
10562 callback__native,
10563 Tcallback__UserData::Free,
10564 callback__userData,
10565 static_cast<Discord_LoggingSeverity>(minSeverity));
10566}
10567void Client::Connect()
10568{
10569 assert(state_ == DiscordObjectState::Owned);
10570 Discord_Client_Connect(&instance_);
10571}
10572void Client::Disconnect()
10573{
10574 assert(state_ == DiscordObjectState::Owned);
10575 Discord_Client_Disconnect(&instance_);
10576}
10577discordpp::Client::Status Client::GetStatus() const
10578{
10579 assert(state_ == DiscordObjectState::Owned);
10580 Discord_Client_Status returnValue__;
10581 returnValue__ = Discord_Client_GetStatus(&instance_);
10582 return static_cast<discordpp::Client::Status>(returnValue__);
10583}
10584void Client::OpenConnectedGamesSettingsInDiscord(
10586{
10587 assert(state_ == DiscordObjectState::Owned);
10588 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10589 auto callback__userData = new Tcallback__UserData(callback);
10590 Discord_Client_OpenConnectedGamesSettingsInDiscordCallback callback__native =
10591 [](auto result, void* userData__) {
10592 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10593 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10594 userData__typed->delegate(std::move(result__obj));
10595 };
10596 Discord_Client_OpenConnectedGamesSettingsInDiscord(
10597 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
10598}
10599void Client::SetApplicationId(uint64_t applicationId)
10600{
10601 assert(state_ == DiscordObjectState::Owned);
10602 Discord_Client_SetApplicationId(&instance_, applicationId);
10603}
10604bool Client::SetLogDir(std::string const& path, discordpp::LoggingSeverity minSeverity)
10605{
10606 assert(state_ == DiscordObjectState::Owned);
10607 bool returnValue__;
10608 Discord_String path__str{(uint8_t*)(path.data()), path.size()};
10609 returnValue__ = Discord_Client_SetLogDir(
10610 &instance_, path__str, static_cast<Discord_LoggingSeverity>(minSeverity));
10611 return returnValue__;
10612}
10613void Client::SetStatusChangedCallback(discordpp::Client::OnStatusChanged cb)
10614{
10615 assert(state_ == DiscordObjectState::Owned);
10616 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10617 auto cb__userData = new Tcb__UserData(cb);
10618 Discord_Client_OnStatusChanged cb__native =
10619 [](auto status, auto error, auto errorDetail, void* userData__) {
10620 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10621 userData__typed->delegate(static_cast<discordpp::Client::Status>(status),
10622 static_cast<discordpp::Client::Error>(error),
10623 errorDetail);
10624 };
10625 Discord_Client_SetStatusChangedCallback(
10626 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10627}
10628void Client::SetVoiceLogDir(std::string const& path, discordpp::LoggingSeverity minSeverity)
10629{
10630 assert(state_ == DiscordObjectState::Owned);
10631 Discord_String path__str{(uint8_t*)(path.data()), path.size()};
10632 Discord_Client_SetVoiceLogDir(
10633 &instance_, path__str, static_cast<Discord_LoggingSeverity>(minSeverity));
10634}
10635void Client::CreateOrJoinLobby(std::string const& secret,
10637{
10638 assert(state_ == DiscordObjectState::Owned);
10639 Discord_String secret__str{(uint8_t*)(secret.data()), secret.size()};
10640 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10641 auto callback__userData = new Tcallback__UserData(callback);
10642 Discord_Client_CreateOrJoinLobbyCallback callback__native =
10643 [](auto result, auto lobbyId, void* userData__) {
10644 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10645 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10646 userData__typed->delegate(std::move(result__obj), lobbyId);
10647 };
10648 Discord_Client_CreateOrJoinLobby(
10649 &instance_, secret__str, callback__native, Tcallback__UserData::Free, callback__userData);
10650}
10651void Client::CreateOrJoinLobbyWithMetadata(
10652 std::string const& secret,
10653 std::unordered_map<std::string, std::string> const& lobbyMetadata,
10654 std::unordered_map<std::string, std::string> const& memberMetadata,
10656{
10657 assert(state_ == DiscordObjectState::Owned);
10658 Discord_String secret__str{(uint8_t*)(secret.data()), secret.size()};
10659 ConvertedProperties lobbyMetadata__convert(lobbyMetadata);
10660 ConvertedProperties memberMetadata__convert(memberMetadata);
10661 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10662 auto callback__userData = new Tcallback__UserData(callback);
10663 Discord_Client_CreateOrJoinLobbyCallback callback__native =
10664 [](auto result, auto lobbyId, void* userData__) {
10665 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10666 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10667 userData__typed->delegate(std::move(result__obj), lobbyId);
10668 };
10669 Discord_Client_CreateOrJoinLobbyWithMetadata(&instance_,
10670 secret__str,
10671 lobbyMetadata__convert.Properties,
10672 memberMetadata__convert.Properties,
10673 callback__native,
10674 Tcallback__UserData::Free,
10675 callback__userData);
10676}
10677void Client::GetGuildChannels(uint64_t guildId, discordpp::Client::GetGuildChannelsCallback cb)
10678{
10679 assert(state_ == DiscordObjectState::Owned);
10680 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10681 auto cb__userData = new Tcb__UserData(cb);
10682 Discord_Client_GetGuildChannelsCallback cb__native =
10683 [](auto result, auto guildChannels, void* userData__) {
10684 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10685 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10686 std::vector<discordpp::GuildChannel> guildChannels__vec;
10687 guildChannels__vec.reserve(guildChannels.size);
10688 for (size_t i__ = 0; i__ < guildChannels.size; ++i__) {
10689 guildChannels__vec.emplace_back(guildChannels.ptr[i__], DiscordObjectState::Owned);
10690 }
10691 Discord_Free(guildChannels.ptr);
10692 userData__typed->delegate(std::move(result__obj), std::move(guildChannels__vec));
10693 };
10694 Discord_Client_GetGuildChannels(
10695 &instance_, guildId, cb__native, Tcb__UserData::Free, cb__userData);
10696}
10697std::optional<discordpp::LobbyHandle> Client::GetLobbyHandle(uint64_t lobbyId) const
10698{
10699 assert(state_ == DiscordObjectState::Owned);
10700 bool returnIsNonNull__;
10701 Discord_LobbyHandle returnValueNative__;
10702 returnIsNonNull__ = Discord_Client_GetLobbyHandle(&instance_, lobbyId, &returnValueNative__);
10703 if (!returnIsNonNull__) {
10704 return {};
10705 }
10706 discordpp::LobbyHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
10707 return returnValue__;
10708}
10709std::vector<uint64_t> Client::GetLobbyIds() const
10710{
10711 assert(state_ == DiscordObjectState::Owned);
10712 Discord_UInt64Span returnValueNative__;
10713 Discord_Client_GetLobbyIds(&instance_, &returnValueNative__);
10714 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
10715 returnValueNative__.ptr + returnValueNative__.size);
10716 Discord_Free(returnValueNative__.ptr);
10717 return returnValue__;
10718}
10719void Client::GetUserGuilds(discordpp::Client::GetUserGuildsCallback cb)
10720{
10721 assert(state_ == DiscordObjectState::Owned);
10722 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10723 auto cb__userData = new Tcb__UserData(cb);
10724 Discord_Client_GetUserGuildsCallback cb__native =
10725 [](auto result, auto guilds, void* userData__) {
10726 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10727 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10728 std::vector<discordpp::GuildMinimal> guilds__vec;
10729 guilds__vec.reserve(guilds.size);
10730 for (size_t i__ = 0; i__ < guilds.size; ++i__) {
10731 guilds__vec.emplace_back(guilds.ptr[i__], DiscordObjectState::Owned);
10732 }
10733 Discord_Free(guilds.ptr);
10734 userData__typed->delegate(std::move(result__obj), std::move(guilds__vec));
10735 };
10736 Discord_Client_GetUserGuilds(&instance_, cb__native, Tcb__UserData::Free, cb__userData);
10737}
10738void Client::LeaveLobby(uint64_t lobbyId, discordpp::Client::LeaveLobbyCallback callback)
10739{
10740 assert(state_ == DiscordObjectState::Owned);
10741 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10742 auto callback__userData = new Tcallback__UserData(callback);
10743 Discord_Client_LeaveLobbyCallback callback__native = [](auto result, void* userData__) {
10744 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10745 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10746 userData__typed->delegate(std::move(result__obj));
10747 };
10748 Discord_Client_LeaveLobby(
10749 &instance_, lobbyId, callback__native, Tcallback__UserData::Free, callback__userData);
10750}
10751void Client::LinkChannelToLobby(uint64_t lobbyId,
10752 uint64_t channelId,
10754{
10755 assert(state_ == DiscordObjectState::Owned);
10756 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10757 auto callback__userData = new Tcallback__UserData(callback);
10758 Discord_Client_LinkOrUnlinkChannelCallback callback__native = [](auto result,
10759 void* userData__) {
10760 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10761 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10762 userData__typed->delegate(std::move(result__obj));
10763 };
10764 Discord_Client_LinkChannelToLobby(&instance_,
10765 lobbyId,
10766 channelId,
10767 callback__native,
10768 Tcallback__UserData::Free,
10769 callback__userData);
10770}
10771void Client::SetLobbyCreatedCallback(discordpp::Client::LobbyCreatedCallback cb)
10772{
10773 assert(state_ == DiscordObjectState::Owned);
10774 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10775 auto cb__userData = new Tcb__UserData(cb);
10776 Discord_Client_LobbyCreatedCallback cb__native = [](auto lobbyId, void* userData__) {
10777 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10778 userData__typed->delegate(lobbyId);
10779 };
10780 Discord_Client_SetLobbyCreatedCallback(
10781 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10782}
10783void Client::SetLobbyDeletedCallback(discordpp::Client::LobbyDeletedCallback cb)
10784{
10785 assert(state_ == DiscordObjectState::Owned);
10786 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10787 auto cb__userData = new Tcb__UserData(cb);
10788 Discord_Client_LobbyDeletedCallback cb__native = [](auto lobbyId, void* userData__) {
10789 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10790 userData__typed->delegate(lobbyId);
10791 };
10792 Discord_Client_SetLobbyDeletedCallback(
10793 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10794}
10795void Client::SetLobbyMemberAddedCallback(discordpp::Client::LobbyMemberAddedCallback cb)
10796{
10797 assert(state_ == DiscordObjectState::Owned);
10798 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10799 auto cb__userData = new Tcb__UserData(cb);
10800 Discord_Client_LobbyMemberAddedCallback cb__native =
10801 [](auto lobbyId, auto memberId, void* userData__) {
10802 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10803 userData__typed->delegate(lobbyId, memberId);
10804 };
10805 Discord_Client_SetLobbyMemberAddedCallback(
10806 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10807}
10808void Client::SetLobbyMemberRemovedCallback(discordpp::Client::LobbyMemberRemovedCallback cb)
10809{
10810 assert(state_ == DiscordObjectState::Owned);
10811 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10812 auto cb__userData = new Tcb__UserData(cb);
10813 Discord_Client_LobbyMemberRemovedCallback cb__native =
10814 [](auto lobbyId, auto memberId, void* userData__) {
10815 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10816 userData__typed->delegate(lobbyId, memberId);
10817 };
10818 Discord_Client_SetLobbyMemberRemovedCallback(
10819 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10820}
10821void Client::SetLobbyMemberUpdatedCallback(discordpp::Client::LobbyMemberUpdatedCallback cb)
10822{
10823 assert(state_ == DiscordObjectState::Owned);
10824 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10825 auto cb__userData = new Tcb__UserData(cb);
10826 Discord_Client_LobbyMemberUpdatedCallback cb__native =
10827 [](auto lobbyId, auto memberId, void* userData__) {
10828 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10829 userData__typed->delegate(lobbyId, memberId);
10830 };
10831 Discord_Client_SetLobbyMemberUpdatedCallback(
10832 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10833}
10834void Client::SetLobbyUpdatedCallback(discordpp::Client::LobbyUpdatedCallback cb)
10835{
10836 assert(state_ == DiscordObjectState::Owned);
10837 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10838 auto cb__userData = new Tcb__UserData(cb);
10839 Discord_Client_LobbyUpdatedCallback cb__native = [](auto lobbyId, void* userData__) {
10840 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10841 userData__typed->delegate(lobbyId);
10842 };
10843 Discord_Client_SetLobbyUpdatedCallback(
10844 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10845}
10846void Client::UnlinkChannelFromLobby(uint64_t lobbyId,
10848{
10849 assert(state_ == DiscordObjectState::Owned);
10850 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10851 auto callback__userData = new Tcallback__UserData(callback);
10852 Discord_Client_LinkOrUnlinkChannelCallback callback__native = [](auto result,
10853 void* userData__) {
10854 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10855 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10856 userData__typed->delegate(std::move(result__obj));
10857 };
10858 Discord_Client_UnlinkChannelFromLobby(
10859 &instance_, lobbyId, callback__native, Tcallback__UserData::Free, callback__userData);
10860}
10861void Client::AcceptActivityInvite(discordpp::ActivityInvite invite,
10863{
10864 assert(state_ == DiscordObjectState::Owned);
10865 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10866 auto cb__userData = new Tcb__UserData(cb);
10867 Discord_Client_AcceptActivityInviteCallback cb__native =
10868 [](auto result, auto joinSecret, void* userData__) {
10869 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10870 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10871 std::string joinSecret__str(reinterpret_cast<char*>(joinSecret.ptr), joinSecret.size);
10872 userData__typed->delegate(std::move(result__obj), std::move(joinSecret__str));
10873 Discord_Free(joinSecret.ptr);
10874 };
10875 Discord_Client_AcceptActivityInvite(
10876 &instance_, invite.instance(), cb__native, Tcb__UserData::Free, cb__userData);
10877}
10878void Client::ClearRichPresence()
10879{
10880 assert(state_ == DiscordObjectState::Owned);
10881 Discord_Client_ClearRichPresence(&instance_);
10882}
10883bool Client::RegisterLaunchCommand(uint64_t applicationId, std::string command)
10884{
10885 assert(state_ == DiscordObjectState::Owned);
10886 bool returnValue__;
10887 Discord_String command__str{(uint8_t*)(command.data()), command.size()};
10888 returnValue__ = Discord_Client_RegisterLaunchCommand(&instance_, applicationId, command__str);
10889 return returnValue__;
10890}
10891bool Client::RegisterLaunchSteamApplication(uint64_t applicationId, uint32_t steamAppId)
10892{
10893 assert(state_ == DiscordObjectState::Owned);
10894 bool returnValue__;
10895 returnValue__ =
10896 Discord_Client_RegisterLaunchSteamApplication(&instance_, applicationId, steamAppId);
10897 return returnValue__;
10898}
10899void Client::SendActivityInvite(uint64_t userId,
10900 std::string const& content,
10902{
10903 assert(state_ == DiscordObjectState::Owned);
10904 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
10905 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10906 auto cb__userData = new Tcb__UserData(cb);
10907 Discord_Client_SendActivityInviteCallback cb__native = [](auto result, void* userData__) {
10908 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10909 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10910 userData__typed->delegate(std::move(result__obj));
10911 };
10912 Discord_Client_SendActivityInvite(
10913 &instance_, userId, content__str, cb__native, Tcb__UserData::Free, cb__userData);
10914}
10915void Client::SendActivityJoinRequest(uint64_t userId,
10917{
10918 assert(state_ == DiscordObjectState::Owned);
10919 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10920 auto cb__userData = new Tcb__UserData(cb);
10921 Discord_Client_SendActivityInviteCallback cb__native = [](auto result, void* userData__) {
10922 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10923 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10924 userData__typed->delegate(std::move(result__obj));
10925 };
10926 Discord_Client_SendActivityJoinRequest(
10927 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
10928}
10929void Client::SendActivityJoinRequestReply(discordpp::ActivityInvite invite,
10931{
10932 assert(state_ == DiscordObjectState::Owned);
10933 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10934 auto cb__userData = new Tcb__UserData(cb);
10935 Discord_Client_SendActivityInviteCallback cb__native = [](auto result, void* userData__) {
10936 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10937 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10938 userData__typed->delegate(std::move(result__obj));
10939 };
10940 Discord_Client_SendActivityJoinRequestReply(
10941 &instance_, invite.instance(), cb__native, Tcb__UserData::Free, cb__userData);
10942}
10943void Client::SetActivityInviteCreatedCallback(discordpp::Client::ActivityInviteCallback cb)
10944{
10945 assert(state_ == DiscordObjectState::Owned);
10946 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10947 auto cb__userData = new Tcb__UserData(cb);
10948 Discord_Client_ActivityInviteCallback cb__native = [](auto invite, void* userData__) {
10949 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10950 discordpp::ActivityInvite invite__obj(*invite, DiscordObjectState::Owned);
10951 userData__typed->delegate(std::move(invite__obj));
10952 };
10953 Discord_Client_SetActivityInviteCreatedCallback(
10954 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10955}
10956void Client::SetActivityInviteUpdatedCallback(discordpp::Client::ActivityInviteCallback cb)
10957{
10958 assert(state_ == DiscordObjectState::Owned);
10959 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10960 auto cb__userData = new Tcb__UserData(cb);
10961 Discord_Client_ActivityInviteCallback cb__native = [](auto invite, void* userData__) {
10962 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10963 discordpp::ActivityInvite invite__obj(*invite, DiscordObjectState::Owned);
10964 userData__typed->delegate(std::move(invite__obj));
10965 };
10966 Discord_Client_SetActivityInviteUpdatedCallback(
10967 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10968}
10969void Client::SetActivityJoinCallback(discordpp::Client::ActivityJoinCallback cb)
10970{
10971 assert(state_ == DiscordObjectState::Owned);
10972 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10973 auto cb__userData = new Tcb__UserData(cb);
10974 Discord_Client_ActivityJoinCallback cb__native = [](auto joinSecret, void* userData__) {
10975 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10976 std::string joinSecret__str(reinterpret_cast<char*>(joinSecret.ptr), joinSecret.size);
10977 userData__typed->delegate(std::move(joinSecret__str));
10978 Discord_Free(joinSecret.ptr);
10979 };
10980 Discord_Client_SetActivityJoinCallback(
10981 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10982}
10983void Client::SetOnlineStatus(discordpp::StatusType status,
10985{
10986 assert(state_ == DiscordObjectState::Owned);
10987 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10988 auto callback__userData = new Tcallback__UserData(callback);
10989 Discord_Client_UpdateStatusCallback callback__native = [](auto result, void* userData__) {
10990 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10991 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10992 userData__typed->delegate(std::move(result__obj));
10993 };
10994 Discord_Client_SetOnlineStatus(&instance_,
10995 static_cast<Discord_StatusType>(status),
10996 callback__native,
10997 Tcallback__UserData::Free,
10998 callback__userData);
10999}
11000void Client::UpdateRichPresence(discordpp::Activity activity,
11002{
11003 assert(state_ == DiscordObjectState::Owned);
11004 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11005 auto cb__userData = new Tcb__UserData(cb);
11006 Discord_Client_UpdateRichPresenceCallback cb__native = [](auto result, void* userData__) {
11007 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11008 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11009 userData__typed->delegate(std::move(result__obj));
11010 };
11011 Discord_Client_UpdateRichPresence(
11012 &instance_, activity.instance(), cb__native, Tcb__UserData::Free, cb__userData);
11013}
11014void Client::AcceptDiscordFriendRequest(uint64_t userId,
11016{
11017 assert(state_ == DiscordObjectState::Owned);
11018 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11019 auto cb__userData = new Tcb__UserData(cb);
11020 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11021 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11022 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11023 userData__typed->delegate(std::move(result__obj));
11024 };
11025 Discord_Client_AcceptDiscordFriendRequest(
11026 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11027}
11028void Client::AcceptGameFriendRequest(uint64_t userId,
11030{
11031 assert(state_ == DiscordObjectState::Owned);
11032 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11033 auto cb__userData = new Tcb__UserData(cb);
11034 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11035 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11036 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11037 userData__typed->delegate(std::move(result__obj));
11038 };
11039 Discord_Client_AcceptGameFriendRequest(
11040 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11041}
11042void Client::BlockUser(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
11043{
11044 assert(state_ == DiscordObjectState::Owned);
11045 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11046 auto cb__userData = new Tcb__UserData(cb);
11047 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11048 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11049 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11050 userData__typed->delegate(std::move(result__obj));
11051 };
11052 Discord_Client_BlockUser(&instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11053}
11054void Client::CancelDiscordFriendRequest(uint64_t userId,
11056{
11057 assert(state_ == DiscordObjectState::Owned);
11058 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11059 auto cb__userData = new Tcb__UserData(cb);
11060 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11061 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11062 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11063 userData__typed->delegate(std::move(result__obj));
11064 };
11065 Discord_Client_CancelDiscordFriendRequest(
11066 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11067}
11068void Client::CancelGameFriendRequest(uint64_t userId,
11070{
11071 assert(state_ == DiscordObjectState::Owned);
11072 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11073 auto cb__userData = new Tcb__UserData(cb);
11074 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11075 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11076 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11077 userData__typed->delegate(std::move(result__obj));
11078 };
11079 Discord_Client_CancelGameFriendRequest(
11080 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11081}
11082discordpp::RelationshipHandle Client::GetRelationshipHandle(uint64_t userId) const
11083{
11084 assert(state_ == DiscordObjectState::Owned);
11085 Discord_RelationshipHandle returnValueNative__{};
11086 Discord_Client_GetRelationshipHandle(&instance_, userId, &returnValueNative__);
11087 discordpp::RelationshipHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
11088 return returnValue__;
11089}
11090std::vector<discordpp::RelationshipHandle> Client::GetRelationships() const
11091{
11092 assert(state_ == DiscordObjectState::Owned);
11093 Discord_RelationshipHandleSpan returnValueNative__;
11094 Discord_Client_GetRelationships(&instance_, &returnValueNative__);
11095 std::vector<discordpp::RelationshipHandle> returnValue__;
11096 returnValue__.reserve(returnValueNative__.size);
11097 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
11098 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
11099 }
11100 Discord_Free(returnValueNative__.ptr);
11101 return returnValue__;
11102}
11103std::vector<discordpp::RelationshipHandle> Client::GetRelationshipsByGroup(
11104 discordpp::RelationshipGroupType groupType) const
11105{
11106 assert(state_ == DiscordObjectState::Owned);
11107 Discord_RelationshipHandleSpan returnValueNative__;
11108 Discord_Client_GetRelationshipsByGroup(
11109 &instance_, static_cast<Discord_RelationshipGroupType>(groupType), &returnValueNative__);
11110 std::vector<discordpp::RelationshipHandle> returnValue__;
11111 returnValue__.reserve(returnValueNative__.size);
11112 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
11113 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
11114 }
11115 Discord_Free(returnValueNative__.ptr);
11116 return returnValue__;
11117}
11118void Client::RejectDiscordFriendRequest(uint64_t userId,
11120{
11121 assert(state_ == DiscordObjectState::Owned);
11122 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11123 auto cb__userData = new Tcb__UserData(cb);
11124 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11125 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11126 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11127 userData__typed->delegate(std::move(result__obj));
11128 };
11129 Discord_Client_RejectDiscordFriendRequest(
11130 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11131}
11132void Client::RejectGameFriendRequest(uint64_t userId,
11134{
11135 assert(state_ == DiscordObjectState::Owned);
11136 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11137 auto cb__userData = new Tcb__UserData(cb);
11138 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11139 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11140 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11141 userData__typed->delegate(std::move(result__obj));
11142 };
11143 Discord_Client_RejectGameFriendRequest(
11144 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11145}
11146void Client::RemoveDiscordAndGameFriend(uint64_t userId,
11148{
11149 assert(state_ == DiscordObjectState::Owned);
11150 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11151 auto cb__userData = new Tcb__UserData(cb);
11152 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11153 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11154 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11155 userData__typed->delegate(std::move(result__obj));
11156 };
11157 Discord_Client_RemoveDiscordAndGameFriend(
11158 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11159}
11160void Client::RemoveGameFriend(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
11161{
11162 assert(state_ == DiscordObjectState::Owned);
11163 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11164 auto cb__userData = new Tcb__UserData(cb);
11165 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11166 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11167 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11168 userData__typed->delegate(std::move(result__obj));
11169 };
11170 Discord_Client_RemoveGameFriend(
11171 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11172}
11173std::vector<discordpp::UserHandle> Client::SearchFriendsByUsername(std::string searchStr) const
11174{
11175 assert(state_ == DiscordObjectState::Owned);
11176 Discord_UserHandleSpan returnValueNative__;
11177 Discord_String searchStr__str{(uint8_t*)(searchStr.data()), searchStr.size()};
11178 Discord_Client_SearchFriendsByUsername(&instance_, searchStr__str, &returnValueNative__);
11179 std::vector<discordpp::UserHandle> returnValue__;
11180 returnValue__.reserve(returnValueNative__.size);
11181 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
11182 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
11183 }
11184 Discord_Free(returnValueNative__.ptr);
11185 return returnValue__;
11186}
11187void Client::SendDiscordFriendRequest(std::string const& username,
11189{
11190 assert(state_ == DiscordObjectState::Owned);
11191 Discord_String username__str{(uint8_t*)(username.data()), username.size()};
11192 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11193 auto cb__userData = new Tcb__UserData(cb);
11194 Discord_Client_SendFriendRequestCallback cb__native = [](auto result, void* userData__) {
11195 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11196 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11197 userData__typed->delegate(std::move(result__obj));
11198 };
11199 Discord_Client_SendDiscordFriendRequest(
11200 &instance_, username__str, cb__native, Tcb__UserData::Free, cb__userData);
11201}
11202void Client::SendDiscordFriendRequestById(uint64_t userId,
11204{
11205 assert(state_ == DiscordObjectState::Owned);
11206 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11207 auto cb__userData = new Tcb__UserData(cb);
11208 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11209 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11210 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11211 userData__typed->delegate(std::move(result__obj));
11212 };
11213 Discord_Client_SendDiscordFriendRequestById(
11214 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11215}
11216void Client::SendGameFriendRequest(std::string const& username,
11218{
11219 assert(state_ == DiscordObjectState::Owned);
11220 Discord_String username__str{(uint8_t*)(username.data()), username.size()};
11221 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11222 auto cb__userData = new Tcb__UserData(cb);
11223 Discord_Client_SendFriendRequestCallback cb__native = [](auto result, void* userData__) {
11224 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11225 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11226 userData__typed->delegate(std::move(result__obj));
11227 };
11228 Discord_Client_SendGameFriendRequest(
11229 &instance_, username__str, cb__native, Tcb__UserData::Free, cb__userData);
11230}
11231void Client::SendGameFriendRequestById(uint64_t userId,
11233{
11234 assert(state_ == DiscordObjectState::Owned);
11235 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11236 auto cb__userData = new Tcb__UserData(cb);
11237 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11238 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11239 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11240 userData__typed->delegate(std::move(result__obj));
11241 };
11242 Discord_Client_SendGameFriendRequestById(
11243 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11244}
11245void Client::SetRelationshipCreatedCallback(discordpp::Client::RelationshipCreatedCallback cb)
11246{
11247 assert(state_ == DiscordObjectState::Owned);
11248 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11249 auto cb__userData = new Tcb__UserData(cb);
11250 Discord_Client_RelationshipCreatedCallback cb__native =
11251 [](auto userId, auto isDiscordRelationshipUpdate, void* userData__) {
11252 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11253 userData__typed->delegate(userId, isDiscordRelationshipUpdate);
11254 };
11255 Discord_Client_SetRelationshipCreatedCallback(
11256 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11257}
11258void Client::SetRelationshipDeletedCallback(discordpp::Client::RelationshipDeletedCallback cb)
11259{
11260 assert(state_ == DiscordObjectState::Owned);
11261 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11262 auto cb__userData = new Tcb__UserData(cb);
11263 Discord_Client_RelationshipDeletedCallback cb__native =
11264 [](auto userId, auto isDiscordRelationshipUpdate, void* userData__) {
11265 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11266 userData__typed->delegate(userId, isDiscordRelationshipUpdate);
11267 };
11268 Discord_Client_SetRelationshipDeletedCallback(
11269 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11270}
11271void Client::UnblockUser(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
11272{
11273 assert(state_ == DiscordObjectState::Owned);
11274 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11275 auto cb__userData = new Tcb__UserData(cb);
11276 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11277 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11278 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11279 userData__typed->delegate(std::move(result__obj));
11280 };
11281 Discord_Client_UnblockUser(&instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11282}
11283discordpp::UserHandle Client::GetCurrentUser() const
11284{
11285 assert(state_ == DiscordObjectState::Owned);
11286 Discord_UserHandle returnValueNative__{};
11287 Discord_Client_GetCurrentUser(&instance_, &returnValueNative__);
11288 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
11289 return returnValue__;
11290}
11291void Client::GetDiscordClientConnectedUser(
11292 uint64_t applicationId,
11294{
11295 assert(state_ == DiscordObjectState::Owned);
11296 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
11297 auto callback__userData = new Tcallback__UserData(callback);
11298 Discord_Client_GetDiscordClientConnectedUserCallback callback__native =
11299 [](auto result, auto user, void* userData__) {
11300 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
11301 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11302 std::optional<discordpp::UserHandle> user__opt{};
11303 if (user) {
11304 user__opt = discordpp::UserHandle(*user, DiscordObjectState::Owned);
11305 }
11306 userData__typed->delegate(std::move(result__obj), std::move(user__opt));
11307 };
11308 Discord_Client_GetDiscordClientConnectedUser(
11309 &instance_, applicationId, callback__native, Tcallback__UserData::Free, callback__userData);
11310}
11311std::optional<discordpp::UserHandle> Client::GetUser(uint64_t userId) const
11312{
11313 assert(state_ == DiscordObjectState::Owned);
11314 bool returnIsNonNull__;
11315 Discord_UserHandle returnValueNative__;
11316 returnIsNonNull__ = Discord_Client_GetUser(&instance_, userId, &returnValueNative__);
11317 if (!returnIsNonNull__) {
11318 return {};
11319 }
11320 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
11321 return returnValue__;
11322}
11323void Client::SetRelationshipGroupsUpdatedCallback(
11325{
11326 assert(state_ == DiscordObjectState::Owned);
11327 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11328 auto cb__userData = new Tcb__UserData(cb);
11329 Discord_Client_RelationshipGroupsUpdatedCallback cb__native = [](auto userId,
11330 void* userData__) {
11331 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11332 userData__typed->delegate(userId);
11333 };
11334 Discord_Client_SetRelationshipGroupsUpdatedCallback(
11335 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11336}
11337void Client::SetUserUpdatedCallback(discordpp::Client::UserUpdatedCallback cb)
11338{
11339 assert(state_ == DiscordObjectState::Owned);
11340 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11341 auto cb__userData = new Tcb__UserData(cb);
11342 Discord_Client_UserUpdatedCallback cb__native = [](auto userId, void* userData__) {
11343 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11344 userData__typed->delegate(userId);
11345 };
11346 Discord_Client_SetUserUpdatedCallback(
11347 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11348}
11349const CallInfoHandle CallInfoHandle::nullobj{{}, DiscordObjectState::Invalid};
11350CallInfoHandle::~CallInfoHandle()
11351{
11352 if (state_ == DiscordObjectState::Owned) {
11353 Drop();
11354 state_ = DiscordObjectState::Invalid;
11355 }
11356}
11357CallInfoHandle::CallInfoHandle(CallInfoHandle&& other) noexcept
11358 : instance_(other.instance_)
11359 , state_(other.state_)
11360{
11361 other.state_ = DiscordObjectState::Invalid;
11362}
11363CallInfoHandle& CallInfoHandle::operator=(CallInfoHandle&& other) noexcept
11364{
11365 if (this != &other) {
11366 if (state_ == DiscordObjectState::Owned) {
11367 Drop();
11368 }
11369 instance_ = other.instance_;
11370 state_ = other.state_;
11371 other.state_ = DiscordObjectState::Invalid;
11372 }
11373 return *this;
11374}
11375CallInfoHandle::CallInfoHandle(const CallInfoHandle& other)
11376 : instance_{}
11377 , state_(DiscordObjectState::Invalid)
11378{
11379 if (other.state_ == DiscordObjectState::Owned) {
11380 Discord_CallInfoHandle_Clone(&instance_, other.instance());
11381
11382 state_ = DiscordObjectState::Owned;
11383 }
11384}
11385CallInfoHandle& CallInfoHandle::operator=(const CallInfoHandle& other)
11386{
11387 if (this != &other) {
11388 if (state_ == DiscordObjectState::Owned) {
11389 Drop();
11390 state_ = DiscordObjectState::Invalid;
11391 }
11392 if (other.state_ == DiscordObjectState::Owned) {
11393 Discord_CallInfoHandle_Clone(&instance_, other.instance());
11394
11395 state_ = DiscordObjectState::Owned;
11396 }
11397 }
11398 return *this;
11399}
11400CallInfoHandle::CallInfoHandle(Discord_CallInfoHandle instance, DiscordObjectState state)
11401 : instance_(instance)
11402 , state_(state)
11403{
11404}
11405void CallInfoHandle::Drop()
11406{
11407 if (state_ != DiscordObjectState::Owned) {
11408 return;
11409 }
11410 Discord_CallInfoHandle_Drop(&instance_);
11411 state_ = DiscordObjectState::Invalid;
11412}
11413uint64_t CallInfoHandle::ChannelId() const
11414{
11415 assert(state_ == DiscordObjectState::Owned);
11416 uint64_t returnValue__;
11417 returnValue__ = Discord_CallInfoHandle_ChannelId(&instance_);
11418 return returnValue__;
11419}
11420std::vector<uint64_t> CallInfoHandle::GetParticipants() const
11421{
11422 assert(state_ == DiscordObjectState::Owned);
11423 Discord_UInt64Span returnValueNative__;
11424 Discord_CallInfoHandle_GetParticipants(&instance_, &returnValueNative__);
11425 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
11426 returnValueNative__.ptr + returnValueNative__.size);
11427 Discord_Free(returnValueNative__.ptr);
11428 return returnValue__;
11429}
11430std::optional<discordpp::VoiceStateHandle> CallInfoHandle::GetVoiceStateHandle(
11431 uint64_t userId) const
11432{
11433 assert(state_ == DiscordObjectState::Owned);
11434 bool returnIsNonNull__;
11435 Discord_VoiceStateHandle returnValueNative__;
11436 returnIsNonNull__ =
11437 Discord_CallInfoHandle_GetVoiceStateHandle(&instance_, userId, &returnValueNative__);
11438 if (!returnIsNonNull__) {
11439 return {};
11440 }
11441 discordpp::VoiceStateHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
11442 return returnValue__;
11443}
11444uint64_t CallInfoHandle::GuildId() const
11445{
11446 assert(state_ == DiscordObjectState::Owned);
11447 uint64_t returnValue__;
11448 returnValue__ = Discord_CallInfoHandle_GuildId(&instance_);
11449 return returnValue__;
11450}
11451} // namespace discordpp
11452
11453#endif // DISCORDPP_IMPLEMENTATION
Struct which controls what your rich presence looks like in the Discord client. If you don't specify ...
Definition discordpp.h:762
void SetLargeImage(std::optional< std::string > LargeImage)
Setter for ActivityAssets::LargeImage.
std::optional< std::string > SmallText() const
A tooltip string that is shown when the user hovers over the small image.
void SetLargeText(std::optional< std::string > LargeText)
Setter for ActivityAssets::LargeText.
ActivityAssets(ActivityAssets &&other) noexcept
Move constructor for ActivityAssets.
std::optional< std::string > SmallImage() const
The secondary image, rendered as a small circle over the largeImage.
ActivityAssets(const ActivityAssets &arg0)
Copy constructor for ActivityAssets.
std::optional< std::string > LargeText() const
A tooltip string that is shown when the user hovers over the large image.
void SetSmallImage(std::optional< std::string > SmallImage)
Setter for ActivityAssets::SmallImage.
ActivityAssets & operator=(const ActivityAssets &arg0)
Copy assignment operator for ActivityAssets.
static const ActivityAssets nullobj
Uninitialized instance of ActivityAssets.
Definition discordpp.h:781
std::optional< std::string > LargeImage() const
The primary image identifier or URL, rendered as a large square icon on a user's rich presence.
void SetSmallText(std::optional< std::string > SmallText)
Setter for ActivityAssets::SmallText.
ActivityAssets & operator=(ActivityAssets &&other) noexcept
Move assignment operator for ActivityAssets.
Definition discordpp.h:987
ActivityButton(ActivityButton &&other) noexcept
Move constructor for ActivityButton.
static const ActivityButton nullobj
Uninitialized instance of ActivityButton.
Definition discordpp.h:1006
std::string Url() const
The url of the button.
ActivityButton & operator=(ActivityButton &&other) noexcept
Move assignment operator for ActivityButton.
void SetLabel(std::string Label)
Setter for ActivityButton::Label.
void SetUrl(std::string Url)
Setter for ActivityButton::Url.
ActivityButton & operator=(const ActivityButton &arg0)
Copy assignment operator for ActivityButton.
ActivityButton(const ActivityButton &arg0)
Copy constructor for ActivityButton.
std::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:664
static const ActivityInvite nullobj
Uninitialized instance of ActivityInvite.
Definition discordpp.h:683
std::string SessionId() const
The session id of the user who sent the invite.
void SetIsValid(bool IsValid)
Setter for ActivityInvite::IsValid.
void SetSessionId(std::string SessionId)
Setter for ActivityInvite::SessionId.
uint64_t ApplicationId() const
The target application of the invite.
uint64_t MessageId() const
The id of the Discord message that contains the invite.
uint64_t SenderId() const
The user id of the user who sent the invite.
void SetApplicationId(uint64_t ApplicationId)
Setter for ActivityInvite::ApplicationId.
void SetSenderId(uint64_t SenderId)
Setter for ActivityInvite::SenderId.
void SetParentApplicationId(uint64_t ParentApplicationId)
Setter for ActivityInvite::ParentApplicationId.
bool IsValid() const
Whether or not this invite is currently joinable. An invite becomes invalid if it was sent more than ...
void SetChannelId(uint64_t ChannelId)
Setter for ActivityInvite::ChannelId.
uint64_t ChannelId() const
The id of the Discord channel in which the invite was sent.
void SetMessageId(uint64_t MessageId)
Setter for ActivityInvite::MessageId.
std::string PartyId() const
The id of the party the invite was sent for.
ActivityInvite & operator=(ActivityInvite &&other) noexcept
Move assignment operator for ActivityInvite.
ActivityInvite(const ActivityInvite &rhs)
Copy constructor for ActivityInvite.
void SetType(discordpp::ActivityActionTypes Type)
Setter for ActivityInvite::Type.
uint64_t ParentApplicationId() const
The application id of the parent - this is only applicable if there is a parent for a publisher's sui...
void SetPartyId(std::string PartyId)
Setter for ActivityInvite::PartyId.
ActivityInvite & operator=(const ActivityInvite &rhs)
Copy assignment operator for ActivityInvite.
discordpp::ActivityActionTypes Type() const
The type of invite that was sent.
ActivityInvite(ActivityInvite &&other) noexcept
Move constructor for ActivityInvite.
Definition discordpp.h:881
void SetMaxSize(int32_t MaxSize)
Setter for ActivityParty::MaxSize.
ActivityParty(ActivityParty &&other) noexcept
Move constructor for ActivityParty.
void SetCurrentSize(int32_t CurrentSize)
Setter for ActivityParty::CurrentSize.
void SetId(std::string Id)
Setter for ActivityParty::Id.
int32_t CurrentSize() const
The number of people currently in the party, must be at least 1.
int32_t MaxSize() const
The maximum number of people that can be in the party, must be at least 0. When 0,...
ActivityParty(const ActivityParty &arg0)
Copy constructor for ActivityParty.
ActivityParty & operator=(ActivityParty &&other) noexcept
Move assignment operator for ActivityParty.
void SetPrivacy(discordpp::ActivityPartyPrivacy Privacy)
Setter for ActivityParty::Privacy.
discordpp::ActivityPartyPrivacy Privacy() const
The privacy of the party.
std::string Id() const
Specifies the id of the party. "Party" is used colloquially to refer to a group of players in a share...
static const ActivityParty nullobj
Uninitialized instance of ActivityParty.
Definition discordpp.h:900
ActivityParty & operator=(const ActivityParty &arg0)
Copy assignment operator for ActivityParty.
Definition discordpp.h:943
ActivitySecrets & operator=(ActivitySecrets &&other) noexcept
Move assignment operator for ActivitySecrets.
std::string Join() const
A secret string that is shared with users who are accepted into the party so the game knows how to jo...
ActivitySecrets & operator=(const ActivitySecrets &arg0)
Copy assignment operator for ActivitySecrets.
ActivitySecrets(ActivitySecrets &&other) noexcept
Move constructor for ActivitySecrets.
ActivitySecrets(const ActivitySecrets &arg0)
Copy constructor for ActivitySecrets.
void SetJoin(std::string Join)
Setter for ActivitySecrets::Join.
static const ActivitySecrets nullobj
Uninitialized instance of ActivitySecrets.
Definition discordpp.h:962
Definition discordpp.h:827
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:846
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:1212
std::vector< discordpp::ActivityButton > GetButtons() const
Returns the custom buttons for the rich presence.
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:1231
std::optional< uint64_t > ApplicationId() const
The application ID of the game that the activity is associated with.
std::string Name() const
The name of the game or application that the activity is associated with.
void SetDetails(std::optional< std::string > Details)
Setter for Activity::Details.
Activity & operator=(Activity &&other) noexcept
Move assignment operator for Activity.
void SetParentApplicationId(std::optional< uint64_t > ParentApplicationId)
Setter for Activity::ParentApplicationId.
void SetType(discordpp::ActivityTypes Type)
Setter for Activity::Type.
std::optional< discordpp::ActivityAssets > Assets() const
Images used to customize how the Activity is displayed in the Discord client.
void SetTimestamps(std::optional< discordpp::ActivityTimestamps > Timestamps)
Setter for Activity::Timestamps.
bool Equals(discordpp::Activity other) const
Compares each field of the Activity struct for equality.
void SetApplicationId(std::optional< uint64_t > ApplicationId)
Setter for Activity::ApplicationId.
void SetName(std::string Name)
Setter for Activity::Name.
void SetSecrets(std::optional< discordpp::ActivitySecrets > Secrets)
Setter for Activity::Secrets.
Activity(const Activity &arg0)
Copy constructor for Activity.
void SetAssets(std::optional< discordpp::ActivityAssets > Assets)
Setter for Activity::Assets.
std::optional< discordpp::ActivityTimestamps > Timestamps() const
The timestamps struct can be used to render either:
void SetParty(std::optional< discordpp::ActivityParty > Party)
Setter for Activity::Party.
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 SetSupportedPlatforms(discordpp::ActivityGamePlatforms SupportedPlatforms)
Setter for Activity::SupportedPlatforms.
std::optional< std::string > Details() const
The state of the what the user is doing for this activity.
void SetState(std::optional< std::string > State)
Setter for Activity::State.
Activity(Activity &&other) noexcept
Move constructor for Activity.
discordpp::ActivityGamePlatforms SupportedPlatforms() const
If an activity is joinable, but only on certain platforms, this field can be used to indicate which p...
std::optional< discordpp::ActivitySecrets > Secrets() const
The secrets struct is used in combination with the party struct to make an Activity joinable.
std::optional< std::string > State() const
The state of the party for this activity.
discordpp::ActivityTypes Type() const
The type of activity this is.
Contains information about non-text content in a message that likely cannot be rendered in game such ...
Definition discordpp.h:2698
static std::string TypeToString(discordpp::AdditionalContentType type)
Converts the AdditionalContentType enum to a string.
AdditionalContent & operator=(AdditionalContent &&other) noexcept
Move assignment operator for AdditionalContent.
void SetCount(uint8_t Count)
Setter for AdditionalContent::Count.
void SetType(discordpp::AdditionalContentType Type)
Setter for AdditionalContent::Type.
std::optional< std::string > Title() const
When the additional content is a poll or thread, this field will contain the name of the poll or thre...
discordpp::AdditionalContentType Type() const
Represents the type of additional content in the message.
uint8_t Count() const
Represents the number of pieces of additional content so you could for example renders "2 additional ...
bool Equals(discordpp::AdditionalContent rhs) const
Compares each field of the AdditionalContent struct for equality.
AdditionalContent(AdditionalContent &&other) noexcept
Move constructor for AdditionalContent.
AdditionalContent & operator=(const AdditionalContent &arg0)
Copy assignment operator for AdditionalContent.
AdditionalContent(const AdditionalContent &arg0)
Copy constructor for AdditionalContent.
void SetTitle(std::optional< std::string > Title)
Setter for AdditionalContent::Title.
static const AdditionalContent nullobj
Uninitialized instance of AdditionalContent.
Definition discordpp.h:2717
Represents a single input or output audio device available to the user.
Definition discordpp.h:2923
AudioDevice & operator=(const AudioDevice &arg0)
Copy assignment operator for AudioDevice.
bool Equals(discordpp::AudioDevice rhs)
Compares the ID of two AudioDevice objects for equality.
std::string Name() const
The display name of the audio device.
bool IsDefault() const
Whether the audio device is the system default device.
std::string Id() const
The ID of the audio device.
AudioDevice(AudioDevice &&other) noexcept
Move constructor for AudioDevice.
AudioDevice & operator=(AudioDevice &&other) noexcept
Move assignment operator for AudioDevice.
static const AudioDevice nullobj
Uninitialized instance of AudioDevice.
Definition discordpp.h:2942
void SetId(std::string Id)
Setter for AudioDevice::Id.
void SetIsDefault(bool IsDefault)
Setter for AudioDevice::IsDefault.
void SetName(std::string Name)
Setter for AudioDevice::Name.
AudioDevice(const AudioDevice &arg0)
Copy constructor for AudioDevice.
Arguments to the Client::Authorize function.
Definition discordpp.h:1530
void SetIntegrationType(std::optional< discordpp::IntegrationType > IntegrationType)
Setter for AuthorizationArgs::IntegrationType.
std::optional< std::string > State() const
See https://discord.com/developers/docs/topics/oauth2#state-and-security for details on this field.
AuthorizationArgs & operator=(AuthorizationArgs &&other) noexcept
Move assignment operator for AuthorizationArgs.
std::optional< std::string > Nonce() const
The nonce field is generally only useful for backend integrations using ID tokens.
std::optional< discordpp::AuthorizationCodeChallenge > CodeChallenge() const
If using the Client::GetToken flow, you will need to generate a code challenge and verifier.
uint64_t ClientId() const
Optional. The Discord application ID for your game. Defaults to the value set by Client::SetApplicati...
AuthorizationArgs(const AuthorizationArgs &arg0)
Copy constructor for AuthorizationArgs.
void SetScopes(std::string Scopes)
Setter for AuthorizationArgs::Scopes.
static const AuthorizationArgs nullobj
Uninitialized instance of AuthorizationArgs.
Definition discordpp.h:1549
void SetClientId(uint64_t ClientId)
Setter for AuthorizationArgs::ClientId.
std::optional< discordpp::IntegrationType > IntegrationType() const
The type of integration the app will be installed as.
void SetCodeChallenge(std::optional< discordpp::AuthorizationCodeChallenge > CodeChallenge)
Setter for AuthorizationArgs::CodeChallenge.
AuthorizationArgs(AuthorizationArgs &&other) noexcept
Move constructor for AuthorizationArgs.
AuthorizationArgs & operator=(const AuthorizationArgs &arg0)
Copy assignment operator for AuthorizationArgs.
std::string Scopes() const
Scopes is a space separated string of the oauth scopes your game is requesting.
void SetNonce(std::optional< std::string > Nonce)
Setter for AuthorizationArgs::Nonce.
void SetState(std::optional< std::string > State)
Setter for AuthorizationArgs::State.
Struct that encapsulates the challenge part of the code verification flow.
Definition discordpp.h:1438
discordpp::AuthenticationCodeChallengeMethod Method() const
The method used to generate the challenge. The only method used by the SDK is sha256.
AuthorizationCodeChallenge(const AuthorizationCodeChallenge &arg0)
Copy constructor for AuthorizationCodeChallenge.
std::string Challenge() const
The challenge value.
AuthorizationCodeChallenge & operator=(AuthorizationCodeChallenge &&other) noexcept
Move assignment operator for AuthorizationCodeChallenge.
void SetMethod(discordpp::AuthenticationCodeChallengeMethod Method)
Setter for AuthorizationCodeChallenge::Method.
static const AuthorizationCodeChallenge nullobj
Uninitialized instance of AuthorizationCodeChallenge.
Definition discordpp.h:1458
AuthorizationCodeChallenge & operator=(const AuthorizationCodeChallenge &arg0)
Copy assignment operator for AuthorizationCodeChallenge.
AuthorizationCodeChallenge(AuthorizationCodeChallenge &&other) noexcept
Move constructor for AuthorizationCodeChallenge.
void SetChallenge(std::string Challenge)
Setter for AuthorizationCodeChallenge::Challenge.
Struct that encapsulates both parts of the code verification flow.
Definition discordpp.h:1485
AuthorizationCodeVerifier(const AuthorizationCodeVerifier &arg0)
Copy constructor for AuthorizationCodeVerifier.
AuthorizationCodeVerifier & operator=(const AuthorizationCodeVerifier &arg0)
Copy assignment operator for AuthorizationCodeVerifier.
void SetVerifier(std::string Verifier)
Setter for AuthorizationCodeVerifier::Verifier.
AuthorizationCodeVerifier(AuthorizationCodeVerifier &&other) noexcept
Move constructor for AuthorizationCodeVerifier.
std::string Verifier() const
The verifier part of the code verification flow.
void SetChallenge(discordpp::AuthorizationCodeChallenge Challenge)
Setter for AuthorizationCodeVerifier::Challenge.
static const AuthorizationCodeVerifier nullobj
Uninitialized instance of AuthorizationCodeVerifier.
Definition discordpp.h:1505
discordpp::AuthorizationCodeChallenge Challenge() const
The challenge part of the code verification flow.
AuthorizationCodeVerifier & operator=(AuthorizationCodeVerifier &&other) noexcept
Move assignment operator for AuthorizationCodeVerifier.
Convenience class that represents the state of a single Discord call in a lobby.
Definition discordpp.h:4835
std::optional< discordpp::VoiceStateHandle > GetVoiceStateHandle(uint64_t userId) const
Accesses the voice state for a single user so you can know if they have muted or deafened themselves.
std::vector< uint64_t > GetParticipants() const
Returns a list of the user IDs of the participants in the call.
CallInfoHandle & operator=(const CallInfoHandle &other)
Copy assignment operator for CallInfoHandle.
CallInfoHandle(const CallInfoHandle &other)
Copy constructor for CallInfoHandle.
CallInfoHandle & operator=(CallInfoHandle &&other) noexcept
Move assignment operator for CallInfoHandle.
uint64_t GuildId() const
Returns the lobby ID of the call.
static const CallInfoHandle nullobj
Uninitialized instance of CallInfoHandle.
Definition discordpp.h:4854
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:1775
static std::string ErrorToString(discordpp::Call::Error type)
Converts the Error enum to a string.
Call & operator=(const Call &other)
Copy assignment operator for Call.
void SetSelfDeaf(bool deaf)
Mutes all audio from the currently active call for the current user. They will not be able to hear an...
std::function< void(uint64_t userId, bool isPlayingSound)> OnSpeakingStatusChanged
Callback function for Call::SetSpeakingStatusChangedCallback.
Definition discordpp.h:1836
static const Call nullobj
Uninitialized instance of Call.
Definition discordpp.h:1853
Call(Call &&other) noexcept
Move constructor for Call.
void SetOnVoiceStateChangedCallback(discordpp::Call::OnVoiceStateChanged cb)
Sets a callback function to generally be invoked whenever a field on a VoiceStateHandle object for a ...
Call & operator=(Call &&other) noexcept
Move assignment operator for Call.
discordpp::AudioModeType GetAudioMode()
Returns whether the call is configured to use voice auto detection or push to talk for the current us...
bool GetPTTActive()
Returns whether push to talk is currently active, meaning the user is currently pressing their config...
discordpp::VADThresholdSettings GetVADThreshold() const
Returns the current configuration for void auto detection thresholds. See the description of the VADT...
std::optional< discordpp::VoiceStateHandle > GetVoiceStateHandle(uint64_t userId) const
Returns a reference to the VoiceStateHandle for the user ID of the given call participant.
static std::string StatusToString(discordpp::Call::Status type)
Converts the Status enum to a string.
void SetVADThreshold(bool automatic, float threshold)
Customizes the void auto detection thresholds for picking up activity from a user's mic.
bool GetSelfDeaf()
Returns whether the current user is deafened.
Error
Enum that represents any network errors with the Call.
Definition discordpp.h:1783
@ None
None.
Definition discordpp.h:1786
@ Forbidden
Forbidden.
Definition discordpp.h:1801
@ SignalingConnectionFailed
SignalingConnectionFailed.
Definition discordpp.h:1789
@ SignalingUnexpectedClose
SignalingUnexpectedClose.
Definition discordpp.h:1792
@ JoinTimeout
JoinTimeout.
Definition discordpp.h:1798
@ VoiceConnectionFailed
VoiceConnectionFailed.
Definition discordpp.h:1795
Status
Enum that respresents the state of the Call's network connection.
Definition discordpp.h:1805
@ Disconnecting
Disconnecting.
Definition discordpp.h:1826
@ Connected
Connected.
Definition discordpp.h:1820
@ Reconnecting
Reconnecting.
Definition discordpp.h:1823
@ Connecting
Connecting.
Definition discordpp.h:1814
@ SignalingConnected
SignalingConnected.
Definition discordpp.h:1817
@ Disconnected
Disconnected.
Definition discordpp.h:1808
@ Joining
Joining.
Definition discordpp.h:1811
void SetLocalMute(uint64_t userId, bool mute)
Locally mutes the given userId, so that the current user cannot hear them anymore.
void SetSpeakingStatusChangedCallback(discordpp::Call::OnSpeakingStatusChanged cb)
Sets a callback function to be invoked whenever a user starts or stops speaking and is passed in the ...
std::function< void(discordpp::Call::Status status, discordpp::Call::Error error, int32_t errorDetail)> OnStatusChanged
Callback function for Call::SetStatusChangedCallback.
Definition discordpp.h:1839
uint32_t GetPTTReleaseDelay()
Returns the time that PTT is active after the user releases the PTT key and SetPTTActive(false) is ca...
uint64_t GetGuildId() const
Returns the ID of the lobby with which this call is associated.
Call(const Call &other)
Copy constructor for Call.
void SetPTTActive(bool active)
When push to talk is enabled, this should be called whenever the user pushes or releases their config...
void SetParticipantChangedCallback(discordpp::Call::OnParticipantChanged cb)
Sets a callback function to be invoked whenever some joins or leaves a voice call.
std::vector< uint64_t > GetParticipants() const
Returns a list of all of the user IDs of the participants in the call.
bool GetSelfMute()
Returns whether the current user's microphone is muted.
void SetPTTReleaseDelay(uint32_t releaseDelayMs)
If set, extends the time that PTT is active after the user releases the PTT key and SetPTTActive(fals...
discordpp::Call::Status GetStatus() const
Returns the current call status.
std::function< void(uint64_t userId, bool added)> OnParticipantChanged
Callback function for Call::SetParticipantChangedCallback.
Definition discordpp.h:1833
void SetParticipantVolume(uint64_t userId, float volume)
Locally changes the playout volume of the given userId.
void SetStatusChangedCallback(discordpp::Call::OnStatusChanged cb)
Sets a callback function to be invoked when the call status changes, such as when it fully connects o...
void SetAudioMode(discordpp::AudioModeType audioMode)
Sets whether to use voice auto detection or push to talk for the current user on this call.
bool GetLocalMute(uint64_t userId)
Returns whether the current user has locally muted the given userId for themselves.
float GetParticipantVolume(uint64_t userId)
Returns the locally set playout volume of the given userId.
void SetSelfMute(bool mute)
Mutes the current user's microphone so that no other participant in their active calls can hear them.
std::function< void(uint64_t userId)> OnVoiceStateChanged
Callback function for Call::SetOnVoiceStateChangedCallback.
Definition discordpp.h:1830
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:2002
ChannelHandle(const ChannelHandle &other)
Copy constructor for ChannelHandle.
ChannelHandle & operator=(const ChannelHandle &other)
Copy assignment operator for ChannelHandle.
static const ChannelHandle nullobj
Uninitialized instance of ChannelHandle.
Definition discordpp.h:2021
uint64_t Id() const
Returns the ID of the channel.
ChannelHandle & operator=(ChannelHandle &&other) noexcept
Move assignment operator for ChannelHandle.
ChannelHandle(ChannelHandle &&other) noexcept
Move constructor for ChannelHandle.
std::vector< uint64_t > Recipients() const
For DMs and GroupDMs, returns the user IDs of the members of the channel. For all other channels retu...
std::string Name() const
Returns the name of the channel.
discordpp::ChannelType Type() const
Returns the type of the channel.
Options for creating a new Client instance.
Definition discordpp.h:2977
discordpp::AudioSystem ExperimentalAudioSystem() const
The audio system to use. Defaults to AudioSystem::Standard.
static const ClientCreateOptions nullobj
Uninitialized instance of ClientCreateOptions.
Definition discordpp.h:2996
ClientCreateOptions & operator=(const ClientCreateOptions &arg0)
Copy assignment operator for ClientCreateOptions.
std::string WebBase() const
The base URL for the Discord web application.
std::string ApiBase() const
The base URL for the Discord API.
void SetApiBase(std::string ApiBase)
Setter for ClientCreateOptions::ApiBase.
ClientCreateOptions(const ClientCreateOptions &arg0)
Copy constructor for ClientCreateOptions.
void SetExperimentalAudioSystem(discordpp::AudioSystem ExperimentalAudioSystem)
Setter for ClientCreateOptions::ExperimentalAudioSystem.
ClientCreateOptions(ClientCreateOptions &&other) noexcept
Move constructor for ClientCreateOptions.
void SetWebBase(std::string WebBase)
Setter for ClientCreateOptions::WebBase.
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:1345
void SetRetryable(bool Retryable)
Setter for ClientResult::Retryable.
bool Retryable() const
Indicates if, although an API request failed, it is safe and recommended to retry it.
void SetErrorCode(int32_t ErrorCode)
Setter for ClientResult::ErrorCode.
ClientResult & operator=(const ClientResult &arg0)
Copy assignment operator for ClientResult.
void SetStatus(discordpp::HttpStatusCode Status)
Setter for ClientResult::Status.
std::string Error() const
A description of the error that occurred.
discordpp::ErrorType Type() const
The type of error that occurred. See ErrorType for more information.
void SetResponseBody(std::string ResponseBody)
Setter for ClientResult::ResponseBody.
ClientResult(ClientResult &&other) noexcept
Move constructor for ClientResult.
void SetSuccessful(bool Successful)
Setter for ClientResult::Successful.
std::string ToString() const
Returns the error message if any of the ClientResult.
static const ClientResult nullobj
Uninitialized instance of ClientResult.
Definition discordpp.h:1364
ClientResult & operator=(ClientResult &&other) noexcept
Move assignment operator for ClientResult.
int32_t ErrorCode() const
A more detailed error code for this failure. Currently the only use of this is when an API request is...
void SetRetryAfter(float RetryAfter)
Setter for ClientResult::RetryAfter.
float RetryAfter() const
When a user is being rate limited by Discord (and so status == 429), this field should be set and is ...
std::string ResponseBody() const
The full HTTP response body, which will usually be a JSON string.
discordpp::HttpStatusCode Status() const
The HTTP status code of the API call.
void SetError(std::string Error)
Setter for ClientResult::Error.
ClientResult(const ClientResult &arg0)
Copy constructor for ClientResult.
bool Successful() const
Equivalent to type == ErrorType::None.
void SetType(discordpp::ErrorType Type)
Setter for ClientResult::Type.
The Client class is the main entry point for the Discord SDK. All functionality is exposed through th...
Definition discordpp.h:3039
std::function< void(discordpp::ClientResult result)> UnmergeIntoProvisionalAccountCallback
Callback function for the Client::UnmergeIntoProvisionalAccount method.
Definition discordpp.h:3212
std::function< void(std::vector< discordpp::AudioDevice > devices)> GetOutputDevicesCallback
Callback function for Client::GetOutputDevices.
Definition discordpp.h:3136
bool RegisterLaunchCommand(uint64_t applicationId, std::string command)
When a user accepts an activity invite for your game within the Discord client, Discord needs to know...
void SetRelationshipCreatedCallback(discordpp::Client::RelationshipCreatedCallback cb)
Sets a callback to be invoked whenever a relationship for this user is established or changes type.
void GetLobbyMessagesWithLimit(uint64_t lobbyId, int32_t limit, discordpp::Client::GetLobbyMessagesCallback cb)
Retrieves recent messages from the specified lobby.
std::function< void(uint64_t messageId)> MessageCreatedCallback
Callback function for Client::SetMessageCreatedCallback.
Definition discordpp.h:3247
discordpp::Call GetCall(uint64_t channelId)
Returns a reference to the currently active call, if any.
std::function< void(uint64_t userId)> RelationshipGroupsUpdatedCallback
Callback function for Client::SetRelationshipGroupsUpdatedCallback.
Definition discordpp.h:3356
std::function< void(discordpp::ClientResult result)> UpdateRelationshipCallback
Callback function for most other Relationship functions such as Client::SendDiscordFriendRequestById.
Definition discordpp.h:3330
void EndCalls(discordpp::Client::EndCallsCallback callback)
Ends any active call, if any. Any references you have to Call objects are invalid after they are ende...
static std::string StatusToString(discordpp::Client::Status type)
Converts the Status enum to a string.
void Disconnect()
Asynchronously disconnects the client.
void SendDiscordFriendRequest(std::string const &username, discordpp::Client::SendFriendRequestCallback cb)
Sends a Discord friend request to the target user.
void RefreshToken(uint64_t applicationId, std::string const &refreshToken, discordpp::Client::TokenExchangeCallback callback)
Generates a new access token for the current user from a refresh token.
void SendLobbyMessageWithMetadata(uint64_t lobbyId, std::string const &content, std::unordered_map< std::string, std::string > const &metadata, discordpp::Client::SendUserMessageCallback cb)
Variant of Client::SendLobbyMessage that also accepts metadata to be sent with the message.
void SetEchoCancellation(bool on)
Enables or disables the basic echo cancellation provided by the WebRTC library.
void GetInputDevices(discordpp::Client::GetInputDevicesCallback cb)
Asynchronously fetches the list of audio input devices available to the user.
void CancelGameFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Cancels an outgoing game friend request to the target user.
void AbortGetTokenFromDevice()
This function is used to abort/cleanup the device authorization flow.
bool SetLogDir(std::string const &path, discordpp::LoggingSeverity minSeverity)
Causes logs generated by the SDK to be written to disk in the specified directory.
void OpenConnectedGamesSettingsInDiscord(discordpp::Client::OpenConnectedGamesSettingsInDiscordCallback callback)
Opens the Connected Games settings in the Discord client, which is where users can manage their setti...
void SetAuthorizeDeviceScreenClosedCallback(discordpp::Client::AuthorizeDeviceScreenClosedCallback cb)
Sets a callback function to be invoked when the device authorization screen is closed.
void SetMessageCreatedCallback(discordpp::Client::MessageCreatedCallback cb)
Sets a callback to be invoked whenever a new message is received in either a lobby or a DM.
std::function< void(discordpp::ClientResult result)> UpdateProvisionalAccountDisplayNameCallback
Callback function for Client::UpdateProvisionalAccountDisplayName.
Definition discordpp.h:3216
std::function< void(bool inputDetected)> NoAudioInputCallback
Callback function for Client::SetNoAudioInputCallback.
Definition discordpp.h:3148
void UnlinkChannelFromLobby(uint64_t lobbyId, discordpp::Client::LinkOrUnlinkChannelCallback callback)
Removes any existing channel link from the specified lobby.
std::function< void()> ProvisionalUserMergeRequiredCallback
Callback function for when Client::ProvisionalUserMergeCompleted completes.
Definition discordpp.h:3235
void SetMessageDeletedCallback(discordpp::Client::MessageDeletedCallback cb)
Sets a callback to be invoked whenever a message is deleted.
void DeleteUserMessage(uint64_t recipientId, uint64_t messageId, discordpp::Client::DeleteUserMessageCallback cb)
Deletes the specified message sent by the current user to the specified recipient.
void SetVoiceParticipantChangedCallback(discordpp::Client::VoiceParticipantChangedCallback cb)
Callback invoked whenever a user in a lobby joins or leaves a voice call.
void UnmergeIntoProvisionalAccount(uint64_t applicationId, discordpp::AuthenticationExternalAuthType externalAuthType, std::string const &externalAuthToken, discordpp::Client::UnmergeIntoProvisionalAccountCallback callback)
This function is used to unlink/unmerge a external identity from a Discord account....
std::function< void(discordpp::ClientResult result, std::vector< discordpp::GuildMinimal > guilds)> GetUserGuildsCallback
Callback function for Client::GetUserGuilds.
Definition discordpp.h:3280
Client(std::string apiBase, std::string webBase)
Creates a new instance of the Client but allows customizing the Discord URL to use.
void RevokeToken(uint64_t applicationId, std::string const &token, discordpp::Client::RevokeTokenCallback callback)
Revoke all application access/refresh tokens associated with a user with any valid access/refresh tok...
void LinkChannelToLobby(uint64_t lobbyId, uint64_t channelId, discordpp::Client::LinkOrUnlinkChannelCallback callback)
Links the specified channel on Discord to the specified in-game lobby.
std::function< void(uint64_t lobbyId)> LobbyDeletedCallback
Callback function for Client::SetLobbyDeletedCallback.
Definition discordpp.h:3293
std::function< void(std::string message, discordpp::LoggingSeverity severity)> LogCallback
Callback function invoked when a new log message is generated.
Definition discordpp.h:3256
void SetDeviceChangeCallback(discordpp::Client::DeviceChangeCallback callback)
Sets a callback function to be invoked when Discord detects a change in the available audio devices.
std::function< void(discordpp::ClientResult result)> LinkOrUnlinkChannelCallback
Callback function for Client::LinkChannelToLobby.
Definition discordpp.h:3287
std::function< void(discordpp::AudioDevice device)> GetCurrentOutputDeviceCallback
Callback function for Client::GetCurrentOutputDevice.
Definition discordpp.h:3129
std::vector< uint64_t > GetLobbyIds() const
Returns a list of all the lobbies that the user is a member of and the SDK has loaded.
void SetUserUpdatedCallback(discordpp::Client::UserUpdatedCallback cb)
The UserUpdatedCallback is invoked whenever any user the current session knows about changes,...
std::function< void()> TokenExpirationCallback
Callback function for Client::SetTokenExpirationCallback.
Definition discordpp.h:3209
std::function< void(discordpp::ClientResult result)> SetOutputDeviceCallback
Callback function for Client::SetOutputDevice.
Definition discordpp.h:3151
void SetAecDump(bool on)
Enables or disables AEC diagnostic recording.
std::function< void(discordpp::ClientResult result, std::optional< discordpp::UserHandle > user)> GetDiscordClientConnectedUserCallback
Callback function for when Client::GetDiscordClientConnectedUser completes.
Definition discordpp.h:3351
void SetActivityInviteCreatedCallback(discordpp::Client::ActivityInviteCallback cb)
Sets a callback function that is invoked when the current user receives an activity invite from anoth...
std::function< void(uint64_t lobbyId, uint64_t memberId)> LobbyMemberUpdatedCallback
Callback function for Client::SetLobbyMemberUpdatedCallback.
Definition discordpp.h:3302
void SendUserMessage(uint64_t recipientId, std::string const &content, discordpp::Client::SendUserMessageCallback cb)
Sends a direct message to the specified user.
Client & operator=(Client &&other) noexcept
Move assignment operator for Client.
void GetTokenFromProvisionalMerge(uint64_t applicationId, std::string const &code, std::string const &codeVerifier, std::string const &redirectUri, discordpp::AuthenticationExternalAuthType externalAuthType, std::string const &externalAuthToken, discordpp::Client::TokenExchangeCallback callback)
This function should be used with the Client::Authorize function whenever a user with a provisional a...
static std::string GetVersionHash()
Returns the git commit hash this version was built from.
bool RegisterLaunchSteamApplication(uint64_t applicationId, uint32_t steamAppId)
When a user accepts an activity invite for your game within the Discord client, Discord needs to know...
void FetchCurrentUser(discordpp::AuthorizationTokenType tokenType, std::string const &token, discordpp::Client::FetchCurrentUserCallback callback)
Fetches basic information about the user associated with the given auth token.
void SetNoAudioInputCallback(discordpp::Client::NoAudioInputCallback callback)
Callback function invoked when the above threshold is set and there is a change in whether audio is b...
std::vector< discordpp::UserHandle > SearchFriendsByUsername(std::string searchStr) const
Searches all of your friends by both username and display name, returning a list of all friends that ...
void SetVoiceLogDir(std::string const &path, discordpp::LoggingSeverity minSeverity)
Causes logs generated by the voice subsystem of the SDK to be written to disk in the specified direct...
std::function< void(uint64_t userId, int16_t *data, uint64_t samplesPerChannel, int32_t sampleRate, uint64_t channels, bool &outShouldMute)> UserAudioReceivedCallback
Callback function for Client::StartCallWithAudioCallbacks.
Definition discordpp.h:3160
std::function< void(discordpp::ClientResult result)> LeaveLobbyCallback
Callback function for Client::LeaveLobby.
Definition discordpp.h:3284
std::function< void(uint64_t lobbyId)> LobbyUpdatedCallback
Callback function for Client::SetLobbyUpdatedCallback.
Definition discordpp.h:3305
void GetTokenFromDevice(discordpp::DeviceAuthorizationArgs args, discordpp::Client::TokenExchangeCallback callback)
This function is a combination of Client::Authorize and Client::GetToken, but is used for the case wh...
void CloseAuthorizeDeviceScreen()
This function is used to hide the device authorization screen and is used for the case where the user...
void SetOpusHardwareCoding(bool encode, bool decode)
Enables or disables hardware encoding and decoding for audio, if it is available.
bool ShowAudioRoutePicker()
On iOS devices, show the system audio route picker.
void SetActivityJoinCallback(discordpp::Client::ActivityJoinCallback cb)
Sets a callback function that is invoked when the current user also has Discord running on their comp...
void GetOutputDevices(discordpp::Client::GetOutputDevicesCallback cb)
Asynchronously fetches the list of audio output devices available to the user.
std::function< void()> AuthorizeDeviceScreenClosedCallback
Callback function for Client::SetAuthorizeDeviceScreenClosedCallback.
Definition discordpp.h:3206
void SetSelfDeafAll(bool deaf)
Mutes all audio from the currently active call for the current user in all calls. They will not be ab...
void ExchangeChildToken(std::string const &parentApplicationToken, uint64_t childApplicationId, discordpp::Client::ExchangeChildTokenCallback callback)
Exchanges a parent application token for a child application token.
std::function< void(discordpp::ClientResult result)> UpdateRichPresenceCallback
Callback function for when Client::UpdateRichPresence completes.
Definition discordpp.h:3326
void CreateOrJoinLobbyWithMetadata(std::string const &secret, std::unordered_map< std::string, std::string > const &lobbyMetadata, std::unordered_map< std::string, std::string > const &memberMetadata, discordpp::Client::CreateOrJoinLobbyCallback callback)
Variant of Client::CreateOrJoinLobby that also accepts developer-supplied metadata.
Client()
Creates a new instance of the Client.
std::function< void(discordpp::ClientResult result)> SendFriendRequestCallback
Callback function for Client::SendDiscordFriendRequest and Client::SendGameFriendRequest.
Definition discordpp.h:3334
std::function< void(discordpp::ClientResult result, std::vector< discordpp::MessageHandle > messages)> GetLobbyMessagesCallback
Callback function for Client::GetLobbyMessagesWithLimit.
Definition discordpp.h:3230
void UpdateToken(discordpp::AuthorizationTokenType tokenType, std::string token, discordpp::Client::UpdateTokenCallback callback)
Asynchronously sets a new auth token for this client to use.
std::function< void(discordpp::Client::Status status, discordpp::Client::Error error, int32_t errorDetail)> OnStatusChanged
Callback function for Client::SetStatusChangedCallback.
Definition discordpp.h:3267
void SetOutputVolume(float outputVolume)
Sets the speaker volume for the current user.
std::function< void()> EndCallsCallback
Callback invoked when Client::EndCalls completes.
Definition discordpp.h:3123
void SendGameFriendRequestById(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Sends (or accepts) a game friend request to the target user.
void OpenMessageInDiscord(uint64_t messageId, discordpp::Client::ProvisionalUserMergeRequiredCallback provisionalUserMergeRequiredCallback, discordpp::Client::OpenMessageInDiscordCallback callback)
Opens the given message in the Discord client.
void RemoveGameFriend(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Removes any game friendship between the current user and the target user.
std::vector< discordpp::Call > GetCalls()
Returns a reference to all currently active calls, if any.
std::optional< discordpp::ChannelHandle > GetChannelHandle(uint64_t channelId) const
Returns a reference to the Discord channel object for the given ID.
std::function< void(discordpp::ClientResult result)> RevokeTokenCallback
Callback function for the Client::RevokeToken method.
Definition discordpp.h:3203
void SendActivityJoinRequest(uint64_t userId, discordpp::Client::SendActivityInviteCallback cb)
Requests to join the activity of the specified user.
std::function< void(discordpp::ClientResult result, std::string joinSecret)> AcceptActivityInviteCallback
Callback function for Client::AcceptActivityInvite.
Definition discordpp.h:3308
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:3082
@ Disconnecting
Disconnecting.
Definition discordpp.h:3100
@ Connected
Connected.
Definition discordpp.h:3091
@ HttpWait
HttpWait.
Definition discordpp.h:3103
@ Reconnecting
Reconnecting.
Definition discordpp.h:3097
@ Connecting
Connecting.
Definition discordpp.h:3088
@ Ready
Ready.
Definition discordpp.h:3094
@ Disconnected
Disconnected.
Definition discordpp.h:3085
static std::string GetDefaultCommunicationScopes()
Returns the default set of OAuth2 scopes that should be used with the Discord SDK when making use of ...
void SetRelationshipDeletedCallback(discordpp::Client::RelationshipDeletedCallback cb)
Sets a callback to be invoked whenever a relationship for this user is removed, such as when the user...
void UpdateProvisionalAccountDisplayName(std::string const &name, discordpp::Client::UpdateProvisionalAccountDisplayNameCallback callback)
Updates the display name of a provisional account to the specified name.
static std::string GetDefaultPresenceScopes()
Returns the default set of OAuth2 scopes that should be used with the Discord SDK when leveraging bas...
void SendLobbyMessage(uint64_t lobbyId, std::string const &content, discordpp::Client::SendUserMessageCallback cb)
Sends a message in a lobby chat to all members of the lobby.
std::optional< discordpp::MessageHandle > GetMessageHandle(uint64_t messageId) const
Returns a reference to the Discord message object for the given ID.
float GetOutputVolume()
Returns the output volume for the current user.
std::function< void(discordpp::ClientResult result, std::string accessToken, std::string refreshToken, discordpp::AuthorizationTokenType tokenType, int32_t expiresIn, std::string scopes)> TokenExchangeCallback
Callback function for the token exchange APIs such as Client::GetToken.
Definition discordpp.h:3195
void SetThreadPriority(discordpp::Client::Thread thread, int32_t priority)
Allows setting the priority of various SDK threads.
discordpp::UserHandle GetCurrentUser() const
Returns the user associated with the current client.
std::function< void(discordpp::ClientResult result)> OpenMessageInDiscordCallback
Callback function for when Client::OpenMessageInDiscord completes.
Definition discordpp.h:3238
void GetProvisionalToken(uint64_t applicationId, discordpp::AuthenticationExternalAuthType externalAuthType, std::string const &externalAuthToken, discordpp::Client::TokenExchangeCallback callback)
Provisional accounts are a way for users that have not signed up for Discord to still access SDK func...
void GetCurrentInputDevice(discordpp::Client::GetCurrentInputDeviceCallback cb)
Asynchronously fetches the current audio input device in use by the client.
void SetAutomaticGainControl(bool on)
When enabled, automatically adjusts the microphone volume to keep it clear and consistent.
void EditUserMessage(uint64_t recipientId, uint64_t messageId, std::string const &content, discordpp::Client::EditUserMessageCallback cb)
Edits the specified message sent by the current user to the specified recipient.
std::function< void()> EndCallCallback
Callback invoked when Client::EndCall completes.
Definition discordpp.h:3120
std::function< void(discordpp::ClientResult result)> EditUserMessageCallback
Callback function for Client::EditUserMessage.
Definition discordpp.h:3227
void Connect()
Asynchronously connects the client to Discord.
void SetLobbyDeletedCallback(discordpp::Client::LobbyDeletedCallback cb)
Sets a callback to be invoked when a lobby is no longer available.
void GetDiscordClientConnectedUser(uint64_t applicationId, discordpp::Client::GetDiscordClientConnectedUserCallback callback) const
If the Discord app is running on the user's computer and the SDK establishes a connection to it,...
static int32_t GetVersionPatch()
Returns the patch version of the Discord Social SDK.
void CreateOrJoinLobby(std::string const &secret, discordpp::Client::CreateOrJoinLobbyCallback callback)
Joins the user to the specified lobby, creating one if it does not exist.
void LeaveLobby(uint64_t lobbyId, discordpp::Client::LeaveLobbyCallback callback)
Removes the current user from the specified lobby.
float GetInputVolume()
Returns the input volume for the current user's microphone.
std::function< void(discordpp::ClientResult result)> SetInputDeviceCallback
Callback function for Client::SetInputDevice.
Definition discordpp.h:3145
void SetLobbyMemberRemovedCallback(discordpp::Client::LobbyMemberRemovedCallback cb)
Sets a callback function to be invoked whenever a member of a lobby is removed and can no longer conn...
Client(Client &&other) noexcept
Move constructor for Client.
static std::string GetDefaultAudioDeviceId()
Returns the ID of the system default audio device if the user has not explicitly chosen one.
void CancelDiscordFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Cancels an outgoing Discord friend request to the target user.
std::function< void(uint64_t lobbyId, uint64_t memberId)> LobbyMemberAddedCallback
Callback function for Client::SetLobbyMemberAddedCallback.
Definition discordpp.h:3296
void SetOnlineStatus(discordpp::StatusType status, discordpp::Client::UpdateStatusCallback callback)
Sets whether a user is online/invisible/idle/dnd on Discord.
void ClearRichPresence()
Clears the right presence for the current user.
void SetSelfMuteAll(bool mute)
Mutes the current user's microphone so that no other participant in their active calls can hear them ...
void SetStatusChangedCallback(discordpp::Client::OnStatusChanged cb)
Sets a callback function to be invoked whenever the SDKs status changes.
std::function< void(discordpp::ActivityInvite invite)> ActivityInviteCallback
Callback function for Client::SetActivityInviteCreatedCallback and Client::SetActivityInviteUpdatedCa...
Definition discordpp.h:3317
std::vector< discordpp::RelationshipHandle > GetRelationshipsByGroup(discordpp::RelationshipGroupType groupType) const
Returns a list of relationships that belong to the specified relationship group type....
std::function< void(discordpp::ClientResult result)> UpdateTokenCallback
Callback invoked when Client::UpdateToken completes. Once this is done it is safe to call Client::Con...
Definition discordpp.h:3221
void SetMessageUpdatedCallback(discordpp::Client::MessageUpdatedCallback cb)
Sets a callback to be invoked whenever a message is edited.
void SetOutputDevice(std::string deviceId, discordpp::Client::SetOutputDeviceCallback cb)
Asynchronously changes the audio output device in use by the client to the specified device....
void SendUserMessageWithMetadata(uint64_t recipientId, std::string const &content, std::unordered_map< std::string, std::string > const &metadata, discordpp::Client::SendUserMessageCallback cb)
Variant of Client::SendUserMessage that also accepts metadata to be sent with the message.
std::function< void(uint64_t lobbyId)> LobbyCreatedCallback
Callback function for Client::SetLobbyCreatedCallback.
Definition discordpp.h:3290
void RemoveDiscordAndGameFriend(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Removes any friendship between the current user and the target user. This function will remove BOTH a...
std::function< void(uint64_t lobbyId, uint64_t memberId)> LobbyMemberRemovedCallback
Callback function for Client::SetLobbyMemberRemovedCallback.
Definition discordpp.h:3299
void SetTokenExpirationCallback(discordpp::Client::TokenExpirationCallback callback)
Get a notification when the current token is about to expire or expired.
void GetUserGuilds(discordpp::Client::GetUserGuildsCallback cb)
Fetches all of the guilds (also known as Discord servers) that the current user is a member of.
void SetGameWindowPid(int32_t pid)
When users are linking their account with Discord, which involves an OAuth2 flow, the SDK can streaml...
void GetToken(uint64_t applicationId, std::string const &code, std::string const &codeVerifier, std::string const &redirectUri, discordpp::Client::TokenExchangeCallback callback)
Exchanges an authorization code that was returned from the Client::Authorize function for an access t...
std::function< void(discordpp::ClientResult result, std::string code, std::string redirectUri)> AuthorizationCallback
Callback invoked when the Authorize function completes.
Definition discordpp.h:3179
void SetActivityInviteUpdatedCallback(discordpp::Client::ActivityInviteCallback cb)
Sets a callback function that is invoked when an existing activity invite changes....
void SetNoAudioInputThreshold(float dBFSThreshold)
Threshold that can be set to indicate when no audio is being received by the user's mic.
std::function< void(std::string joinSecret)> ActivityJoinCallback
Callback function for Client::SetActivityJoinCallback.
Definition discordpp.h:3320
static std::string ErrorToString(discordpp::Client::Error type)
Converts the Error enum to a string.
std::optional< discordpp::UserHandle > GetUser(uint64_t userId) const
Returns the UserHandle associated with the given user ID.
discordpp::RelationshipHandle GetRelationshipHandle(uint64_t userId) const
Returns the RelationshipHandle that corresponds to the relationship between the current user and the ...
std::function< void(discordpp::ClientResult result)> SendActivityInviteCallback
Callback function for Client::SendActivityInvite, Client::SendActivityJoinRequest,...
Definition discordpp.h:3313
discordpp::AuthorizationCodeVerifier CreateAuthorizationCodeVerifier()
Helper function that can create a code challenge and verifier for use in the Client::Authorize + Clie...
std::function< void(uint64_t lobbyId, uint64_t memberId, bool added)> VoiceParticipantChangedCallback
Callback function for Client::SetVoiceParticipantChangedCallback.
Definition discordpp.h:3154
discordpp::Call StartCallWithAudioCallbacks(uint64_t lobbyId, discordpp::Client::UserAudioReceivedCallback receivedCb, discordpp::Client::UserAudioCapturedCallback capturedCb)
Starts or joins a call in the specified lobby.
uint64_t GetApplicationId()
This function is used to get the application ID for the client. This is used to identify the applicat...
std::function< void(uint64_t userId, bool isDiscordRelationshipUpdate)> RelationshipDeletedCallback
Callback function for Client::SetRelationshipDeletedCallback.
Definition discordpp.h:3347
bool GetSelfDeafAll() const
Returns whether the current user is deafened in all calls.
bool SetSpeakerMode(bool speakerMode)
(deprecated) On mobile devices, enable speakerphone mode.
static int32_t GetVersionMinor()
Returns the minor version of the Discord Social SDK.
void AddVoiceLogCallback(discordpp::Client::LogCallback callback, discordpp::LoggingSeverity minSeverity)
Adds a callback function to be invoked for each new log message generated by the voice subsystem of t...
void AbortAuthorize()
This will abort the authorize flow if it is in progress and tear down any associated state.
Error
Represents an error state for the socket connection that the Discord SDK maintains with the Discord b...
Definition discordpp.h:3053
@ None
None.
Definition discordpp.h:3056
@ ConnectionCanceled
ConnectionCanceled.
Definition discordpp.h:3065
@ ConnectionFailed
ConnectionFailed.
Definition discordpp.h:3059
@ UnexpectedClose
UnexpectedClose.
Definition discordpp.h:3062
void UnblockUser(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Unblocks the target user. Does not restore any old relationship between the users though.
void SetShowingChat(bool showingChat)
Sets whether chat messages are currently being shown in the game.
static int32_t GetVersionMajor()
Returns the major version of the Discord Social SDK.
std::function< void(discordpp::ClientResult result, uint64_t messageId)> SendUserMessageCallback
This is used for all kinds of 'send message' calls despite the name, to make sure engine bindings use...
Definition discordpp.h:3243
std::function< void(discordpp::AudioDevice device)> GetCurrentInputDeviceCallback
Callback function for Client::GetCurrentInputDevice.
Definition discordpp.h:3126
void SetLobbyCreatedCallback(discordpp::Client::LobbyCreatedCallback cb)
Sets a callback to be invoked when a lobby "becomes available" to the client.
void Authorize(discordpp::AuthorizationArgs args, discordpp::Client::AuthorizationCallback callback)
Initiates an OAuth2 flow for a user to "sign in with Discord". This flow is intended for desktop and ...
std::function< void(uint64_t userId)> UserUpdatedCallback
Callback function for Client::SetUserUpdatedCallback.
Definition discordpp.h:3359
void AcceptActivityInvite(discordpp::ActivityInvite invite, discordpp::Client::AcceptActivityInviteCallback cb)
Accepts an activity invite that the current user has received.
void SetInputDevice(std::string deviceId, discordpp::Client::SetInputDeviceCallback cb)
Asynchronously changes the audio input device in use by the client to the specified device....
void RejectGameFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Declines an incoming game friend request from the target user.
void SetInputVolume(float inputVolume)
Sets the microphone volume for the current user.
void SetApplicationId(uint64_t applicationId)
This function is used to set the application ID for the client. This is used to identify the applicat...
std::vector< discordpp::RelationshipHandle > GetRelationships() const
Returns a list of all of the relationships the current user has with others, including all Discord re...
std::function< void(uint64_t messageId, uint64_t channelId)> MessageDeletedCallback
Callback function for Client::SetMessageDeletedCallback.
Definition discordpp.h:3250
void SetLobbyUpdatedCallback(discordpp::Client::LobbyUpdatedCallback cb)
Sets a callback to be invoked when a lobby is edited, for example if the lobby's metadata is changed.
std::function< void(discordpp::ClientResult result)> OpenConnectedGamesSettingsInDiscordCallback
Callback function for when Client::OpenConnectedGamesSettingsInDiscord completes.
Definition discordpp.h:3260
Thread
Represents the type of thread to control thread priority on.
Definition discordpp.h:3107
@ Client
Client.
Definition discordpp.h:3110
@ Voice
Voice.
Definition discordpp.h:3113
@ Network
Network.
Definition discordpp.h:3116
void SendActivityJoinRequestReply(discordpp::ActivityInvite invite, discordpp::Client::SendActivityInviteCallback cb)
When another user requests to join the current user's party, this function is called to to allow that...
void GetGuildChannels(uint64_t guildId, discordpp::Client::GetGuildChannelsCallback cb)
Fetches all of the channels that the current user can access in the given guild.
static std::string ThreadToString(discordpp::Client::Thread type)
Converts the Thread enum to a string.
void BlockUser(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Blocks the target user so that they cannot send the user friend or activity invites and cannot messag...
std::function< void(uint64_t messageId)> MessageUpdatedCallback
Callback function for Client::SetMessageUpdatedCallback.
Definition discordpp.h:3253
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.
bool GetSelfMuteAll() const
Returns whether the current user's microphone is muted in all calls.
std::function< void(uint64_t userId, bool isDiscordRelationshipUpdate)> RelationshipCreatedCallback
Callback function for Client::SetRelationshipCreatedCallback.
Definition discordpp.h:3340
std::function< void(discordpp::ClientResult result)> DeleteUserMessageCallback
Callback function for Client::DeleteUserMessage.
Definition discordpp.h:3224
std::function< void(discordpp::ClientResult result, std::string accessToken, discordpp::AuthorizationTokenType tokenType, int32_t expiresIn, std::string scopes)> ExchangeChildTokenCallback
Callback function for Client::ExchangeChildToken.
Definition discordpp.h:3183
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.
void SetLobbyMemberAddedCallback(discordpp::Client::LobbyMemberAddedCallback cb)
Sets a callback function to be invoked whenever a user is added to a lobby.
void GetCurrentOutputDevice(discordpp::Client::GetCurrentOutputDeviceCallback cb)
Asynchronously fetches the current audio output device in use by the client.
void SetHttpRequestTimeout(int32_t httpTimeoutInMilliseconds)
This function is used to override the default HTTP timeout for the websocket client.
void EndCall(uint64_t channelId, discordpp::Client::EndCallCallback callback)
Ends any active call, if any. Any references you have to Call objects are invalid after they are ende...
void AcceptGameFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Accepts an incoming game friend request from the target user.
std::function< void(discordpp::ClientResult result, uint64_t id, std::string name)> FetchCurrentUserCallback
Callback function for Client::FetchCurrentUser.
Definition discordpp.h:3191
std::function< void(discordpp::ClientResult result, std::vector< discordpp::GuildChannel > guildChannels)> GetGuildChannelsCallback
Callback function for Client::GetGuildChannels.
Definition discordpp.h:3275
std::function< void(discordpp::ClientResult result)> UpdateStatusCallback
Callback function for when Client::SetOnlineStatus completes.
Definition discordpp.h:3323
std::optional< discordpp::LobbyHandle > GetLobbyHandle(uint64_t lobbyId) const
Returns a reference to the Discord lobby object for the given ID.
std::function< void(discordpp::ClientResult result, uint64_t lobbyId)> CreateOrJoinLobbyCallback
Callback function for Client::CreateOrJoinLobby.
Definition discordpp.h:3271
discordpp::Call StartCall(uint64_t channelId)
Starts or joins a call in the lobby specified by channelId (For a lobby, simply pass in the lobbyId).
void UpdateRichPresence(discordpp::Activity activity, discordpp::Client::UpdateRichPresenceCallback cb)
Updates the rich presence for the current user.
void SetRelationshipGroupsUpdatedCallback(discordpp::Client::RelationshipGroupsUpdatedCallback cb)
The RelationshipGroupsUpdatedCallback is invoked whenever any user in the friends list changes....
Client(discordpp::ClientCreateOptions options)
Creates a new instance of the Client with custom options.
void OpenAuthorizeDeviceScreen(uint64_t clientId, std::string const &userCode)
This function is used to show the device authorization screen and is used for the case where the user...
std::function< void(int16_t *data, uint64_t samplesPerChannel, int32_t sampleRate, uint64_t channels)> UserAudioCapturedCallback
Callback function for Client::StartCallWithAudioCallbacks.
Definition discordpp.h:3170
std::function< void(std::vector< discordpp::AudioDevice > inputDevices, std::vector< discordpp::AudioDevice > outputDevices)> DeviceChangeCallback
Callback function for Client::SetDeviceChangeCallback.
Definition discordpp.h:3140
void AddLogCallback(discordpp::Client::LogCallback callback, discordpp::LoggingSeverity minSeverity)
Adds a callback function to be invoked for each new log message generated by the SDK.
void ProvisionalUserMergeCompleted(bool success)
Some functions don't work for provisional accounts, and require the user merge their account into a f...
void AcceptDiscordFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Accepts an incoming Discord friend request from the target user.
void SendDiscordFriendRequestById(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Sends a Discord friend request to the target user.
void SendGameFriendRequest(std::string const &username, discordpp::Client::SendFriendRequestCallback cb)
Sends (or accepts) a game friend request to the target user.
void SendActivityInvite(uint64_t userId, std::string const &content, discordpp::Client::SendActivityInviteCallback cb)
Sends a Discord activity invite to the specified user.
std::function< void(std::vector< discordpp::AudioDevice > devices)> GetInputDevicesCallback
Callback function for Client::GetInputDevices.
Definition discordpp.h:3132
void GetTokenFromDeviceProvisionalMerge(discordpp::DeviceAuthorizationArgs args, discordpp::AuthenticationExternalAuthType externalAuthType, std::string const &externalAuthToken, discordpp::Client::TokenExchangeCallback callback)
This function is a combination of Client::Authorize and Client::GetTokenFromProvisionalMerge,...
bool IsAuthenticated()
Returns true if the SDK has a non-empty OAuth2 token set, regardless of whether that token is valid o...
static const Client nullobj
Uninitialized instance of Client.
Definition discordpp.h:3372
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:1621
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:1641
void SetClientId(uint64_t ClientId)
Setter for DeviceAuthorizationArgs::ClientId.
void SetScopes(std::string Scopes)
Setter for DeviceAuthorizationArgs::Scopes.
DeviceAuthorizationArgs & operator=(const DeviceAuthorizationArgs &arg0)
Copy assignment operator for DeviceAuthorizationArgs.
std::string Scopes() const
Scopes is a space separated string of the oauth scopes your game is requesting.
DeviceAuthorizationArgs & operator=(DeviceAuthorizationArgs &&other) noexcept
Move assignment operator for DeviceAuthorizationArgs.
void SetIsLinkable(bool IsLinkable)
Setter for GuildChannel::IsLinkable.
bool IsViewableAndWriteableByAllMembers() const
Whether the channel is "fully public" which means every member of the guild is able to view and send ...
std::optional< discordpp::LinkedLobby > LinkedLobby() const
Information about the currently linked lobby, if any. Currently Discord enforces that a channel can o...
uint64_t Id() const
The id of the channel.
void SetName(std::string Name)
Setter for GuildChannel::Name.
GuildChannel(const GuildChannel &arg0)
Copy constructor for GuildChannel.
void SetId(uint64_t Id)
Setter for GuildChannel::Id.
std::string Name() const
The name of the channel.
GuildChannel & operator=(const GuildChannel &arg0)
Copy assignment operator for GuildChannel.
GuildChannel & operator=(GuildChannel &&other) noexcept
Move assignment operator for GuildChannel.
GuildChannel(GuildChannel &&other) noexcept
Move constructor for GuildChannel.
bool IsLinkable() const
Whether the current user is able to link this channel to a lobby.
void SetLinkedLobby(std::optional< discordpp::LinkedLobby > LinkedLobby)
Setter for GuildChannel::LinkedLobby.
void SetIsViewableAndWriteableByAllMembers(bool IsViewableAndWriteableByAllMembers)
Setter for GuildChannel::IsViewableAndWriteableByAllMembers.
static const GuildChannel nullobj
Uninitialized instance of GuildChannel.
Definition discordpp.h:2117
void SetName(std::string Name)
Setter for GuildMinimal::Name.
std::string Name() const
The name of the guild.
void SetId(uint64_t Id)
Setter for GuildMinimal::Id.
static const GuildMinimal nullobj
Uninitialized instance of GuildMinimal.
Definition discordpp.h:2072
GuildMinimal & operator=(GuildMinimal &&other) noexcept
Move assignment operator for GuildMinimal.
GuildMinimal & operator=(const GuildMinimal &arg0)
Copy assignment operator for GuildMinimal.
GuildMinimal(const GuildMinimal &arg0)
Copy constructor for GuildMinimal.
GuildMinimal(GuildMinimal &&other) noexcept
Move constructor for GuildMinimal.
uint64_t Id() const
The id of the guild.
Struct that stores information about the channel that a lobby is linked to.
Definition discordpp.h:2225
uint64_t GuildId() const
The id of the guild (aka server) that owns the linked channel.
void SetName(std::string Name)
Setter for LinkedChannel::Name.
LinkedChannel & operator=(LinkedChannel &&other) noexcept
Move assignment operator for LinkedChannel.
LinkedChannel & operator=(const LinkedChannel &arg0)
Copy assignment operator for LinkedChannel.
std::string Name() const
The name of the linked channel.
void SetGuildId(uint64_t GuildId)
Setter for LinkedChannel::GuildId.
static const LinkedChannel nullobj
Uninitialized instance of LinkedChannel.
Definition discordpp.h:2244
LinkedChannel(const LinkedChannel &arg0)
Copy constructor for LinkedChannel.
void SetId(uint64_t Id)
Setter for LinkedChannel::Id.
uint64_t Id() const
The id of the linked channel.
LinkedChannel(LinkedChannel &&other) noexcept
Move constructor for LinkedChannel.
Struct that stores information about the lobby linked to a channel.
Definition discordpp.h:2179
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:2198
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:2634
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:2653
LobbyHandle & operator=(const LobbyHandle &other)
Copy assignment operator for LobbyHandle.
std::optional< discordpp::CallInfoHandle > GetCallInfoHandle() const
Returns a reference to the CallInfoHandle if there is an active voice call in this lobby.
std::unordered_map< std::string, std::string > Metadata() const
Returns any developer supplied metadata for this lobby.
std::optional< discordpp::LobbyMemberHandle > GetLobbyMemberHandle(uint64_t memberId) const
Returns a reference to the LobbyMemberHandle for the given user ID, if they are a member of this lobb...
LobbyHandle(const LobbyHandle &other)
Copy constructor for LobbyHandle.
std::vector< discordpp::LobbyMemberHandle > LobbyMembers() const
Returns a list of the LobbyMemberHandle objects for each member of this lobby.
uint64_t Id() const
Returns the id of the lobby.
std::vector< uint64_t > LobbyMemberIds() const
Returns a list of the user IDs that are members of this lobby.
LobbyHandle & operator=(LobbyHandle &&other) noexcept
Move assignment operator for LobbyHandle.
A LobbyMemberHandle represents the state of a single user in a Lobby.
Definition discordpp.h:2491
LobbyMemberHandle & operator=(const LobbyMemberHandle &other)
Copy assignment operator for LobbyMemberHandle.
static const LobbyMemberHandle nullobj
Uninitialized instance of LobbyMemberHandle.
Definition discordpp.h:2510
uint64_t Id() const
The user id of the lobby member.
LobbyMemberHandle(const LobbyMemberHandle &other)
Copy constructor for LobbyMemberHandle.
bool Connected() const
Returns true if the user is currently connected to the lobby.
LobbyMemberHandle & operator=(LobbyMemberHandle &&other) noexcept
Move assignment operator for LobbyMemberHandle.
std::optional< discordpp::UserHandle > User() const
The UserHandle of the lobby member.
bool CanLinkLobby() const
Returns true if the user is allowed to link a channel to this lobby.
LobbyMemberHandle(LobbyMemberHandle &&other) noexcept
Move constructor for LobbyMemberHandle.
std::unordered_map< std::string, std::string > Metadata() const
Metadata is a set of string key/value pairs that the game developer can use.
A MessageHandle represents a single message received by the SDK.
Definition discordpp.h:2810
uint64_t AuthorId() const
Returns the user ID of the user who sent this message.
std::optional< discordpp::ChannelHandle > Channel() const
Returns the ChannelHandle for the channel this message was sent in.
static const MessageHandle nullobj
Uninitialized instance of MessageHandle.
Definition discordpp.h:2829
std::optional< discordpp::UserHandle > Recipient() const
Returns the UserHandle for the other participant in a DM, if this message was sent in a DM.
std::optional< uint64_t > ApplicationId() const
Returns the application ID associated with this message, if any. You can use this to identify if the ...
MessageHandle & operator=(const MessageHandle &other)
Copy assignment operator for MessageHandle.
uint64_t Id() const
Returns the ID of this message.
std::optional< discordpp::UserHandle > Author() const
Returns the UserHandle for the author of this message.
MessageHandle & operator=(MessageHandle &&other) noexcept
Move assignment operator for MessageHandle.
uint64_t EditedTimestamp() const
The timestamp in millis since the epoch when the message was most recently edited.
MessageHandle(const MessageHandle &other)
Copy constructor for MessageHandle.
std::string Content() const
Returns the content of this message, if any.
std::unordered_map< std::string, std::string > Metadata() const
Returns any metadata the developer included with this message.
std::string RawContent() const
Returns the content of this message, if any, but without replacing any markup from emojis and mention...
std::optional< discordpp::LobbyHandle > Lobby() const
Returns the LobbyHandle this message was sent in, if it was sent in a lobby.
uint64_t RecipientId() const
When this message was sent in a DM or Ephemeral DM, this method will return the ID of the other user ...
uint64_t SentTimestamp() const
The timestamp in millis since the epoch when the message was sent.
std::optional< discordpp::DisclosureTypes > DisclosureType() const
If this is an auto-generated message that is explaining some integration behavior to users,...
uint64_t ChannelId() const
Returns the channel ID this message was sent in.
MessageHandle(MessageHandle &&other) noexcept
Move constructor for MessageHandle.
bool SentFromGame() const
Returns true if this message was sent in-game, otherwise false (i.e. from Discord itself)....
std::optional< discordpp::AdditionalContent > AdditionalContent() const
If the message contains non-text content, such as images, videos, embeds, polls, etc,...
A RelationshipHandle represents the relationship between the current user and a target user on Discor...
Definition discordpp.h:2307
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:2326
bool IsSpamRequest() const
Returns whether this relationship is a spam request.
std::optional< discordpp::UserHandle > User() const
Returns a handle to the target user in this relationship, if one is available. This would be the user...
RelationshipHandle & operator=(RelationshipHandle &&other) noexcept
Move assignment operator for RelationshipHandle.
A UserHandle represents a single user on Discord that the SDK knows about and contains basic account ...
Definition discordpp.h:2366
uint64_t Id() const
Returns the ID of this user.
UserHandle & operator=(UserHandle &&other) noexcept
Move assignment operator for UserHandle.
std::string Username() const
Returns the globally unique username of this user.
static const UserHandle nullobj
Uninitialized instance of UserHandle.
Definition discordpp.h:2400
std::optional< std::string > Avatar() const
Returns the hash of the user's Discord profile avatar, if one is set.
UserHandle(const UserHandle &arg0)
Copy constructor for UserHandle.
discordpp::StatusType Status() const
Returns the user's online/offline/idle status.
UserHandle(UserHandle &&other) noexcept
Move constructor for UserHandle.
std::string AvatarUrl(discordpp::UserHandle::AvatarType animatedType, discordpp::UserHandle::AvatarType staticType) const
Returns a CDN url to the user's Discord profile avatar.
AvatarType
The desired type of avatar url to generate for a User.
Definition discordpp.h:2374
@ Jpeg
Jpeg.
Definition discordpp.h:2386
@ Gif
Gif.
Definition discordpp.h:2377
@ Webp
Webp.
Definition discordpp.h:2380
@ Png
Png.
Definition discordpp.h:2383
bool IsProvisional() const
Returns true if this user is a provisional account.
std::optional< std::string > GlobalName() const
Returns the preferred display name of this user, if one is set.
std::optional< discordpp::Activity > GameActivity() const
Returns the user's rich presence activity that is associated with the current game,...
UserHandle & operator=(const UserHandle &arg0)
Copy assignment operator for UserHandle.
static std::string AvatarTypeToString(discordpp::UserHandle::AvatarType type)
Converts the AvatarType enum to a string.
std::string DisplayName() const
Returns the user's preferred name, if one is set, otherwise returns their unique username.
discordpp::RelationshipHandle Relationship() const
Returns a reference to the RelationshipHandle between the currently authenticated user and this user,...
Settings for the void auto detection threshold for picking up activity from a user's mic.
Definition discordpp.h:1731
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:1750
bool Automatic() const
Whether or not Discord is currently automatically setting and detecting the appropriate threshold to ...
float VadThreshold() const
The current void auto detection threshold value, has a range of -100, 0 and defaults to -60.
void SetAutomatic(bool Automatic)
Setter for VADThresholdSettings::Automatic.
void SetVadThreshold(float VadThreshold)
Setter for VADThresholdSettings::VadThreshold.
A VoiceStateHandle represents the state of a single participant in a Discord voice call.
Definition discordpp.h:1689
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:1708
bool SelfDeaf() const
Returns true if the given user has deafened themselves so that no one else in the call can hear them ...
VoiceStateHandle(VoiceStateHandle &&other) noexcept
Move constructor for VoiceStateHandle.
VoiceStateHandle & operator=(const VoiceStateHandle &other)
Copy assignment operator for VoiceStateHandle.
VoiceStateHandle(const VoiceStateHandle &other)
Copy constructor for VoiceStateHandle.
The namespace for the generated Discord SDK bindings.
Definition discordpp.h:16
ActivityPartyPrivacy
Allows your game to control the privacy of the party the user is in.
Definition discordpp.h:51
@ Public
The party is public, which means that the user is in a party which could be joinable by either friend...
Definition discordpp.h:65
@ Private
The party is private (or unknown), which means that the user is in a party but it is not joinable wit...
Definition discordpp.h:59
DisclosureTypes
Enum that represents various informational disclosures that Discord may make to users,...
Definition discordpp.h:558
@ MessageDataVisibleOnDiscord
This disclosure type happens the first time a user sends a message in game, and that message will be ...
Definition discordpp.h:564
const char * EnumToString(discordpp::ActivityActionTypes value)
Converts a discordpp::ActivityActionTypes to a string.
Definition discordpp.h:4881
HttpStatusCode
Enum that represents the various HTTP status codes that can be returned.
Definition discordpp.h:189
@ RequestHeaderFieldsTooLarge
RequestHeaderFieldsTooLarge.
Definition discordpp.h:336
@ PayloadTooLarge
PayloadTooLarge.
Definition discordpp.h:297
@ MultiStatus
MultiStatus.
Definition discordpp.h:228
@ VariantAlsoNegotiates
VariantAlsoNegotiates.
Definition discordpp.h:357
@ Gone
Gone.
Definition discordpp.h:288
@ BadGateway
BadGateway.
Definition discordpp.h:345
@ Created
Created.
Definition discordpp.h:210
@ TemporaryRedirect
TemporaryRedirect.
Definition discordpp.h:252
@ ServiceUnavailable
ServiceUnavailable.
Definition discordpp.h:348
@ MovedPermanently
MovedPermanently.
Definition discordpp.h:240
@ PreconditionFailed
PreconditionFailed.
Definition discordpp.h:294
@ RequestTimeout
RequestTimeout.
Definition discordpp.h:282
@ Accepted
Accepted.
Definition discordpp.h:213
@ NonAuthoritativeInfo
NonAuthoritativeInfo.
Definition discordpp.h:216
@ NotFound
NotFound.
Definition discordpp.h:270
@ FailedDependency
FailedDependency.
Definition discordpp.h:321
@ PaymentRequired
PaymentRequired.
Definition discordpp.h:264
@ PreconditionRequired
PreconditionRequired.
Definition discordpp.h:330
@ ResetContent
ResetContent.
Definition discordpp.h:222
@ SwitchingProtocols
SwitchingProtocols.
Definition discordpp.h:198
@ HttpVersionNotSupported
HttpVersionNotSupported.
Definition discordpp.h:354
@ Found
Found.
Definition discordpp.h:243
@ Processing
Processing.
Definition discordpp.h:201
@ None
None.
Definition discordpp.h:192
@ ExpectationFailed
ExpectationFailed.
Definition discordpp.h:309
@ Forbidden
Forbidden.
Definition discordpp.h:267
@ PartialContent
PartialContent.
Definition discordpp.h:225
@ SeeOther
SeeOther.
Definition discordpp.h:246
@ EarlyHints
EarlyHints.
Definition discordpp.h:204
@ LengthRequired
LengthRequired.
Definition discordpp.h:291
@ MethodNotAllowed
MethodNotAllowed.
Definition discordpp.h:273
@ NotExtended
NotExtended.
Definition discordpp.h:366
@ RangeNotSatisfiable
RangeNotSatisfiable.
Definition discordpp.h:306
@ NotImplemented
NotImplemented.
Definition discordpp.h:342
@ BadRequest
BadRequest.
Definition discordpp.h:258
@ Continue
Continue.
Definition discordpp.h:195
@ LoopDetected
LoopDetected.
Definition discordpp.h:363
@ UnsupportedMediaType
UnsupportedMediaType.
Definition discordpp.h:303
@ NetworkAuthorizationRequired
NetworkAuthorizationRequired.
Definition discordpp.h:369
@ ImUsed
ImUsed.
Definition discordpp.h:234
@ MultipleChoices
MultipleChoices.
Definition discordpp.h:237
@ Ok
Ok.
Definition discordpp.h:207
@ TooManyRequests
TooManyRequests.
Definition discordpp.h:333
@ ProxyAuthRequired
ProxyAuthRequired.
Definition discordpp.h:279
@ UnprocessableEntity
UnprocessableEntity.
Definition discordpp.h:315
@ MisdirectedRequest
MisdirectedRequest.
Definition discordpp.h:312
@ PermanentRedirect
PermanentRedirect.
Definition discordpp.h:255
@ NotModified
NotModified.
Definition discordpp.h:249
@ AlreadyReported
AlreadyReported.
Definition discordpp.h:231
@ NoContent
NoContent.
Definition discordpp.h:219
@ Locked
Locked.
Definition discordpp.h:318
@ GatewayTimeout
GatewayTimeout.
Definition discordpp.h:351
@ Unauthorized
Unauthorized.
Definition discordpp.h:261
@ UpgradeRequired
UpgradeRequired.
Definition discordpp.h:327
@ InsufficientStorage
InsufficientStorage.
Definition discordpp.h:360
@ InternalServerError
InternalServerError.
Definition discordpp.h:339
@ TooEarly
TooEarly.
Definition discordpp.h:324
@ Conflict
Conflict.
Definition discordpp.h:285
@ UriTooLong
UriTooLong.
Definition discordpp.h:300
@ NotAcceptable
NotAcceptable.
Definition discordpp.h:276
AuthorizationTokenType
Represents the type of auth token used by the SDK, either the normal tokens produced by the Discord d...
Definition discordpp.h:569
@ Bearer
Bearer.
Definition discordpp.h:575
@ User
User.
Definition discordpp.h:572
ChannelType
Enum that represents the various channel types on Discord.
Definition discordpp.h:442
@ GuildForum
GuildForum.
Definition discordpp.h:481
@ Dm
Dm.
Definition discordpp.h:448
@ Lobby
Lobby.
Definition discordpp.h:487
@ GuildNews
GuildNews.
Definition discordpp.h:460
@ GuildVoice
GuildVoice.
Definition discordpp.h:451
@ GuildPublicThread
GuildPublicThread.
Definition discordpp.h:469
@ GuildNewsThread
GuildNewsThread.
Definition discordpp.h:466
@ GuildDirectory
GuildDirectory.
Definition discordpp.h:478
@ GuildCategory
GuildCategory.
Definition discordpp.h:457
@ GuildStageVoice
GuildStageVoice.
Definition discordpp.h:475
@ GuildMedia
GuildMedia.
Definition discordpp.h:484
@ GuildStore
GuildStore.
Definition discordpp.h:463
@ GuildText
GuildText.
Definition discordpp.h:445
@ GroupDm
GroupDm.
Definition discordpp.h:454
@ EphemeralDm
EphemeralDm.
Definition discordpp.h:490
@ GuildPrivateThread
GuildPrivateThread.
Definition discordpp.h:472
AuthenticationCodeChallengeMethod
Represents the crypto method used to generate a code challenge.
Definition discordpp.h:375
@ S256
S256.
Definition discordpp.h:378
RelationshipType
Enum that represents the possible types of relationships that can exist between two users.
Definition discordpp.h:494
@ PendingIncoming
The current user has received a friend request from the target user, but it is not yet accepted.
Definition discordpp.h:509
@ Implicit
The Implicit type is documented for visibility, but should be unused in the SDK.
Definition discordpp.h:516
@ Suggestion
The Suggestion type is documented for visibility, but should be unused in the SDK.
Definition discordpp.h:519
@ PendingOutgoing
The current user has sent a friend request to the target user, but it is not yet accepted.
Definition discordpp.h:513
@ Blocked
The current user has blocked the target user, and so certain actions such as sending messages between...
Definition discordpp.h:504
@ None
The user has no relationship with the other user.
Definition discordpp.h:497
@ Friend
The user is friends with the other user.
Definition discordpp.h:500
AuthenticationExternalAuthType
Represents the various identity providers that can be used to authenticate a provisional account user...
Definition discordpp.h:580
@ EpicOnlineServicesIdToken
EpicOnlineServicesIdToken.
Definition discordpp.h:589
@ EpicOnlineServicesAccessToken
EpicOnlineServicesAccessToken.
Definition discordpp.h:586
@ SteamSessionTicket
SteamSessionTicket.
Definition discordpp.h:592
@ OIDC
OIDC.
Definition discordpp.h:583
@ UnityServicesIdToken
UnityServicesIdToken.
Definition discordpp.h:595
LoggingSeverity
Enum that represents the various log levels supported by the SDK.
Definition discordpp.h:599
@ Warning
Warning.
Definition discordpp.h:608
@ Info
Info.
Definition discordpp.h:605
@ None
None.
Definition discordpp.h:614
@ Error
Error.
Definition discordpp.h:611
@ Verbose
Verbose.
Definition discordpp.h:602
RelationshipGroupType
Enum that represents the logical groups of relationships based on online status and game activity.
Definition discordpp.h:619
@ OnlinePlayingGame
Users who are online and currently playing the game.
Definition discordpp.h:622
@ Offline
Users who are offline.
Definition discordpp.h:628
@ OnlineElsewhere
Users who are online but not playing the game.
Definition discordpp.h:625
IntegrationType
Represents the type of integration the app will be installed as.
Definition discordpp.h:382
@ GuildInstall
GuildInstall.
Definition discordpp.h:385
@ UserInstall
UserInstall.
Definition discordpp.h:388
AudioSystem
The Discord Voice audio system to use.
Definition discordpp.h:417
@ Game
Use the game audio system.
Definition discordpp.h:423
@ Standard
Use the standard audio system.
Definition discordpp.h:420
ActivityGamePlatforms
Represents the type of platforms that an activity invite can be accepted on.
Definition discordpp.h:99
@ Embedded
Embedded.
Definition discordpp.h:117
@ Xbox
Xbox.
Definition discordpp.h:105
@ Desktop
Desktop.
Definition discordpp.h:102
@ Samsung
Samsung.
Definition discordpp.h:108
@ PS5
PS5.
Definition discordpp.h:123
@ PS4
PS4.
Definition discordpp.h:120
@ IOS
IOS.
Definition discordpp.h:111
@ Android
Android.
Definition discordpp.h:114
ActivityTypes
Discord RichPresence supports multiple types of activities that a user can be doing.
Definition discordpp.h:74
@ Watching
Watching.
Definition discordpp.h:86
@ Competing
Competing.
Definition discordpp.h:92
@ HangStatus
HangStatus.
Definition discordpp.h:95
@ Listening
Listening.
Definition discordpp.h:83
@ Streaming
Streaming.
Definition discordpp.h:80
@ CustomStatus
CustomStatus.
Definition discordpp.h:89
@ Playing
Playing.
Definition discordpp.h:77
StatusType
Enum that specifies the various online statuses for a user.
Definition discordpp.h:526
@ Blocked
Blocked.
Definition discordpp.h:535
@ Online
The user is online and recently active.
Definition discordpp.h:529
@ Dnd
The user is online, but wishes to suppress notifications for the time being.
Definition discordpp.h:542
@ Unknown
Unknown.
Definition discordpp.h:551
@ Invisible
The user is online, but wishes to appear as if they are offline to other users.
Definition discordpp.h:545
@ Offline
The user is offline and not connected to Discord.
Definition discordpp.h:532
@ Streaming
The user is online and is actively streaming content.
Definition discordpp.h:548
@ Idle
The user is online, but has not been active for a while and may be away from their computer.
Definition discordpp.h:539
void RunCallbacks()
Definition discordpp.h:29
AudioModeType
Represents whether a voice call is using push to talk or auto voice detection.
Definition discordpp.h:427
@ MODE_PTT
MODE_PTT.
Definition discordpp.h:436
@ MODE_VAD
MODE_VAD.
Definition discordpp.h:433
@ MODE_UNINIT
MODE_UNINIT.
Definition discordpp.h:430
ErrorType
Enum representing various types of errors the SDK returns.
Definition discordpp.h:127
@ HTTPError
An HTTP call was made to Discord's servers but a non success HTTP status code was returned....
Definition discordpp.h:142
@ NetworkError
The user is offline or there was some network issue that prevented an underlying HTTP call from succe...
Definition discordpp.h:134
@ AuthorizationFailed
An authorization function failed, but not necessarily as the result of an HTTP call that returned an ...
Definition discordpp.h:176
@ ClientNotReady
An operation such as sending a friend request or joining a lobby was attempted but the Client is not ...
Definition discordpp.h:152
@ None
No error, the operation was successful.
Definition discordpp.h:130
@ Aborted
The user or developer aborted an operation, such as an authorization flow.
Definition discordpp.h:171
@ RPCError
An RPC call was made to Discord's desktop application, but it returned a non-success result....
Definition discordpp.h:181
@ ValidationError
Used when an SDK method is called but the inputs don't pass local validation. For example if one atte...
Definition discordpp.h:168
@ ClientDestroyed
The Client has been destroyed and so this operation cannot complete.
Definition discordpp.h:158
@ Disabled
An operation was temporarily disabled for stability reasons.
Definition discordpp.h:155
DiscordObjectState
Represents the memory state of a Discord object.
Definition discordpp.h:19
@ Invalid
The object has been freed.
Definition discordpp.h:21
@ Owned
The object is owned by the C++ wrapper and methods can be called on it.
Definition discordpp.h:23
AdditionalContentType
Represents the type of additional content contained in a message.
Definition discordpp.h:392
@ Sticker
Sticker.
Definition discordpp.h:413
@ VoiceMessage
VoiceMessage.
Definition discordpp.h:404
@ Other
Other.
Definition discordpp.h:395
@ Poll
Poll.
Definition discordpp.h:401
@ Thread
Thread.
Definition discordpp.h:407
@ Attachment
Attachment.
Definition discordpp.h:398
@ Embed
Embed.
Definition discordpp.h:410
ActivityActionTypes
ActivityActionTypes represents the type of invite being sent to a user.
Definition discordpp.h:41
@ Join
Join.
Definition discordpp.h:44
@ JoinRequest
JoinRequest.
Definition discordpp.h:47