Discord Social SDK
Loading...
Searching...
No Matches
discordpp.h
1// Generated with <3 by Discord.Sdk.Derive
2#ifndef DISCORD_HEADER_DISCORDPP_H_
3#define DISCORD_HEADER_DISCORDPP_H_
4#include "cdiscord.h"
5#include <atomic>
6#include <cassert>
7#include <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
102
104 Name = 0,
105
107 State = 1,
108
111};
112
115
118
120 Xbox = 2,
121
124
126 IOS = 8,
127
130
133
135 PS4 = 64,
136
138 PS5 = 128,
139};
140
142enum class ErrorType {
143
145 None = 0,
146
150
158
168
171
174
184
187
192
197};
198
204enum class HttpStatusCode {
205
207 None = 0,
208
210 Continue = 100,
211
214
217
220
222 Ok = 200,
223
225 Created = 201,
226
228 Accepted = 202,
229
232
235
238
241
244
247
249 ImUsed = 209,
250
253
256
258 Found = 302,
259
261 SeeOther = 303,
262
265
268
271
274
277
280
283
285 NotFound = 404,
286
289
292
295
298
300 Conflict = 409,
301
303 Gone = 410,
304
307
310
313
316
319
322
325
328
331
333 Locked = 423,
334
337
339 TooEarly = 425,
340
343
346
349
352
355
358
361
364
367
370
373
376
379
382
385};
386
391
393 S256 = 0,
394};
395
397enum class IntegrationType {
398
401
404};
405
408
410 Other = 0,
411
414
416 Poll = 2,
417
420
423
425 Embed = 5,
426
429};
430
432enum class AudioSystem {
433
436
438 Game = 1,
439};
440
442enum class AudioModeType {
443
446
449
452};
453
457enum class ChannelType {
458
461
463 Dm = 1,
464
467
470
473
476
479
482
485
488
491
494
497
500
502 Lobby = 17,
503
506};
507
510
512 None = 0,
513
516
520
525
529
532
535};
536
541enum class StatusType {
542
545
548
551
554 Idle = 3,
555
557 Dnd = 4,
558
561
564
567};
568
581
585
587 User = 0,
588
591};
592
612
614enum class LoggingSeverity {
615
618
620 Info = 2,
621
624
626 Error = 4,
627
629 None = 5,
630};
631
645class ActivityInvite;
646class ActivityAssets;
647class ActivityTimestamps;
648class ActivityParty;
649class ActivitySecrets;
650class ActivityButton;
651class Activity;
652class ClientResult;
653class AuthorizationCodeChallenge;
654class AuthorizationCodeVerifier;
655class AuthorizationArgs;
656class DeviceAuthorizationArgs;
657class VoiceStateHandle;
658class VADThresholdSettings;
659class Call;
660class ChannelHandle;
661class GuildMinimal;
662class GuildChannel;
663class LinkedLobby;
664class LinkedChannel;
665class RelationshipHandle;
666class UserHandle;
667class LobbyMemberHandle;
668class LobbyHandle;
669class AdditionalContent;
670class MessageHandle;
671class AudioDevice;
672class UserMessageSummary;
673class ClientCreateOptions;
674class Client;
675class CallInfoHandle;
676
682 mutable Discord_ActivityInvite instance_{};
685
686public:
688 Discord_ActivityInvite* instance() const { return &instance_; }
691 explicit ActivityInvite(Discord_ActivityInvite instance, DiscordObjectState state);
701 operator bool() const { return state_ != DiscordObjectState::Invalid; }
702
707
708 explicit ActivityInvite();
709
711 void Drop();
713
715 uint64_t SenderId() const;
717 void SetSenderId(uint64_t SenderId);
718
720 uint64_t ChannelId() const;
722 void SetChannelId(uint64_t ChannelId);
723
725 uint64_t MessageId() const;
727 void SetMessageId(uint64_t MessageId);
728
733
735 uint64_t ApplicationId() const;
738
741 uint64_t ParentApplicationId() const;
744
746 std::string PartyId() const;
748 void SetPartyId(std::string PartyId);
749
751 std::string SessionId() const;
753 void SetSessionId(std::string SessionId);
754
757 bool IsValid() const;
759 void SetIsValid(bool IsValid);
760};
761
780 mutable Discord_ActivityAssets instance_{};
783
784public:
786 Discord_ActivityAssets* instance() const { return &instance_; }
789 explicit ActivityAssets(Discord_ActivityAssets instance, DiscordObjectState state);
799 operator bool() const { return state_ != DiscordObjectState::Invalid; }
800
805
806 explicit ActivityAssets();
807
809 void Drop();
811
816 std::optional<std::string> LargeImage() const;
818 void SetLargeImage(std::optional<std::string> LargeImage);
819
823 std::optional<std::string> LargeText() const;
825 void SetLargeText(std::optional<std::string> LargeText);
826
830 std::optional<std::string> LargeUrl() const;
832 void SetLargeUrl(std::optional<std::string> LargeUrl);
833
837 std::optional<std::string> SmallImage() const;
839 void SetSmallImage(std::optional<std::string> SmallImage);
840
844 std::optional<std::string> SmallText() const;
846 void SetSmallText(std::optional<std::string> SmallText);
847
851 std::optional<std::string> SmallUrl() const;
853 void SetSmallUrl(std::optional<std::string> SmallUrl);
854};
855
859 mutable Discord_ActivityTimestamps instance_{};
862
863public:
865 Discord_ActivityTimestamps* instance() const { return &instance_; }
868 explicit ActivityTimestamps(Discord_ActivityTimestamps instance, DiscordObjectState state);
878 operator bool() const { return state_ != DiscordObjectState::Invalid; }
879
884
885 explicit ActivityTimestamps();
886
888 void Drop();
890
896 uint64_t Start() const;
898 void SetStart(uint64_t Start);
899
905 uint64_t End() const;
907 void SetEnd(uint64_t End);
908};
909
913 mutable Discord_ActivityParty instance_{};
916
917public:
919 Discord_ActivityParty* instance() const { return &instance_; }
922 explicit ActivityParty(Discord_ActivityParty instance, DiscordObjectState state);
926 ActivityParty(ActivityParty&& other) noexcept;
930 static const ActivityParty nullobj;
932 operator bool() const { return state_ != DiscordObjectState::Invalid; }
933
938
939 explicit ActivityParty();
940
942 void Drop();
944
951 std::string Id() const;
953 void SetId(std::string Id);
954
956 int32_t CurrentSize() const;
959
962 int32_t MaxSize() const;
964 void SetMaxSize(int32_t MaxSize);
965
970};
971
975 mutable Discord_ActivitySecrets instance_{};
978
979public:
981 Discord_ActivitySecrets* instance() const { return &instance_; }
984 explicit ActivitySecrets(Discord_ActivitySecrets instance, DiscordObjectState state);
994 operator bool() const { return state_ != DiscordObjectState::Invalid; }
995
1000
1001 explicit ActivitySecrets();
1002
1004 void Drop();
1006
1011 std::string Join() const;
1013 void SetJoin(std::string Join);
1014};
1015
1019 mutable Discord_ActivityButton instance_{};
1022
1023public:
1025 Discord_ActivityButton* instance() const { return &instance_; }
1028 explicit ActivityButton(Discord_ActivityButton instance, DiscordObjectState state);
1038 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1039
1044
1045 explicit ActivityButton();
1046
1048 void Drop();
1050
1052 std::string Label() const;
1054 void SetLabel(std::string Label);
1055
1057 std::string Url() const;
1059 void SetUrl(std::string Url);
1060};
1061
1244 mutable Discord_Activity instance_{};
1247
1248public:
1250 Discord_Activity* instance() const { return &instance_; }
1253 explicit Activity(Discord_Activity instance, DiscordObjectState state);
1254 ~Activity();
1257 Activity(Activity&& other) noexcept;
1259 Activity& operator=(Activity&& other) noexcept;
1261 static const Activity nullobj;
1263 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1264
1266 Activity(const Activity& arg0);
1269
1270 explicit Activity();
1271
1273 void Drop();
1275
1278
1280 bool Equals(discordpp::Activity other) const;
1281
1283 std::vector<discordpp::ActivityButton> GetButtons() const;
1284
1288 std::string Name() const;
1290 void SetName(std::string Name);
1291
1298
1302 std::optional<discordpp::StatusDisplayTypes> StatusDisplayType() const;
1304 void SetStatusDisplayType(std::optional<discordpp::StatusDisplayTypes> StatusDisplayType);
1305
1310 std::optional<std::string> State() const;
1312 void SetState(std::optional<std::string> State);
1313
1318 std::optional<std::string> StateUrl() const;
1320 void SetStateUrl(std::optional<std::string> StateUrl);
1321
1326 std::optional<std::string> Details() const;
1328 void SetDetails(std::optional<std::string> Details);
1329
1334 std::optional<std::string> DetailsUrl() const;
1336 void SetDetailsUrl(std::optional<std::string> DetailsUrl);
1337
1342 std::optional<uint64_t> ApplicationId() const;
1344 void SetApplicationId(std::optional<uint64_t> ApplicationId);
1345
1351 std::optional<uint64_t> ParentApplicationId() const;
1353 void SetParentApplicationId(std::optional<uint64_t> ParentApplicationId);
1354
1356 std::optional<discordpp::ActivityAssets> Assets() const;
1358 void SetAssets(std::optional<discordpp::ActivityAssets> Assets);
1359
1363 std::optional<discordpp::ActivityTimestamps> Timestamps() const;
1365 void SetTimestamps(std::optional<discordpp::ActivityTimestamps> Timestamps);
1366
1369 std::optional<discordpp::ActivityParty> Party() const;
1371 void SetParty(std::optional<discordpp::ActivityParty> Party);
1372
1375 std::optional<discordpp::ActivitySecrets> Secrets() const;
1377 void SetSecrets(std::optional<discordpp::ActivitySecrets> Secrets);
1378
1387};
1388
1400 mutable Discord_ClientResult instance_{};
1403
1404public:
1406 Discord_ClientResult* instance() const { return &instance_; }
1409 explicit ClientResult(Discord_ClientResult instance, DiscordObjectState state);
1410 ~ClientResult();
1413 ClientResult(ClientResult&& other) noexcept;
1417 static const ClientResult nullobj;
1419 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1420
1425
1427 void Drop();
1429
1431 std::string ToString() const;
1432
1437
1439 std::string Error() const;
1441 void SetError(std::string Error);
1442
1451 int32_t ErrorCode() const;
1454
1461
1469 std::string ResponseBody() const;
1472
1474 bool Successful() const;
1477
1479 bool Retryable() const;
1482
1485 float RetryAfter() const;
1488};
1489
1493 mutable Discord_AuthorizationCodeChallenge instance_{};
1496
1497public:
1499 Discord_AuthorizationCodeChallenge* instance() const { return &instance_; }
1502 explicit AuthorizationCodeChallenge(Discord_AuthorizationCodeChallenge instance,
1503 DiscordObjectState state);
1513 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1514
1519
1520 explicit AuthorizationCodeChallenge();
1521
1523 void Drop();
1525
1530
1532 std::string Challenge() const;
1534 void SetChallenge(std::string Challenge);
1535};
1536
1540 mutable Discord_AuthorizationCodeVerifier instance_{};
1543
1544public:
1546 Discord_AuthorizationCodeVerifier* instance() const { return &instance_; }
1549 explicit AuthorizationCodeVerifier(Discord_AuthorizationCodeVerifier instance,
1550 DiscordObjectState state);
1560 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1561
1566
1568 void Drop();
1570
1575
1577 std::string Verifier() const;
1579 void SetVerifier(std::string Verifier);
1580};
1581
1585 mutable Discord_AuthorizationArgs instance_{};
1588
1589public:
1591 Discord_AuthorizationArgs* instance() const { return &instance_; }
1594 explicit AuthorizationArgs(Discord_AuthorizationArgs instance, DiscordObjectState state);
1604 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1605
1610
1611 explicit AuthorizationArgs();
1612
1614 void Drop();
1616
1619 uint64_t ClientId() const;
1621 void SetClientId(uint64_t ClientId);
1622
1635 std::string Scopes() const;
1637 void SetScopes(std::string Scopes);
1638
1644 std::optional<std::string> State() const;
1646 void SetState(std::optional<std::string> State);
1647
1652 std::optional<std::string> Nonce() const;
1654 void SetNonce(std::optional<std::string> Nonce);
1655
1661 std::optional<discordpp::AuthorizationCodeChallenge> CodeChallenge() const;
1663 void SetCodeChallenge(std::optional<discordpp::AuthorizationCodeChallenge> CodeChallenge);
1664
1668 std::optional<discordpp::IntegrationType> IntegrationType() const;
1670 void SetIntegrationType(std::optional<discordpp::IntegrationType> IntegrationType);
1671
1683 std::optional<std::string> CustomSchemeParam() const;
1685 void SetCustomSchemeParam(std::optional<std::string> CustomSchemeParam);
1686};
1687
1691 mutable Discord_DeviceAuthorizationArgs instance_{};
1694
1695public:
1697 Discord_DeviceAuthorizationArgs* instance() const { return &instance_; }
1700 explicit DeviceAuthorizationArgs(Discord_DeviceAuthorizationArgs instance,
1701 DiscordObjectState state);
1711 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1712
1717
1718 explicit DeviceAuthorizationArgs();
1719
1721 void Drop();
1723
1726 uint64_t ClientId() const;
1728 void SetClientId(uint64_t ClientId);
1729
1742 std::string Scopes() const;
1744 void SetScopes(std::string Scopes);
1745};
1746
1759 mutable Discord_VoiceStateHandle instance_{};
1762
1763public:
1765 Discord_VoiceStateHandle* instance() const { return &instance_; }
1768 explicit VoiceStateHandle(Discord_VoiceStateHandle instance, DiscordObjectState state);
1778 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1779
1784
1786 void Drop();
1788
1791 bool SelfDeaf() const;
1792
1795 bool SelfMute() const;
1796};
1797
1801 mutable Discord_VADThresholdSettings instance_{};
1804
1805public:
1807 Discord_VADThresholdSettings* instance() const { return &instance_; }
1810 explicit VADThresholdSettings(Discord_VADThresholdSettings instance, DiscordObjectState state);
1820 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1821
1824
1826 void Drop();
1828
1831 float VadThreshold() const;
1834
1837 bool Automatic() const;
1840};
1841
1843class Call {
1845 mutable Discord_Call instance_{};
1848
1849public:
1871
1873 enum class Status {
1874
1877
1880
1883
1886
1889
1892
1895 };
1896
1898 using OnVoiceStateChanged = std::function<void(uint64_t userId)>;
1899
1901 using OnParticipantChanged = std::function<void(uint64_t userId, bool added)>;
1902
1904 using OnSpeakingStatusChanged = std::function<void(uint64_t userId, bool isPlayingSound)>;
1905
1907 using OnStatusChanged = std::function<
1908 void(discordpp::Call::Status status, discordpp::Call::Error error, int32_t errorDetail)>;
1910 Discord_Call* instance() const { return &instance_; }
1913 explicit Call(Discord_Call instance, DiscordObjectState state);
1914 ~Call();
1917 Call(Call&& other) noexcept;
1919 Call& operator=(Call&& other) noexcept;
1921 static const Call nullobj;
1923 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1924
1926 Call(const Call& other);
1928 Call& operator=(const Call& other);
1929
1931 void Drop();
1933
1935 static std::string ErrorToString(discordpp::Call::Error type);
1936
1940
1942 uint64_t GetChannelId() const;
1943
1945 uint64_t GetGuildId() const;
1946
1948 bool GetLocalMute(uint64_t userId);
1949
1951 std::vector<uint64_t> GetParticipants() const;
1952
1957 float GetParticipantVolume(uint64_t userId);
1958
1962
1966
1969
1972
1977
1981
1987 std::optional<discordpp::VoiceStateHandle> GetVoiceStateHandle(uint64_t userId) const;
1988
1995
1999 void SetLocalMute(uint64_t userId, bool mute);
2000
2008
2011
2016 void SetParticipantVolume(uint64_t userId, float volume);
2017
2021 void SetPTTActive(bool active);
2022
2027 void SetPTTReleaseDelay(uint32_t releaseDelayMs);
2028
2032 void SetSelfDeaf(bool deaf);
2033
2036 void SetSelfMute(bool mute);
2037
2044
2048
2055 void SetVADThreshold(bool automatic, float threshold);
2056
2058 static std::string StatusToString(discordpp::Call::Status type);
2059};
2060
2072 mutable Discord_ChannelHandle instance_{};
2075
2076public:
2078 Discord_ChannelHandle* instance() const { return &instance_; }
2081 explicit ChannelHandle(Discord_ChannelHandle instance, DiscordObjectState state);
2085 ChannelHandle(ChannelHandle&& other) noexcept;
2091 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2092
2097
2099 void Drop();
2101
2103 uint64_t Id() const;
2104
2109 std::string Name() const;
2110
2113 std::vector<uint64_t> Recipients() const;
2114
2117};
2118
2123 mutable Discord_GuildMinimal instance_{};
2126
2127public:
2129 Discord_GuildMinimal* instance() const { return &instance_; }
2132 explicit GuildMinimal(Discord_GuildMinimal instance, DiscordObjectState state);
2133 ~GuildMinimal();
2136 GuildMinimal(GuildMinimal&& other) noexcept;
2140 static const GuildMinimal nullobj;
2142 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2143
2148
2150 void Drop();
2152
2154 uint64_t Id() const;
2156 void SetId(uint64_t Id);
2157
2159 std::string Name() const;
2161 void SetName(std::string Name);
2162};
2163
2168 mutable Discord_GuildChannel instance_{};
2171
2172public:
2174 Discord_GuildChannel* instance() const { return &instance_; }
2177 explicit GuildChannel(Discord_GuildChannel instance, DiscordObjectState state);
2178 ~GuildChannel();
2181 GuildChannel(GuildChannel&& other) noexcept;
2185 static const GuildChannel nullobj;
2187 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2188
2193
2195 void Drop();
2197
2199 uint64_t Id() const;
2201 void SetId(uint64_t Id);
2202
2204 std::string Name() const;
2206 void SetName(std::string Name);
2207
2218 bool IsLinkable() const;
2221
2238
2241 std::optional<discordpp::LinkedLobby> LinkedLobby() const;
2243 void SetLinkedLobby(std::optional<discordpp::LinkedLobby> LinkedLobby);
2244};
2245
2249 mutable Discord_LinkedLobby instance_{};
2252
2253public:
2255 Discord_LinkedLobby* instance() const { return &instance_; }
2258 explicit LinkedLobby(Discord_LinkedLobby instance, DiscordObjectState state);
2259 ~LinkedLobby();
2262 LinkedLobby(LinkedLobby&& other) noexcept;
2266 static const LinkedLobby nullobj;
2268 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2269
2274
2275 explicit LinkedLobby();
2276
2278 void Drop();
2280
2282 uint64_t ApplicationId() const;
2285
2287 uint64_t LobbyId() const;
2289 void SetLobbyId(uint64_t LobbyId);
2290};
2291
2295 mutable Discord_LinkedChannel instance_{};
2298
2299public:
2301 Discord_LinkedChannel* instance() const { return &instance_; }
2304 explicit LinkedChannel(Discord_LinkedChannel instance, DiscordObjectState state);
2308 LinkedChannel(LinkedChannel&& other) noexcept;
2314 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2315
2320
2322 void Drop();
2324
2326 uint64_t Id() const;
2328 void SetId(uint64_t Id);
2329
2331 std::string Name() const;
2333 void SetName(std::string Name);
2334
2336 uint64_t GuildId() const;
2338 void SetGuildId(uint64_t GuildId);
2339};
2340
2377 mutable Discord_RelationshipHandle instance_{};
2380
2381public:
2383 Discord_RelationshipHandle* instance() const { return &instance_; }
2386 explicit RelationshipHandle(Discord_RelationshipHandle instance, DiscordObjectState state);
2396 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2397
2402
2404 void Drop();
2406
2409
2412
2414 uint64_t Id() const;
2415
2417 bool IsSpamRequest() const;
2418
2421 std::optional<discordpp::UserHandle> User() const;
2422};
2423
2436 mutable Discord_UserHandle instance_{};
2439
2440public:
2442 enum class AvatarType {
2443
2445 Gif = 0,
2446
2448 Webp = 1,
2449
2451 Png = 2,
2452
2454 Jpeg = 3,
2455 };
2456
2457 Discord_UserHandle* instance() const { return &instance_; }
2460 explicit UserHandle(Discord_UserHandle instance, DiscordObjectState state);
2461 ~UserHandle();
2464 UserHandle(UserHandle&& other) noexcept;
2466 UserHandle& operator=(UserHandle&& other) noexcept;
2468 static const UserHandle nullobj;
2470 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2471
2476
2478 void Drop();
2480
2482 std::optional<std::string> Avatar() const;
2483
2486
2492 discordpp::UserHandle::AvatarType staticType) const;
2493
2496 std::string DisplayName() const;
2497
2507 std::optional<discordpp::Activity> GameActivity() const;
2508
2517 std::optional<std::string> GlobalName() const;
2518
2522 uint64_t Id() const;
2523
2525 bool IsProvisional() const;
2526
2530
2533
2540 std::string Username() const;
2541};
2542
2561 mutable Discord_LobbyMemberHandle instance_{};
2564
2565public:
2567 Discord_LobbyMemberHandle* instance() const { return &instance_; }
2570 explicit LobbyMemberHandle(Discord_LobbyMemberHandle instance, DiscordObjectState state);
2580 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2581
2586
2588 void Drop();
2590
2597 bool CanLinkLobby() const;
2598
2600 bool Connected() const;
2601
2603 uint64_t Id() const;
2604
2610 std::unordered_map<std::string, std::string> Metadata() const;
2611
2613 std::optional<discordpp::UserHandle> User() const;
2614};
2615
2704 mutable Discord_LobbyHandle instance_{};
2707
2708public:
2710 Discord_LobbyHandle* instance() const { return &instance_; }
2713 explicit LobbyHandle(Discord_LobbyHandle instance, DiscordObjectState state);
2714 ~LobbyHandle();
2717 LobbyHandle(LobbyHandle&& other) noexcept;
2721 static const LobbyHandle nullobj;
2723 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2724
2729
2731 void Drop();
2733
2739 std::optional<discordpp::CallInfoHandle> GetCallInfoHandle() const;
2740
2743 std::optional<discordpp::LobbyMemberHandle> GetLobbyMemberHandle(uint64_t memberId) const;
2744
2746 uint64_t Id() const;
2747
2749 std::optional<discordpp::LinkedChannel> LinkedChannel() const;
2750
2752 std::vector<uint64_t> LobbyMemberIds() const;
2753
2755 std::vector<discordpp::LobbyMemberHandle> LobbyMembers() const;
2756
2761 std::unordered_map<std::string, std::string> Metadata() const;
2762};
2763
2768 mutable Discord_AdditionalContent instance_{};
2771
2772public:
2774 Discord_AdditionalContent* instance() const { return &instance_; }
2777 explicit AdditionalContent(Discord_AdditionalContent instance, DiscordObjectState state);
2787 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2788
2793
2794 explicit AdditionalContent();
2795
2797 void Drop();
2799
2802
2805
2810
2813 std::optional<std::string> Title() const;
2815 void SetTitle(std::optional<std::string> Title);
2816
2819 uint8_t Count() const;
2821 void SetCount(uint8_t Count);
2822};
2823
2880 mutable Discord_MessageHandle instance_{};
2883
2884public:
2886 Discord_MessageHandle* instance() const { return &instance_; }
2889 explicit MessageHandle(Discord_MessageHandle instance, DiscordObjectState state);
2893 MessageHandle(MessageHandle&& other) noexcept;
2899 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2900
2905
2907 void Drop();
2909
2912 std::optional<discordpp::AdditionalContent> AdditionalContent() const;
2913
2920 std::optional<uint64_t> ApplicationId() const;
2921
2923 std::optional<discordpp::UserHandle> Author() const;
2924
2926 uint64_t AuthorId() const;
2927
2929 std::optional<discordpp::ChannelHandle> Channel() const;
2930
2932 uint64_t ChannelId() const;
2933
2939 std::string Content() const;
2940
2943 std::optional<discordpp::DisclosureTypes> DisclosureType() const;
2944
2948 uint64_t EditedTimestamp() const;
2949
2951 uint64_t Id() const;
2952
2954 std::optional<discordpp::LobbyHandle> Lobby() const;
2955
2961 std::unordered_map<std::string, std::string> Metadata() const;
2962
2968 std::string RawContent() const;
2969
2972 std::optional<discordpp::UserHandle> Recipient() const;
2973
2976 uint64_t RecipientId() const;
2977
2981 bool SentFromGame() const;
2982
2984 uint64_t SentTimestamp() const;
2985};
2986
2993 mutable Discord_AudioDevice instance_{};
2996
2997public:
2999 Discord_AudioDevice* instance() const { return &instance_; }
3002 explicit AudioDevice(Discord_AudioDevice instance, DiscordObjectState state);
3003 ~AudioDevice();
3006 AudioDevice(AudioDevice&& other) noexcept;
3010 static const AudioDevice nullobj;
3012 operator bool() const { return state_ != DiscordObjectState::Invalid; }
3013
3018
3020 void Drop();
3022
3025
3027 std::string Id() const;
3029 void SetId(std::string Id);
3030
3032 std::string Name() const;
3034 void SetName(std::string Name);
3035
3037 bool IsDefault() const;
3040};
3041
3045 mutable Discord_UserMessageSummary instance_{};
3048
3049public:
3051 Discord_UserMessageSummary* instance() const { return &instance_; }
3054 explicit UserMessageSummary(Discord_UserMessageSummary instance, DiscordObjectState state);
3064 operator bool() const { return state_ != DiscordObjectState::Invalid; }
3065
3070
3072 void Drop();
3074
3076 uint64_t LastMessageId() const;
3077
3079 uint64_t UserId() const;
3080};
3081
3087 mutable Discord_ClientCreateOptions instance_{};
3090
3091public:
3093 Discord_ClientCreateOptions* instance() const { return &instance_; }
3096 explicit ClientCreateOptions(Discord_ClientCreateOptions instance, DiscordObjectState state);
3106 operator bool() const { return state_ != DiscordObjectState::Invalid; }
3107
3112
3113 explicit ClientCreateOptions();
3114
3116 void Drop();
3118
3120 std::string WebBase() const;
3122 void SetWebBase(std::string WebBase);
3123
3125 std::string ApiBase() const;
3127 void SetApiBase(std::string ApiBase);
3128
3140
3153};
3154
3159class Client {
3161 mutable Discord_Client instance_{};
3164
3165public:
3173 enum class Error {
3174
3176 None = 0,
3177
3180
3183
3186 };
3187
3202 enum class Status {
3203
3206
3209
3212
3215
3218
3221
3224 };
3225
3227 enum class Thread {
3228
3231
3234
3237 };
3238
3240 using EndCallCallback = std::function<void()>;
3241
3243 using EndCallsCallback = std::function<void()>;
3244
3246 using GetCurrentInputDeviceCallback = std::function<void(discordpp::AudioDevice device)>;
3247
3249 using GetCurrentOutputDeviceCallback = std::function<void(discordpp::AudioDevice device)>;
3250
3253 std::function<void(std::vector<discordpp::AudioDevice> devices)>;
3254
3257 std::function<void(std::vector<discordpp::AudioDevice> devices)>;
3258
3261 std::function<void(std::vector<discordpp::AudioDevice> inputDevices,
3262 std::vector<discordpp::AudioDevice> outputDevices)>;
3263
3265 using SetInputDeviceCallback = std::function<void(discordpp::ClientResult result)>;
3266
3268 using NoAudioInputCallback = std::function<void(bool inputDetected)>;
3269
3271 using SetOutputDeviceCallback = std::function<void(discordpp::ClientResult result)>;
3272
3275 std::function<void(uint64_t lobbyId, uint64_t memberId, bool added)>;
3276
3280 using UserAudioReceivedCallback = std::function<void(uint64_t userId,
3281 int16_t* data,
3282 uint64_t samplesPerChannel,
3283 int32_t sampleRate,
3284 uint64_t channels,
3285 bool& outShouldMute)>;
3286
3290 using UserAudioCapturedCallback = std::function<
3291 void(int16_t* data, uint64_t samplesPerChannel, int32_t sampleRate, uint64_t channels)>;
3292
3299 using AuthorizationCallback = std::function<
3300 void(discordpp::ClientResult result, std::string code, std::string redirectUri)>;
3301
3304 std::function<void(discordpp::ClientResult result,
3305 std::string accessToken,
3307 int32_t expiresIn,
3308 std::string scopes)>;
3309
3312 std::function<void(discordpp::ClientResult result, uint64_t id, std::string name)>;
3313
3315 using TokenExchangeCallback = std::function<void(discordpp::ClientResult result,
3316 std::string accessToken,
3317 std::string refreshToken,
3319 int32_t expiresIn,
3320 std::string scopes)>;
3321
3323 using RevokeTokenCallback = std::function<void(discordpp::ClientResult result)>;
3324
3326 using AuthorizeDeviceScreenClosedCallback = std::function<void()>;
3327
3329 using TokenExpirationCallback = std::function<void()>;
3330
3333 std::function<void(discordpp::ClientResult result)>;
3334
3337 std::function<void(discordpp::ClientResult result)>;
3338
3341 using UpdateTokenCallback = std::function<void(discordpp::ClientResult result)>;
3342
3344 using DeleteUserMessageCallback = std::function<void(discordpp::ClientResult result)>;
3345
3347 using EditUserMessageCallback = std::function<void(discordpp::ClientResult result)>;
3348
3351 std::function<void(discordpp::ClientResult result,
3352 std::vector<discordpp::MessageHandle> messages)>;
3353
3356 std::function<void(discordpp::ClientResult result,
3357 std::vector<discordpp::UserMessageSummary> summaries)>;
3358
3361 std::function<void(discordpp::ClientResult result,
3362 std::vector<discordpp::MessageHandle> messages)>;
3363
3365 using ProvisionalUserMergeRequiredCallback = std::function<void()>;
3366
3368 using OpenMessageInDiscordCallback = std::function<void(discordpp::ClientResult result)>;
3369
3374 std::function<void(discordpp::ClientResult result, uint64_t messageId)>;
3375
3377 using MessageCreatedCallback = std::function<void(uint64_t messageId)>;
3378
3380 using MessageDeletedCallback = std::function<void(uint64_t messageId, uint64_t channelId)>;
3381
3383 using MessageUpdatedCallback = std::function<void(uint64_t messageId)>;
3384
3387 std::function<void(std::string message, discordpp::LoggingSeverity severity)>;
3388
3391 std::function<void(discordpp::ClientResult result)>;
3392
3397 using OnStatusChanged = std::function<
3398 void(discordpp::Client::Status status, discordpp::Client::Error error, int32_t errorDetail)>;
3399
3402 std::function<void(discordpp::ClientResult result, uint64_t lobbyId)>;
3403
3406 std::function<void(discordpp::ClientResult result,
3407 std::vector<discordpp::GuildChannel> guildChannels)>;
3408
3410 using GetUserGuildsCallback = std::function<void(discordpp::ClientResult result,
3411 std::vector<discordpp::GuildMinimal> guilds)>;
3412
3415 std::function<void(discordpp::ClientResult result, std::string inviteUrl)>;
3416
3418 using LeaveLobbyCallback = std::function<void(discordpp::ClientResult result)>;
3419
3421 using LinkOrUnlinkChannelCallback = std::function<void(discordpp::ClientResult result)>;
3422
3424 using LobbyCreatedCallback = std::function<void(uint64_t lobbyId)>;
3425
3427 using LobbyDeletedCallback = std::function<void(uint64_t lobbyId)>;
3428
3430 using LobbyMemberAddedCallback = std::function<void(uint64_t lobbyId, uint64_t memberId)>;
3431
3433 using LobbyMemberRemovedCallback = std::function<void(uint64_t lobbyId, uint64_t memberId)>;
3434
3436 using LobbyMemberUpdatedCallback = std::function<void(uint64_t lobbyId, uint64_t memberId)>;
3437
3439 using LobbyUpdatedCallback = std::function<void(uint64_t lobbyId)>;
3440
3443 std::function<void(discordpp::ClientResult result, std::string joinSecret)>;
3444
3447 using SendActivityInviteCallback = std::function<void(discordpp::ClientResult result)>;
3448
3451 using ActivityInviteCallback = std::function<void(discordpp::ActivityInvite invite)>;
3452
3454 using ActivityJoinCallback = std::function<void(std::string joinSecret)>;
3455
3458 std::function<void(uint64_t applicationId, std::string joinSecret)>;
3459
3461 using UpdateStatusCallback = std::function<void(discordpp::ClientResult result)>;
3462
3464 using UpdateRichPresenceCallback = std::function<void(discordpp::ClientResult result)>;
3465
3468 using UpdateRelationshipCallback = std::function<void(discordpp::ClientResult result)>;
3469
3472 using SendFriendRequestCallback = std::function<void(discordpp::ClientResult result)>;
3473
3479 std::function<void(uint64_t userId, bool isDiscordRelationshipUpdate)>;
3480
3486 std::function<void(uint64_t userId, bool isDiscordRelationshipUpdate)>;
3487
3490 std::function<void(discordpp::ClientResult result,
3491 std::optional<discordpp::UserHandle> user)>;
3492
3494 using RelationshipGroupsUpdatedCallback = std::function<void(uint64_t userId)>;
3495
3497 using UserUpdatedCallback = std::function<void(uint64_t userId)>;
3499 Discord_Client* instance() const { return &instance_; }
3502 explicit Client(Discord_Client instance, DiscordObjectState state);
3503 ~Client();
3506 Client(Client&& other) noexcept;
3508 Client& operator=(Client&& other) noexcept;
3510 static const Client nullobj;
3512 operator bool() const { return state_ != DiscordObjectState::Invalid; }
3513
3514 Client(const Client&) = delete;
3515 Client& operator=(const Client&) = delete;
3516
3518 explicit Client();
3519
3521 explicit Client(std::string apiBase, std::string webBase);
3522
3525
3527 void Drop();
3529
3531 static std::string ErrorToString(discordpp::Client::Error type);
3532
3538
3541 static std::string GetDefaultAudioDeviceId();
3542
3557 static std::string GetDefaultCommunicationScopes();
3558
3569 static std::string GetDefaultPresenceScopes();
3570
3572 static std::string GetVersionHash();
3573
3575 static int32_t GetVersionMajor();
3576
3578 static int32_t GetVersionMinor();
3579
3581 static int32_t GetVersionPatch();
3582
3584 void SetHttpRequestTimeout(int32_t httpTimeoutInMilliseconds);
3585
3588
3591
3594
3597 void EndCall(uint64_t channelId, discordpp::Client::EndCallCallback callback);
3598
3602
3604 discordpp::Call GetCall(uint64_t channelId);
3605
3607 std::vector<discordpp::Call> GetCalls();
3608
3611
3614
3617
3623
3626
3632
3634 bool GetSelfDeafAll() const;
3635
3637 bool GetSelfMuteAll() const;
3638
3643 void SetAecDump(bool on);
3644
3653
3657
3664 void SetEchoCancellation(bool on);
3665
3676 void SetEngineManagedAudioSession(bool isEngineManaged);
3677
3682
3687 void SetInputVolume(float inputVolume);
3688
3692
3701 void SetNoAudioInputThreshold(float dBFSThreshold);
3702
3709 void SetNoiseSuppression(bool on);
3710
3717 void SetOpusHardwareCoding(bool encode, bool decode);
3718
3723
3728 void SetOutputVolume(float outputVolume);
3729
3734 void SetSelfDeafAll(bool deaf);
3735
3738 void SetSelfMuteAll(bool mute);
3739
3743 [[deprecated("Calling Client::SetSpeakerMode is DEPRECATED.")]]
3744 bool SetSpeakerMode(bool speakerMode);
3745
3752 void SetThreadPriority(discordpp::Client::Thread thread, int32_t priority);
3753
3760
3763
3774 discordpp::Call StartCall(uint64_t channelId);
3775
3795 uint64_t lobbyId,
3799
3802
3808
3811
3907
3914
3920
3936 void ExchangeChildToken(std::string const& parentApplicationToken,
3937 uint64_t childApplicationId,
3939
3946 std::string const& token,
3948
3982 void GetProvisionalToken(uint64_t applicationId,
3984 std::string const& externalAuthToken,
3986
4010 void GetToken(uint64_t applicationId,
4011 std::string const& code,
4012 std::string const& codeVerifier,
4013 std::string const& redirectUri,
4015
4043
4083 std::string const& externalAuthToken,
4085
4116 void GetTokenFromProvisionalMerge(uint64_t applicationId,
4117 std::string const& code,
4118 std::string const& codeVerifier,
4119 std::string const& redirectUri,
4121 std::string const& externalAuthToken,
4123
4127
4132 void OpenAuthorizeDeviceScreen(uint64_t clientId, std::string const& userCode);
4133
4141
4156 void RefreshToken(uint64_t applicationId,
4157 std::string const& refreshToken,
4159
4172 void RevokeToken(uint64_t applicationId,
4173 std::string const& token,
4175
4180
4186 void SetGameWindowPid(int32_t pid);
4187
4201
4219 uint64_t applicationId,
4221 std::string const& externalAuthToken,
4223
4230 std::string const& name,
4232
4240 std::string token,
4243
4246
4252 bool CanOpenMessageInDiscord(uint64_t messageId);
4253
4255 void DeleteUserMessage(uint64_t recipientId,
4256 uint64_t messageId,
4258
4262 void EditUserMessage(uint64_t recipientId,
4263 uint64_t messageId,
4264 std::string const& content,
4266
4273 std::optional<discordpp::ChannelHandle> GetChannelHandle(uint64_t channelId) const;
4274
4286 void GetLobbyMessagesWithLimit(uint64_t lobbyId,
4287 int32_t limit,
4289
4294 std::optional<discordpp::MessageHandle> GetMessageHandle(uint64_t messageId) const;
4295
4303
4315 void GetUserMessagesWithLimit(uint64_t recipientId,
4316 int32_t limit,
4318
4325 uint64_t messageId,
4326 discordpp::Client::ProvisionalUserMergeRequiredCallback provisionalUserMergeRequiredCallback,
4328
4339 void SendLobbyMessage(uint64_t lobbyId,
4340 std::string const& content,
4342
4349 void SendLobbyMessageWithMetadata(uint64_t lobbyId,
4350 std::string const& content,
4351 std::unordered_map<std::string, std::string> const& metadata,
4353
4366 void SendUserMessage(uint64_t recipientId,
4367 std::string const& content,
4369
4376 void SendUserMessageWithMetadata(uint64_t recipientId,
4377 std::string const& content,
4378 std::unordered_map<std::string, std::string> const& metadata,
4380
4393
4401
4409
4420 void SetShowingChat(bool showingChat);
4422
4425
4436 discordpp::LoggingSeverity minSeverity);
4437
4444 discordpp::LoggingSeverity minSeverity);
4445
4452 void Connect();
4453
4460
4464
4474
4479 void SetApplicationId(uint64_t applicationId);
4480
4495 bool SetLogDir(std::string const& path, discordpp::LoggingSeverity minSeverity);
4496
4499
4512 void SetVoiceLogDir(std::string const& path, discordpp::LoggingSeverity minSeverity);
4514
4517
4535 void CreateOrJoinLobby(std::string const& secret,
4537
4545 std::string const& secret,
4546 std::unordered_map<std::string, std::string> const& lobbyMetadata,
4547 std::unordered_map<std::string, std::string> const& memberMetadata,
4549
4556
4558 std::optional<discordpp::LobbyHandle> GetLobbyHandle(uint64_t lobbyId) const;
4559
4565 std::vector<uint64_t> GetLobbyIds() const;
4566
4574
4582 uint64_t lobbyId,
4583 discordpp::Client::ProvisionalUserMergeRequiredCallback provisionalUserMergeRequiredCallback,
4585
4592 void LeaveLobby(uint64_t lobbyId, discordpp::Client::LeaveLobbyCallback callback);
4593
4598 void LinkChannelToLobby(uint64_t lobbyId,
4599 uint64_t channelId,
4601
4614
4625
4634
4643
4650
4654
4660 void UnlinkChannelFromLobby(uint64_t lobbyId,
4663
4666
4674
4677
4697 bool RegisterLaunchCommand(uint64_t applicationId, std::string command);
4698
4705 bool RegisterLaunchSteamApplication(uint64_t applicationId, uint32_t steamAppId);
4706
4717 void SendActivityInvite(uint64_t userId,
4718 std::string const& content,
4720
4728
4734
4744
4751
4759
4768
4772
4792
4795
4801 void AcceptDiscordFriendRequest(uint64_t userId,
4803
4809
4817
4823 void CancelDiscordFriendRequest(uint64_t userId,
4825
4831
4835
4838 std::vector<discordpp::RelationshipHandle> GetRelationships() const;
4839
4847 std::vector<discordpp::RelationshipHandle> GetRelationshipsByGroup(
4848 discordpp::RelationshipGroupType groupType) const;
4849
4855 void RejectDiscordFriendRequest(uint64_t userId,
4857
4863
4868 void RemoveDiscordAndGameFriend(uint64_t userId,
4870
4875
4880 std::vector<discordpp::UserHandle> SearchFriendsByUsername(std::string searchStr) const;
4881
4897 void SendDiscordFriendRequest(std::string const& username,
4899
4915 void SendDiscordFriendRequestById(uint64_t userId,
4917
4933 void SendGameFriendRequest(std::string const& username,
4935
4951 void SendGameFriendRequestById(uint64_t userId,
4953
4960
4967
4974
4977
4986
4992 std::optional<discordpp::UserHandle> GetCurrentUserV2() const;
4993
4998 uint64_t applicationId,
5000
5006 std::optional<discordpp::UserHandle> GetUser(uint64_t userId) const;
5007
5014
5021};
5022
5026 mutable Discord_CallInfoHandle instance_{};
5029
5030public:
5032 Discord_CallInfoHandle* instance() const { return &instance_; }
5035 explicit CallInfoHandle(Discord_CallInfoHandle instance, DiscordObjectState state);
5045 operator bool() const { return state_ != DiscordObjectState::Invalid; }
5046
5051
5053 void Drop();
5055
5057 uint64_t ChannelId() const;
5058
5060 std::vector<uint64_t> GetParticipants() const;
5061
5064 std::optional<discordpp::VoiceStateHandle> GetVoiceStateHandle(uint64_t userId) const;
5065
5067 uint64_t GuildId() const;
5068};
5069
5071{
5072 switch (value) {
5074 return "Join";
5076 return "JoinRequest";
5077 default:
5078 return "unknown";
5079 }
5080}
5081
5083{
5084 switch (value) {
5086 return "Private";
5088 return "Public";
5089 default:
5090 return "unknown";
5091 }
5092}
5093
5095{
5096 switch (value) {
5098 return "Playing";
5100 return "Streaming";
5102 return "Listening";
5104 return "Watching";
5106 return "CustomStatus";
5108 return "Competing";
5110 return "HangStatus";
5111 default:
5112 return "unknown";
5113 }
5114}
5115
5117{
5118 switch (value) {
5120 return "Name";
5122 return "State";
5124 return "Details";
5125 default:
5126 return "unknown";
5127 }
5128}
5129
5131{
5132 switch (value) {
5134 return "Desktop";
5136 return "Xbox";
5138 return "Samsung";
5140 return "IOS";
5142 return "Android";
5144 return "Embedded";
5146 return "PS4";
5148 return "PS5";
5149 default:
5150 return "unknown";
5151 }
5152}
5153
5154inline const char* EnumToString(discordpp::ErrorType value)
5155{
5156 switch (value) {
5158 return "None";
5160 return "NetworkError";
5162 return "HTTPError";
5164 return "ClientNotReady";
5166 return "Disabled";
5168 return "ClientDestroyed";
5170 return "ValidationError";
5172 return "Aborted";
5174 return "AuthorizationFailed";
5176 return "RPCError";
5177 default:
5178 return "unknown";
5179 }
5180}
5181
5183{
5184 switch (value) {
5186 return "None";
5188 return "Continue";
5190 return "SwitchingProtocols";
5192 return "Processing";
5194 return "EarlyHints";
5196 return "Ok";
5198 return "Created";
5200 return "Accepted";
5202 return "NonAuthoritativeInfo";
5204 return "NoContent";
5206 return "ResetContent";
5208 return "PartialContent";
5210 return "MultiStatus";
5212 return "AlreadyReported";
5214 return "ImUsed";
5216 return "MultipleChoices";
5218 return "MovedPermanently";
5220 return "Found";
5222 return "SeeOther";
5224 return "NotModified";
5226 return "TemporaryRedirect";
5228 return "PermanentRedirect";
5230 return "BadRequest";
5232 return "Unauthorized";
5234 return "PaymentRequired";
5236 return "Forbidden";
5238 return "NotFound";
5240 return "MethodNotAllowed";
5242 return "NotAcceptable";
5244 return "ProxyAuthRequired";
5246 return "RequestTimeout";
5248 return "Conflict";
5250 return "Gone";
5252 return "LengthRequired";
5254 return "PreconditionFailed";
5256 return "PayloadTooLarge";
5258 return "UriTooLong";
5260 return "UnsupportedMediaType";
5262 return "RangeNotSatisfiable";
5264 return "ExpectationFailed";
5266 return "MisdirectedRequest";
5268 return "UnprocessableEntity";
5270 return "Locked";
5272 return "FailedDependency";
5274 return "TooEarly";
5276 return "UpgradeRequired";
5278 return "PreconditionRequired";
5280 return "TooManyRequests";
5282 return "RequestHeaderFieldsTooLarge";
5284 return "InternalServerError";
5286 return "NotImplemented";
5288 return "BadGateway";
5290 return "ServiceUnavailable";
5292 return "GatewayTimeout";
5294 return "HttpVersionNotSupported";
5296 return "VariantAlsoNegotiates";
5298 return "InsufficientStorage";
5300 return "LoopDetected";
5302 return "NotExtended";
5304 return "NetworkAuthorizationRequired";
5305 default:
5306 return "unknown";
5307 }
5308}
5309
5311{
5312 switch (value) {
5314 return "S256";
5315 default:
5316 return "unknown";
5317 }
5318}
5319
5321{
5322 switch (value) {
5324 return "GuildInstall";
5326 return "UserInstall";
5327 default:
5328 return "unknown";
5329 }
5330}
5331
5333{
5334 switch (value) {
5336 return "Other";
5338 return "Attachment";
5340 return "Poll";
5342 return "VoiceMessage";
5344 return "Thread";
5346 return "Embed";
5348 return "Sticker";
5349 default:
5350 return "unknown";
5351 }
5352}
5353
5354inline const char* EnumToString(discordpp::AudioSystem value)
5355{
5356 switch (value) {
5358 return "Standard";
5360 return "Game";
5361 default:
5362 return "unknown";
5363 }
5364}
5365
5366inline const char* EnumToString(discordpp::Call::Error value)
5367{
5368 switch (value) {
5370 return "None";
5372 return "SignalingConnectionFailed";
5374 return "SignalingUnexpectedClose";
5376 return "VoiceConnectionFailed";
5378 return "JoinTimeout";
5380 return "Forbidden";
5381 default:
5382 return "unknown";
5383 }
5384}
5385
5387{
5388 switch (value) {
5390 return "MODE_UNINIT";
5392 return "MODE_VAD";
5394 return "MODE_PTT";
5395 default:
5396 return "unknown";
5397 }
5398}
5399
5400inline const char* EnumToString(discordpp::Call::Status value)
5401{
5402 switch (value) {
5404 return "Disconnected";
5406 return "Joining";
5408 return "Connecting";
5410 return "SignalingConnected";
5412 return "Connected";
5414 return "Reconnecting";
5416 return "Disconnecting";
5417 default:
5418 return "unknown";
5419 }
5420}
5421
5422inline const char* EnumToString(discordpp::ChannelType value)
5423{
5424 switch (value) {
5426 return "GuildText";
5428 return "Dm";
5430 return "GuildVoice";
5432 return "GroupDm";
5434 return "GuildCategory";
5436 return "GuildNews";
5438 return "GuildStore";
5440 return "GuildNewsThread";
5442 return "GuildPublicThread";
5444 return "GuildPrivateThread";
5446 return "GuildStageVoice";
5448 return "GuildDirectory";
5450 return "GuildForum";
5452 return "GuildMedia";
5454 return "Lobby";
5456 return "EphemeralDm";
5457 default:
5458 return "unknown";
5459 }
5460}
5461
5463{
5464 switch (value) {
5466 return "None";
5468 return "Friend";
5470 return "Blocked";
5472 return "PendingIncoming";
5474 return "PendingOutgoing";
5476 return "Implicit";
5478 return "Suggestion";
5479 default:
5480 return "unknown";
5481 }
5482}
5483
5485{
5486 switch (value) {
5488 return "Gif";
5490 return "Webp";
5492 return "Png";
5494 return "Jpeg";
5495 default:
5496 return "unknown";
5497 }
5498}
5499
5500inline const char* EnumToString(discordpp::StatusType value)
5501{
5502 switch (value) {
5504 return "Online";
5506 return "Offline";
5508 return "Blocked";
5510 return "Idle";
5512 return "Dnd";
5514 return "Invisible";
5516 return "Streaming";
5518 return "Unknown";
5519 default:
5520 return "unknown";
5521 }
5522}
5523
5525{
5526 switch (value) {
5528 return "MessageDataVisibleOnDiscord";
5529 default:
5530 return "unknown";
5531 }
5532}
5533
5535{
5536 switch (value) {
5538 return "None";
5540 return "ConnectionFailed";
5542 return "UnexpectedClose";
5544 return "ConnectionCanceled";
5545 default:
5546 return "unknown";
5547 }
5548}
5549
5551{
5552 switch (value) {
5554 return "Disconnected";
5556 return "Connecting";
5558 return "Connected";
5560 return "Ready";
5562 return "Reconnecting";
5564 return "Disconnecting";
5566 return "HttpWait";
5567 default:
5568 return "unknown";
5569 }
5570}
5571
5573{
5574 switch (value) {
5576 return "Client";
5578 return "Voice";
5580 return "Network";
5581 default:
5582 return "unknown";
5583 }
5584}
5585
5587{
5588 switch (value) {
5590 return "User";
5592 return "Bearer";
5593 default:
5594 return "unknown";
5595 }
5596}
5597
5599{
5600 switch (value) {
5602 return "OIDC";
5604 return "EpicOnlineServicesAccessToken";
5606 return "EpicOnlineServicesIdToken";
5608 return "SteamSessionTicket";
5610 return "UnityServicesIdToken";
5611 default:
5612 return "unknown";
5613 }
5614}
5615
5617{
5618 switch (value) {
5620 return "Verbose";
5622 return "Info";
5624 return "Warning";
5626 return "Error";
5628 return "None";
5629 default:
5630 return "unknown";
5631 }
5632}
5633
5635{
5636 switch (value) {
5638 return "OnlinePlayingGame";
5640 return "OnlineElsewhere";
5642 return "Offline";
5643 default:
5644 return "unknown";
5645 }
5646}
5647} // namespace discordpp
5648#endif // DISCORD_HEADER_DISCORDPP_H_
5649#ifdef DISCORDPP_IMPLEMENTATION
5650#undef DISCORDPP_IMPLEMENTATION
5651#ifdef __clang__
5652#pragma clang diagnostic push
5653#pragma clang diagnostic ignored "-Wunused-parameter"
5654#endif
5655namespace discordpp {
5656std::function<void(std::function<void()>)> s_synchronizationContext;
5657
5658inline bool HasSynchronizationContext()
5659{
5660 return !!s_synchronizationContext;
5661}
5662
5663inline void PostTask(std::function<void()> task)
5664{
5665 assert(s_synchronizationContext);
5666 s_synchronizationContext(std::move(task));
5667}
5668
5669void SetSynchronizationContext(std::function<void(std::function<void()>)> executor)
5670{
5671 s_synchronizationContext = std::move(executor);
5672}
5673
5674template <typename T>
5675struct TDelegateUserData {
5676 T delegate;
5677 TDelegateUserData(T delegate)
5678 : delegate{delegate}
5679 {
5680 }
5681
5682 static void Free(void* ptr) { delete reinterpret_cast<TDelegateUserData*>(ptr); }
5683
5684 static T& Get(void* userData)
5685 {
5686 return reinterpret_cast<TDelegateUserData*>(userData)->delegate;
5687 }
5688};
5689
5690struct ConvertedProperties {
5691 ConvertedProperties(std::unordered_map<std::string, std::string> const& PropertyMap)
5692 {
5693 Properties.size = PropertyMap.size();
5694 Properties.keys = reinterpret_cast<Discord_String*>(
5695 Discord_Alloc(Properties.size * sizeof(Discord_String)));
5696 Properties.values = reinterpret_cast<Discord_String*>(
5697 Discord_Alloc(Properties.size * sizeof(Discord_String)));
5698 size_t i = 0;
5699 for (auto& pair : PropertyMap) {
5700 Properties.keys[i] = AllocateString(pair.first);
5701 Properties.values[i] = AllocateString(pair.second);
5702 ++i;
5703 }
5704 }
5705 ~ConvertedProperties() { Discord_FreeProperties(Properties); }
5706 Discord_Properties Properties{};
5707
5708private:
5709 Discord_String AllocateString(std::string const& str)
5710 {
5711 Discord_String result;
5712 result.ptr = reinterpret_cast<uint8_t*>(Discord_Alloc(str.size()));
5713 result.size = str.size();
5714 std::memcpy(result.ptr, str.data(), result.size);
5715 return result;
5716 }
5717};
5718
5719std::unordered_map<std::string, std::string> ConvertReturnedProperties(
5720 Discord_Properties const& Properties)
5721{
5722 std::unordered_map<std::string, std::string> result;
5723 for (size_t i = 0; i < Properties.size; ++i) {
5724 std::string key(reinterpret_cast<char*>(Properties.keys[i].ptr), Properties.keys[i].size);
5725 std::string value(reinterpret_cast<char*>(Properties.values[i].ptr),
5726 Properties.values[i].size);
5727 result.emplace(std::move(key), std::move(value));
5728 }
5729 return result;
5730}
5732ActivityInvite::~ActivityInvite()
5733{
5734 if (state_ == DiscordObjectState::Owned) {
5735 Drop();
5737 }
5738}
5740 : instance_(other.instance_)
5741 , state_(other.state_)
5742{
5743 other.state_ = DiscordObjectState::Invalid;
5744}
5746{
5747 if (this != &other) {
5748 if (state_ == DiscordObjectState::Owned) {
5749 Drop();
5750 }
5751 instance_ = other.instance_;
5752 state_ = other.state_;
5753 other.state_ = DiscordObjectState::Invalid;
5754 }
5755 return *this;
5756}
5758 : instance_{}
5759 , state_(DiscordObjectState::Invalid)
5760{
5761 if (rhs.state_ == DiscordObjectState::Owned) {
5762 Discord_ActivityInvite_Clone(&instance_, rhs.instance());
5763
5764 state_ = DiscordObjectState::Owned;
5765 }
5766}
5767ActivityInvite& ActivityInvite::operator=(const ActivityInvite& rhs)
5768{
5769 if (this != &rhs) {
5770 if (state_ == DiscordObjectState::Owned) {
5771 Drop();
5772 state_ = DiscordObjectState::Invalid;
5773 }
5774 if (rhs.state_ == DiscordObjectState::Owned) {
5775 Discord_ActivityInvite_Clone(&instance_, rhs.instance());
5776
5777 state_ = DiscordObjectState::Owned;
5778 }
5779 }
5780 return *this;
5781}
5782ActivityInvite::ActivityInvite(Discord_ActivityInvite instance, DiscordObjectState state)
5783 : instance_(instance)
5784 , state_(state)
5785{
5786}
5787ActivityInvite::ActivityInvite()
5788{
5789 assert(state_ == DiscordObjectState::Invalid);
5790 Discord_ActivityInvite_Init(&instance_);
5791 state_ = DiscordObjectState::Owned;
5792}
5793void ActivityInvite::Drop()
5794{
5795 if (state_ != DiscordObjectState::Owned) {
5796 return;
5797 }
5798 Discord_ActivityInvite_Drop(&instance_);
5799 state_ = DiscordObjectState::Invalid;
5800}
5801uint64_t ActivityInvite::SenderId() const
5802{
5803 assert(state_ == DiscordObjectState::Owned);
5804 uint64_t returnValue__;
5805 returnValue__ = Discord_ActivityInvite_SenderId(&instance_);
5806 return returnValue__;
5807}
5808void ActivityInvite::SetSenderId(uint64_t SenderId)
5809{
5810 assert(state_ == DiscordObjectState::Owned);
5811 Discord_ActivityInvite_SetSenderId(&instance_, SenderId);
5812}
5813uint64_t ActivityInvite::ChannelId() const
5814{
5815 assert(state_ == DiscordObjectState::Owned);
5816 uint64_t returnValue__;
5817 returnValue__ = Discord_ActivityInvite_ChannelId(&instance_);
5818 return returnValue__;
5819}
5820void ActivityInvite::SetChannelId(uint64_t ChannelId)
5821{
5822 assert(state_ == DiscordObjectState::Owned);
5823 Discord_ActivityInvite_SetChannelId(&instance_, ChannelId);
5824}
5825uint64_t ActivityInvite::MessageId() const
5826{
5827 assert(state_ == DiscordObjectState::Owned);
5828 uint64_t returnValue__;
5829 returnValue__ = Discord_ActivityInvite_MessageId(&instance_);
5830 return returnValue__;
5831}
5832void ActivityInvite::SetMessageId(uint64_t MessageId)
5833{
5834 assert(state_ == DiscordObjectState::Owned);
5835 Discord_ActivityInvite_SetMessageId(&instance_, MessageId);
5836}
5837discordpp::ActivityActionTypes ActivityInvite::Type() const
5838{
5839 assert(state_ == DiscordObjectState::Owned);
5840 Discord_ActivityActionTypes returnValue__;
5841 returnValue__ = Discord_ActivityInvite_Type(&instance_);
5842 return static_cast<discordpp::ActivityActionTypes>(returnValue__);
5843}
5844void ActivityInvite::SetType(discordpp::ActivityActionTypes Type)
5845{
5846 assert(state_ == DiscordObjectState::Owned);
5847 Discord_ActivityInvite_SetType(&instance_, static_cast<Discord_ActivityActionTypes>(Type));
5848}
5849uint64_t ActivityInvite::ApplicationId() const
5850{
5851 assert(state_ == DiscordObjectState::Owned);
5852 uint64_t returnValue__;
5853 returnValue__ = Discord_ActivityInvite_ApplicationId(&instance_);
5854 return returnValue__;
5855}
5856void ActivityInvite::SetApplicationId(uint64_t ApplicationId)
5857{
5858 assert(state_ == DiscordObjectState::Owned);
5859 Discord_ActivityInvite_SetApplicationId(&instance_, ApplicationId);
5860}
5861uint64_t ActivityInvite::ParentApplicationId() const
5862{
5863 assert(state_ == DiscordObjectState::Owned);
5864 uint64_t returnValue__;
5865 returnValue__ = Discord_ActivityInvite_ParentApplicationId(&instance_);
5866 return returnValue__;
5867}
5868void ActivityInvite::SetParentApplicationId(uint64_t ParentApplicationId)
5869{
5870 assert(state_ == DiscordObjectState::Owned);
5871 Discord_ActivityInvite_SetParentApplicationId(&instance_, ParentApplicationId);
5872}
5873std::string ActivityInvite::PartyId() const
5874{
5875 assert(state_ == DiscordObjectState::Owned);
5876 Discord_String returnValueNative__;
5877 Discord_ActivityInvite_PartyId(&instance_, &returnValueNative__);
5878 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5879 returnValueNative__.size);
5880 Discord_Free(returnValueNative__.ptr);
5881 return returnValue__;
5882}
5883void ActivityInvite::SetPartyId(std::string PartyId)
5884{
5885 assert(state_ == DiscordObjectState::Owned);
5886 Discord_String PartyId__str{(uint8_t*)(PartyId.data()), PartyId.size()};
5887 Discord_ActivityInvite_SetPartyId(&instance_, PartyId__str);
5888}
5889std::string ActivityInvite::SessionId() const
5890{
5891 assert(state_ == DiscordObjectState::Owned);
5892 Discord_String returnValueNative__;
5893 Discord_ActivityInvite_SessionId(&instance_, &returnValueNative__);
5894 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5895 returnValueNative__.size);
5896 Discord_Free(returnValueNative__.ptr);
5897 return returnValue__;
5898}
5899void ActivityInvite::SetSessionId(std::string SessionId)
5900{
5901 assert(state_ == DiscordObjectState::Owned);
5902 Discord_String SessionId__str{(uint8_t*)(SessionId.data()), SessionId.size()};
5903 Discord_ActivityInvite_SetSessionId(&instance_, SessionId__str);
5904}
5905bool ActivityInvite::IsValid() const
5906{
5907 assert(state_ == DiscordObjectState::Owned);
5908 bool returnValue__;
5909 returnValue__ = Discord_ActivityInvite_IsValid(&instance_);
5910 return returnValue__;
5911}
5912void ActivityInvite::SetIsValid(bool IsValid)
5913{
5914 assert(state_ == DiscordObjectState::Owned);
5915 Discord_ActivityInvite_SetIsValid(&instance_, IsValid);
5916}
5917const ActivityAssets ActivityAssets::nullobj{{}, DiscordObjectState::Invalid};
5918ActivityAssets::~ActivityAssets()
5919{
5920 if (state_ == DiscordObjectState::Owned) {
5921 Drop();
5922 state_ = DiscordObjectState::Invalid;
5923 }
5924}
5925ActivityAssets::ActivityAssets(ActivityAssets&& other) noexcept
5926 : instance_(other.instance_)
5927 , state_(other.state_)
5928{
5929 other.state_ = DiscordObjectState::Invalid;
5930}
5931ActivityAssets& ActivityAssets::operator=(ActivityAssets&& other) noexcept
5932{
5933 if (this != &other) {
5934 if (state_ == DiscordObjectState::Owned) {
5935 Drop();
5936 }
5937 instance_ = other.instance_;
5938 state_ = other.state_;
5939 other.state_ = DiscordObjectState::Invalid;
5940 }
5941 return *this;
5942}
5943ActivityAssets::ActivityAssets(const ActivityAssets& arg0)
5944 : instance_{}
5945 , state_(DiscordObjectState::Invalid)
5946{
5947 if (arg0.state_ == DiscordObjectState::Owned) {
5948 Discord_ActivityAssets_Clone(&instance_, arg0.instance());
5949
5950 state_ = DiscordObjectState::Owned;
5951 }
5952}
5953ActivityAssets& ActivityAssets::operator=(const ActivityAssets& arg0)
5954{
5955 if (this != &arg0) {
5956 if (state_ == DiscordObjectState::Owned) {
5957 Drop();
5958 state_ = DiscordObjectState::Invalid;
5959 }
5960 if (arg0.state_ == DiscordObjectState::Owned) {
5961 Discord_ActivityAssets_Clone(&instance_, arg0.instance());
5962
5963 state_ = DiscordObjectState::Owned;
5964 }
5965 }
5966 return *this;
5967}
5968ActivityAssets::ActivityAssets(Discord_ActivityAssets instance, DiscordObjectState state)
5969 : instance_(instance)
5970 , state_(state)
5971{
5972}
5973ActivityAssets::ActivityAssets()
5974{
5975 assert(state_ == DiscordObjectState::Invalid);
5976 Discord_ActivityAssets_Init(&instance_);
5977 state_ = DiscordObjectState::Owned;
5978}
5979void ActivityAssets::Drop()
5980{
5981 if (state_ != DiscordObjectState::Owned) {
5982 return;
5983 }
5984 Discord_ActivityAssets_Drop(&instance_);
5985 state_ = DiscordObjectState::Invalid;
5986}
5987std::optional<std::string> ActivityAssets::LargeImage() const
5988{
5989 assert(state_ == DiscordObjectState::Owned);
5990 bool returnIsNonNull__;
5991 Discord_String returnValueNative__;
5992 returnIsNonNull__ = Discord_ActivityAssets_LargeImage(&instance_, &returnValueNative__);
5993 if (!returnIsNonNull__) {
5994 return {};
5995 }
5996 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5997 returnValueNative__.size);
5998 Discord_Free(returnValueNative__.ptr);
5999 return returnValue__;
6000}
6001void ActivityAssets::SetLargeImage(std::optional<std::string> LargeImage)
6002{
6003 assert(state_ == DiscordObjectState::Owned);
6004 Discord_String LargeImage__str{};
6005 if (LargeImage.has_value()) {
6006 LargeImage__str.ptr = reinterpret_cast<uint8_t*>(LargeImage->data());
6007 LargeImage__str.size = LargeImage->size();
6008 }
6009 Discord_ActivityAssets_SetLargeImage(&instance_,
6010 (LargeImage.has_value() ? &LargeImage__str : nullptr));
6011}
6012std::optional<std::string> ActivityAssets::LargeText() const
6013{
6014 assert(state_ == DiscordObjectState::Owned);
6015 bool returnIsNonNull__;
6016 Discord_String returnValueNative__;
6017 returnIsNonNull__ = Discord_ActivityAssets_LargeText(&instance_, &returnValueNative__);
6018 if (!returnIsNonNull__) {
6019 return {};
6020 }
6021 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6022 returnValueNative__.size);
6023 Discord_Free(returnValueNative__.ptr);
6024 return returnValue__;
6025}
6026void ActivityAssets::SetLargeText(std::optional<std::string> LargeText)
6027{
6028 assert(state_ == DiscordObjectState::Owned);
6029 Discord_String LargeText__str{};
6030 if (LargeText.has_value()) {
6031 LargeText__str.ptr = reinterpret_cast<uint8_t*>(LargeText->data());
6032 LargeText__str.size = LargeText->size();
6033 }
6034 Discord_ActivityAssets_SetLargeText(&instance_,
6035 (LargeText.has_value() ? &LargeText__str : nullptr));
6036}
6037std::optional<std::string> ActivityAssets::LargeUrl() const
6038{
6039 assert(state_ == DiscordObjectState::Owned);
6040 bool returnIsNonNull__;
6041 Discord_String returnValueNative__;
6042 returnIsNonNull__ = Discord_ActivityAssets_LargeUrl(&instance_, &returnValueNative__);
6043 if (!returnIsNonNull__) {
6044 return {};
6045 }
6046 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6047 returnValueNative__.size);
6048 Discord_Free(returnValueNative__.ptr);
6049 return returnValue__;
6050}
6051void ActivityAssets::SetLargeUrl(std::optional<std::string> LargeUrl)
6052{
6053 assert(state_ == DiscordObjectState::Owned);
6054 Discord_String LargeUrl__str{};
6055 if (LargeUrl.has_value()) {
6056 LargeUrl__str.ptr = reinterpret_cast<uint8_t*>(LargeUrl->data());
6057 LargeUrl__str.size = LargeUrl->size();
6058 }
6059 Discord_ActivityAssets_SetLargeUrl(&instance_,
6060 (LargeUrl.has_value() ? &LargeUrl__str : nullptr));
6061}
6062std::optional<std::string> ActivityAssets::SmallImage() const
6063{
6064 assert(state_ == DiscordObjectState::Owned);
6065 bool returnIsNonNull__;
6066 Discord_String returnValueNative__;
6067 returnIsNonNull__ = Discord_ActivityAssets_SmallImage(&instance_, &returnValueNative__);
6068 if (!returnIsNonNull__) {
6069 return {};
6070 }
6071 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6072 returnValueNative__.size);
6073 Discord_Free(returnValueNative__.ptr);
6074 return returnValue__;
6075}
6076void ActivityAssets::SetSmallImage(std::optional<std::string> SmallImage)
6077{
6078 assert(state_ == DiscordObjectState::Owned);
6079 Discord_String SmallImage__str{};
6080 if (SmallImage.has_value()) {
6081 SmallImage__str.ptr = reinterpret_cast<uint8_t*>(SmallImage->data());
6082 SmallImage__str.size = SmallImage->size();
6083 }
6084 Discord_ActivityAssets_SetSmallImage(&instance_,
6085 (SmallImage.has_value() ? &SmallImage__str : nullptr));
6086}
6087std::optional<std::string> ActivityAssets::SmallText() const
6088{
6089 assert(state_ == DiscordObjectState::Owned);
6090 bool returnIsNonNull__;
6091 Discord_String returnValueNative__;
6092 returnIsNonNull__ = Discord_ActivityAssets_SmallText(&instance_, &returnValueNative__);
6093 if (!returnIsNonNull__) {
6094 return {};
6095 }
6096 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6097 returnValueNative__.size);
6098 Discord_Free(returnValueNative__.ptr);
6099 return returnValue__;
6100}
6101void ActivityAssets::SetSmallText(std::optional<std::string> SmallText)
6102{
6103 assert(state_ == DiscordObjectState::Owned);
6104 Discord_String SmallText__str{};
6105 if (SmallText.has_value()) {
6106 SmallText__str.ptr = reinterpret_cast<uint8_t*>(SmallText->data());
6107 SmallText__str.size = SmallText->size();
6108 }
6109 Discord_ActivityAssets_SetSmallText(&instance_,
6110 (SmallText.has_value() ? &SmallText__str : nullptr));
6111}
6112std::optional<std::string> ActivityAssets::SmallUrl() const
6113{
6114 assert(state_ == DiscordObjectState::Owned);
6115 bool returnIsNonNull__;
6116 Discord_String returnValueNative__;
6117 returnIsNonNull__ = Discord_ActivityAssets_SmallUrl(&instance_, &returnValueNative__);
6118 if (!returnIsNonNull__) {
6119 return {};
6120 }
6121 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6122 returnValueNative__.size);
6123 Discord_Free(returnValueNative__.ptr);
6124 return returnValue__;
6125}
6126void ActivityAssets::SetSmallUrl(std::optional<std::string> SmallUrl)
6127{
6128 assert(state_ == DiscordObjectState::Owned);
6129 Discord_String SmallUrl__str{};
6130 if (SmallUrl.has_value()) {
6131 SmallUrl__str.ptr = reinterpret_cast<uint8_t*>(SmallUrl->data());
6132 SmallUrl__str.size = SmallUrl->size();
6133 }
6134 Discord_ActivityAssets_SetSmallUrl(&instance_,
6135 (SmallUrl.has_value() ? &SmallUrl__str : nullptr));
6136}
6137const ActivityTimestamps ActivityTimestamps::nullobj{{}, DiscordObjectState::Invalid};
6138ActivityTimestamps::~ActivityTimestamps()
6139{
6140 if (state_ == DiscordObjectState::Owned) {
6141 Drop();
6142 state_ = DiscordObjectState::Invalid;
6143 }
6144}
6145ActivityTimestamps::ActivityTimestamps(ActivityTimestamps&& other) noexcept
6146 : instance_(other.instance_)
6147 , state_(other.state_)
6148{
6149 other.state_ = DiscordObjectState::Invalid;
6150}
6151ActivityTimestamps& ActivityTimestamps::operator=(ActivityTimestamps&& other) noexcept
6152{
6153 if (this != &other) {
6154 if (state_ == DiscordObjectState::Owned) {
6155 Drop();
6156 }
6157 instance_ = other.instance_;
6158 state_ = other.state_;
6159 other.state_ = DiscordObjectState::Invalid;
6160 }
6161 return *this;
6162}
6163ActivityTimestamps::ActivityTimestamps(const ActivityTimestamps& arg0)
6164 : instance_{}
6165 , state_(DiscordObjectState::Invalid)
6166{
6167 if (arg0.state_ == DiscordObjectState::Owned) {
6168 Discord_ActivityTimestamps_Clone(&instance_, arg0.instance());
6169
6170 state_ = DiscordObjectState::Owned;
6171 }
6172}
6173ActivityTimestamps& ActivityTimestamps::operator=(const ActivityTimestamps& arg0)
6174{
6175 if (this != &arg0) {
6176 if (state_ == DiscordObjectState::Owned) {
6177 Drop();
6178 state_ = DiscordObjectState::Invalid;
6179 }
6180 if (arg0.state_ == DiscordObjectState::Owned) {
6181 Discord_ActivityTimestamps_Clone(&instance_, arg0.instance());
6182
6183 state_ = DiscordObjectState::Owned;
6184 }
6185 }
6186 return *this;
6187}
6188ActivityTimestamps::ActivityTimestamps(Discord_ActivityTimestamps instance,
6189 DiscordObjectState state)
6190 : instance_(instance)
6191 , state_(state)
6192{
6193}
6194ActivityTimestamps::ActivityTimestamps()
6195{
6196 assert(state_ == DiscordObjectState::Invalid);
6197 Discord_ActivityTimestamps_Init(&instance_);
6198 state_ = DiscordObjectState::Owned;
6199}
6200void ActivityTimestamps::Drop()
6201{
6202 if (state_ != DiscordObjectState::Owned) {
6203 return;
6204 }
6205 Discord_ActivityTimestamps_Drop(&instance_);
6206 state_ = DiscordObjectState::Invalid;
6207}
6208uint64_t ActivityTimestamps::Start() const
6209{
6210 assert(state_ == DiscordObjectState::Owned);
6211 uint64_t returnValue__;
6212 returnValue__ = Discord_ActivityTimestamps_Start(&instance_);
6213 return returnValue__;
6214}
6215void ActivityTimestamps::SetStart(uint64_t Start)
6216{
6217 assert(state_ == DiscordObjectState::Owned);
6218 Discord_ActivityTimestamps_SetStart(&instance_, Start);
6219}
6220uint64_t ActivityTimestamps::End() const
6221{
6222 assert(state_ == DiscordObjectState::Owned);
6223 uint64_t returnValue__;
6224 returnValue__ = Discord_ActivityTimestamps_End(&instance_);
6225 return returnValue__;
6226}
6227void ActivityTimestamps::SetEnd(uint64_t End)
6228{
6229 assert(state_ == DiscordObjectState::Owned);
6230 Discord_ActivityTimestamps_SetEnd(&instance_, End);
6231}
6232const ActivityParty ActivityParty::nullobj{{}, DiscordObjectState::Invalid};
6233ActivityParty::~ActivityParty()
6234{
6235 if (state_ == DiscordObjectState::Owned) {
6236 Drop();
6237 state_ = DiscordObjectState::Invalid;
6238 }
6239}
6240ActivityParty::ActivityParty(ActivityParty&& other) noexcept
6241 : instance_(other.instance_)
6242 , state_(other.state_)
6243{
6244 other.state_ = DiscordObjectState::Invalid;
6245}
6246ActivityParty& ActivityParty::operator=(ActivityParty&& other) noexcept
6247{
6248 if (this != &other) {
6249 if (state_ == DiscordObjectState::Owned) {
6250 Drop();
6251 }
6252 instance_ = other.instance_;
6253 state_ = other.state_;
6254 other.state_ = DiscordObjectState::Invalid;
6255 }
6256 return *this;
6257}
6258ActivityParty::ActivityParty(const ActivityParty& arg0)
6259 : instance_{}
6260 , state_(DiscordObjectState::Invalid)
6261{
6262 if (arg0.state_ == DiscordObjectState::Owned) {
6263 Discord_ActivityParty_Clone(&instance_, arg0.instance());
6264
6265 state_ = DiscordObjectState::Owned;
6266 }
6267}
6268ActivityParty& ActivityParty::operator=(const ActivityParty& arg0)
6269{
6270 if (this != &arg0) {
6271 if (state_ == DiscordObjectState::Owned) {
6272 Drop();
6273 state_ = DiscordObjectState::Invalid;
6274 }
6275 if (arg0.state_ == DiscordObjectState::Owned) {
6276 Discord_ActivityParty_Clone(&instance_, arg0.instance());
6277
6278 state_ = DiscordObjectState::Owned;
6279 }
6280 }
6281 return *this;
6282}
6283ActivityParty::ActivityParty(Discord_ActivityParty instance, DiscordObjectState state)
6284 : instance_(instance)
6285 , state_(state)
6286{
6287}
6288ActivityParty::ActivityParty()
6289{
6290 assert(state_ == DiscordObjectState::Invalid);
6291 Discord_ActivityParty_Init(&instance_);
6292 state_ = DiscordObjectState::Owned;
6293}
6294void ActivityParty::Drop()
6295{
6296 if (state_ != DiscordObjectState::Owned) {
6297 return;
6298 }
6299 Discord_ActivityParty_Drop(&instance_);
6300 state_ = DiscordObjectState::Invalid;
6301}
6302std::string ActivityParty::Id() const
6303{
6304 assert(state_ == DiscordObjectState::Owned);
6305 Discord_String returnValueNative__;
6306 Discord_ActivityParty_Id(&instance_, &returnValueNative__);
6307 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6308 returnValueNative__.size);
6309 Discord_Free(returnValueNative__.ptr);
6310 return returnValue__;
6311}
6312void ActivityParty::SetId(std::string Id)
6313{
6314 assert(state_ == DiscordObjectState::Owned);
6315 Discord_String Id__str{(uint8_t*)(Id.data()), Id.size()};
6316 Discord_ActivityParty_SetId(&instance_, Id__str);
6317}
6318int32_t ActivityParty::CurrentSize() const
6319{
6320 assert(state_ == DiscordObjectState::Owned);
6321 int32_t returnValue__;
6322 returnValue__ = Discord_ActivityParty_CurrentSize(&instance_);
6323 return returnValue__;
6324}
6325void ActivityParty::SetCurrentSize(int32_t CurrentSize)
6326{
6327 assert(state_ == DiscordObjectState::Owned);
6328 Discord_ActivityParty_SetCurrentSize(&instance_, CurrentSize);
6329}
6330int32_t ActivityParty::MaxSize() const
6331{
6332 assert(state_ == DiscordObjectState::Owned);
6333 int32_t returnValue__;
6334 returnValue__ = Discord_ActivityParty_MaxSize(&instance_);
6335 return returnValue__;
6336}
6337void ActivityParty::SetMaxSize(int32_t MaxSize)
6338{
6339 assert(state_ == DiscordObjectState::Owned);
6340 Discord_ActivityParty_SetMaxSize(&instance_, MaxSize);
6341}
6342discordpp::ActivityPartyPrivacy ActivityParty::Privacy() const
6343{
6344 assert(state_ == DiscordObjectState::Owned);
6345 Discord_ActivityPartyPrivacy returnValue__;
6346 returnValue__ = Discord_ActivityParty_Privacy(&instance_);
6347 return static_cast<discordpp::ActivityPartyPrivacy>(returnValue__);
6348}
6349void ActivityParty::SetPrivacy(discordpp::ActivityPartyPrivacy Privacy)
6350{
6351 assert(state_ == DiscordObjectState::Owned);
6352 Discord_ActivityParty_SetPrivacy(&instance_,
6353 static_cast<Discord_ActivityPartyPrivacy>(Privacy));
6354}
6355const ActivitySecrets ActivitySecrets::nullobj{{}, DiscordObjectState::Invalid};
6356ActivitySecrets::~ActivitySecrets()
6357{
6358 if (state_ == DiscordObjectState::Owned) {
6359 Drop();
6360 state_ = DiscordObjectState::Invalid;
6361 }
6362}
6363ActivitySecrets::ActivitySecrets(ActivitySecrets&& other) noexcept
6364 : instance_(other.instance_)
6365 , state_(other.state_)
6366{
6367 other.state_ = DiscordObjectState::Invalid;
6368}
6369ActivitySecrets& ActivitySecrets::operator=(ActivitySecrets&& other) noexcept
6370{
6371 if (this != &other) {
6372 if (state_ == DiscordObjectState::Owned) {
6373 Drop();
6374 }
6375 instance_ = other.instance_;
6376 state_ = other.state_;
6377 other.state_ = DiscordObjectState::Invalid;
6378 }
6379 return *this;
6380}
6381ActivitySecrets::ActivitySecrets(const ActivitySecrets& arg0)
6382 : instance_{}
6383 , state_(DiscordObjectState::Invalid)
6384{
6385 if (arg0.state_ == DiscordObjectState::Owned) {
6386 Discord_ActivitySecrets_Clone(&instance_, arg0.instance());
6387
6388 state_ = DiscordObjectState::Owned;
6389 }
6390}
6391ActivitySecrets& ActivitySecrets::operator=(const ActivitySecrets& arg0)
6392{
6393 if (this != &arg0) {
6394 if (state_ == DiscordObjectState::Owned) {
6395 Drop();
6396 state_ = DiscordObjectState::Invalid;
6397 }
6398 if (arg0.state_ == DiscordObjectState::Owned) {
6399 Discord_ActivitySecrets_Clone(&instance_, arg0.instance());
6400
6401 state_ = DiscordObjectState::Owned;
6402 }
6403 }
6404 return *this;
6405}
6406ActivitySecrets::ActivitySecrets(Discord_ActivitySecrets instance, DiscordObjectState state)
6407 : instance_(instance)
6408 , state_(state)
6409{
6410}
6411ActivitySecrets::ActivitySecrets()
6412{
6413 assert(state_ == DiscordObjectState::Invalid);
6414 Discord_ActivitySecrets_Init(&instance_);
6415 state_ = DiscordObjectState::Owned;
6416}
6417void ActivitySecrets::Drop()
6418{
6419 if (state_ != DiscordObjectState::Owned) {
6420 return;
6421 }
6422 Discord_ActivitySecrets_Drop(&instance_);
6423 state_ = DiscordObjectState::Invalid;
6424}
6425std::string ActivitySecrets::Join() const
6426{
6427 assert(state_ == DiscordObjectState::Owned);
6428 Discord_String returnValueNative__;
6429 Discord_ActivitySecrets_Join(&instance_, &returnValueNative__);
6430 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6431 returnValueNative__.size);
6432 Discord_Free(returnValueNative__.ptr);
6433 return returnValue__;
6434}
6435void ActivitySecrets::SetJoin(std::string Join)
6436{
6437 assert(state_ == DiscordObjectState::Owned);
6438 Discord_String Join__str{(uint8_t*)(Join.data()), Join.size()};
6439 Discord_ActivitySecrets_SetJoin(&instance_, Join__str);
6440}
6441const ActivityButton ActivityButton::nullobj{{}, DiscordObjectState::Invalid};
6442ActivityButton::~ActivityButton()
6443{
6444 if (state_ == DiscordObjectState::Owned) {
6445 Drop();
6446 state_ = DiscordObjectState::Invalid;
6447 }
6448}
6449ActivityButton::ActivityButton(ActivityButton&& other) noexcept
6450 : instance_(other.instance_)
6451 , state_(other.state_)
6452{
6453 other.state_ = DiscordObjectState::Invalid;
6454}
6455ActivityButton& ActivityButton::operator=(ActivityButton&& other) noexcept
6456{
6457 if (this != &other) {
6458 if (state_ == DiscordObjectState::Owned) {
6459 Drop();
6460 }
6461 instance_ = other.instance_;
6462 state_ = other.state_;
6463 other.state_ = DiscordObjectState::Invalid;
6464 }
6465 return *this;
6466}
6467ActivityButton::ActivityButton(const ActivityButton& arg0)
6468 : instance_{}
6469 , state_(DiscordObjectState::Invalid)
6470{
6471 if (arg0.state_ == DiscordObjectState::Owned) {
6472 Discord_ActivityButton_Clone(&instance_, arg0.instance());
6473
6474 state_ = DiscordObjectState::Owned;
6475 }
6476}
6477ActivityButton& ActivityButton::operator=(const ActivityButton& arg0)
6478{
6479 if (this != &arg0) {
6480 if (state_ == DiscordObjectState::Owned) {
6481 Drop();
6482 state_ = DiscordObjectState::Invalid;
6483 }
6484 if (arg0.state_ == DiscordObjectState::Owned) {
6485 Discord_ActivityButton_Clone(&instance_, arg0.instance());
6486
6487 state_ = DiscordObjectState::Owned;
6488 }
6489 }
6490 return *this;
6491}
6492ActivityButton::ActivityButton(Discord_ActivityButton instance, DiscordObjectState state)
6493 : instance_(instance)
6494 , state_(state)
6495{
6496}
6497ActivityButton::ActivityButton()
6498{
6499 assert(state_ == DiscordObjectState::Invalid);
6500 Discord_ActivityButton_Init(&instance_);
6501 state_ = DiscordObjectState::Owned;
6502}
6503void ActivityButton::Drop()
6504{
6505 if (state_ != DiscordObjectState::Owned) {
6506 return;
6507 }
6508 Discord_ActivityButton_Drop(&instance_);
6509 state_ = DiscordObjectState::Invalid;
6510}
6511std::string ActivityButton::Label() const
6512{
6513 assert(state_ == DiscordObjectState::Owned);
6514 Discord_String returnValueNative__;
6515 Discord_ActivityButton_Label(&instance_, &returnValueNative__);
6516 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6517 returnValueNative__.size);
6518 Discord_Free(returnValueNative__.ptr);
6519 return returnValue__;
6520}
6521void ActivityButton::SetLabel(std::string Label)
6522{
6523 assert(state_ == DiscordObjectState::Owned);
6524 Discord_String Label__str{(uint8_t*)(Label.data()), Label.size()};
6525 Discord_ActivityButton_SetLabel(&instance_, Label__str);
6526}
6527std::string ActivityButton::Url() const
6528{
6529 assert(state_ == DiscordObjectState::Owned);
6530 Discord_String returnValueNative__;
6531 Discord_ActivityButton_Url(&instance_, &returnValueNative__);
6532 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6533 returnValueNative__.size);
6534 Discord_Free(returnValueNative__.ptr);
6535 return returnValue__;
6536}
6537void ActivityButton::SetUrl(std::string Url)
6538{
6539 assert(state_ == DiscordObjectState::Owned);
6540 Discord_String Url__str{(uint8_t*)(Url.data()), Url.size()};
6541 Discord_ActivityButton_SetUrl(&instance_, Url__str);
6542}
6543const Activity Activity::nullobj{{}, DiscordObjectState::Invalid};
6544Activity::~Activity()
6545{
6546 if (state_ == DiscordObjectState::Owned) {
6547 Drop();
6548 state_ = DiscordObjectState::Invalid;
6549 }
6550}
6551Activity::Activity(Activity&& other) noexcept
6552 : instance_(other.instance_)
6553 , state_(other.state_)
6554{
6555 other.state_ = DiscordObjectState::Invalid;
6556}
6557Activity& Activity::operator=(Activity&& other) noexcept
6558{
6559 if (this != &other) {
6560 if (state_ == DiscordObjectState::Owned) {
6561 Drop();
6562 }
6563 instance_ = other.instance_;
6564 state_ = other.state_;
6565 other.state_ = DiscordObjectState::Invalid;
6566 }
6567 return *this;
6568}
6569Activity::Activity(const Activity& arg0)
6570 : instance_{}
6571 , state_(DiscordObjectState::Invalid)
6572{
6573 if (arg0.state_ == DiscordObjectState::Owned) {
6574 Discord_Activity_Clone(&instance_, arg0.instance());
6575
6576 state_ = DiscordObjectState::Owned;
6577 }
6578}
6579Activity& Activity::operator=(const Activity& arg0)
6580{
6581 if (this != &arg0) {
6582 if (state_ == DiscordObjectState::Owned) {
6583 Drop();
6584 state_ = DiscordObjectState::Invalid;
6585 }
6586 if (arg0.state_ == DiscordObjectState::Owned) {
6587 Discord_Activity_Clone(&instance_, arg0.instance());
6588
6589 state_ = DiscordObjectState::Owned;
6590 }
6591 }
6592 return *this;
6593}
6594Activity::Activity(Discord_Activity instance, DiscordObjectState state)
6595 : instance_(instance)
6596 , state_(state)
6597{
6598}
6599Activity::Activity()
6600{
6601 assert(state_ == DiscordObjectState::Invalid);
6602 Discord_Activity_Init(&instance_);
6603 state_ = DiscordObjectState::Owned;
6604}
6605void Activity::Drop()
6606{
6607 if (state_ != DiscordObjectState::Owned) {
6608 return;
6609 }
6610 Discord_Activity_Drop(&instance_);
6611 state_ = DiscordObjectState::Invalid;
6612}
6613void Activity::AddButton(discordpp::ActivityButton button)
6614{
6615 assert(state_ == DiscordObjectState::Owned);
6616 Discord_Activity_AddButton(&instance_, button.instance());
6617}
6618bool Activity::Equals(discordpp::Activity other) const
6619{
6620 assert(state_ == DiscordObjectState::Owned);
6621 bool returnValue__;
6622 returnValue__ = Discord_Activity_Equals(&instance_, other.instance());
6623 return returnValue__;
6624}
6625std::vector<discordpp::ActivityButton> Activity::GetButtons() const
6626{
6627 assert(state_ == DiscordObjectState::Owned);
6628 Discord_ActivityButtonSpan returnValueNative__;
6629 Discord_Activity_GetButtons(&instance_, &returnValueNative__);
6630 std::vector<discordpp::ActivityButton> returnValue__;
6631 returnValue__.reserve(returnValueNative__.size);
6632 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
6633 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
6634 }
6635 Discord_Free(returnValueNative__.ptr);
6636 return returnValue__;
6637}
6638std::string Activity::Name() const
6639{
6640 assert(state_ == DiscordObjectState::Owned);
6641 Discord_String returnValueNative__;
6642 Discord_Activity_Name(&instance_, &returnValueNative__);
6643 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6644 returnValueNative__.size);
6645 Discord_Free(returnValueNative__.ptr);
6646 return returnValue__;
6647}
6648void Activity::SetName(std::string Name)
6649{
6650 assert(state_ == DiscordObjectState::Owned);
6651 Discord_String Name__str{(uint8_t*)(Name.data()), Name.size()};
6652 Discord_Activity_SetName(&instance_, Name__str);
6653}
6654discordpp::ActivityTypes Activity::Type() const
6655{
6656 assert(state_ == DiscordObjectState::Owned);
6657 Discord_ActivityTypes returnValue__;
6658 returnValue__ = Discord_Activity_Type(&instance_);
6659 return static_cast<discordpp::ActivityTypes>(returnValue__);
6660}
6661void Activity::SetType(discordpp::ActivityTypes Type)
6662{
6663 assert(state_ == DiscordObjectState::Owned);
6664 Discord_Activity_SetType(&instance_, static_cast<Discord_ActivityTypes>(Type));
6665}
6666std::optional<discordpp::StatusDisplayTypes> Activity::StatusDisplayType() const
6667{
6668 assert(state_ == DiscordObjectState::Owned);
6669 bool returnIsNonNull__;
6670 Discord_StatusDisplayTypes returnValueNative__;
6671 returnIsNonNull__ = Discord_Activity_StatusDisplayType(&instance_, &returnValueNative__);
6672 if (!returnIsNonNull__) {
6673 return {};
6674 }
6675 auto returnValue__ = static_cast<discordpp::StatusDisplayTypes>(returnValueNative__);
6676 return returnValue__;
6677}
6678void Activity::SetStatusDisplayType(std::optional<discordpp::StatusDisplayTypes> StatusDisplayType)
6679{
6680 assert(state_ == DiscordObjectState::Owned);
6681 Discord_Activity_SetStatusDisplayType(
6682 &instance_,
6683 (StatusDisplayType.has_value()
6684 ? reinterpret_cast<Discord_StatusDisplayTypes*>(&*StatusDisplayType)
6685 : nullptr));
6686}
6687std::optional<std::string> Activity::State() const
6688{
6689 assert(state_ == DiscordObjectState::Owned);
6690 bool returnIsNonNull__;
6691 Discord_String returnValueNative__;
6692 returnIsNonNull__ = Discord_Activity_State(&instance_, &returnValueNative__);
6693 if (!returnIsNonNull__) {
6694 return {};
6695 }
6696 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6697 returnValueNative__.size);
6698 Discord_Free(returnValueNative__.ptr);
6699 return returnValue__;
6700}
6701void Activity::SetState(std::optional<std::string> State)
6702{
6703 assert(state_ == DiscordObjectState::Owned);
6704 Discord_String State__str{};
6705 if (State.has_value()) {
6706 State__str.ptr = reinterpret_cast<uint8_t*>(State->data());
6707 State__str.size = State->size();
6708 }
6709 Discord_Activity_SetState(&instance_, (State.has_value() ? &State__str : nullptr));
6710}
6711std::optional<std::string> Activity::StateUrl() const
6712{
6713 assert(state_ == DiscordObjectState::Owned);
6714 bool returnIsNonNull__;
6715 Discord_String returnValueNative__;
6716 returnIsNonNull__ = Discord_Activity_StateUrl(&instance_, &returnValueNative__);
6717 if (!returnIsNonNull__) {
6718 return {};
6719 }
6720 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6721 returnValueNative__.size);
6722 Discord_Free(returnValueNative__.ptr);
6723 return returnValue__;
6724}
6725void Activity::SetStateUrl(std::optional<std::string> StateUrl)
6726{
6727 assert(state_ == DiscordObjectState::Owned);
6728 Discord_String StateUrl__str{};
6729 if (StateUrl.has_value()) {
6730 StateUrl__str.ptr = reinterpret_cast<uint8_t*>(StateUrl->data());
6731 StateUrl__str.size = StateUrl->size();
6732 }
6733 Discord_Activity_SetStateUrl(&instance_, (StateUrl.has_value() ? &StateUrl__str : nullptr));
6734}
6735std::optional<std::string> Activity::Details() const
6736{
6737 assert(state_ == DiscordObjectState::Owned);
6738 bool returnIsNonNull__;
6739 Discord_String returnValueNative__;
6740 returnIsNonNull__ = Discord_Activity_Details(&instance_, &returnValueNative__);
6741 if (!returnIsNonNull__) {
6742 return {};
6743 }
6744 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6745 returnValueNative__.size);
6746 Discord_Free(returnValueNative__.ptr);
6747 return returnValue__;
6748}
6749void Activity::SetDetails(std::optional<std::string> Details)
6750{
6751 assert(state_ == DiscordObjectState::Owned);
6752 Discord_String Details__str{};
6753 if (Details.has_value()) {
6754 Details__str.ptr = reinterpret_cast<uint8_t*>(Details->data());
6755 Details__str.size = Details->size();
6756 }
6757 Discord_Activity_SetDetails(&instance_, (Details.has_value() ? &Details__str : nullptr));
6758}
6759std::optional<std::string> Activity::DetailsUrl() const
6760{
6761 assert(state_ == DiscordObjectState::Owned);
6762 bool returnIsNonNull__;
6763 Discord_String returnValueNative__;
6764 returnIsNonNull__ = Discord_Activity_DetailsUrl(&instance_, &returnValueNative__);
6765 if (!returnIsNonNull__) {
6766 return {};
6767 }
6768 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6769 returnValueNative__.size);
6770 Discord_Free(returnValueNative__.ptr);
6771 return returnValue__;
6772}
6773void Activity::SetDetailsUrl(std::optional<std::string> DetailsUrl)
6774{
6775 assert(state_ == DiscordObjectState::Owned);
6776 Discord_String DetailsUrl__str{};
6777 if (DetailsUrl.has_value()) {
6778 DetailsUrl__str.ptr = reinterpret_cast<uint8_t*>(DetailsUrl->data());
6779 DetailsUrl__str.size = DetailsUrl->size();
6780 }
6781 Discord_Activity_SetDetailsUrl(&instance_,
6782 (DetailsUrl.has_value() ? &DetailsUrl__str : nullptr));
6783}
6784std::optional<uint64_t> Activity::ApplicationId() const
6785{
6786 assert(state_ == DiscordObjectState::Owned);
6787 bool returnIsNonNull__;
6788 uint64_t returnValue__;
6789 returnIsNonNull__ = Discord_Activity_ApplicationId(&instance_, &returnValue__);
6790 if (!returnIsNonNull__) {
6791 return std::nullopt;
6792 }
6793 return returnValue__;
6794}
6795void Activity::SetApplicationId(std::optional<uint64_t> ApplicationId)
6796{
6797 assert(state_ == DiscordObjectState::Owned);
6798 Discord_Activity_SetApplicationId(&instance_,
6799 (ApplicationId.has_value() ? &*ApplicationId : nullptr));
6800}
6801std::optional<uint64_t> Activity::ParentApplicationId() const
6802{
6803 assert(state_ == DiscordObjectState::Owned);
6804 bool returnIsNonNull__;
6805 uint64_t returnValue__;
6806 returnIsNonNull__ = Discord_Activity_ParentApplicationId(&instance_, &returnValue__);
6807 if (!returnIsNonNull__) {
6808 return std::nullopt;
6809 }
6810 return returnValue__;
6811}
6812void Activity::SetParentApplicationId(std::optional<uint64_t> ParentApplicationId)
6813{
6814 assert(state_ == DiscordObjectState::Owned);
6815 Discord_Activity_SetParentApplicationId(
6816 &instance_, (ParentApplicationId.has_value() ? &*ParentApplicationId : nullptr));
6817}
6818std::optional<discordpp::ActivityAssets> Activity::Assets() const
6819{
6820 assert(state_ == DiscordObjectState::Owned);
6821 bool returnIsNonNull__;
6822 Discord_ActivityAssets returnValueNative__;
6823 returnIsNonNull__ = Discord_Activity_Assets(&instance_, &returnValueNative__);
6824 if (!returnIsNonNull__) {
6825 return {};
6826 }
6827 discordpp::ActivityAssets returnValue__(returnValueNative__, DiscordObjectState::Owned);
6828 return returnValue__;
6829}
6830void Activity::SetAssets(std::optional<discordpp::ActivityAssets> Assets)
6831{
6832 assert(state_ == DiscordObjectState::Owned);
6833 Discord_Activity_SetAssets(&instance_, (Assets.has_value() ? Assets->instance() : nullptr));
6834}
6835std::optional<discordpp::ActivityTimestamps> Activity::Timestamps() const
6836{
6837 assert(state_ == DiscordObjectState::Owned);
6838 bool returnIsNonNull__;
6839 Discord_ActivityTimestamps returnValueNative__;
6840 returnIsNonNull__ = Discord_Activity_Timestamps(&instance_, &returnValueNative__);
6841 if (!returnIsNonNull__) {
6842 return {};
6843 }
6844 discordpp::ActivityTimestamps returnValue__(returnValueNative__, DiscordObjectState::Owned);
6845 return returnValue__;
6846}
6847void Activity::SetTimestamps(std::optional<discordpp::ActivityTimestamps> Timestamps)
6848{
6849 assert(state_ == DiscordObjectState::Owned);
6850 Discord_Activity_SetTimestamps(&instance_,
6851 (Timestamps.has_value() ? Timestamps->instance() : nullptr));
6852}
6853std::optional<discordpp::ActivityParty> Activity::Party() const
6854{
6855 assert(state_ == DiscordObjectState::Owned);
6856 bool returnIsNonNull__;
6857 Discord_ActivityParty returnValueNative__;
6858 returnIsNonNull__ = Discord_Activity_Party(&instance_, &returnValueNative__);
6859 if (!returnIsNonNull__) {
6860 return {};
6861 }
6862 discordpp::ActivityParty returnValue__(returnValueNative__, DiscordObjectState::Owned);
6863 return returnValue__;
6864}
6865void Activity::SetParty(std::optional<discordpp::ActivityParty> Party)
6866{
6867 assert(state_ == DiscordObjectState::Owned);
6868 Discord_Activity_SetParty(&instance_, (Party.has_value() ? Party->instance() : nullptr));
6869}
6870std::optional<discordpp::ActivitySecrets> Activity::Secrets() const
6871{
6872 assert(state_ == DiscordObjectState::Owned);
6873 bool returnIsNonNull__;
6874 Discord_ActivitySecrets returnValueNative__;
6875 returnIsNonNull__ = Discord_Activity_Secrets(&instance_, &returnValueNative__);
6876 if (!returnIsNonNull__) {
6877 return {};
6878 }
6879 discordpp::ActivitySecrets returnValue__(returnValueNative__, DiscordObjectState::Owned);
6880 return returnValue__;
6881}
6882void Activity::SetSecrets(std::optional<discordpp::ActivitySecrets> Secrets)
6883{
6884 assert(state_ == DiscordObjectState::Owned);
6885 Discord_Activity_SetSecrets(&instance_, (Secrets.has_value() ? Secrets->instance() : nullptr));
6886}
6887discordpp::ActivityGamePlatforms Activity::SupportedPlatforms() const
6888{
6889 assert(state_ == DiscordObjectState::Owned);
6890 Discord_ActivityGamePlatforms returnValue__;
6891 returnValue__ = Discord_Activity_SupportedPlatforms(&instance_);
6892 return static_cast<discordpp::ActivityGamePlatforms>(returnValue__);
6893}
6894void Activity::SetSupportedPlatforms(discordpp::ActivityGamePlatforms SupportedPlatforms)
6895{
6896 assert(state_ == DiscordObjectState::Owned);
6897 Discord_Activity_SetSupportedPlatforms(
6898 &instance_, static_cast<Discord_ActivityGamePlatforms>(SupportedPlatforms));
6899}
6900const ClientResult ClientResult::nullobj{{}, DiscordObjectState::Invalid};
6901ClientResult::~ClientResult()
6902{
6903 if (state_ == DiscordObjectState::Owned) {
6904 Drop();
6905 state_ = DiscordObjectState::Invalid;
6906 }
6907}
6908ClientResult::ClientResult(ClientResult&& other) noexcept
6909 : instance_(other.instance_)
6910 , state_(other.state_)
6911{
6912 other.state_ = DiscordObjectState::Invalid;
6913}
6914ClientResult& ClientResult::operator=(ClientResult&& other) noexcept
6915{
6916 if (this != &other) {
6917 if (state_ == DiscordObjectState::Owned) {
6918 Drop();
6919 }
6920 instance_ = other.instance_;
6921 state_ = other.state_;
6922 other.state_ = DiscordObjectState::Invalid;
6923 }
6924 return *this;
6925}
6926ClientResult::ClientResult(const ClientResult& arg0)
6927 : instance_{}
6928 , state_(DiscordObjectState::Invalid)
6929{
6930 if (arg0.state_ == DiscordObjectState::Owned) {
6931 Discord_ClientResult_Clone(&instance_, arg0.instance());
6932
6933 state_ = DiscordObjectState::Owned;
6934 }
6935}
6936ClientResult& ClientResult::operator=(const ClientResult& arg0)
6937{
6938 if (this != &arg0) {
6939 if (state_ == DiscordObjectState::Owned) {
6940 Drop();
6941 state_ = DiscordObjectState::Invalid;
6942 }
6943 if (arg0.state_ == DiscordObjectState::Owned) {
6944 Discord_ClientResult_Clone(&instance_, arg0.instance());
6945
6946 state_ = DiscordObjectState::Owned;
6947 }
6948 }
6949 return *this;
6950}
6951ClientResult::ClientResult(Discord_ClientResult instance, DiscordObjectState state)
6952 : instance_(instance)
6953 , state_(state)
6954{
6955}
6956void ClientResult::Drop()
6957{
6958 if (state_ != DiscordObjectState::Owned) {
6959 return;
6960 }
6961 Discord_ClientResult_Drop(&instance_);
6962 state_ = DiscordObjectState::Invalid;
6963}
6964std::string ClientResult::ToString() const
6965{
6966 assert(state_ == DiscordObjectState::Owned);
6967 Discord_String returnValueNative__;
6968 Discord_ClientResult_ToString(&instance_, &returnValueNative__);
6969 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6970 returnValueNative__.size);
6971 Discord_Free(returnValueNative__.ptr);
6972 return returnValue__;
6973}
6974discordpp::ErrorType ClientResult::Type() const
6975{
6976 assert(state_ == DiscordObjectState::Owned);
6977 Discord_ErrorType returnValue__;
6978 returnValue__ = Discord_ClientResult_Type(&instance_);
6979 return static_cast<discordpp::ErrorType>(returnValue__);
6980}
6981void ClientResult::SetType(discordpp::ErrorType Type)
6982{
6983 assert(state_ == DiscordObjectState::Owned);
6984 Discord_ClientResult_SetType(&instance_, static_cast<Discord_ErrorType>(Type));
6985}
6986std::string ClientResult::Error() const
6987{
6988 assert(state_ == DiscordObjectState::Owned);
6989 Discord_String returnValueNative__;
6990 Discord_ClientResult_Error(&instance_, &returnValueNative__);
6991 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6992 returnValueNative__.size);
6993 Discord_Free(returnValueNative__.ptr);
6994 return returnValue__;
6995}
6996void ClientResult::SetError(std::string Error)
6997{
6998 assert(state_ == DiscordObjectState::Owned);
6999 Discord_String Error__str{(uint8_t*)(Error.data()), Error.size()};
7000 Discord_ClientResult_SetError(&instance_, Error__str);
7001}
7002int32_t ClientResult::ErrorCode() const
7003{
7004 assert(state_ == DiscordObjectState::Owned);
7005 int32_t returnValue__;
7006 returnValue__ = Discord_ClientResult_ErrorCode(&instance_);
7007 return returnValue__;
7008}
7009void ClientResult::SetErrorCode(int32_t ErrorCode)
7010{
7011 assert(state_ == DiscordObjectState::Owned);
7012 Discord_ClientResult_SetErrorCode(&instance_, ErrorCode);
7013}
7014discordpp::HttpStatusCode ClientResult::Status() const
7015{
7016 assert(state_ == DiscordObjectState::Owned);
7017 Discord_HttpStatusCode returnValue__;
7018 returnValue__ = Discord_ClientResult_Status(&instance_);
7019 return static_cast<discordpp::HttpStatusCode>(returnValue__);
7020}
7021void ClientResult::SetStatus(discordpp::HttpStatusCode Status)
7022{
7023 assert(state_ == DiscordObjectState::Owned);
7024 Discord_ClientResult_SetStatus(&instance_, static_cast<Discord_HttpStatusCode>(Status));
7025}
7026std::string ClientResult::ResponseBody() const
7027{
7028 assert(state_ == DiscordObjectState::Owned);
7029 Discord_String returnValueNative__;
7030 Discord_ClientResult_ResponseBody(&instance_, &returnValueNative__);
7031 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7032 returnValueNative__.size);
7033 Discord_Free(returnValueNative__.ptr);
7034 return returnValue__;
7035}
7036void ClientResult::SetResponseBody(std::string ResponseBody)
7037{
7038 assert(state_ == DiscordObjectState::Owned);
7039 Discord_String ResponseBody__str{(uint8_t*)(ResponseBody.data()), ResponseBody.size()};
7040 Discord_ClientResult_SetResponseBody(&instance_, ResponseBody__str);
7041}
7042bool ClientResult::Successful() const
7043{
7044 assert(state_ == DiscordObjectState::Owned);
7045 bool returnValue__;
7046 returnValue__ = Discord_ClientResult_Successful(&instance_);
7047 return returnValue__;
7048}
7049void ClientResult::SetSuccessful(bool Successful)
7050{
7051 assert(state_ == DiscordObjectState::Owned);
7052 Discord_ClientResult_SetSuccessful(&instance_, Successful);
7053}
7054bool ClientResult::Retryable() const
7055{
7056 assert(state_ == DiscordObjectState::Owned);
7057 bool returnValue__;
7058 returnValue__ = Discord_ClientResult_Retryable(&instance_);
7059 return returnValue__;
7060}
7061void ClientResult::SetRetryable(bool Retryable)
7062{
7063 assert(state_ == DiscordObjectState::Owned);
7064 Discord_ClientResult_SetRetryable(&instance_, Retryable);
7065}
7066float ClientResult::RetryAfter() const
7067{
7068 assert(state_ == DiscordObjectState::Owned);
7069 float returnValue__;
7070 returnValue__ = Discord_ClientResult_RetryAfter(&instance_);
7071 return returnValue__;
7072}
7073void ClientResult::SetRetryAfter(float RetryAfter)
7074{
7075 assert(state_ == DiscordObjectState::Owned);
7076 Discord_ClientResult_SetRetryAfter(&instance_, RetryAfter);
7077}
7078const AuthorizationCodeChallenge AuthorizationCodeChallenge::nullobj{{},
7079 DiscordObjectState::Invalid};
7080AuthorizationCodeChallenge::~AuthorizationCodeChallenge()
7081{
7082 if (state_ == DiscordObjectState::Owned) {
7083 Drop();
7084 state_ = DiscordObjectState::Invalid;
7085 }
7086}
7087AuthorizationCodeChallenge::AuthorizationCodeChallenge(AuthorizationCodeChallenge&& other) noexcept
7088 : instance_(other.instance_)
7089 , state_(other.state_)
7090{
7091 other.state_ = DiscordObjectState::Invalid;
7092}
7093AuthorizationCodeChallenge& AuthorizationCodeChallenge::operator=(
7094 AuthorizationCodeChallenge&& other) noexcept
7095{
7096 if (this != &other) {
7097 if (state_ == DiscordObjectState::Owned) {
7098 Drop();
7099 }
7100 instance_ = other.instance_;
7101 state_ = other.state_;
7102 other.state_ = DiscordObjectState::Invalid;
7103 }
7104 return *this;
7105}
7106AuthorizationCodeChallenge::AuthorizationCodeChallenge(const AuthorizationCodeChallenge& arg0)
7107 : instance_{}
7108 , state_(DiscordObjectState::Invalid)
7109{
7110 if (arg0.state_ == DiscordObjectState::Owned) {
7111 Discord_AuthorizationCodeChallenge_Clone(&instance_, arg0.instance());
7112
7113 state_ = DiscordObjectState::Owned;
7114 }
7115}
7116AuthorizationCodeChallenge& AuthorizationCodeChallenge::operator=(
7117 const AuthorizationCodeChallenge& arg0)
7118{
7119 if (this != &arg0) {
7120 if (state_ == DiscordObjectState::Owned) {
7121 Drop();
7122 state_ = DiscordObjectState::Invalid;
7123 }
7124 if (arg0.state_ == DiscordObjectState::Owned) {
7125 Discord_AuthorizationCodeChallenge_Clone(&instance_, arg0.instance());
7126
7127 state_ = DiscordObjectState::Owned;
7128 }
7129 }
7130 return *this;
7131}
7132AuthorizationCodeChallenge::AuthorizationCodeChallenge(Discord_AuthorizationCodeChallenge instance,
7133 DiscordObjectState state)
7134 : instance_(instance)
7135 , state_(state)
7136{
7137}
7138AuthorizationCodeChallenge::AuthorizationCodeChallenge()
7139{
7140 assert(state_ == DiscordObjectState::Invalid);
7141 Discord_AuthorizationCodeChallenge_Init(&instance_);
7142 state_ = DiscordObjectState::Owned;
7143}
7144void AuthorizationCodeChallenge::Drop()
7145{
7146 if (state_ != DiscordObjectState::Owned) {
7147 return;
7148 }
7149 Discord_AuthorizationCodeChallenge_Drop(&instance_);
7150 state_ = DiscordObjectState::Invalid;
7151}
7152discordpp::AuthenticationCodeChallengeMethod AuthorizationCodeChallenge::Method() const
7153{
7154 assert(state_ == DiscordObjectState::Owned);
7155 Discord_AuthenticationCodeChallengeMethod returnValue__;
7156 returnValue__ = Discord_AuthorizationCodeChallenge_Method(&instance_);
7157 return static_cast<discordpp::AuthenticationCodeChallengeMethod>(returnValue__);
7158}
7159void AuthorizationCodeChallenge::SetMethod(discordpp::AuthenticationCodeChallengeMethod Method)
7160{
7161 assert(state_ == DiscordObjectState::Owned);
7162 Discord_AuthorizationCodeChallenge_SetMethod(
7163 &instance_, static_cast<Discord_AuthenticationCodeChallengeMethod>(Method));
7164}
7165std::string AuthorizationCodeChallenge::Challenge() const
7166{
7167 assert(state_ == DiscordObjectState::Owned);
7168 Discord_String returnValueNative__;
7169 Discord_AuthorizationCodeChallenge_Challenge(&instance_, &returnValueNative__);
7170 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7171 returnValueNative__.size);
7172 Discord_Free(returnValueNative__.ptr);
7173 return returnValue__;
7174}
7175void AuthorizationCodeChallenge::SetChallenge(std::string Challenge)
7176{
7177 assert(state_ == DiscordObjectState::Owned);
7178 Discord_String Challenge__str{(uint8_t*)(Challenge.data()), Challenge.size()};
7179 Discord_AuthorizationCodeChallenge_SetChallenge(&instance_, Challenge__str);
7180}
7181const AuthorizationCodeVerifier AuthorizationCodeVerifier::nullobj{{}, DiscordObjectState::Invalid};
7182AuthorizationCodeVerifier::~AuthorizationCodeVerifier()
7183{
7184 if (state_ == DiscordObjectState::Owned) {
7185 Drop();
7186 state_ = DiscordObjectState::Invalid;
7187 }
7188}
7189AuthorizationCodeVerifier::AuthorizationCodeVerifier(AuthorizationCodeVerifier&& other) noexcept
7190 : instance_(other.instance_)
7191 , state_(other.state_)
7192{
7193 other.state_ = DiscordObjectState::Invalid;
7194}
7195AuthorizationCodeVerifier& AuthorizationCodeVerifier::operator=(
7196 AuthorizationCodeVerifier&& other) noexcept
7197{
7198 if (this != &other) {
7199 if (state_ == DiscordObjectState::Owned) {
7200 Drop();
7201 }
7202 instance_ = other.instance_;
7203 state_ = other.state_;
7204 other.state_ = DiscordObjectState::Invalid;
7205 }
7206 return *this;
7207}
7208AuthorizationCodeVerifier::AuthorizationCodeVerifier(const AuthorizationCodeVerifier& arg0)
7209 : instance_{}
7210 , state_(DiscordObjectState::Invalid)
7211{
7212 if (arg0.state_ == DiscordObjectState::Owned) {
7213 Discord_AuthorizationCodeVerifier_Clone(&instance_, arg0.instance());
7214
7215 state_ = DiscordObjectState::Owned;
7216 }
7217}
7218AuthorizationCodeVerifier& AuthorizationCodeVerifier::operator=(
7219 const AuthorizationCodeVerifier& arg0)
7220{
7221 if (this != &arg0) {
7222 if (state_ == DiscordObjectState::Owned) {
7223 Drop();
7224 state_ = DiscordObjectState::Invalid;
7225 }
7226 if (arg0.state_ == DiscordObjectState::Owned) {
7227 Discord_AuthorizationCodeVerifier_Clone(&instance_, arg0.instance());
7228
7229 state_ = DiscordObjectState::Owned;
7230 }
7231 }
7232 return *this;
7233}
7234AuthorizationCodeVerifier::AuthorizationCodeVerifier(Discord_AuthorizationCodeVerifier instance,
7235 DiscordObjectState state)
7236 : instance_(instance)
7237 , state_(state)
7238{
7239}
7240void AuthorizationCodeVerifier::Drop()
7241{
7242 if (state_ != DiscordObjectState::Owned) {
7243 return;
7244 }
7245 Discord_AuthorizationCodeVerifier_Drop(&instance_);
7246 state_ = DiscordObjectState::Invalid;
7247}
7248discordpp::AuthorizationCodeChallenge AuthorizationCodeVerifier::Challenge() const
7249{
7250 assert(state_ == DiscordObjectState::Owned);
7251 Discord_AuthorizationCodeChallenge returnValueNative__{};
7252 Discord_AuthorizationCodeVerifier_Challenge(&instance_, &returnValueNative__);
7253 discordpp::AuthorizationCodeChallenge returnValue__(returnValueNative__,
7254 DiscordObjectState::Owned);
7255 return returnValue__;
7256}
7257void AuthorizationCodeVerifier::SetChallenge(discordpp::AuthorizationCodeChallenge Challenge)
7258{
7259 assert(state_ == DiscordObjectState::Owned);
7260 Discord_AuthorizationCodeVerifier_SetChallenge(&instance_, Challenge.instance());
7261}
7262std::string AuthorizationCodeVerifier::Verifier() const
7263{
7264 assert(state_ == DiscordObjectState::Owned);
7265 Discord_String returnValueNative__;
7266 Discord_AuthorizationCodeVerifier_Verifier(&instance_, &returnValueNative__);
7267 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7268 returnValueNative__.size);
7269 Discord_Free(returnValueNative__.ptr);
7270 return returnValue__;
7271}
7272void AuthorizationCodeVerifier::SetVerifier(std::string Verifier)
7273{
7274 assert(state_ == DiscordObjectState::Owned);
7275 Discord_String Verifier__str{(uint8_t*)(Verifier.data()), Verifier.size()};
7276 Discord_AuthorizationCodeVerifier_SetVerifier(&instance_, Verifier__str);
7277}
7278const AuthorizationArgs AuthorizationArgs::nullobj{{}, DiscordObjectState::Invalid};
7279AuthorizationArgs::~AuthorizationArgs()
7280{
7281 if (state_ == DiscordObjectState::Owned) {
7282 Drop();
7283 state_ = DiscordObjectState::Invalid;
7284 }
7285}
7286AuthorizationArgs::AuthorizationArgs(AuthorizationArgs&& other) noexcept
7287 : instance_(other.instance_)
7288 , state_(other.state_)
7289{
7290 other.state_ = DiscordObjectState::Invalid;
7291}
7292AuthorizationArgs& AuthorizationArgs::operator=(AuthorizationArgs&& other) noexcept
7293{
7294 if (this != &other) {
7295 if (state_ == DiscordObjectState::Owned) {
7296 Drop();
7297 }
7298 instance_ = other.instance_;
7299 state_ = other.state_;
7300 other.state_ = DiscordObjectState::Invalid;
7301 }
7302 return *this;
7303}
7304AuthorizationArgs::AuthorizationArgs(const AuthorizationArgs& arg0)
7305 : instance_{}
7306 , state_(DiscordObjectState::Invalid)
7307{
7308 if (arg0.state_ == DiscordObjectState::Owned) {
7309 Discord_AuthorizationArgs_Clone(&instance_, arg0.instance());
7310
7311 state_ = DiscordObjectState::Owned;
7312 }
7313}
7314AuthorizationArgs& AuthorizationArgs::operator=(const AuthorizationArgs& arg0)
7315{
7316 if (this != &arg0) {
7317 if (state_ == DiscordObjectState::Owned) {
7318 Drop();
7319 state_ = DiscordObjectState::Invalid;
7320 }
7321 if (arg0.state_ == DiscordObjectState::Owned) {
7322 Discord_AuthorizationArgs_Clone(&instance_, arg0.instance());
7323
7324 state_ = DiscordObjectState::Owned;
7325 }
7326 }
7327 return *this;
7328}
7329AuthorizationArgs::AuthorizationArgs(Discord_AuthorizationArgs instance, DiscordObjectState state)
7330 : instance_(instance)
7331 , state_(state)
7332{
7333}
7334AuthorizationArgs::AuthorizationArgs()
7335{
7336 assert(state_ == DiscordObjectState::Invalid);
7337 Discord_AuthorizationArgs_Init(&instance_);
7338 state_ = DiscordObjectState::Owned;
7339}
7340void AuthorizationArgs::Drop()
7341{
7342 if (state_ != DiscordObjectState::Owned) {
7343 return;
7344 }
7345 Discord_AuthorizationArgs_Drop(&instance_);
7346 state_ = DiscordObjectState::Invalid;
7347}
7348uint64_t AuthorizationArgs::ClientId() const
7349{
7350 assert(state_ == DiscordObjectState::Owned);
7351 uint64_t returnValue__;
7352 returnValue__ = Discord_AuthorizationArgs_ClientId(&instance_);
7353 return returnValue__;
7354}
7355void AuthorizationArgs::SetClientId(uint64_t ClientId)
7356{
7357 assert(state_ == DiscordObjectState::Owned);
7358 Discord_AuthorizationArgs_SetClientId(&instance_, ClientId);
7359}
7360std::string AuthorizationArgs::Scopes() const
7361{
7362 assert(state_ == DiscordObjectState::Owned);
7363 Discord_String returnValueNative__;
7364 Discord_AuthorizationArgs_Scopes(&instance_, &returnValueNative__);
7365 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7366 returnValueNative__.size);
7367 Discord_Free(returnValueNative__.ptr);
7368 return returnValue__;
7369}
7370void AuthorizationArgs::SetScopes(std::string Scopes)
7371{
7372 assert(state_ == DiscordObjectState::Owned);
7373 Discord_String Scopes__str{(uint8_t*)(Scopes.data()), Scopes.size()};
7374 Discord_AuthorizationArgs_SetScopes(&instance_, Scopes__str);
7375}
7376std::optional<std::string> AuthorizationArgs::State() const
7377{
7378 assert(state_ == DiscordObjectState::Owned);
7379 bool returnIsNonNull__;
7380 Discord_String returnValueNative__;
7381 returnIsNonNull__ = Discord_AuthorizationArgs_State(&instance_, &returnValueNative__);
7382 if (!returnIsNonNull__) {
7383 return {};
7384 }
7385 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7386 returnValueNative__.size);
7387 Discord_Free(returnValueNative__.ptr);
7388 return returnValue__;
7389}
7390void AuthorizationArgs::SetState(std::optional<std::string> State)
7391{
7392 assert(state_ == DiscordObjectState::Owned);
7393 Discord_String State__str{};
7394 if (State.has_value()) {
7395 State__str.ptr = reinterpret_cast<uint8_t*>(State->data());
7396 State__str.size = State->size();
7397 }
7398 Discord_AuthorizationArgs_SetState(&instance_, (State.has_value() ? &State__str : nullptr));
7399}
7400std::optional<std::string> AuthorizationArgs::Nonce() const
7401{
7402 assert(state_ == DiscordObjectState::Owned);
7403 bool returnIsNonNull__;
7404 Discord_String returnValueNative__;
7405 returnIsNonNull__ = Discord_AuthorizationArgs_Nonce(&instance_, &returnValueNative__);
7406 if (!returnIsNonNull__) {
7407 return {};
7408 }
7409 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7410 returnValueNative__.size);
7411 Discord_Free(returnValueNative__.ptr);
7412 return returnValue__;
7413}
7414void AuthorizationArgs::SetNonce(std::optional<std::string> Nonce)
7415{
7416 assert(state_ == DiscordObjectState::Owned);
7417 Discord_String Nonce__str{};
7418 if (Nonce.has_value()) {
7419 Nonce__str.ptr = reinterpret_cast<uint8_t*>(Nonce->data());
7420 Nonce__str.size = Nonce->size();
7421 }
7422 Discord_AuthorizationArgs_SetNonce(&instance_, (Nonce.has_value() ? &Nonce__str : nullptr));
7423}
7424std::optional<discordpp::AuthorizationCodeChallenge> AuthorizationArgs::CodeChallenge() const
7425{
7426 assert(state_ == DiscordObjectState::Owned);
7427 bool returnIsNonNull__;
7428 Discord_AuthorizationCodeChallenge returnValueNative__;
7429 returnIsNonNull__ = Discord_AuthorizationArgs_CodeChallenge(&instance_, &returnValueNative__);
7430 if (!returnIsNonNull__) {
7431 return {};
7432 }
7433 discordpp::AuthorizationCodeChallenge returnValue__(returnValueNative__,
7434 DiscordObjectState::Owned);
7435 return returnValue__;
7436}
7437void AuthorizationArgs::SetCodeChallenge(
7438 std::optional<discordpp::AuthorizationCodeChallenge> CodeChallenge)
7439{
7440 assert(state_ == DiscordObjectState::Owned);
7441 Discord_AuthorizationArgs_SetCodeChallenge(
7442 &instance_, (CodeChallenge.has_value() ? CodeChallenge->instance() : nullptr));
7443}
7444std::optional<discordpp::IntegrationType> AuthorizationArgs::IntegrationType() const
7445{
7446 assert(state_ == DiscordObjectState::Owned);
7447 bool returnIsNonNull__;
7448 Discord_IntegrationType returnValueNative__;
7449 returnIsNonNull__ = Discord_AuthorizationArgs_IntegrationType(&instance_, &returnValueNative__);
7450 if (!returnIsNonNull__) {
7451 return {};
7452 }
7453 auto returnValue__ = static_cast<discordpp::IntegrationType>(returnValueNative__);
7454 return returnValue__;
7455}
7456void AuthorizationArgs::SetIntegrationType(
7457 std::optional<discordpp::IntegrationType> IntegrationType)
7458{
7459 assert(state_ == DiscordObjectState::Owned);
7460 Discord_AuthorizationArgs_SetIntegrationType(
7461 &instance_,
7462 (IntegrationType.has_value() ? reinterpret_cast<Discord_IntegrationType*>(&*IntegrationType)
7463 : nullptr));
7464}
7465std::optional<std::string> AuthorizationArgs::CustomSchemeParam() const
7466{
7467 assert(state_ == DiscordObjectState::Owned);
7468 bool returnIsNonNull__;
7469 Discord_String returnValueNative__;
7470 returnIsNonNull__ =
7471 Discord_AuthorizationArgs_CustomSchemeParam(&instance_, &returnValueNative__);
7472 if (!returnIsNonNull__) {
7473 return {};
7474 }
7475 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7476 returnValueNative__.size);
7477 Discord_Free(returnValueNative__.ptr);
7478 return returnValue__;
7479}
7480void AuthorizationArgs::SetCustomSchemeParam(std::optional<std::string> CustomSchemeParam)
7481{
7482 assert(state_ == DiscordObjectState::Owned);
7483 Discord_String CustomSchemeParam__str{};
7484 if (CustomSchemeParam.has_value()) {
7485 CustomSchemeParam__str.ptr = reinterpret_cast<uint8_t*>(CustomSchemeParam->data());
7486 CustomSchemeParam__str.size = CustomSchemeParam->size();
7487 }
7488 Discord_AuthorizationArgs_SetCustomSchemeParam(
7489 &instance_, (CustomSchemeParam.has_value() ? &CustomSchemeParam__str : nullptr));
7490}
7491const DeviceAuthorizationArgs DeviceAuthorizationArgs::nullobj{{}, DiscordObjectState::Invalid};
7492DeviceAuthorizationArgs::~DeviceAuthorizationArgs()
7493{
7494 if (state_ == DiscordObjectState::Owned) {
7495 Drop();
7496 state_ = DiscordObjectState::Invalid;
7497 }
7498}
7499DeviceAuthorizationArgs::DeviceAuthorizationArgs(DeviceAuthorizationArgs&& other) noexcept
7500 : instance_(other.instance_)
7501 , state_(other.state_)
7502{
7503 other.state_ = DiscordObjectState::Invalid;
7504}
7505DeviceAuthorizationArgs& DeviceAuthorizationArgs::operator=(
7506 DeviceAuthorizationArgs&& other) noexcept
7507{
7508 if (this != &other) {
7509 if (state_ == DiscordObjectState::Owned) {
7510 Drop();
7511 }
7512 instance_ = other.instance_;
7513 state_ = other.state_;
7514 other.state_ = DiscordObjectState::Invalid;
7515 }
7516 return *this;
7517}
7518DeviceAuthorizationArgs::DeviceAuthorizationArgs(const DeviceAuthorizationArgs& arg0)
7519 : instance_{}
7520 , state_(DiscordObjectState::Invalid)
7521{
7522 if (arg0.state_ == DiscordObjectState::Owned) {
7523 Discord_DeviceAuthorizationArgs_Clone(&instance_, arg0.instance());
7524
7525 state_ = DiscordObjectState::Owned;
7526 }
7527}
7528DeviceAuthorizationArgs& DeviceAuthorizationArgs::operator=(const DeviceAuthorizationArgs& arg0)
7529{
7530 if (this != &arg0) {
7531 if (state_ == DiscordObjectState::Owned) {
7532 Drop();
7533 state_ = DiscordObjectState::Invalid;
7534 }
7535 if (arg0.state_ == DiscordObjectState::Owned) {
7536 Discord_DeviceAuthorizationArgs_Clone(&instance_, arg0.instance());
7537
7538 state_ = DiscordObjectState::Owned;
7539 }
7540 }
7541 return *this;
7542}
7543DeviceAuthorizationArgs::DeviceAuthorizationArgs(Discord_DeviceAuthorizationArgs instance,
7544 DiscordObjectState state)
7545 : instance_(instance)
7546 , state_(state)
7547{
7548}
7549DeviceAuthorizationArgs::DeviceAuthorizationArgs()
7550{
7551 assert(state_ == DiscordObjectState::Invalid);
7552 Discord_DeviceAuthorizationArgs_Init(&instance_);
7553 state_ = DiscordObjectState::Owned;
7554}
7555void DeviceAuthorizationArgs::Drop()
7556{
7557 if (state_ != DiscordObjectState::Owned) {
7558 return;
7559 }
7560 Discord_DeviceAuthorizationArgs_Drop(&instance_);
7561 state_ = DiscordObjectState::Invalid;
7562}
7563uint64_t DeviceAuthorizationArgs::ClientId() const
7564{
7565 assert(state_ == DiscordObjectState::Owned);
7566 uint64_t returnValue__;
7567 returnValue__ = Discord_DeviceAuthorizationArgs_ClientId(&instance_);
7568 return returnValue__;
7569}
7570void DeviceAuthorizationArgs::SetClientId(uint64_t ClientId)
7571{
7572 assert(state_ == DiscordObjectState::Owned);
7573 Discord_DeviceAuthorizationArgs_SetClientId(&instance_, ClientId);
7574}
7575std::string DeviceAuthorizationArgs::Scopes() const
7576{
7577 assert(state_ == DiscordObjectState::Owned);
7578 Discord_String returnValueNative__;
7579 Discord_DeviceAuthorizationArgs_Scopes(&instance_, &returnValueNative__);
7580 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7581 returnValueNative__.size);
7582 Discord_Free(returnValueNative__.ptr);
7583 return returnValue__;
7584}
7585void DeviceAuthorizationArgs::SetScopes(std::string Scopes)
7586{
7587 assert(state_ == DiscordObjectState::Owned);
7588 Discord_String Scopes__str{(uint8_t*)(Scopes.data()), Scopes.size()};
7589 Discord_DeviceAuthorizationArgs_SetScopes(&instance_, Scopes__str);
7590}
7591const VoiceStateHandle VoiceStateHandle::nullobj{{}, DiscordObjectState::Invalid};
7592VoiceStateHandle::~VoiceStateHandle()
7593{
7594 if (state_ == DiscordObjectState::Owned) {
7595 Drop();
7596 state_ = DiscordObjectState::Invalid;
7597 }
7598}
7599VoiceStateHandle::VoiceStateHandle(VoiceStateHandle&& other) noexcept
7600 : instance_(other.instance_)
7601 , state_(other.state_)
7602{
7603 other.state_ = DiscordObjectState::Invalid;
7604}
7605VoiceStateHandle& VoiceStateHandle::operator=(VoiceStateHandle&& other) noexcept
7606{
7607 if (this != &other) {
7608 if (state_ == DiscordObjectState::Owned) {
7609 Drop();
7610 }
7611 instance_ = other.instance_;
7612 state_ = other.state_;
7613 other.state_ = DiscordObjectState::Invalid;
7614 }
7615 return *this;
7616}
7617VoiceStateHandle::VoiceStateHandle(const VoiceStateHandle& other)
7618 : instance_{}
7619 , state_(DiscordObjectState::Invalid)
7620{
7621 if (other.state_ == DiscordObjectState::Owned) {
7622 Discord_VoiceStateHandle_Clone(&instance_, other.instance());
7623
7624 state_ = DiscordObjectState::Owned;
7625 }
7626}
7627VoiceStateHandle& VoiceStateHandle::operator=(const VoiceStateHandle& other)
7628{
7629 if (this != &other) {
7630 if (state_ == DiscordObjectState::Owned) {
7631 Drop();
7632 state_ = DiscordObjectState::Invalid;
7633 }
7634 if (other.state_ == DiscordObjectState::Owned) {
7635 Discord_VoiceStateHandle_Clone(&instance_, other.instance());
7636
7637 state_ = DiscordObjectState::Owned;
7638 }
7639 }
7640 return *this;
7641}
7642VoiceStateHandle::VoiceStateHandle(Discord_VoiceStateHandle instance, DiscordObjectState state)
7643 : instance_(instance)
7644 , state_(state)
7645{
7646}
7647void VoiceStateHandle::Drop()
7648{
7649 if (state_ != DiscordObjectState::Owned) {
7650 return;
7651 }
7652 Discord_VoiceStateHandle_Drop(&instance_);
7653 state_ = DiscordObjectState::Invalid;
7654}
7655bool VoiceStateHandle::SelfDeaf() const
7656{
7657 assert(state_ == DiscordObjectState::Owned);
7658 bool returnValue__;
7659 returnValue__ = Discord_VoiceStateHandle_SelfDeaf(&instance_);
7660 return returnValue__;
7661}
7662bool VoiceStateHandle::SelfMute() const
7663{
7664 assert(state_ == DiscordObjectState::Owned);
7665 bool returnValue__;
7666 returnValue__ = Discord_VoiceStateHandle_SelfMute(&instance_);
7667 return returnValue__;
7668}
7669const VADThresholdSettings VADThresholdSettings::nullobj{{}, DiscordObjectState::Invalid};
7670VADThresholdSettings::~VADThresholdSettings()
7671{
7672 if (state_ == DiscordObjectState::Owned) {
7673 Drop();
7674 state_ = DiscordObjectState::Invalid;
7675 }
7676}
7677VADThresholdSettings::VADThresholdSettings(VADThresholdSettings&& other) noexcept
7678 : instance_(other.instance_)
7679 , state_(other.state_)
7680{
7681 other.state_ = DiscordObjectState::Invalid;
7682}
7683VADThresholdSettings& VADThresholdSettings::operator=(VADThresholdSettings&& other) noexcept
7684{
7685 if (this != &other) {
7686 if (state_ == DiscordObjectState::Owned) {
7687 Drop();
7688 }
7689 instance_ = other.instance_;
7690 state_ = other.state_;
7691 other.state_ = DiscordObjectState::Invalid;
7692 }
7693 return *this;
7694}
7695VADThresholdSettings::VADThresholdSettings(Discord_VADThresholdSettings instance,
7696 DiscordObjectState state)
7697 : instance_(instance)
7698 , state_(state)
7699{
7700}
7701void VADThresholdSettings::Drop()
7702{
7703 if (state_ != DiscordObjectState::Owned) {
7704 return;
7705 }
7706 Discord_VADThresholdSettings_Drop(&instance_);
7707 state_ = DiscordObjectState::Invalid;
7708}
7709float VADThresholdSettings::VadThreshold() const
7710{
7711 assert(state_ == DiscordObjectState::Owned);
7712 float returnValue__;
7713 returnValue__ = Discord_VADThresholdSettings_VadThreshold(&instance_);
7714 return returnValue__;
7715}
7716void VADThresholdSettings::SetVadThreshold(float VadThreshold)
7717{
7718 assert(state_ == DiscordObjectState::Owned);
7719 Discord_VADThresholdSettings_SetVadThreshold(&instance_, VadThreshold);
7720}
7721bool VADThresholdSettings::Automatic() const
7722{
7723 assert(state_ == DiscordObjectState::Owned);
7724 bool returnValue__;
7725 returnValue__ = Discord_VADThresholdSettings_Automatic(&instance_);
7726 return returnValue__;
7727}
7728void VADThresholdSettings::SetAutomatic(bool Automatic)
7729{
7730 assert(state_ == DiscordObjectState::Owned);
7731 Discord_VADThresholdSettings_SetAutomatic(&instance_, Automatic);
7732}
7733const Call Call::nullobj{{}, DiscordObjectState::Invalid};
7734Call::~Call()
7735{
7736 if (state_ == DiscordObjectState::Owned) {
7737 Drop();
7738 state_ = DiscordObjectState::Invalid;
7739 }
7740}
7741Call::Call(Call&& other) noexcept
7742 : instance_(other.instance_)
7743 , state_(other.state_)
7744{
7745 other.state_ = DiscordObjectState::Invalid;
7746}
7747Call& Call::operator=(Call&& other) noexcept
7748{
7749 if (this != &other) {
7750 if (state_ == DiscordObjectState::Owned) {
7751 Drop();
7752 }
7753 instance_ = other.instance_;
7754 state_ = other.state_;
7755 other.state_ = DiscordObjectState::Invalid;
7756 }
7757 return *this;
7758}
7759Call::Call(const Call& other)
7760 : instance_{}
7761 , state_(DiscordObjectState::Invalid)
7762{
7763 if (other.state_ == DiscordObjectState::Owned) {
7764 Discord_Call_Clone(&instance_, other.instance());
7765
7766 state_ = DiscordObjectState::Owned;
7767 }
7768}
7769Call& Call::operator=(const Call& other)
7770{
7771 if (this != &other) {
7772 if (state_ == DiscordObjectState::Owned) {
7773 Drop();
7774 state_ = DiscordObjectState::Invalid;
7775 }
7776 if (other.state_ == DiscordObjectState::Owned) {
7777 Discord_Call_Clone(&instance_, other.instance());
7778
7779 state_ = DiscordObjectState::Owned;
7780 }
7781 }
7782 return *this;
7783}
7784Call::Call(Discord_Call instance, DiscordObjectState state)
7785 : instance_(instance)
7786 , state_(state)
7787{
7788}
7789void Call::Drop()
7790{
7791 if (state_ != DiscordObjectState::Owned) {
7792 return;
7793 }
7794 Discord_Call_Drop(&instance_);
7795 state_ = DiscordObjectState::Invalid;
7796}
7797std::string Call::ErrorToString(discordpp::Call::Error type)
7798{
7799 Discord_String returnValueNative__;
7800 Discord_Call_ErrorToString(static_cast<Discord_Call_Error>(type), &returnValueNative__);
7801 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7802 returnValueNative__.size);
7803 Discord_Free(returnValueNative__.ptr);
7804 return returnValue__;
7805}
7806discordpp::AudioModeType Call::GetAudioMode()
7807{
7808 assert(state_ == DiscordObjectState::Owned);
7809 Discord_AudioModeType returnValue__;
7810 returnValue__ = Discord_Call_GetAudioMode(&instance_);
7811 return static_cast<discordpp::AudioModeType>(returnValue__);
7812}
7813uint64_t Call::GetChannelId() const
7814{
7815 assert(state_ == DiscordObjectState::Owned);
7816 uint64_t returnValue__;
7817 returnValue__ = Discord_Call_GetChannelId(&instance_);
7818 return returnValue__;
7819}
7820uint64_t Call::GetGuildId() const
7821{
7822 assert(state_ == DiscordObjectState::Owned);
7823 uint64_t returnValue__;
7824 returnValue__ = Discord_Call_GetGuildId(&instance_);
7825 return returnValue__;
7826}
7827bool Call::GetLocalMute(uint64_t userId)
7828{
7829 assert(state_ == DiscordObjectState::Owned);
7830 bool returnValue__;
7831 returnValue__ = Discord_Call_GetLocalMute(&instance_, userId);
7832 return returnValue__;
7833}
7834std::vector<uint64_t> Call::GetParticipants() const
7835{
7836 assert(state_ == DiscordObjectState::Owned);
7837 Discord_UInt64Span returnValueNative__;
7838 Discord_Call_GetParticipants(&instance_, &returnValueNative__);
7839 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
7840 returnValueNative__.ptr + returnValueNative__.size);
7841 Discord_Free(returnValueNative__.ptr);
7842 return returnValue__;
7843}
7844float Call::GetParticipantVolume(uint64_t userId)
7845{
7846 assert(state_ == DiscordObjectState::Owned);
7847 float returnValue__;
7848 returnValue__ = Discord_Call_GetParticipantVolume(&instance_, userId);
7849 return returnValue__;
7850}
7851bool Call::GetPTTActive()
7852{
7853 assert(state_ == DiscordObjectState::Owned);
7854 bool returnValue__;
7855 returnValue__ = Discord_Call_GetPTTActive(&instance_);
7856 return returnValue__;
7857}
7858uint32_t Call::GetPTTReleaseDelay()
7859{
7860 assert(state_ == DiscordObjectState::Owned);
7861 uint32_t returnValue__;
7862 returnValue__ = Discord_Call_GetPTTReleaseDelay(&instance_);
7863 return returnValue__;
7864}
7865bool Call::GetSelfDeaf()
7866{
7867 assert(state_ == DiscordObjectState::Owned);
7868 bool returnValue__;
7869 returnValue__ = Discord_Call_GetSelfDeaf(&instance_);
7870 return returnValue__;
7871}
7872bool Call::GetSelfMute()
7873{
7874 assert(state_ == DiscordObjectState::Owned);
7875 bool returnValue__;
7876 returnValue__ = Discord_Call_GetSelfMute(&instance_);
7877 return returnValue__;
7878}
7879discordpp::Call::Status Call::GetStatus() const
7880{
7881 assert(state_ == DiscordObjectState::Owned);
7882 Discord_Call_Status returnValue__;
7883 returnValue__ = Discord_Call_GetStatus(&instance_);
7884 return static_cast<discordpp::Call::Status>(returnValue__);
7885}
7886discordpp::VADThresholdSettings Call::GetVADThreshold() const
7887{
7888 assert(state_ == DiscordObjectState::Owned);
7889 Discord_VADThresholdSettings returnValueNative__{};
7890 Discord_Call_GetVADThreshold(&instance_, &returnValueNative__);
7891 discordpp::VADThresholdSettings returnValue__(returnValueNative__, DiscordObjectState::Owned);
7892 return returnValue__;
7893}
7894std::optional<discordpp::VoiceStateHandle> Call::GetVoiceStateHandle(uint64_t userId) const
7895{
7896 assert(state_ == DiscordObjectState::Owned);
7897 bool returnIsNonNull__;
7898 Discord_VoiceStateHandle returnValueNative__;
7899 returnIsNonNull__ = Discord_Call_GetVoiceStateHandle(&instance_, userId, &returnValueNative__);
7900 if (!returnIsNonNull__) {
7901 return {};
7902 }
7903 discordpp::VoiceStateHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
7904 return returnValue__;
7905}
7906void Call::SetAudioMode(discordpp::AudioModeType audioMode)
7907{
7908 assert(state_ == DiscordObjectState::Owned);
7909 Discord_Call_SetAudioMode(&instance_, static_cast<Discord_AudioModeType>(audioMode));
7910}
7911void Call::SetLocalMute(uint64_t userId, bool mute)
7912{
7913 assert(state_ == DiscordObjectState::Owned);
7914 Discord_Call_SetLocalMute(&instance_, userId, mute);
7915}
7916void Call::SetOnVoiceStateChangedCallback(discordpp::Call::OnVoiceStateChanged cb)
7917{
7918 assert(state_ == DiscordObjectState::Owned);
7919 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
7920 auto cb__userData = new Tcb__UserData(cb);
7921 Discord_Call_OnVoiceStateChanged cb__native = [](auto userId, void* userData__) {
7922 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
7923 userData__typed->delegate(userId);
7924 };
7925 Discord_Call_SetOnVoiceStateChangedCallback(
7926 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
7927}
7928void Call::SetParticipantChangedCallback(discordpp::Call::OnParticipantChanged cb)
7929{
7930 assert(state_ == DiscordObjectState::Owned);
7931 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
7932 auto cb__userData = new Tcb__UserData(cb);
7933 Discord_Call_OnParticipantChanged cb__native = [](auto userId, auto added, void* userData__) {
7934 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
7935 userData__typed->delegate(userId, added);
7936 };
7937 Discord_Call_SetParticipantChangedCallback(
7938 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
7939}
7940void Call::SetParticipantVolume(uint64_t userId, float volume)
7941{
7942 assert(state_ == DiscordObjectState::Owned);
7943 Discord_Call_SetParticipantVolume(&instance_, userId, volume);
7944}
7945void Call::SetPTTActive(bool active)
7946{
7947 assert(state_ == DiscordObjectState::Owned);
7948 Discord_Call_SetPTTActive(&instance_, active);
7949}
7950void Call::SetPTTReleaseDelay(uint32_t releaseDelayMs)
7951{
7952 assert(state_ == DiscordObjectState::Owned);
7953 Discord_Call_SetPTTReleaseDelay(&instance_, releaseDelayMs);
7954}
7955void Call::SetSelfDeaf(bool deaf)
7956{
7957 assert(state_ == DiscordObjectState::Owned);
7958 Discord_Call_SetSelfDeaf(&instance_, deaf);
7959}
7960void Call::SetSelfMute(bool mute)
7961{
7962 assert(state_ == DiscordObjectState::Owned);
7963 Discord_Call_SetSelfMute(&instance_, mute);
7964}
7965void Call::SetSpeakingStatusChangedCallback(discordpp::Call::OnSpeakingStatusChanged cb)
7966{
7967 assert(state_ == DiscordObjectState::Owned);
7968 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
7969 auto cb__userData = new Tcb__UserData(cb);
7970 Discord_Call_OnSpeakingStatusChanged cb__native =
7971 [](auto userId, auto isPlayingSound, void* userData__) {
7972 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
7973 userData__typed->delegate(userId, isPlayingSound);
7974 };
7975 Discord_Call_SetSpeakingStatusChangedCallback(
7976 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
7977}
7978void Call::SetStatusChangedCallback(discordpp::Call::OnStatusChanged cb)
7979{
7980 assert(state_ == DiscordObjectState::Owned);
7981 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
7982 auto cb__userData = new Tcb__UserData(cb);
7983 Discord_Call_OnStatusChanged cb__native =
7984 [](auto status, auto error, auto errorDetail, void* userData__) {
7985 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
7986 userData__typed->delegate(static_cast<discordpp::Call::Status>(status),
7987 static_cast<discordpp::Call::Error>(error),
7988 errorDetail);
7989 };
7990 Discord_Call_SetStatusChangedCallback(
7991 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
7992}
7993void Call::SetVADThreshold(bool automatic, float threshold)
7994{
7995 assert(state_ == DiscordObjectState::Owned);
7996 Discord_Call_SetVADThreshold(&instance_, automatic, threshold);
7997}
7998std::string Call::StatusToString(discordpp::Call::Status type)
7999{
8000 Discord_String returnValueNative__;
8001 Discord_Call_StatusToString(static_cast<Discord_Call_Status>(type), &returnValueNative__);
8002 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8003 returnValueNative__.size);
8004 Discord_Free(returnValueNative__.ptr);
8005 return returnValue__;
8006}
8007const ChannelHandle ChannelHandle::nullobj{{}, DiscordObjectState::Invalid};
8008ChannelHandle::~ChannelHandle()
8009{
8010 if (state_ == DiscordObjectState::Owned) {
8011 Drop();
8012 state_ = DiscordObjectState::Invalid;
8013 }
8014}
8015ChannelHandle::ChannelHandle(ChannelHandle&& other) noexcept
8016 : instance_(other.instance_)
8017 , state_(other.state_)
8018{
8019 other.state_ = DiscordObjectState::Invalid;
8020}
8021ChannelHandle& ChannelHandle::operator=(ChannelHandle&& other) noexcept
8022{
8023 if (this != &other) {
8024 if (state_ == DiscordObjectState::Owned) {
8025 Drop();
8026 }
8027 instance_ = other.instance_;
8028 state_ = other.state_;
8029 other.state_ = DiscordObjectState::Invalid;
8030 }
8031 return *this;
8032}
8033ChannelHandle::ChannelHandle(const ChannelHandle& other)
8034 : instance_{}
8035 , state_(DiscordObjectState::Invalid)
8036{
8037 if (other.state_ == DiscordObjectState::Owned) {
8038 Discord_ChannelHandle_Clone(&instance_, other.instance());
8039
8040 state_ = DiscordObjectState::Owned;
8041 }
8042}
8043ChannelHandle& ChannelHandle::operator=(const ChannelHandle& other)
8044{
8045 if (this != &other) {
8046 if (state_ == DiscordObjectState::Owned) {
8047 Drop();
8048 state_ = DiscordObjectState::Invalid;
8049 }
8050 if (other.state_ == DiscordObjectState::Owned) {
8051 Discord_ChannelHandle_Clone(&instance_, other.instance());
8052
8053 state_ = DiscordObjectState::Owned;
8054 }
8055 }
8056 return *this;
8057}
8058ChannelHandle::ChannelHandle(Discord_ChannelHandle instance, DiscordObjectState state)
8059 : instance_(instance)
8060 , state_(state)
8061{
8062}
8063void ChannelHandle::Drop()
8064{
8065 if (state_ != DiscordObjectState::Owned) {
8066 return;
8067 }
8068 Discord_ChannelHandle_Drop(&instance_);
8069 state_ = DiscordObjectState::Invalid;
8070}
8071uint64_t ChannelHandle::Id() const
8072{
8073 assert(state_ == DiscordObjectState::Owned);
8074 uint64_t returnValue__;
8075 returnValue__ = Discord_ChannelHandle_Id(&instance_);
8076 return returnValue__;
8077}
8078std::string ChannelHandle::Name() const
8079{
8080 assert(state_ == DiscordObjectState::Owned);
8081 Discord_String returnValueNative__;
8082 Discord_ChannelHandle_Name(&instance_, &returnValueNative__);
8083 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8084 returnValueNative__.size);
8085 Discord_Free(returnValueNative__.ptr);
8086 return returnValue__;
8087}
8088std::vector<uint64_t> ChannelHandle::Recipients() const
8089{
8090 assert(state_ == DiscordObjectState::Owned);
8091 Discord_UInt64Span returnValueNative__;
8092 Discord_ChannelHandle_Recipients(&instance_, &returnValueNative__);
8093 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
8094 returnValueNative__.ptr + returnValueNative__.size);
8095 Discord_Free(returnValueNative__.ptr);
8096 return returnValue__;
8097}
8098discordpp::ChannelType ChannelHandle::Type() const
8099{
8100 assert(state_ == DiscordObjectState::Owned);
8101 Discord_ChannelType returnValue__;
8102 returnValue__ = Discord_ChannelHandle_Type(&instance_);
8103 return static_cast<discordpp::ChannelType>(returnValue__);
8104}
8105const GuildMinimal GuildMinimal::nullobj{{}, DiscordObjectState::Invalid};
8106GuildMinimal::~GuildMinimal()
8107{
8108 if (state_ == DiscordObjectState::Owned) {
8109 Drop();
8110 state_ = DiscordObjectState::Invalid;
8111 }
8112}
8113GuildMinimal::GuildMinimal(GuildMinimal&& other) noexcept
8114 : instance_(other.instance_)
8115 , state_(other.state_)
8116{
8117 other.state_ = DiscordObjectState::Invalid;
8118}
8119GuildMinimal& GuildMinimal::operator=(GuildMinimal&& other) noexcept
8120{
8121 if (this != &other) {
8122 if (state_ == DiscordObjectState::Owned) {
8123 Drop();
8124 }
8125 instance_ = other.instance_;
8126 state_ = other.state_;
8127 other.state_ = DiscordObjectState::Invalid;
8128 }
8129 return *this;
8130}
8131GuildMinimal::GuildMinimal(const GuildMinimal& arg0)
8132 : instance_{}
8133 , state_(DiscordObjectState::Invalid)
8134{
8135 if (arg0.state_ == DiscordObjectState::Owned) {
8136 Discord_GuildMinimal_Clone(&instance_, arg0.instance());
8137
8138 state_ = DiscordObjectState::Owned;
8139 }
8140}
8141GuildMinimal& GuildMinimal::operator=(const GuildMinimal& arg0)
8142{
8143 if (this != &arg0) {
8144 if (state_ == DiscordObjectState::Owned) {
8145 Drop();
8146 state_ = DiscordObjectState::Invalid;
8147 }
8148 if (arg0.state_ == DiscordObjectState::Owned) {
8149 Discord_GuildMinimal_Clone(&instance_, arg0.instance());
8150
8151 state_ = DiscordObjectState::Owned;
8152 }
8153 }
8154 return *this;
8155}
8156GuildMinimal::GuildMinimal(Discord_GuildMinimal instance, DiscordObjectState state)
8157 : instance_(instance)
8158 , state_(state)
8159{
8160}
8161void GuildMinimal::Drop()
8162{
8163 if (state_ != DiscordObjectState::Owned) {
8164 return;
8165 }
8166 Discord_GuildMinimal_Drop(&instance_);
8167 state_ = DiscordObjectState::Invalid;
8168}
8169uint64_t GuildMinimal::Id() const
8170{
8171 assert(state_ == DiscordObjectState::Owned);
8172 uint64_t returnValue__;
8173 returnValue__ = Discord_GuildMinimal_Id(&instance_);
8174 return returnValue__;
8175}
8176void GuildMinimal::SetId(uint64_t Id)
8177{
8178 assert(state_ == DiscordObjectState::Owned);
8179 Discord_GuildMinimal_SetId(&instance_, Id);
8180}
8181std::string GuildMinimal::Name() const
8182{
8183 assert(state_ == DiscordObjectState::Owned);
8184 Discord_String returnValueNative__;
8185 Discord_GuildMinimal_Name(&instance_, &returnValueNative__);
8186 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8187 returnValueNative__.size);
8188 Discord_Free(returnValueNative__.ptr);
8189 return returnValue__;
8190}
8191void GuildMinimal::SetName(std::string Name)
8192{
8193 assert(state_ == DiscordObjectState::Owned);
8194 Discord_String Name__str{(uint8_t*)(Name.data()), Name.size()};
8195 Discord_GuildMinimal_SetName(&instance_, Name__str);
8196}
8197const GuildChannel GuildChannel::nullobj{{}, DiscordObjectState::Invalid};
8198GuildChannel::~GuildChannel()
8199{
8200 if (state_ == DiscordObjectState::Owned) {
8201 Drop();
8202 state_ = DiscordObjectState::Invalid;
8203 }
8204}
8205GuildChannel::GuildChannel(GuildChannel&& other) noexcept
8206 : instance_(other.instance_)
8207 , state_(other.state_)
8208{
8209 other.state_ = DiscordObjectState::Invalid;
8210}
8211GuildChannel& GuildChannel::operator=(GuildChannel&& other) noexcept
8212{
8213 if (this != &other) {
8214 if (state_ == DiscordObjectState::Owned) {
8215 Drop();
8216 }
8217 instance_ = other.instance_;
8218 state_ = other.state_;
8219 other.state_ = DiscordObjectState::Invalid;
8220 }
8221 return *this;
8222}
8223GuildChannel::GuildChannel(const GuildChannel& arg0)
8224 : instance_{}
8225 , state_(DiscordObjectState::Invalid)
8226{
8227 if (arg0.state_ == DiscordObjectState::Owned) {
8228 Discord_GuildChannel_Clone(&instance_, arg0.instance());
8229
8230 state_ = DiscordObjectState::Owned;
8231 }
8232}
8233GuildChannel& GuildChannel::operator=(const GuildChannel& arg0)
8234{
8235 if (this != &arg0) {
8236 if (state_ == DiscordObjectState::Owned) {
8237 Drop();
8238 state_ = DiscordObjectState::Invalid;
8239 }
8240 if (arg0.state_ == DiscordObjectState::Owned) {
8241 Discord_GuildChannel_Clone(&instance_, arg0.instance());
8242
8243 state_ = DiscordObjectState::Owned;
8244 }
8245 }
8246 return *this;
8247}
8248GuildChannel::GuildChannel(Discord_GuildChannel instance, DiscordObjectState state)
8249 : instance_(instance)
8250 , state_(state)
8251{
8252}
8253void GuildChannel::Drop()
8254{
8255 if (state_ != DiscordObjectState::Owned) {
8256 return;
8257 }
8258 Discord_GuildChannel_Drop(&instance_);
8259 state_ = DiscordObjectState::Invalid;
8260}
8261uint64_t GuildChannel::Id() const
8262{
8263 assert(state_ == DiscordObjectState::Owned);
8264 uint64_t returnValue__;
8265 returnValue__ = Discord_GuildChannel_Id(&instance_);
8266 return returnValue__;
8267}
8268void GuildChannel::SetId(uint64_t Id)
8269{
8270 assert(state_ == DiscordObjectState::Owned);
8271 Discord_GuildChannel_SetId(&instance_, Id);
8272}
8273std::string GuildChannel::Name() const
8274{
8275 assert(state_ == DiscordObjectState::Owned);
8276 Discord_String returnValueNative__;
8277 Discord_GuildChannel_Name(&instance_, &returnValueNative__);
8278 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8279 returnValueNative__.size);
8280 Discord_Free(returnValueNative__.ptr);
8281 return returnValue__;
8282}
8283void GuildChannel::SetName(std::string Name)
8284{
8285 assert(state_ == DiscordObjectState::Owned);
8286 Discord_String Name__str{(uint8_t*)(Name.data()), Name.size()};
8287 Discord_GuildChannel_SetName(&instance_, Name__str);
8288}
8289bool GuildChannel::IsLinkable() const
8290{
8291 assert(state_ == DiscordObjectState::Owned);
8292 bool returnValue__;
8293 returnValue__ = Discord_GuildChannel_IsLinkable(&instance_);
8294 return returnValue__;
8295}
8296void GuildChannel::SetIsLinkable(bool IsLinkable)
8297{
8298 assert(state_ == DiscordObjectState::Owned);
8299 Discord_GuildChannel_SetIsLinkable(&instance_, IsLinkable);
8300}
8301bool GuildChannel::IsViewableAndWriteableByAllMembers() const
8302{
8303 assert(state_ == DiscordObjectState::Owned);
8304 bool returnValue__;
8305 returnValue__ = Discord_GuildChannel_IsViewableAndWriteableByAllMembers(&instance_);
8306 return returnValue__;
8307}
8308void GuildChannel::SetIsViewableAndWriteableByAllMembers(bool IsViewableAndWriteableByAllMembers)
8309{
8310 assert(state_ == DiscordObjectState::Owned);
8311 Discord_GuildChannel_SetIsViewableAndWriteableByAllMembers(&instance_,
8312 IsViewableAndWriteableByAllMembers);
8313}
8314std::optional<discordpp::LinkedLobby> GuildChannel::LinkedLobby() const
8315{
8316 assert(state_ == DiscordObjectState::Owned);
8317 bool returnIsNonNull__;
8318 Discord_LinkedLobby returnValueNative__;
8319 returnIsNonNull__ = Discord_GuildChannel_LinkedLobby(&instance_, &returnValueNative__);
8320 if (!returnIsNonNull__) {
8321 return {};
8322 }
8323 discordpp::LinkedLobby returnValue__(returnValueNative__, DiscordObjectState::Owned);
8324 return returnValue__;
8325}
8326void GuildChannel::SetLinkedLobby(std::optional<discordpp::LinkedLobby> LinkedLobby)
8327{
8328 assert(state_ == DiscordObjectState::Owned);
8329 Discord_GuildChannel_SetLinkedLobby(
8330 &instance_, (LinkedLobby.has_value() ? LinkedLobby->instance() : nullptr));
8331}
8332const LinkedLobby LinkedLobby::nullobj{{}, DiscordObjectState::Invalid};
8333LinkedLobby::~LinkedLobby()
8334{
8335 if (state_ == DiscordObjectState::Owned) {
8336 Drop();
8337 state_ = DiscordObjectState::Invalid;
8338 }
8339}
8340LinkedLobby::LinkedLobby(LinkedLobby&& other) noexcept
8341 : instance_(other.instance_)
8342 , state_(other.state_)
8343{
8344 other.state_ = DiscordObjectState::Invalid;
8345}
8346LinkedLobby& LinkedLobby::operator=(LinkedLobby&& other) noexcept
8347{
8348 if (this != &other) {
8349 if (state_ == DiscordObjectState::Owned) {
8350 Drop();
8351 }
8352 instance_ = other.instance_;
8353 state_ = other.state_;
8354 other.state_ = DiscordObjectState::Invalid;
8355 }
8356 return *this;
8357}
8358LinkedLobby::LinkedLobby(const LinkedLobby& arg0)
8359 : instance_{}
8360 , state_(DiscordObjectState::Invalid)
8361{
8362 if (arg0.state_ == DiscordObjectState::Owned) {
8363 Discord_LinkedLobby_Clone(&instance_, arg0.instance());
8364
8365 state_ = DiscordObjectState::Owned;
8366 }
8367}
8368LinkedLobby& LinkedLobby::operator=(const LinkedLobby& arg0)
8369{
8370 if (this != &arg0) {
8371 if (state_ == DiscordObjectState::Owned) {
8372 Drop();
8373 state_ = DiscordObjectState::Invalid;
8374 }
8375 if (arg0.state_ == DiscordObjectState::Owned) {
8376 Discord_LinkedLobby_Clone(&instance_, arg0.instance());
8377
8378 state_ = DiscordObjectState::Owned;
8379 }
8380 }
8381 return *this;
8382}
8383LinkedLobby::LinkedLobby(Discord_LinkedLobby instance, DiscordObjectState state)
8384 : instance_(instance)
8385 , state_(state)
8386{
8387}
8388LinkedLobby::LinkedLobby()
8389{
8390 assert(state_ == DiscordObjectState::Invalid);
8391 Discord_LinkedLobby_Init(&instance_);
8392 state_ = DiscordObjectState::Owned;
8393}
8394void LinkedLobby::Drop()
8395{
8396 if (state_ != DiscordObjectState::Owned) {
8397 return;
8398 }
8399 Discord_LinkedLobby_Drop(&instance_);
8400 state_ = DiscordObjectState::Invalid;
8401}
8402uint64_t LinkedLobby::ApplicationId() const
8403{
8404 assert(state_ == DiscordObjectState::Owned);
8405 uint64_t returnValue__;
8406 returnValue__ = Discord_LinkedLobby_ApplicationId(&instance_);
8407 return returnValue__;
8408}
8409void LinkedLobby::SetApplicationId(uint64_t ApplicationId)
8410{
8411 assert(state_ == DiscordObjectState::Owned);
8412 Discord_LinkedLobby_SetApplicationId(&instance_, ApplicationId);
8413}
8414uint64_t LinkedLobby::LobbyId() const
8415{
8416 assert(state_ == DiscordObjectState::Owned);
8417 uint64_t returnValue__;
8418 returnValue__ = Discord_LinkedLobby_LobbyId(&instance_);
8419 return returnValue__;
8420}
8421void LinkedLobby::SetLobbyId(uint64_t LobbyId)
8422{
8423 assert(state_ == DiscordObjectState::Owned);
8424 Discord_LinkedLobby_SetLobbyId(&instance_, LobbyId);
8425}
8426const LinkedChannel LinkedChannel::nullobj{{}, DiscordObjectState::Invalid};
8427LinkedChannel::~LinkedChannel()
8428{
8429 if (state_ == DiscordObjectState::Owned) {
8430 Drop();
8431 state_ = DiscordObjectState::Invalid;
8432 }
8433}
8434LinkedChannel::LinkedChannel(LinkedChannel&& other) noexcept
8435 : instance_(other.instance_)
8436 , state_(other.state_)
8437{
8438 other.state_ = DiscordObjectState::Invalid;
8439}
8440LinkedChannel& LinkedChannel::operator=(LinkedChannel&& other) noexcept
8441{
8442 if (this != &other) {
8443 if (state_ == DiscordObjectState::Owned) {
8444 Drop();
8445 }
8446 instance_ = other.instance_;
8447 state_ = other.state_;
8448 other.state_ = DiscordObjectState::Invalid;
8449 }
8450 return *this;
8451}
8452LinkedChannel::LinkedChannel(const LinkedChannel& arg0)
8453 : instance_{}
8454 , state_(DiscordObjectState::Invalid)
8455{
8456 if (arg0.state_ == DiscordObjectState::Owned) {
8457 Discord_LinkedChannel_Clone(&instance_, arg0.instance());
8458
8459 state_ = DiscordObjectState::Owned;
8460 }
8461}
8462LinkedChannel& LinkedChannel::operator=(const LinkedChannel& arg0)
8463{
8464 if (this != &arg0) {
8465 if (state_ == DiscordObjectState::Owned) {
8466 Drop();
8467 state_ = DiscordObjectState::Invalid;
8468 }
8469 if (arg0.state_ == DiscordObjectState::Owned) {
8470 Discord_LinkedChannel_Clone(&instance_, arg0.instance());
8471
8472 state_ = DiscordObjectState::Owned;
8473 }
8474 }
8475 return *this;
8476}
8477LinkedChannel::LinkedChannel(Discord_LinkedChannel instance, DiscordObjectState state)
8478 : instance_(instance)
8479 , state_(state)
8480{
8481}
8482void LinkedChannel::Drop()
8483{
8484 if (state_ != DiscordObjectState::Owned) {
8485 return;
8486 }
8487 Discord_LinkedChannel_Drop(&instance_);
8488 state_ = DiscordObjectState::Invalid;
8489}
8490uint64_t LinkedChannel::Id() const
8491{
8492 assert(state_ == DiscordObjectState::Owned);
8493 uint64_t returnValue__;
8494 returnValue__ = Discord_LinkedChannel_Id(&instance_);
8495 return returnValue__;
8496}
8497void LinkedChannel::SetId(uint64_t Id)
8498{
8499 assert(state_ == DiscordObjectState::Owned);
8500 Discord_LinkedChannel_SetId(&instance_, Id);
8501}
8502std::string LinkedChannel::Name() const
8503{
8504 assert(state_ == DiscordObjectState::Owned);
8505 Discord_String returnValueNative__;
8506 Discord_LinkedChannel_Name(&instance_, &returnValueNative__);
8507 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8508 returnValueNative__.size);
8509 Discord_Free(returnValueNative__.ptr);
8510 return returnValue__;
8511}
8512void LinkedChannel::SetName(std::string Name)
8513{
8514 assert(state_ == DiscordObjectState::Owned);
8515 Discord_String Name__str{(uint8_t*)(Name.data()), Name.size()};
8516 Discord_LinkedChannel_SetName(&instance_, Name__str);
8517}
8518uint64_t LinkedChannel::GuildId() const
8519{
8520 assert(state_ == DiscordObjectState::Owned);
8521 uint64_t returnValue__;
8522 returnValue__ = Discord_LinkedChannel_GuildId(&instance_);
8523 return returnValue__;
8524}
8525void LinkedChannel::SetGuildId(uint64_t GuildId)
8526{
8527 assert(state_ == DiscordObjectState::Owned);
8528 Discord_LinkedChannel_SetGuildId(&instance_, GuildId);
8529}
8530const RelationshipHandle RelationshipHandle::nullobj{{}, DiscordObjectState::Invalid};
8531RelationshipHandle::~RelationshipHandle()
8532{
8533 if (state_ == DiscordObjectState::Owned) {
8534 Drop();
8535 state_ = DiscordObjectState::Invalid;
8536 }
8537}
8538RelationshipHandle::RelationshipHandle(RelationshipHandle&& other) noexcept
8539 : instance_(other.instance_)
8540 , state_(other.state_)
8541{
8542 other.state_ = DiscordObjectState::Invalid;
8543}
8544RelationshipHandle& RelationshipHandle::operator=(RelationshipHandle&& other) noexcept
8545{
8546 if (this != &other) {
8547 if (state_ == DiscordObjectState::Owned) {
8548 Drop();
8549 }
8550 instance_ = other.instance_;
8551 state_ = other.state_;
8552 other.state_ = DiscordObjectState::Invalid;
8553 }
8554 return *this;
8555}
8556RelationshipHandle::RelationshipHandle(const RelationshipHandle& other)
8557 : instance_{}
8558 , state_(DiscordObjectState::Invalid)
8559{
8560 if (other.state_ == DiscordObjectState::Owned) {
8561 Discord_RelationshipHandle_Clone(&instance_, other.instance());
8562
8563 state_ = DiscordObjectState::Owned;
8564 }
8565}
8566RelationshipHandle& RelationshipHandle::operator=(const RelationshipHandle& other)
8567{
8568 if (this != &other) {
8569 if (state_ == DiscordObjectState::Owned) {
8570 Drop();
8571 state_ = DiscordObjectState::Invalid;
8572 }
8573 if (other.state_ == DiscordObjectState::Owned) {
8574 Discord_RelationshipHandle_Clone(&instance_, other.instance());
8575
8576 state_ = DiscordObjectState::Owned;
8577 }
8578 }
8579 return *this;
8580}
8581RelationshipHandle::RelationshipHandle(Discord_RelationshipHandle instance,
8582 DiscordObjectState state)
8583 : instance_(instance)
8584 , state_(state)
8585{
8586}
8587void RelationshipHandle::Drop()
8588{
8589 if (state_ != DiscordObjectState::Owned) {
8590 return;
8591 }
8592 Discord_RelationshipHandle_Drop(&instance_);
8593 state_ = DiscordObjectState::Invalid;
8594}
8595discordpp::RelationshipType RelationshipHandle::DiscordRelationshipType() const
8596{
8597 assert(state_ == DiscordObjectState::Owned);
8598 Discord_RelationshipType returnValue__;
8599 returnValue__ = Discord_RelationshipHandle_DiscordRelationshipType(&instance_);
8600 return static_cast<discordpp::RelationshipType>(returnValue__);
8601}
8602discordpp::RelationshipType RelationshipHandle::GameRelationshipType() const
8603{
8604 assert(state_ == DiscordObjectState::Owned);
8605 Discord_RelationshipType returnValue__;
8606 returnValue__ = Discord_RelationshipHandle_GameRelationshipType(&instance_);
8607 return static_cast<discordpp::RelationshipType>(returnValue__);
8608}
8609uint64_t RelationshipHandle::Id() const
8610{
8611 assert(state_ == DiscordObjectState::Owned);
8612 uint64_t returnValue__;
8613 returnValue__ = Discord_RelationshipHandle_Id(&instance_);
8614 return returnValue__;
8615}
8616bool RelationshipHandle::IsSpamRequest() const
8617{
8618 assert(state_ == DiscordObjectState::Owned);
8619 bool returnValue__;
8620 returnValue__ = Discord_RelationshipHandle_IsSpamRequest(&instance_);
8621 return returnValue__;
8622}
8623std::optional<discordpp::UserHandle> RelationshipHandle::User() const
8624{
8625 assert(state_ == DiscordObjectState::Owned);
8626 bool returnIsNonNull__;
8627 Discord_UserHandle returnValueNative__;
8628 returnIsNonNull__ = Discord_RelationshipHandle_User(&instance_, &returnValueNative__);
8629 if (!returnIsNonNull__) {
8630 return {};
8631 }
8632 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8633 return returnValue__;
8634}
8635const UserHandle UserHandle::nullobj{{}, DiscordObjectState::Invalid};
8636UserHandle::~UserHandle()
8637{
8638 if (state_ == DiscordObjectState::Owned) {
8639 Drop();
8640 state_ = DiscordObjectState::Invalid;
8641 }
8642}
8643UserHandle::UserHandle(UserHandle&& other) noexcept
8644 : instance_(other.instance_)
8645 , state_(other.state_)
8646{
8647 other.state_ = DiscordObjectState::Invalid;
8648}
8649UserHandle& UserHandle::operator=(UserHandle&& other) noexcept
8650{
8651 if (this != &other) {
8652 if (state_ == DiscordObjectState::Owned) {
8653 Drop();
8654 }
8655 instance_ = other.instance_;
8656 state_ = other.state_;
8657 other.state_ = DiscordObjectState::Invalid;
8658 }
8659 return *this;
8660}
8661UserHandle::UserHandle(const UserHandle& arg0)
8662 : instance_{}
8663 , state_(DiscordObjectState::Invalid)
8664{
8665 if (arg0.state_ == DiscordObjectState::Owned) {
8666 Discord_UserHandle_Clone(&instance_, arg0.instance());
8667
8668 state_ = DiscordObjectState::Owned;
8669 }
8670}
8671UserHandle& UserHandle::operator=(const UserHandle& arg0)
8672{
8673 if (this != &arg0) {
8674 if (state_ == DiscordObjectState::Owned) {
8675 Drop();
8676 state_ = DiscordObjectState::Invalid;
8677 }
8678 if (arg0.state_ == DiscordObjectState::Owned) {
8679 Discord_UserHandle_Clone(&instance_, arg0.instance());
8680
8681 state_ = DiscordObjectState::Owned;
8682 }
8683 }
8684 return *this;
8685}
8686UserHandle::UserHandle(Discord_UserHandle instance, DiscordObjectState state)
8687 : instance_(instance)
8688 , state_(state)
8689{
8690}
8691void UserHandle::Drop()
8692{
8693 if (state_ != DiscordObjectState::Owned) {
8694 return;
8695 }
8696 Discord_UserHandle_Drop(&instance_);
8697 state_ = DiscordObjectState::Invalid;
8698}
8699std::optional<std::string> UserHandle::Avatar() const
8700{
8701 assert(state_ == DiscordObjectState::Owned);
8702 bool returnIsNonNull__;
8703 Discord_String returnValueNative__;
8704 returnIsNonNull__ = Discord_UserHandle_Avatar(&instance_, &returnValueNative__);
8705 if (!returnIsNonNull__) {
8706 return {};
8707 }
8708 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8709 returnValueNative__.size);
8710 Discord_Free(returnValueNative__.ptr);
8711 return returnValue__;
8712}
8713std::string UserHandle::AvatarTypeToString(discordpp::UserHandle::AvatarType type)
8714{
8715 Discord_String returnValueNative__;
8716 Discord_UserHandle_AvatarTypeToString(static_cast<Discord_UserHandle_AvatarType>(type),
8717 &returnValueNative__);
8718 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8719 returnValueNative__.size);
8720 Discord_Free(returnValueNative__.ptr);
8721 return returnValue__;
8722}
8723std::string UserHandle::AvatarUrl(discordpp::UserHandle::AvatarType animatedType,
8724 discordpp::UserHandle::AvatarType staticType) const
8725{
8726 assert(state_ == DiscordObjectState::Owned);
8727 Discord_String returnValueNative__;
8728 Discord_UserHandle_AvatarUrl(&instance_,
8729 static_cast<Discord_UserHandle_AvatarType>(animatedType),
8730 static_cast<Discord_UserHandle_AvatarType>(staticType),
8731 &returnValueNative__);
8732 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8733 returnValueNative__.size);
8734 Discord_Free(returnValueNative__.ptr);
8735 return returnValue__;
8736}
8737std::string UserHandle::DisplayName() const
8738{
8739 assert(state_ == DiscordObjectState::Owned);
8740 Discord_String returnValueNative__;
8741 Discord_UserHandle_DisplayName(&instance_, &returnValueNative__);
8742 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8743 returnValueNative__.size);
8744 Discord_Free(returnValueNative__.ptr);
8745 return returnValue__;
8746}
8747std::optional<discordpp::Activity> UserHandle::GameActivity() const
8748{
8749 assert(state_ == DiscordObjectState::Owned);
8750 bool returnIsNonNull__;
8751 Discord_Activity returnValueNative__;
8752 returnIsNonNull__ = Discord_UserHandle_GameActivity(&instance_, &returnValueNative__);
8753 if (!returnIsNonNull__) {
8754 return {};
8755 }
8756 discordpp::Activity returnValue__(returnValueNative__, DiscordObjectState::Owned);
8757 return returnValue__;
8758}
8759std::optional<std::string> UserHandle::GlobalName() const
8760{
8761 assert(state_ == DiscordObjectState::Owned);
8762 bool returnIsNonNull__;
8763 Discord_String returnValueNative__;
8764 returnIsNonNull__ = Discord_UserHandle_GlobalName(&instance_, &returnValueNative__);
8765 if (!returnIsNonNull__) {
8766 return {};
8767 }
8768 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8769 returnValueNative__.size);
8770 Discord_Free(returnValueNative__.ptr);
8771 return returnValue__;
8772}
8773uint64_t UserHandle::Id() const
8774{
8775 assert(state_ == DiscordObjectState::Owned);
8776 uint64_t returnValue__;
8777 returnValue__ = Discord_UserHandle_Id(&instance_);
8778 return returnValue__;
8779}
8780bool UserHandle::IsProvisional() const
8781{
8782 assert(state_ == DiscordObjectState::Owned);
8783 bool returnValue__;
8784 returnValue__ = Discord_UserHandle_IsProvisional(&instance_);
8785 return returnValue__;
8786}
8787discordpp::RelationshipHandle UserHandle::Relationship() const
8788{
8789 assert(state_ == DiscordObjectState::Owned);
8790 Discord_RelationshipHandle returnValueNative__{};
8791 Discord_UserHandle_Relationship(&instance_, &returnValueNative__);
8792 discordpp::RelationshipHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8793 return returnValue__;
8794}
8795discordpp::StatusType UserHandle::Status() const
8796{
8797 assert(state_ == DiscordObjectState::Owned);
8798 Discord_StatusType returnValue__;
8799 returnValue__ = Discord_UserHandle_Status(&instance_);
8800 return static_cast<discordpp::StatusType>(returnValue__);
8801}
8802std::string UserHandle::Username() const
8803{
8804 assert(state_ == DiscordObjectState::Owned);
8805 Discord_String returnValueNative__;
8806 Discord_UserHandle_Username(&instance_, &returnValueNative__);
8807 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8808 returnValueNative__.size);
8809 Discord_Free(returnValueNative__.ptr);
8810 return returnValue__;
8811}
8812const LobbyMemberHandle LobbyMemberHandle::nullobj{{}, DiscordObjectState::Invalid};
8813LobbyMemberHandle::~LobbyMemberHandle()
8814{
8815 if (state_ == DiscordObjectState::Owned) {
8816 Drop();
8817 state_ = DiscordObjectState::Invalid;
8818 }
8819}
8820LobbyMemberHandle::LobbyMemberHandle(LobbyMemberHandle&& other) noexcept
8821 : instance_(other.instance_)
8822 , state_(other.state_)
8823{
8824 other.state_ = DiscordObjectState::Invalid;
8825}
8826LobbyMemberHandle& LobbyMemberHandle::operator=(LobbyMemberHandle&& other) noexcept
8827{
8828 if (this != &other) {
8829 if (state_ == DiscordObjectState::Owned) {
8830 Drop();
8831 }
8832 instance_ = other.instance_;
8833 state_ = other.state_;
8834 other.state_ = DiscordObjectState::Invalid;
8835 }
8836 return *this;
8837}
8838LobbyMemberHandle::LobbyMemberHandle(const LobbyMemberHandle& other)
8839 : instance_{}
8840 , state_(DiscordObjectState::Invalid)
8841{
8842 if (other.state_ == DiscordObjectState::Owned) {
8843 Discord_LobbyMemberHandle_Clone(&instance_, other.instance());
8844
8845 state_ = DiscordObjectState::Owned;
8846 }
8847}
8848LobbyMemberHandle& LobbyMemberHandle::operator=(const LobbyMemberHandle& other)
8849{
8850 if (this != &other) {
8851 if (state_ == DiscordObjectState::Owned) {
8852 Drop();
8853 state_ = DiscordObjectState::Invalid;
8854 }
8855 if (other.state_ == DiscordObjectState::Owned) {
8856 Discord_LobbyMemberHandle_Clone(&instance_, other.instance());
8857
8858 state_ = DiscordObjectState::Owned;
8859 }
8860 }
8861 return *this;
8862}
8863LobbyMemberHandle::LobbyMemberHandle(Discord_LobbyMemberHandle instance, DiscordObjectState state)
8864 : instance_(instance)
8865 , state_(state)
8866{
8867}
8868void LobbyMemberHandle::Drop()
8869{
8870 if (state_ != DiscordObjectState::Owned) {
8871 return;
8872 }
8873 Discord_LobbyMemberHandle_Drop(&instance_);
8874 state_ = DiscordObjectState::Invalid;
8875}
8876bool LobbyMemberHandle::CanLinkLobby() const
8877{
8878 assert(state_ == DiscordObjectState::Owned);
8879 bool returnValue__;
8880 returnValue__ = Discord_LobbyMemberHandle_CanLinkLobby(&instance_);
8881 return returnValue__;
8882}
8883bool LobbyMemberHandle::Connected() const
8884{
8885 assert(state_ == DiscordObjectState::Owned);
8886 bool returnValue__;
8887 returnValue__ = Discord_LobbyMemberHandle_Connected(&instance_);
8888 return returnValue__;
8889}
8890uint64_t LobbyMemberHandle::Id() const
8891{
8892 assert(state_ == DiscordObjectState::Owned);
8893 uint64_t returnValue__;
8894 returnValue__ = Discord_LobbyMemberHandle_Id(&instance_);
8895 return returnValue__;
8896}
8897std::unordered_map<std::string, std::string> LobbyMemberHandle::Metadata() const
8898{
8899 assert(state_ == DiscordObjectState::Owned);
8900 Discord_Properties returnValueNative__;
8901 Discord_LobbyMemberHandle_Metadata(&instance_, &returnValueNative__);
8902 std::unordered_map<std::string, std::string> returnValue__ =
8903 ConvertReturnedProperties(returnValueNative__);
8904 Discord_FreeProperties(returnValueNative__);
8905 return returnValue__;
8906}
8907std::optional<discordpp::UserHandle> LobbyMemberHandle::User() const
8908{
8909 assert(state_ == DiscordObjectState::Owned);
8910 bool returnIsNonNull__;
8911 Discord_UserHandle returnValueNative__;
8912 returnIsNonNull__ = Discord_LobbyMemberHandle_User(&instance_, &returnValueNative__);
8913 if (!returnIsNonNull__) {
8914 return {};
8915 }
8916 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8917 return returnValue__;
8918}
8919const LobbyHandle LobbyHandle::nullobj{{}, DiscordObjectState::Invalid};
8920LobbyHandle::~LobbyHandle()
8921{
8922 if (state_ == DiscordObjectState::Owned) {
8923 Drop();
8924 state_ = DiscordObjectState::Invalid;
8925 }
8926}
8927LobbyHandle::LobbyHandle(LobbyHandle&& other) noexcept
8928 : instance_(other.instance_)
8929 , state_(other.state_)
8930{
8931 other.state_ = DiscordObjectState::Invalid;
8932}
8933LobbyHandle& LobbyHandle::operator=(LobbyHandle&& other) noexcept
8934{
8935 if (this != &other) {
8936 if (state_ == DiscordObjectState::Owned) {
8937 Drop();
8938 }
8939 instance_ = other.instance_;
8940 state_ = other.state_;
8941 other.state_ = DiscordObjectState::Invalid;
8942 }
8943 return *this;
8944}
8945LobbyHandle::LobbyHandle(const LobbyHandle& other)
8946 : instance_{}
8947 , state_(DiscordObjectState::Invalid)
8948{
8949 if (other.state_ == DiscordObjectState::Owned) {
8950 Discord_LobbyHandle_Clone(&instance_, other.instance());
8951
8952 state_ = DiscordObjectState::Owned;
8953 }
8954}
8955LobbyHandle& LobbyHandle::operator=(const LobbyHandle& other)
8956{
8957 if (this != &other) {
8958 if (state_ == DiscordObjectState::Owned) {
8959 Drop();
8960 state_ = DiscordObjectState::Invalid;
8961 }
8962 if (other.state_ == DiscordObjectState::Owned) {
8963 Discord_LobbyHandle_Clone(&instance_, other.instance());
8964
8965 state_ = DiscordObjectState::Owned;
8966 }
8967 }
8968 return *this;
8969}
8970LobbyHandle::LobbyHandle(Discord_LobbyHandle instance, DiscordObjectState state)
8971 : instance_(instance)
8972 , state_(state)
8973{
8974}
8975void LobbyHandle::Drop()
8976{
8977 if (state_ != DiscordObjectState::Owned) {
8978 return;
8979 }
8980 Discord_LobbyHandle_Drop(&instance_);
8981 state_ = DiscordObjectState::Invalid;
8982}
8983std::optional<discordpp::CallInfoHandle> LobbyHandle::GetCallInfoHandle() const
8984{
8985 assert(state_ == DiscordObjectState::Owned);
8986 bool returnIsNonNull__;
8987 Discord_CallInfoHandle returnValueNative__;
8988 returnIsNonNull__ = Discord_LobbyHandle_GetCallInfoHandle(&instance_, &returnValueNative__);
8989 if (!returnIsNonNull__) {
8990 return {};
8991 }
8992 discordpp::CallInfoHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8993 return returnValue__;
8994}
8995std::optional<discordpp::LobbyMemberHandle> LobbyHandle::GetLobbyMemberHandle(
8996 uint64_t memberId) const
8997{
8998 assert(state_ == DiscordObjectState::Owned);
8999 bool returnIsNonNull__;
9000 Discord_LobbyMemberHandle returnValueNative__;
9001 returnIsNonNull__ =
9002 Discord_LobbyHandle_GetLobbyMemberHandle(&instance_, memberId, &returnValueNative__);
9003 if (!returnIsNonNull__) {
9004 return {};
9005 }
9006 discordpp::LobbyMemberHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
9007 return returnValue__;
9008}
9009uint64_t LobbyHandle::Id() const
9010{
9011 assert(state_ == DiscordObjectState::Owned);
9012 uint64_t returnValue__;
9013 returnValue__ = Discord_LobbyHandle_Id(&instance_);
9014 return returnValue__;
9015}
9016std::optional<discordpp::LinkedChannel> LobbyHandle::LinkedChannel() const
9017{
9018 assert(state_ == DiscordObjectState::Owned);
9019 bool returnIsNonNull__;
9020 Discord_LinkedChannel returnValueNative__;
9021 returnIsNonNull__ = Discord_LobbyHandle_LinkedChannel(&instance_, &returnValueNative__);
9022 if (!returnIsNonNull__) {
9023 return {};
9024 }
9025 discordpp::LinkedChannel returnValue__(returnValueNative__, DiscordObjectState::Owned);
9026 return returnValue__;
9027}
9028std::vector<uint64_t> LobbyHandle::LobbyMemberIds() const
9029{
9030 assert(state_ == DiscordObjectState::Owned);
9031 Discord_UInt64Span returnValueNative__;
9032 Discord_LobbyHandle_LobbyMemberIds(&instance_, &returnValueNative__);
9033 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
9034 returnValueNative__.ptr + returnValueNative__.size);
9035 Discord_Free(returnValueNative__.ptr);
9036 return returnValue__;
9037}
9038std::vector<discordpp::LobbyMemberHandle> LobbyHandle::LobbyMembers() const
9039{
9040 assert(state_ == DiscordObjectState::Owned);
9041 Discord_LobbyMemberHandleSpan returnValueNative__;
9042 Discord_LobbyHandle_LobbyMembers(&instance_, &returnValueNative__);
9043 std::vector<discordpp::LobbyMemberHandle> returnValue__;
9044 returnValue__.reserve(returnValueNative__.size);
9045 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
9046 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
9047 }
9048 Discord_Free(returnValueNative__.ptr);
9049 return returnValue__;
9050}
9051std::unordered_map<std::string, std::string> LobbyHandle::Metadata() const
9052{
9053 assert(state_ == DiscordObjectState::Owned);
9054 Discord_Properties returnValueNative__;
9055 Discord_LobbyHandle_Metadata(&instance_, &returnValueNative__);
9056 std::unordered_map<std::string, std::string> returnValue__ =
9057 ConvertReturnedProperties(returnValueNative__);
9058 Discord_FreeProperties(returnValueNative__);
9059 return returnValue__;
9060}
9061const AdditionalContent AdditionalContent::nullobj{{}, DiscordObjectState::Invalid};
9062AdditionalContent::~AdditionalContent()
9063{
9064 if (state_ == DiscordObjectState::Owned) {
9065 Drop();
9066 state_ = DiscordObjectState::Invalid;
9067 }
9068}
9069AdditionalContent::AdditionalContent(AdditionalContent&& other) noexcept
9070 : instance_(other.instance_)
9071 , state_(other.state_)
9072{
9073 other.state_ = DiscordObjectState::Invalid;
9074}
9075AdditionalContent& AdditionalContent::operator=(AdditionalContent&& other) noexcept
9076{
9077 if (this != &other) {
9078 if (state_ == DiscordObjectState::Owned) {
9079 Drop();
9080 }
9081 instance_ = other.instance_;
9082 state_ = other.state_;
9083 other.state_ = DiscordObjectState::Invalid;
9084 }
9085 return *this;
9086}
9087AdditionalContent::AdditionalContent(const AdditionalContent& arg0)
9088 : instance_{}
9089 , state_(DiscordObjectState::Invalid)
9090{
9091 if (arg0.state_ == DiscordObjectState::Owned) {
9092 Discord_AdditionalContent_Clone(&instance_, arg0.instance());
9093
9094 state_ = DiscordObjectState::Owned;
9095 }
9096}
9097AdditionalContent& AdditionalContent::operator=(const AdditionalContent& arg0)
9098{
9099 if (this != &arg0) {
9100 if (state_ == DiscordObjectState::Owned) {
9101 Drop();
9102 state_ = DiscordObjectState::Invalid;
9103 }
9104 if (arg0.state_ == DiscordObjectState::Owned) {
9105 Discord_AdditionalContent_Clone(&instance_, arg0.instance());
9106
9107 state_ = DiscordObjectState::Owned;
9108 }
9109 }
9110 return *this;
9111}
9112AdditionalContent::AdditionalContent(Discord_AdditionalContent instance, DiscordObjectState state)
9113 : instance_(instance)
9114 , state_(state)
9115{
9116}
9117AdditionalContent::AdditionalContent()
9118{
9119 assert(state_ == DiscordObjectState::Invalid);
9120 Discord_AdditionalContent_Init(&instance_);
9121 state_ = DiscordObjectState::Owned;
9122}
9123void AdditionalContent::Drop()
9124{
9125 if (state_ != DiscordObjectState::Owned) {
9126 return;
9127 }
9128 Discord_AdditionalContent_Drop(&instance_);
9129 state_ = DiscordObjectState::Invalid;
9130}
9131bool AdditionalContent::Equals(discordpp::AdditionalContent rhs) const
9132{
9133 assert(state_ == DiscordObjectState::Owned);
9134 bool returnValue__;
9135 returnValue__ = Discord_AdditionalContent_Equals(&instance_, rhs.instance());
9136 return returnValue__;
9137}
9138std::string AdditionalContent::TypeToString(discordpp::AdditionalContentType type)
9139{
9140 Discord_String returnValueNative__;
9141 Discord_AdditionalContent_TypeToString(static_cast<Discord_AdditionalContentType>(type),
9142 &returnValueNative__);
9143 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9144 returnValueNative__.size);
9145 Discord_Free(returnValueNative__.ptr);
9146 return returnValue__;
9147}
9148discordpp::AdditionalContentType AdditionalContent::Type() const
9149{
9150 assert(state_ == DiscordObjectState::Owned);
9151 Discord_AdditionalContentType returnValue__;
9152 returnValue__ = Discord_AdditionalContent_Type(&instance_);
9153 return static_cast<discordpp::AdditionalContentType>(returnValue__);
9154}
9155void AdditionalContent::SetType(discordpp::AdditionalContentType Type)
9156{
9157 assert(state_ == DiscordObjectState::Owned);
9158 Discord_AdditionalContent_SetType(&instance_, static_cast<Discord_AdditionalContentType>(Type));
9159}
9160std::optional<std::string> AdditionalContent::Title() const
9161{
9162 assert(state_ == DiscordObjectState::Owned);
9163 bool returnIsNonNull__;
9164 Discord_String returnValueNative__;
9165 returnIsNonNull__ = Discord_AdditionalContent_Title(&instance_, &returnValueNative__);
9166 if (!returnIsNonNull__) {
9167 return {};
9168 }
9169 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9170 returnValueNative__.size);
9171 Discord_Free(returnValueNative__.ptr);
9172 return returnValue__;
9173}
9174void AdditionalContent::SetTitle(std::optional<std::string> Title)
9175{
9176 assert(state_ == DiscordObjectState::Owned);
9177 Discord_String Title__str{};
9178 if (Title.has_value()) {
9179 Title__str.ptr = reinterpret_cast<uint8_t*>(Title->data());
9180 Title__str.size = Title->size();
9181 }
9182 Discord_AdditionalContent_SetTitle(&instance_, (Title.has_value() ? &Title__str : nullptr));
9183}
9184uint8_t AdditionalContent::Count() const
9185{
9186 assert(state_ == DiscordObjectState::Owned);
9187 uint8_t returnValue__;
9188 returnValue__ = Discord_AdditionalContent_Count(&instance_);
9189 return returnValue__;
9190}
9191void AdditionalContent::SetCount(uint8_t Count)
9192{
9193 assert(state_ == DiscordObjectState::Owned);
9194 Discord_AdditionalContent_SetCount(&instance_, Count);
9195}
9196const MessageHandle MessageHandle::nullobj{{}, DiscordObjectState::Invalid};
9197MessageHandle::~MessageHandle()
9198{
9199 if (state_ == DiscordObjectState::Owned) {
9200 Drop();
9201 state_ = DiscordObjectState::Invalid;
9202 }
9203}
9204MessageHandle::MessageHandle(MessageHandle&& other) noexcept
9205 : instance_(other.instance_)
9206 , state_(other.state_)
9207{
9208 other.state_ = DiscordObjectState::Invalid;
9209}
9210MessageHandle& MessageHandle::operator=(MessageHandle&& other) noexcept
9211{
9212 if (this != &other) {
9213 if (state_ == DiscordObjectState::Owned) {
9214 Drop();
9215 }
9216 instance_ = other.instance_;
9217 state_ = other.state_;
9218 other.state_ = DiscordObjectState::Invalid;
9219 }
9220 return *this;
9221}
9222MessageHandle::MessageHandle(const MessageHandle& other)
9223 : instance_{}
9224 , state_(DiscordObjectState::Invalid)
9225{
9226 if (other.state_ == DiscordObjectState::Owned) {
9227 Discord_MessageHandle_Clone(&instance_, other.instance());
9228
9229 state_ = DiscordObjectState::Owned;
9230 }
9231}
9232MessageHandle& MessageHandle::operator=(const MessageHandle& other)
9233{
9234 if (this != &other) {
9235 if (state_ == DiscordObjectState::Owned) {
9236 Drop();
9237 state_ = DiscordObjectState::Invalid;
9238 }
9239 if (other.state_ == DiscordObjectState::Owned) {
9240 Discord_MessageHandle_Clone(&instance_, other.instance());
9241
9242 state_ = DiscordObjectState::Owned;
9243 }
9244 }
9245 return *this;
9246}
9247MessageHandle::MessageHandle(Discord_MessageHandle instance, DiscordObjectState state)
9248 : instance_(instance)
9249 , state_(state)
9250{
9251}
9252void MessageHandle::Drop()
9253{
9254 if (state_ != DiscordObjectState::Owned) {
9255 return;
9256 }
9257 Discord_MessageHandle_Drop(&instance_);
9258 state_ = DiscordObjectState::Invalid;
9259}
9260std::optional<discordpp::AdditionalContent> MessageHandle::AdditionalContent() const
9261{
9262 assert(state_ == DiscordObjectState::Owned);
9263 bool returnIsNonNull__;
9264 Discord_AdditionalContent returnValueNative__;
9265 returnIsNonNull__ = Discord_MessageHandle_AdditionalContent(&instance_, &returnValueNative__);
9266 if (!returnIsNonNull__) {
9267 return {};
9268 }
9269 discordpp::AdditionalContent returnValue__(returnValueNative__, DiscordObjectState::Owned);
9270 return returnValue__;
9271}
9272std::optional<uint64_t> MessageHandle::ApplicationId() const
9273{
9274 assert(state_ == DiscordObjectState::Owned);
9275 bool returnIsNonNull__;
9276 uint64_t returnValue__;
9277 returnIsNonNull__ = Discord_MessageHandle_ApplicationId(&instance_, &returnValue__);
9278 if (!returnIsNonNull__) {
9279 return std::nullopt;
9280 }
9281 return returnValue__;
9282}
9283std::optional<discordpp::UserHandle> MessageHandle::Author() const
9284{
9285 assert(state_ == DiscordObjectState::Owned);
9286 bool returnIsNonNull__;
9287 Discord_UserHandle returnValueNative__;
9288 returnIsNonNull__ = Discord_MessageHandle_Author(&instance_, &returnValueNative__);
9289 if (!returnIsNonNull__) {
9290 return {};
9291 }
9292 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
9293 return returnValue__;
9294}
9295uint64_t MessageHandle::AuthorId() const
9296{
9297 assert(state_ == DiscordObjectState::Owned);
9298 uint64_t returnValue__;
9299 returnValue__ = Discord_MessageHandle_AuthorId(&instance_);
9300 return returnValue__;
9301}
9302std::optional<discordpp::ChannelHandle> MessageHandle::Channel() const
9303{
9304 assert(state_ == DiscordObjectState::Owned);
9305 bool returnIsNonNull__;
9306 Discord_ChannelHandle returnValueNative__;
9307 returnIsNonNull__ = Discord_MessageHandle_Channel(&instance_, &returnValueNative__);
9308 if (!returnIsNonNull__) {
9309 return {};
9310 }
9311 discordpp::ChannelHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
9312 return returnValue__;
9313}
9314uint64_t MessageHandle::ChannelId() const
9315{
9316 assert(state_ == DiscordObjectState::Owned);
9317 uint64_t returnValue__;
9318 returnValue__ = Discord_MessageHandle_ChannelId(&instance_);
9319 return returnValue__;
9320}
9321std::string MessageHandle::Content() const
9322{
9323 assert(state_ == DiscordObjectState::Owned);
9324 Discord_String returnValueNative__;
9325 Discord_MessageHandle_Content(&instance_, &returnValueNative__);
9326 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9327 returnValueNative__.size);
9328 Discord_Free(returnValueNative__.ptr);
9329 return returnValue__;
9330}
9331std::optional<discordpp::DisclosureTypes> MessageHandle::DisclosureType() const
9332{
9333 assert(state_ == DiscordObjectState::Owned);
9334 bool returnIsNonNull__;
9335 Discord_DisclosureTypes returnValueNative__;
9336 returnIsNonNull__ = Discord_MessageHandle_DisclosureType(&instance_, &returnValueNative__);
9337 if (!returnIsNonNull__) {
9338 return {};
9339 }
9340 auto returnValue__ = static_cast<discordpp::DisclosureTypes>(returnValueNative__);
9341 return returnValue__;
9342}
9343uint64_t MessageHandle::EditedTimestamp() const
9344{
9345 assert(state_ == DiscordObjectState::Owned);
9346 uint64_t returnValue__;
9347 returnValue__ = Discord_MessageHandle_EditedTimestamp(&instance_);
9348 return returnValue__;
9349}
9350uint64_t MessageHandle::Id() const
9351{
9352 assert(state_ == DiscordObjectState::Owned);
9353 uint64_t returnValue__;
9354 returnValue__ = Discord_MessageHandle_Id(&instance_);
9355 return returnValue__;
9356}
9357std::optional<discordpp::LobbyHandle> MessageHandle::Lobby() const
9358{
9359 assert(state_ == DiscordObjectState::Owned);
9360 bool returnIsNonNull__;
9361 Discord_LobbyHandle returnValueNative__;
9362 returnIsNonNull__ = Discord_MessageHandle_Lobby(&instance_, &returnValueNative__);
9363 if (!returnIsNonNull__) {
9364 return {};
9365 }
9366 discordpp::LobbyHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
9367 return returnValue__;
9368}
9369std::unordered_map<std::string, std::string> MessageHandle::Metadata() const
9370{
9371 assert(state_ == DiscordObjectState::Owned);
9372 Discord_Properties returnValueNative__;
9373 Discord_MessageHandle_Metadata(&instance_, &returnValueNative__);
9374 std::unordered_map<std::string, std::string> returnValue__ =
9375 ConvertReturnedProperties(returnValueNative__);
9376 Discord_FreeProperties(returnValueNative__);
9377 return returnValue__;
9378}
9379std::string MessageHandle::RawContent() const
9380{
9381 assert(state_ == DiscordObjectState::Owned);
9382 Discord_String returnValueNative__;
9383 Discord_MessageHandle_RawContent(&instance_, &returnValueNative__);
9384 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9385 returnValueNative__.size);
9386 Discord_Free(returnValueNative__.ptr);
9387 return returnValue__;
9388}
9389std::optional<discordpp::UserHandle> MessageHandle::Recipient() const
9390{
9391 assert(state_ == DiscordObjectState::Owned);
9392 bool returnIsNonNull__;
9393 Discord_UserHandle returnValueNative__;
9394 returnIsNonNull__ = Discord_MessageHandle_Recipient(&instance_, &returnValueNative__);
9395 if (!returnIsNonNull__) {
9396 return {};
9397 }
9398 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
9399 return returnValue__;
9400}
9401uint64_t MessageHandle::RecipientId() const
9402{
9403 assert(state_ == DiscordObjectState::Owned);
9404 uint64_t returnValue__;
9405 returnValue__ = Discord_MessageHandle_RecipientId(&instance_);
9406 return returnValue__;
9407}
9408bool MessageHandle::SentFromGame() const
9409{
9410 assert(state_ == DiscordObjectState::Owned);
9411 bool returnValue__;
9412 returnValue__ = Discord_MessageHandle_SentFromGame(&instance_);
9413 return returnValue__;
9414}
9415uint64_t MessageHandle::SentTimestamp() const
9416{
9417 assert(state_ == DiscordObjectState::Owned);
9418 uint64_t returnValue__;
9419 returnValue__ = Discord_MessageHandle_SentTimestamp(&instance_);
9420 return returnValue__;
9421}
9422const AudioDevice AudioDevice::nullobj{{}, DiscordObjectState::Invalid};
9423AudioDevice::~AudioDevice()
9424{
9425 if (state_ == DiscordObjectState::Owned) {
9426 Drop();
9427 state_ = DiscordObjectState::Invalid;
9428 }
9429}
9430AudioDevice::AudioDevice(AudioDevice&& other) noexcept
9431 : instance_(other.instance_)
9432 , state_(other.state_)
9433{
9434 other.state_ = DiscordObjectState::Invalid;
9435}
9436AudioDevice& AudioDevice::operator=(AudioDevice&& other) noexcept
9437{
9438 if (this != &other) {
9439 if (state_ == DiscordObjectState::Owned) {
9440 Drop();
9441 }
9442 instance_ = other.instance_;
9443 state_ = other.state_;
9444 other.state_ = DiscordObjectState::Invalid;
9445 }
9446 return *this;
9447}
9448AudioDevice::AudioDevice(const AudioDevice& arg0)
9449 : instance_{}
9450 , state_(DiscordObjectState::Invalid)
9451{
9452 if (arg0.state_ == DiscordObjectState::Owned) {
9453 Discord_AudioDevice_Clone(&instance_, arg0.instance());
9454
9455 state_ = DiscordObjectState::Owned;
9456 }
9457}
9458AudioDevice& AudioDevice::operator=(const AudioDevice& arg0)
9459{
9460 if (this != &arg0) {
9461 if (state_ == DiscordObjectState::Owned) {
9462 Drop();
9463 state_ = DiscordObjectState::Invalid;
9464 }
9465 if (arg0.state_ == DiscordObjectState::Owned) {
9466 Discord_AudioDevice_Clone(&instance_, arg0.instance());
9467
9468 state_ = DiscordObjectState::Owned;
9469 }
9470 }
9471 return *this;
9472}
9473AudioDevice::AudioDevice(Discord_AudioDevice instance, DiscordObjectState state)
9474 : instance_(instance)
9475 , state_(state)
9476{
9477}
9478void AudioDevice::Drop()
9479{
9480 if (state_ != DiscordObjectState::Owned) {
9481 return;
9482 }
9483 Discord_AudioDevice_Drop(&instance_);
9484 state_ = DiscordObjectState::Invalid;
9485}
9486bool AudioDevice::Equals(discordpp::AudioDevice rhs)
9487{
9488 assert(state_ == DiscordObjectState::Owned);
9489 bool returnValue__;
9490 returnValue__ = Discord_AudioDevice_Equals(&instance_, rhs.instance());
9491 return returnValue__;
9492}
9493std::string AudioDevice::Id() const
9494{
9495 assert(state_ == DiscordObjectState::Owned);
9496 Discord_String returnValueNative__;
9497 Discord_AudioDevice_Id(&instance_, &returnValueNative__);
9498 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9499 returnValueNative__.size);
9500 Discord_Free(returnValueNative__.ptr);
9501 return returnValue__;
9502}
9503void AudioDevice::SetId(std::string Id)
9504{
9505 assert(state_ == DiscordObjectState::Owned);
9506 Discord_String Id__str{(uint8_t*)(Id.data()), Id.size()};
9507 Discord_AudioDevice_SetId(&instance_, Id__str);
9508}
9509std::string AudioDevice::Name() const
9510{
9511 assert(state_ == DiscordObjectState::Owned);
9512 Discord_String returnValueNative__;
9513 Discord_AudioDevice_Name(&instance_, &returnValueNative__);
9514 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9515 returnValueNative__.size);
9516 Discord_Free(returnValueNative__.ptr);
9517 return returnValue__;
9518}
9519void AudioDevice::SetName(std::string Name)
9520{
9521 assert(state_ == DiscordObjectState::Owned);
9522 Discord_String Name__str{(uint8_t*)(Name.data()), Name.size()};
9523 Discord_AudioDevice_SetName(&instance_, Name__str);
9524}
9525bool AudioDevice::IsDefault() const
9526{
9527 assert(state_ == DiscordObjectState::Owned);
9528 bool returnValue__;
9529 returnValue__ = Discord_AudioDevice_IsDefault(&instance_);
9530 return returnValue__;
9531}
9532void AudioDevice::SetIsDefault(bool IsDefault)
9533{
9534 assert(state_ == DiscordObjectState::Owned);
9535 Discord_AudioDevice_SetIsDefault(&instance_, IsDefault);
9536}
9537const UserMessageSummary UserMessageSummary::nullobj{{}, DiscordObjectState::Invalid};
9538UserMessageSummary::~UserMessageSummary()
9539{
9540 if (state_ == DiscordObjectState::Owned) {
9541 Drop();
9542 state_ = DiscordObjectState::Invalid;
9543 }
9544}
9545UserMessageSummary::UserMessageSummary(UserMessageSummary&& other) noexcept
9546 : instance_(other.instance_)
9547 , state_(other.state_)
9548{
9549 other.state_ = DiscordObjectState::Invalid;
9550}
9551UserMessageSummary& UserMessageSummary::operator=(UserMessageSummary&& other) noexcept
9552{
9553 if (this != &other) {
9554 if (state_ == DiscordObjectState::Owned) {
9555 Drop();
9556 }
9557 instance_ = other.instance_;
9558 state_ = other.state_;
9559 other.state_ = DiscordObjectState::Invalid;
9560 }
9561 return *this;
9562}
9563UserMessageSummary::UserMessageSummary(const UserMessageSummary& arg0)
9564 : instance_{}
9565 , state_(DiscordObjectState::Invalid)
9566{
9567 if (arg0.state_ == DiscordObjectState::Owned) {
9568 Discord_UserMessageSummary_Clone(&instance_, arg0.instance());
9569
9570 state_ = DiscordObjectState::Owned;
9571 }
9572}
9573UserMessageSummary& UserMessageSummary::operator=(const UserMessageSummary& arg0)
9574{
9575 if (this != &arg0) {
9576 if (state_ == DiscordObjectState::Owned) {
9577 Drop();
9578 state_ = DiscordObjectState::Invalid;
9579 }
9580 if (arg0.state_ == DiscordObjectState::Owned) {
9581 Discord_UserMessageSummary_Clone(&instance_, arg0.instance());
9582
9583 state_ = DiscordObjectState::Owned;
9584 }
9585 }
9586 return *this;
9587}
9588UserMessageSummary::UserMessageSummary(Discord_UserMessageSummary instance,
9589 DiscordObjectState state)
9590 : instance_(instance)
9591 , state_(state)
9592{
9593}
9594void UserMessageSummary::Drop()
9595{
9596 if (state_ != DiscordObjectState::Owned) {
9597 return;
9598 }
9599 Discord_UserMessageSummary_Drop(&instance_);
9600 state_ = DiscordObjectState::Invalid;
9601}
9602uint64_t UserMessageSummary::LastMessageId() const
9603{
9604 assert(state_ == DiscordObjectState::Owned);
9605 uint64_t returnValue__;
9606 returnValue__ = Discord_UserMessageSummary_LastMessageId(&instance_);
9607 return returnValue__;
9608}
9609uint64_t UserMessageSummary::UserId() const
9610{
9611 assert(state_ == DiscordObjectState::Owned);
9612 uint64_t returnValue__;
9613 returnValue__ = Discord_UserMessageSummary_UserId(&instance_);
9614 return returnValue__;
9615}
9616const ClientCreateOptions ClientCreateOptions::nullobj{{}, DiscordObjectState::Invalid};
9617ClientCreateOptions::~ClientCreateOptions()
9618{
9619 if (state_ == DiscordObjectState::Owned) {
9620 Drop();
9621 state_ = DiscordObjectState::Invalid;
9622 }
9623}
9624ClientCreateOptions::ClientCreateOptions(ClientCreateOptions&& other) noexcept
9625 : instance_(other.instance_)
9626 , state_(other.state_)
9627{
9628 other.state_ = DiscordObjectState::Invalid;
9629}
9630ClientCreateOptions& ClientCreateOptions::operator=(ClientCreateOptions&& other) noexcept
9631{
9632 if (this != &other) {
9633 if (state_ == DiscordObjectState::Owned) {
9634 Drop();
9635 }
9636 instance_ = other.instance_;
9637 state_ = other.state_;
9638 other.state_ = DiscordObjectState::Invalid;
9639 }
9640 return *this;
9641}
9642ClientCreateOptions::ClientCreateOptions(const ClientCreateOptions& arg0)
9643 : instance_{}
9644 , state_(DiscordObjectState::Invalid)
9645{
9646 if (arg0.state_ == DiscordObjectState::Owned) {
9647 Discord_ClientCreateOptions_Clone(&instance_, arg0.instance());
9648
9649 state_ = DiscordObjectState::Owned;
9650 }
9651}
9652ClientCreateOptions& ClientCreateOptions::operator=(const ClientCreateOptions& arg0)
9653{
9654 if (this != &arg0) {
9655 if (state_ == DiscordObjectState::Owned) {
9656 Drop();
9657 state_ = DiscordObjectState::Invalid;
9658 }
9659 if (arg0.state_ == DiscordObjectState::Owned) {
9660 Discord_ClientCreateOptions_Clone(&instance_, arg0.instance());
9661
9662 state_ = DiscordObjectState::Owned;
9663 }
9664 }
9665 return *this;
9666}
9667ClientCreateOptions::ClientCreateOptions(Discord_ClientCreateOptions instance,
9668 DiscordObjectState state)
9669 : instance_(instance)
9670 , state_(state)
9671{
9672}
9673ClientCreateOptions::ClientCreateOptions()
9674{
9675 assert(state_ == DiscordObjectState::Invalid);
9676 Discord_ClientCreateOptions_Init(&instance_);
9677 state_ = DiscordObjectState::Owned;
9678}
9679void ClientCreateOptions::Drop()
9680{
9681 if (state_ != DiscordObjectState::Owned) {
9682 return;
9683 }
9684 Discord_ClientCreateOptions_Drop(&instance_);
9685 state_ = DiscordObjectState::Invalid;
9686}
9687std::string ClientCreateOptions::WebBase() const
9688{
9689 assert(state_ == DiscordObjectState::Owned);
9690 Discord_String returnValueNative__;
9691 Discord_ClientCreateOptions_WebBase(&instance_, &returnValueNative__);
9692 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9693 returnValueNative__.size);
9694 Discord_Free(returnValueNative__.ptr);
9695 return returnValue__;
9696}
9697void ClientCreateOptions::SetWebBase(std::string WebBase)
9698{
9699 assert(state_ == DiscordObjectState::Owned);
9700 Discord_String WebBase__str{(uint8_t*)(WebBase.data()), WebBase.size()};
9701 Discord_ClientCreateOptions_SetWebBase(&instance_, WebBase__str);
9702}
9703std::string ClientCreateOptions::ApiBase() const
9704{
9705 assert(state_ == DiscordObjectState::Owned);
9706 Discord_String returnValueNative__;
9707 Discord_ClientCreateOptions_ApiBase(&instance_, &returnValueNative__);
9708 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9709 returnValueNative__.size);
9710 Discord_Free(returnValueNative__.ptr);
9711 return returnValue__;
9712}
9713void ClientCreateOptions::SetApiBase(std::string ApiBase)
9714{
9715 assert(state_ == DiscordObjectState::Owned);
9716 Discord_String ApiBase__str{(uint8_t*)(ApiBase.data()), ApiBase.size()};
9717 Discord_ClientCreateOptions_SetApiBase(&instance_, ApiBase__str);
9718}
9719discordpp::AudioSystem ClientCreateOptions::ExperimentalAudioSystem() const
9720{
9721 assert(state_ == DiscordObjectState::Owned);
9722 Discord_AudioSystem returnValue__;
9723 returnValue__ = Discord_ClientCreateOptions_ExperimentalAudioSystem(&instance_);
9724 return static_cast<discordpp::AudioSystem>(returnValue__);
9725}
9726void ClientCreateOptions::SetExperimentalAudioSystem(discordpp::AudioSystem ExperimentalAudioSystem)
9727{
9728 assert(state_ == DiscordObjectState::Owned);
9729 Discord_ClientCreateOptions_SetExperimentalAudioSystem(
9730 &instance_, static_cast<Discord_AudioSystem>(ExperimentalAudioSystem));
9731}
9732bool ClientCreateOptions::ExperimentalAndroidPreventCommsForBluetooth() const
9733{
9734 assert(state_ == DiscordObjectState::Owned);
9735 bool returnValue__;
9736 returnValue__ =
9737 Discord_ClientCreateOptions_ExperimentalAndroidPreventCommsForBluetooth(&instance_);
9738 return returnValue__;
9739}
9740void ClientCreateOptions::SetExperimentalAndroidPreventCommsForBluetooth(
9741 bool ExperimentalAndroidPreventCommsForBluetooth)
9742{
9743 assert(state_ == DiscordObjectState::Owned);
9744 Discord_ClientCreateOptions_SetExperimentalAndroidPreventCommsForBluetooth(
9745 &instance_, ExperimentalAndroidPreventCommsForBluetooth);
9746}
9747const Client Client::nullobj{{}, DiscordObjectState::Invalid};
9748Client::~Client()
9749{
9750 if (state_ == DiscordObjectState::Owned) {
9751 Drop();
9752 state_ = DiscordObjectState::Invalid;
9753 }
9754}
9755Client::Client(Client&& other) noexcept
9756 : instance_(other.instance_)
9757 , state_(other.state_)
9758{
9759 other.state_ = DiscordObjectState::Invalid;
9760}
9761Client& Client::operator=(Client&& other) noexcept
9762{
9763 if (this != &other) {
9764 if (state_ == DiscordObjectState::Owned) {
9765 Drop();
9766 }
9767 instance_ = other.instance_;
9768 state_ = other.state_;
9769 other.state_ = DiscordObjectState::Invalid;
9770 }
9771 return *this;
9772}
9773Client::Client(Discord_Client instance, DiscordObjectState state)
9774 : instance_(instance)
9775 , state_(state)
9776{
9777}
9778Client::Client()
9779{
9780 assert(state_ == DiscordObjectState::Invalid);
9781 Discord_Client_Init(&instance_);
9782 state_ = DiscordObjectState::Owned;
9783}
9784Client::Client(std::string apiBase, std::string webBase)
9785{
9786 assert(state_ == DiscordObjectState::Invalid);
9787 Discord_String apiBase__str{(uint8_t*)(apiBase.data()), apiBase.size()};
9788 Discord_String webBase__str{(uint8_t*)(webBase.data()), webBase.size()};
9789 Discord_Client_InitWithBases(&instance_, apiBase__str, webBase__str);
9790 state_ = DiscordObjectState::Owned;
9791}
9792Client::Client(discordpp::ClientCreateOptions options)
9793{
9794 assert(state_ == DiscordObjectState::Invalid);
9795 Discord_Client_InitWithOptions(&instance_, options.instance());
9796 state_ = DiscordObjectState::Owned;
9797}
9798void Client::Drop()
9799{
9800 if (state_ != DiscordObjectState::Owned) {
9801 return;
9802 }
9803 Discord_Client_Drop(&instance_);
9804 state_ = DiscordObjectState::Invalid;
9805}
9806std::string Client::ErrorToString(discordpp::Client::Error type)
9807{
9808 Discord_String returnValueNative__;
9809 Discord_Client_ErrorToString(static_cast<Discord_Client_Error>(type), &returnValueNative__);
9810 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9811 returnValueNative__.size);
9812 Discord_Free(returnValueNative__.ptr);
9813 return returnValue__;
9814}
9815uint64_t Client::GetApplicationId()
9816{
9817 assert(state_ == DiscordObjectState::Owned);
9818 uint64_t returnValue__;
9819 returnValue__ = Discord_Client_GetApplicationId(&instance_);
9820 return returnValue__;
9821}
9822std::string Client::GetDefaultAudioDeviceId()
9823{
9824 Discord_String returnValueNative__;
9825 Discord_Client_GetDefaultAudioDeviceId(&returnValueNative__);
9826 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9827 returnValueNative__.size);
9828 Discord_Free(returnValueNative__.ptr);
9829 return returnValue__;
9830}
9831std::string Client::GetDefaultCommunicationScopes()
9832{
9833 Discord_String returnValueNative__;
9834 Discord_Client_GetDefaultCommunicationScopes(&returnValueNative__);
9835 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9836 returnValueNative__.size);
9837 Discord_Free(returnValueNative__.ptr);
9838 return returnValue__;
9839}
9840std::string Client::GetDefaultPresenceScopes()
9841{
9842 Discord_String returnValueNative__;
9843 Discord_Client_GetDefaultPresenceScopes(&returnValueNative__);
9844 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9845 returnValueNative__.size);
9846 Discord_Free(returnValueNative__.ptr);
9847 return returnValue__;
9848}
9849std::string Client::GetVersionHash()
9850{
9851 Discord_String returnValueNative__;
9852 Discord_Client_GetVersionHash(&returnValueNative__);
9853 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9854 returnValueNative__.size);
9855 Discord_Free(returnValueNative__.ptr);
9856 return returnValue__;
9857}
9858int32_t Client::GetVersionMajor()
9859{
9860 int32_t returnValue__;
9861 returnValue__ = Discord_Client_GetVersionMajor();
9862 return returnValue__;
9863}
9864int32_t Client::GetVersionMinor()
9865{
9866 int32_t returnValue__;
9867 returnValue__ = Discord_Client_GetVersionMinor();
9868 return returnValue__;
9869}
9870int32_t Client::GetVersionPatch()
9871{
9872 int32_t returnValue__;
9873 returnValue__ = Discord_Client_GetVersionPatch();
9874 return returnValue__;
9875}
9876void Client::SetHttpRequestTimeout(int32_t httpTimeoutInMilliseconds)
9877{
9878 assert(state_ == DiscordObjectState::Owned);
9879 Discord_Client_SetHttpRequestTimeout(&instance_, httpTimeoutInMilliseconds);
9880}
9881std::string Client::StatusToString(discordpp::Client::Status type)
9882{
9883 Discord_String returnValueNative__;
9884 Discord_Client_StatusToString(static_cast<Discord_Client_Status>(type), &returnValueNative__);
9885 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9886 returnValueNative__.size);
9887 Discord_Free(returnValueNative__.ptr);
9888 return returnValue__;
9889}
9890std::string Client::ThreadToString(discordpp::Client::Thread type)
9891{
9892 Discord_String returnValueNative__;
9893 Discord_Client_ThreadToString(static_cast<Discord_Client_Thread>(type), &returnValueNative__);
9894 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
9895 returnValueNative__.size);
9896 Discord_Free(returnValueNative__.ptr);
9897 return returnValue__;
9898}
9899void Client::EndCall(uint64_t channelId, discordpp::Client::EndCallCallback callback)
9900{
9901 assert(state_ == DiscordObjectState::Owned);
9902 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9903 auto callback__userData = new Tcallback__UserData(callback);
9904 Discord_Client_EndCallCallback callback__native = [](void* userData__) {
9905 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9906 userData__typed->delegate();
9907 };
9908 Discord_Client_EndCall(
9909 &instance_, channelId, callback__native, Tcallback__UserData::Free, callback__userData);
9910}
9911void Client::EndCalls(discordpp::Client::EndCallsCallback callback)
9912{
9913 assert(state_ == DiscordObjectState::Owned);
9914 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9915 auto callback__userData = new Tcallback__UserData(callback);
9916 Discord_Client_EndCallsCallback callback__native = [](void* userData__) {
9917 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9918 userData__typed->delegate();
9919 };
9920 Discord_Client_EndCalls(
9921 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
9922}
9923discordpp::Call Client::GetCall(uint64_t channelId)
9924{
9925 assert(state_ == DiscordObjectState::Owned);
9926 bool returnIsNonNull__;
9927 Discord_Call returnValueNative__{};
9928 returnIsNonNull__ = Discord_Client_GetCall(&instance_, channelId, &returnValueNative__);
9929 discordpp::Call returnValue__(
9930 returnValueNative__,
9931 returnIsNonNull__ ? DiscordObjectState::Owned : DiscordObjectState::Invalid);
9932 return returnValue__;
9933}
9934std::vector<discordpp::Call> Client::GetCalls()
9935{
9936 assert(state_ == DiscordObjectState::Owned);
9937 Discord_CallSpan returnValueNative__;
9938 Discord_Client_GetCalls(&instance_, &returnValueNative__);
9939 std::vector<discordpp::Call> returnValue__;
9940 returnValue__.reserve(returnValueNative__.size);
9941 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
9942 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
9943 }
9944 Discord_Free(returnValueNative__.ptr);
9945 return returnValue__;
9946}
9947void Client::GetCurrentInputDevice(discordpp::Client::GetCurrentInputDeviceCallback cb)
9948{
9949 assert(state_ == DiscordObjectState::Owned);
9950 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9951 auto cb__userData = new Tcb__UserData(cb);
9952 Discord_Client_GetCurrentInputDeviceCallback cb__native = [](auto device, void* userData__) {
9953 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9954 discordpp::AudioDevice device__obj(*device, DiscordObjectState::Owned);
9955 userData__typed->delegate(std::move(device__obj));
9956 };
9957 Discord_Client_GetCurrentInputDevice(&instance_, cb__native, Tcb__UserData::Free, cb__userData);
9958}
9959void Client::GetCurrentOutputDevice(discordpp::Client::GetCurrentOutputDeviceCallback cb)
9960{
9961 assert(state_ == DiscordObjectState::Owned);
9962 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9963 auto cb__userData = new Tcb__UserData(cb);
9964 Discord_Client_GetCurrentOutputDeviceCallback cb__native = [](auto device, void* userData__) {
9965 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9966 discordpp::AudioDevice device__obj(*device, DiscordObjectState::Owned);
9967 userData__typed->delegate(std::move(device__obj));
9968 };
9969 Discord_Client_GetCurrentOutputDevice(
9970 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
9971}
9972void Client::GetInputDevices(discordpp::Client::GetInputDevicesCallback cb)
9973{
9974 assert(state_ == DiscordObjectState::Owned);
9975 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9976 auto cb__userData = new Tcb__UserData(cb);
9977 Discord_Client_GetInputDevicesCallback cb__native = [](auto devices, void* userData__) {
9978 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9979 std::vector<discordpp::AudioDevice> devices__vec;
9980 devices__vec.reserve(devices.size);
9981 for (size_t i__ = 0; i__ < devices.size; ++i__) {
9982 devices__vec.emplace_back(devices.ptr[i__], DiscordObjectState::Owned);
9983 }
9984 Discord_Free(devices.ptr);
9985 userData__typed->delegate(std::move(devices__vec));
9986 };
9987 Discord_Client_GetInputDevices(&instance_, cb__native, Tcb__UserData::Free, cb__userData);
9988}
9989float Client::GetInputVolume()
9990{
9991 assert(state_ == DiscordObjectState::Owned);
9992 float returnValue__;
9993 returnValue__ = Discord_Client_GetInputVolume(&instance_);
9994 return returnValue__;
9995}
9996void Client::GetOutputDevices(discordpp::Client::GetOutputDevicesCallback cb)
9997{
9998 assert(state_ == DiscordObjectState::Owned);
9999 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10000 auto cb__userData = new Tcb__UserData(cb);
10001 Discord_Client_GetOutputDevicesCallback cb__native = [](auto devices, void* userData__) {
10002 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10003 std::vector<discordpp::AudioDevice> devices__vec;
10004 devices__vec.reserve(devices.size);
10005 for (size_t i__ = 0; i__ < devices.size; ++i__) {
10006 devices__vec.emplace_back(devices.ptr[i__], DiscordObjectState::Owned);
10007 }
10008 Discord_Free(devices.ptr);
10009 userData__typed->delegate(std::move(devices__vec));
10010 };
10011 Discord_Client_GetOutputDevices(&instance_, cb__native, Tcb__UserData::Free, cb__userData);
10012}
10013float Client::GetOutputVolume()
10014{
10015 assert(state_ == DiscordObjectState::Owned);
10016 float returnValue__;
10017 returnValue__ = Discord_Client_GetOutputVolume(&instance_);
10018 return returnValue__;
10019}
10020bool Client::GetSelfDeafAll() const
10021{
10022 assert(state_ == DiscordObjectState::Owned);
10023 bool returnValue__;
10024 returnValue__ = Discord_Client_GetSelfDeafAll(&instance_);
10025 return returnValue__;
10026}
10027bool Client::GetSelfMuteAll() const
10028{
10029 assert(state_ == DiscordObjectState::Owned);
10030 bool returnValue__;
10031 returnValue__ = Discord_Client_GetSelfMuteAll(&instance_);
10032 return returnValue__;
10033}
10034void Client::SetAecDump(bool on)
10035{
10036 assert(state_ == DiscordObjectState::Owned);
10037 Discord_Client_SetAecDump(&instance_, on);
10038}
10039void Client::SetAutomaticGainControl(bool on)
10040{
10041 assert(state_ == DiscordObjectState::Owned);
10042 Discord_Client_SetAutomaticGainControl(&instance_, on);
10043}
10044void Client::SetDeviceChangeCallback(discordpp::Client::DeviceChangeCallback callback)
10045{
10046 assert(state_ == DiscordObjectState::Owned);
10047 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10048 auto callback__userData = new Tcallback__UserData(callback);
10049 Discord_Client_DeviceChangeCallback callback__native =
10050 [](auto inputDevices, auto outputDevices, void* userData__) {
10051 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10052 std::vector<discordpp::AudioDevice> inputDevices__vec;
10053 inputDevices__vec.reserve(inputDevices.size);
10054 for (size_t i__ = 0; i__ < inputDevices.size; ++i__) {
10055 inputDevices__vec.emplace_back(inputDevices.ptr[i__], DiscordObjectState::Owned);
10056 }
10057 Discord_Free(inputDevices.ptr);
10058 std::vector<discordpp::AudioDevice> outputDevices__vec;
10059 outputDevices__vec.reserve(outputDevices.size);
10060 for (size_t i__ = 0; i__ < outputDevices.size; ++i__) {
10061 outputDevices__vec.emplace_back(outputDevices.ptr[i__], DiscordObjectState::Owned);
10062 }
10063 Discord_Free(outputDevices.ptr);
10064 userData__typed->delegate(std::move(inputDevices__vec), std::move(outputDevices__vec));
10065 };
10066 Discord_Client_SetDeviceChangeCallback(
10067 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
10068}
10069void Client::SetEchoCancellation(bool on)
10070{
10071 assert(state_ == DiscordObjectState::Owned);
10072 Discord_Client_SetEchoCancellation(&instance_, on);
10073}
10074void Client::SetEngineManagedAudioSession(bool isEngineManaged)
10075{
10076 assert(state_ == DiscordObjectState::Owned);
10077 Discord_Client_SetEngineManagedAudioSession(&instance_, isEngineManaged);
10078}
10079void Client::SetInputDevice(std::string deviceId, discordpp::Client::SetInputDeviceCallback cb)
10080{
10081 assert(state_ == DiscordObjectState::Owned);
10082 Discord_String deviceId__str{(uint8_t*)(deviceId.data()), deviceId.size()};
10083 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10084 auto cb__userData = new Tcb__UserData(cb);
10085 Discord_Client_SetInputDeviceCallback cb__native = [](auto result, void* userData__) {
10086 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10087 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10088 userData__typed->delegate(std::move(result__obj));
10089 };
10090 Discord_Client_SetInputDevice(
10091 &instance_, deviceId__str, cb__native, Tcb__UserData::Free, cb__userData);
10092}
10093void Client::SetInputVolume(float inputVolume)
10094{
10095 assert(state_ == DiscordObjectState::Owned);
10096 Discord_Client_SetInputVolume(&instance_, inputVolume);
10097}
10098void Client::SetNoAudioInputCallback(discordpp::Client::NoAudioInputCallback callback)
10099{
10100 assert(state_ == DiscordObjectState::Owned);
10101 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10102 auto callback__userData = new Tcallback__UserData(callback);
10103 Discord_Client_NoAudioInputCallback callback__native = [](auto inputDetected,
10104 void* userData__) {
10105 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10106 userData__typed->delegate(inputDetected);
10107 };
10108 Discord_Client_SetNoAudioInputCallback(
10109 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
10110}
10111void Client::SetNoAudioInputThreshold(float dBFSThreshold)
10112{
10113 assert(state_ == DiscordObjectState::Owned);
10114 Discord_Client_SetNoAudioInputThreshold(&instance_, dBFSThreshold);
10115}
10116void Client::SetNoiseSuppression(bool on)
10117{
10118 assert(state_ == DiscordObjectState::Owned);
10119 Discord_Client_SetNoiseSuppression(&instance_, on);
10120}
10121void Client::SetOpusHardwareCoding(bool encode, bool decode)
10122{
10123 assert(state_ == DiscordObjectState::Owned);
10124 Discord_Client_SetOpusHardwareCoding(&instance_, encode, decode);
10125}
10126void Client::SetOutputDevice(std::string deviceId, discordpp::Client::SetOutputDeviceCallback cb)
10127{
10128 assert(state_ == DiscordObjectState::Owned);
10129 Discord_String deviceId__str{(uint8_t*)(deviceId.data()), deviceId.size()};
10130 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10131 auto cb__userData = new Tcb__UserData(cb);
10132 Discord_Client_SetOutputDeviceCallback cb__native = [](auto result, void* userData__) {
10133 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10134 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10135 userData__typed->delegate(std::move(result__obj));
10136 };
10137 Discord_Client_SetOutputDevice(
10138 &instance_, deviceId__str, cb__native, Tcb__UserData::Free, cb__userData);
10139}
10140void Client::SetOutputVolume(float outputVolume)
10141{
10142 assert(state_ == DiscordObjectState::Owned);
10143 Discord_Client_SetOutputVolume(&instance_, outputVolume);
10144}
10145void Client::SetSelfDeafAll(bool deaf)
10146{
10147 assert(state_ == DiscordObjectState::Owned);
10148 Discord_Client_SetSelfDeafAll(&instance_, deaf);
10149}
10150void Client::SetSelfMuteAll(bool mute)
10151{
10152 assert(state_ == DiscordObjectState::Owned);
10153 Discord_Client_SetSelfMuteAll(&instance_, mute);
10154}
10155bool Client::SetSpeakerMode(bool speakerMode)
10156{
10157 assert(state_ == DiscordObjectState::Owned);
10158 bool returnValue__;
10159 returnValue__ = Discord_Client_SetSpeakerMode(&instance_, speakerMode);
10160 return returnValue__;
10161}
10162void Client::SetThreadPriority(discordpp::Client::Thread thread, int32_t priority)
10163{
10164 assert(state_ == DiscordObjectState::Owned);
10165 Discord_Client_SetThreadPriority(
10166 &instance_, static_cast<Discord_Client_Thread>(thread), priority);
10167}
10168void Client::SetVoiceParticipantChangedCallback(
10170{
10171 assert(state_ == DiscordObjectState::Owned);
10172 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10173 auto cb__userData = new Tcb__UserData(cb);
10174 Discord_Client_VoiceParticipantChangedCallback cb__native =
10175 [](auto lobbyId, auto memberId, auto added, void* userData__) {
10176 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10177 userData__typed->delegate(lobbyId, memberId, added);
10178 };
10179 Discord_Client_SetVoiceParticipantChangedCallback(
10180 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10181}
10182bool Client::ShowAudioRoutePicker()
10183{
10184 assert(state_ == DiscordObjectState::Owned);
10185 bool returnValue__;
10186 returnValue__ = Discord_Client_ShowAudioRoutePicker(&instance_);
10187 return returnValue__;
10188}
10189discordpp::Call Client::StartCall(uint64_t channelId)
10190{
10191 assert(state_ == DiscordObjectState::Owned);
10192 bool returnIsNonNull__;
10193 Discord_Call returnValueNative__{};
10194 returnIsNonNull__ = Discord_Client_StartCall(&instance_, channelId, &returnValueNative__);
10195 discordpp::Call returnValue__(
10196 returnValueNative__,
10197 returnIsNonNull__ ? DiscordObjectState::Owned : DiscordObjectState::Invalid);
10198 return returnValue__;
10199}
10200discordpp::Call Client::StartCallWithAudioCallbacks(
10201 uint64_t lobbyId,
10204{
10205 assert(state_ == DiscordObjectState::Owned);
10206 bool returnIsNonNull__;
10207 Discord_Call returnValueNative__{};
10208 using TreceivedCb__UserData = TDelegateUserData<std::remove_reference_t<decltype(receivedCb)>>;
10209 auto receivedCb__userData = new TreceivedCb__UserData(receivedCb);
10210 Discord_Client_UserAudioReceivedCallback receivedCb__native = [](auto userId,
10211 auto data,
10212 auto samplesPerChannel,
10213 auto sampleRate,
10214 auto channels,
10215 auto outShouldMute,
10216 void* userData__) {
10217 auto userData__typed = static_cast<TreceivedCb__UserData*>(userData__);
10218 userData__typed->delegate(
10219 userId, data, samplesPerChannel, sampleRate, channels, *outShouldMute);
10220 };
10221 using TcapturedCb__UserData = TDelegateUserData<std::remove_reference_t<decltype(capturedCb)>>;
10222 auto capturedCb__userData = new TcapturedCb__UserData(capturedCb);
10223 Discord_Client_UserAudioCapturedCallback capturedCb__native =
10224 [](auto data, auto samplesPerChannel, auto sampleRate, auto channels, void* userData__) {
10225 auto userData__typed = static_cast<TcapturedCb__UserData*>(userData__);
10226 userData__typed->delegate(data, samplesPerChannel, sampleRate, channels);
10227 };
10228 returnIsNonNull__ = Discord_Client_StartCallWithAudioCallbacks(&instance_,
10229 lobbyId,
10230 receivedCb__native,
10231 TreceivedCb__UserData::Free,
10232 receivedCb__userData,
10233 capturedCb__native,
10234 TcapturedCb__UserData::Free,
10235 capturedCb__userData,
10236 &returnValueNative__);
10237 discordpp::Call returnValue__(
10238 returnValueNative__,
10239 returnIsNonNull__ ? DiscordObjectState::Owned : DiscordObjectState::Invalid);
10240 return returnValue__;
10241}
10242void Client::AbortAuthorize()
10243{
10244 assert(state_ == DiscordObjectState::Owned);
10245 Discord_Client_AbortAuthorize(&instance_);
10246}
10247void Client::AbortGetTokenFromDevice()
10248{
10249 assert(state_ == DiscordObjectState::Owned);
10250 Discord_Client_AbortGetTokenFromDevice(&instance_);
10251}
10252void Client::Authorize(discordpp::AuthorizationArgs args,
10254{
10255 assert(state_ == DiscordObjectState::Owned);
10256 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10257 auto callback__userData = new Tcallback__UserData(callback);
10258 Discord_Client_AuthorizationCallback callback__native =
10259 [](auto result, auto code, auto redirectUri, void* userData__) {
10260 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10261 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10262 std::string code__str(reinterpret_cast<char*>(code.ptr), code.size);
10263 std::string redirectUri__str(reinterpret_cast<char*>(redirectUri.ptr), redirectUri.size);
10264 userData__typed->delegate(
10265 std::move(result__obj), std::move(code__str), std::move(redirectUri__str));
10266 Discord_Free(redirectUri.ptr);
10267 Discord_Free(code.ptr);
10268 };
10269 Discord_Client_Authorize(
10270 &instance_, args.instance(), callback__native, Tcallback__UserData::Free, callback__userData);
10271}
10272void Client::CloseAuthorizeDeviceScreen()
10273{
10274 assert(state_ == DiscordObjectState::Owned);
10275 Discord_Client_CloseAuthorizeDeviceScreen(&instance_);
10276}
10277discordpp::AuthorizationCodeVerifier Client::CreateAuthorizationCodeVerifier()
10278{
10279 assert(state_ == DiscordObjectState::Owned);
10280 Discord_AuthorizationCodeVerifier returnValueNative__{};
10281 Discord_Client_CreateAuthorizationCodeVerifier(&instance_, &returnValueNative__);
10282 discordpp::AuthorizationCodeVerifier returnValue__(returnValueNative__,
10283 DiscordObjectState::Owned);
10284 return returnValue__;
10285}
10286void Client::ExchangeChildToken(std::string const& parentApplicationToken,
10287 uint64_t childApplicationId,
10289{
10290 assert(state_ == DiscordObjectState::Owned);
10291 Discord_String parentApplicationToken__str{(uint8_t*)(parentApplicationToken.data()),
10292 parentApplicationToken.size()};
10293 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10294 auto callback__userData = new Tcallback__UserData(callback);
10295 Discord_Client_ExchangeChildTokenCallback callback__native = [](auto result,
10296 auto accessToken,
10297 auto tokenType,
10298 auto expiresIn,
10299 auto scopes,
10300 void* userData__) {
10301 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10302 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10303 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
10304 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
10305 userData__typed->delegate(std::move(result__obj),
10306 std::move(accessToken__str),
10307 static_cast<discordpp::AuthorizationTokenType>(tokenType),
10308 expiresIn,
10309 std::move(scopes__str));
10310 Discord_Free(scopes.ptr);
10311 Discord_Free(accessToken.ptr);
10312 };
10313 Discord_Client_ExchangeChildToken(&instance_,
10314 parentApplicationToken__str,
10315 childApplicationId,
10316 callback__native,
10317 Tcallback__UserData::Free,
10318 callback__userData);
10319}
10320void Client::FetchCurrentUser(discordpp::AuthorizationTokenType tokenType,
10321 std::string const& token,
10323{
10324 assert(state_ == DiscordObjectState::Owned);
10325 Discord_String token__str{(uint8_t*)(token.data()), token.size()};
10326 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10327 auto callback__userData = new Tcallback__UserData(callback);
10328 Discord_Client_FetchCurrentUserCallback callback__native =
10329 [](auto result, auto id, auto name, void* userData__) {
10330 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10331 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10332 std::string name__str(reinterpret_cast<char*>(name.ptr), name.size);
10333 userData__typed->delegate(std::move(result__obj), id, std::move(name__str));
10334 Discord_Free(name.ptr);
10335 };
10336 Discord_Client_FetchCurrentUser(&instance_,
10337 static_cast<Discord_AuthorizationTokenType>(tokenType),
10338 token__str,
10339 callback__native,
10340 Tcallback__UserData::Free,
10341 callback__userData);
10342}
10343void Client::GetProvisionalToken(uint64_t applicationId,
10345 std::string const& externalAuthToken,
10347{
10348 assert(state_ == DiscordObjectState::Owned);
10349 Discord_String externalAuthToken__str{(uint8_t*)(externalAuthToken.data()),
10350 externalAuthToken.size()};
10351 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10352 auto callback__userData = new Tcallback__UserData(callback);
10353 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
10354 auto accessToken,
10355 auto refreshToken,
10356 auto tokenType,
10357 auto expiresIn,
10358 auto scopes,
10359 void* userData__) {
10360 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10361 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10362 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
10363 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
10364 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
10365 userData__typed->delegate(std::move(result__obj),
10366 std::move(accessToken__str),
10367 std::move(refreshToken__str),
10368 static_cast<discordpp::AuthorizationTokenType>(tokenType),
10369 expiresIn,
10370 std::move(scopes__str));
10371 Discord_Free(scopes.ptr);
10372 Discord_Free(refreshToken.ptr);
10373 Discord_Free(accessToken.ptr);
10374 };
10375 Discord_Client_GetProvisionalToken(
10376 &instance_,
10377 applicationId,
10378 static_cast<Discord_AuthenticationExternalAuthType>(externalAuthType),
10379 externalAuthToken__str,
10380 callback__native,
10381 Tcallback__UserData::Free,
10382 callback__userData);
10383}
10384void Client::GetToken(uint64_t applicationId,
10385 std::string const& code,
10386 std::string const& codeVerifier,
10387 std::string const& redirectUri,
10389{
10390 assert(state_ == DiscordObjectState::Owned);
10391 Discord_String code__str{(uint8_t*)(code.data()), code.size()};
10392 Discord_String codeVerifier__str{(uint8_t*)(codeVerifier.data()), codeVerifier.size()};
10393 Discord_String redirectUri__str{(uint8_t*)(redirectUri.data()), redirectUri.size()};
10394 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10395 auto callback__userData = new Tcallback__UserData(callback);
10396 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
10397 auto accessToken,
10398 auto refreshToken,
10399 auto tokenType,
10400 auto expiresIn,
10401 auto scopes,
10402 void* userData__) {
10403 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10404 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10405 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
10406 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
10407 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
10408 userData__typed->delegate(std::move(result__obj),
10409 std::move(accessToken__str),
10410 std::move(refreshToken__str),
10411 static_cast<discordpp::AuthorizationTokenType>(tokenType),
10412 expiresIn,
10413 std::move(scopes__str));
10414 Discord_Free(scopes.ptr);
10415 Discord_Free(refreshToken.ptr);
10416 Discord_Free(accessToken.ptr);
10417 };
10418 Discord_Client_GetToken(&instance_,
10419 applicationId,
10420 code__str,
10421 codeVerifier__str,
10422 redirectUri__str,
10423 callback__native,
10424 Tcallback__UserData::Free,
10425 callback__userData);
10426}
10427void Client::GetTokenFromDevice(discordpp::DeviceAuthorizationArgs args,
10429{
10430 assert(state_ == DiscordObjectState::Owned);
10431 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10432 auto callback__userData = new Tcallback__UserData(callback);
10433 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
10434 auto accessToken,
10435 auto refreshToken,
10436 auto tokenType,
10437 auto expiresIn,
10438 auto scopes,
10439 void* userData__) {
10440 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10441 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10442 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
10443 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
10444 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
10445 userData__typed->delegate(std::move(result__obj),
10446 std::move(accessToken__str),
10447 std::move(refreshToken__str),
10448 static_cast<discordpp::AuthorizationTokenType>(tokenType),
10449 expiresIn,
10450 std::move(scopes__str));
10451 Discord_Free(scopes.ptr);
10452 Discord_Free(refreshToken.ptr);
10453 Discord_Free(accessToken.ptr);
10454 };
10455 Discord_Client_GetTokenFromDevice(
10456 &instance_, args.instance(), callback__native, Tcallback__UserData::Free, callback__userData);
10457}
10458void Client::GetTokenFromDeviceProvisionalMerge(
10461 std::string const& externalAuthToken,
10463{
10464 assert(state_ == DiscordObjectState::Owned);
10465 Discord_String externalAuthToken__str{(uint8_t*)(externalAuthToken.data()),
10466 externalAuthToken.size()};
10467 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10468 auto callback__userData = new Tcallback__UserData(callback);
10469 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
10470 auto accessToken,
10471 auto refreshToken,
10472 auto tokenType,
10473 auto expiresIn,
10474 auto scopes,
10475 void* userData__) {
10476 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10477 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10478 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
10479 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
10480 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
10481 userData__typed->delegate(std::move(result__obj),
10482 std::move(accessToken__str),
10483 std::move(refreshToken__str),
10484 static_cast<discordpp::AuthorizationTokenType>(tokenType),
10485 expiresIn,
10486 std::move(scopes__str));
10487 Discord_Free(scopes.ptr);
10488 Discord_Free(refreshToken.ptr);
10489 Discord_Free(accessToken.ptr);
10490 };
10491 Discord_Client_GetTokenFromDeviceProvisionalMerge(
10492 &instance_,
10493 args.instance(),
10494 static_cast<Discord_AuthenticationExternalAuthType>(externalAuthType),
10495 externalAuthToken__str,
10496 callback__native,
10497 Tcallback__UserData::Free,
10498 callback__userData);
10499}
10500void Client::GetTokenFromProvisionalMerge(
10501 uint64_t applicationId,
10502 std::string const& code,
10503 std::string const& codeVerifier,
10504 std::string const& redirectUri,
10506 std::string const& externalAuthToken,
10508{
10509 assert(state_ == DiscordObjectState::Owned);
10510 Discord_String code__str{(uint8_t*)(code.data()), code.size()};
10511 Discord_String codeVerifier__str{(uint8_t*)(codeVerifier.data()), codeVerifier.size()};
10512 Discord_String redirectUri__str{(uint8_t*)(redirectUri.data()), redirectUri.size()};
10513 Discord_String externalAuthToken__str{(uint8_t*)(externalAuthToken.data()),
10514 externalAuthToken.size()};
10515 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10516 auto callback__userData = new Tcallback__UserData(callback);
10517 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
10518 auto accessToken,
10519 auto refreshToken,
10520 auto tokenType,
10521 auto expiresIn,
10522 auto scopes,
10523 void* userData__) {
10524 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10525 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10526 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
10527 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
10528 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
10529 userData__typed->delegate(std::move(result__obj),
10530 std::move(accessToken__str),
10531 std::move(refreshToken__str),
10532 static_cast<discordpp::AuthorizationTokenType>(tokenType),
10533 expiresIn,
10534 std::move(scopes__str));
10535 Discord_Free(scopes.ptr);
10536 Discord_Free(refreshToken.ptr);
10537 Discord_Free(accessToken.ptr);
10538 };
10539 Discord_Client_GetTokenFromProvisionalMerge(
10540 &instance_,
10541 applicationId,
10542 code__str,
10543 codeVerifier__str,
10544 redirectUri__str,
10545 static_cast<Discord_AuthenticationExternalAuthType>(externalAuthType),
10546 externalAuthToken__str,
10547 callback__native,
10548 Tcallback__UserData::Free,
10549 callback__userData);
10550}
10551bool Client::IsAuthenticated()
10552{
10553 assert(state_ == DiscordObjectState::Owned);
10554 bool returnValue__;
10555 returnValue__ = Discord_Client_IsAuthenticated(&instance_);
10556 return returnValue__;
10557}
10558void Client::OpenAuthorizeDeviceScreen(uint64_t clientId, std::string const& userCode)
10559{
10560 assert(state_ == DiscordObjectState::Owned);
10561 Discord_String userCode__str{(uint8_t*)(userCode.data()), userCode.size()};
10562 Discord_Client_OpenAuthorizeDeviceScreen(&instance_, clientId, userCode__str);
10563}
10564void Client::ProvisionalUserMergeCompleted(bool success)
10565{
10566 assert(state_ == DiscordObjectState::Owned);
10567 Discord_Client_ProvisionalUserMergeCompleted(&instance_, success);
10568}
10569void Client::RefreshToken(uint64_t applicationId,
10570 std::string const& refreshToken,
10572{
10573 assert(state_ == DiscordObjectState::Owned);
10574 Discord_String refreshToken__str{(uint8_t*)(refreshToken.data()), refreshToken.size()};
10575 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10576 auto callback__userData = new Tcallback__UserData(callback);
10577 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
10578 auto accessToken,
10579 auto refreshToken,
10580 auto tokenType,
10581 auto expiresIn,
10582 auto scopes,
10583 void* userData__) {
10584 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10585 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10586 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
10587 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
10588 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
10589 userData__typed->delegate(std::move(result__obj),
10590 std::move(accessToken__str),
10591 std::move(refreshToken__str),
10592 static_cast<discordpp::AuthorizationTokenType>(tokenType),
10593 expiresIn,
10594 std::move(scopes__str));
10595 Discord_Free(scopes.ptr);
10596 Discord_Free(refreshToken.ptr);
10597 Discord_Free(accessToken.ptr);
10598 };
10599 Discord_Client_RefreshToken(&instance_,
10600 applicationId,
10601 refreshToken__str,
10602 callback__native,
10603 Tcallback__UserData::Free,
10604 callback__userData);
10605}
10606void Client::RevokeToken(uint64_t applicationId,
10607 std::string const& token,
10609{
10610 assert(state_ == DiscordObjectState::Owned);
10611 Discord_String token__str{(uint8_t*)(token.data()), token.size()};
10612 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10613 auto callback__userData = new Tcallback__UserData(callback);
10614 Discord_Client_RevokeTokenCallback callback__native = [](auto result, void* userData__) {
10615 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10616 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10617 userData__typed->delegate(std::move(result__obj));
10618 };
10619 Discord_Client_RevokeToken(&instance_,
10620 applicationId,
10621 token__str,
10622 callback__native,
10623 Tcallback__UserData::Free,
10624 callback__userData);
10625}
10626void Client::SetAuthorizeDeviceScreenClosedCallback(
10628{
10629 assert(state_ == DiscordObjectState::Owned);
10630 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10631 auto cb__userData = new Tcb__UserData(cb);
10632 Discord_Client_AuthorizeDeviceScreenClosedCallback cb__native = [](void* userData__) {
10633 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10634 userData__typed->delegate();
10635 };
10636 Discord_Client_SetAuthorizeDeviceScreenClosedCallback(
10637 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10638}
10639void Client::SetGameWindowPid(int32_t pid)
10640{
10641 assert(state_ == DiscordObjectState::Owned);
10642 Discord_Client_SetGameWindowPid(&instance_, pid);
10643}
10644void Client::SetTokenExpirationCallback(discordpp::Client::TokenExpirationCallback callback)
10645{
10646 assert(state_ == DiscordObjectState::Owned);
10647 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10648 auto callback__userData = new Tcallback__UserData(callback);
10649 Discord_Client_TokenExpirationCallback callback__native = [](void* userData__) {
10650 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10651 userData__typed->delegate();
10652 };
10653 Discord_Client_SetTokenExpirationCallback(
10654 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
10655}
10656void Client::UnmergeIntoProvisionalAccount(
10657 uint64_t applicationId,
10659 std::string const& externalAuthToken,
10661{
10662 assert(state_ == DiscordObjectState::Owned);
10663 Discord_String externalAuthToken__str{(uint8_t*)(externalAuthToken.data()),
10664 externalAuthToken.size()};
10665 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10666 auto callback__userData = new Tcallback__UserData(callback);
10667 Discord_Client_UnmergeIntoProvisionalAccountCallback callback__native = [](auto result,
10668 void* userData__) {
10669 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10670 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10671 userData__typed->delegate(std::move(result__obj));
10672 };
10673 Discord_Client_UnmergeIntoProvisionalAccount(
10674 &instance_,
10675 applicationId,
10676 static_cast<Discord_AuthenticationExternalAuthType>(externalAuthType),
10677 externalAuthToken__str,
10678 callback__native,
10679 Tcallback__UserData::Free,
10680 callback__userData);
10681}
10682void Client::UpdateProvisionalAccountDisplayName(
10683 std::string const& name,
10685{
10686 assert(state_ == DiscordObjectState::Owned);
10687 Discord_String name__str{(uint8_t*)(name.data()), name.size()};
10688 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10689 auto callback__userData = new Tcallback__UserData(callback);
10690 Discord_Client_UpdateProvisionalAccountDisplayNameCallback callback__native =
10691 [](auto result, void* userData__) {
10692 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10693 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10694 userData__typed->delegate(std::move(result__obj));
10695 };
10696 Discord_Client_UpdateProvisionalAccountDisplayName(
10697 &instance_, name__str, callback__native, Tcallback__UserData::Free, callback__userData);
10698}
10699void Client::UpdateToken(discordpp::AuthorizationTokenType tokenType,
10700 std::string token,
10702{
10703 assert(state_ == DiscordObjectState::Owned);
10704 Discord_String token__str{(uint8_t*)(token.data()), token.size()};
10705 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10706 auto callback__userData = new Tcallback__UserData(callback);
10707 Discord_Client_UpdateTokenCallback callback__native = [](auto result, void* userData__) {
10708 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10709 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10710 userData__typed->delegate(std::move(result__obj));
10711 };
10712 Discord_Client_UpdateToken(&instance_,
10713 static_cast<Discord_AuthorizationTokenType>(tokenType),
10714 token__str,
10715 callback__native,
10716 Tcallback__UserData::Free,
10717 callback__userData);
10718}
10719bool Client::CanOpenMessageInDiscord(uint64_t messageId)
10720{
10721 assert(state_ == DiscordObjectState::Owned);
10722 bool returnValue__;
10723 returnValue__ = Discord_Client_CanOpenMessageInDiscord(&instance_, messageId);
10724 return returnValue__;
10725}
10726void Client::DeleteUserMessage(uint64_t recipientId,
10727 uint64_t messageId,
10729{
10730 assert(state_ == DiscordObjectState::Owned);
10731 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10732 auto cb__userData = new Tcb__UserData(cb);
10733 Discord_Client_DeleteUserMessageCallback cb__native = [](auto result, void* userData__) {
10734 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10735 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10736 userData__typed->delegate(std::move(result__obj));
10737 };
10738 Discord_Client_DeleteUserMessage(
10739 &instance_, recipientId, messageId, cb__native, Tcb__UserData::Free, cb__userData);
10740}
10741void Client::EditUserMessage(uint64_t recipientId,
10742 uint64_t messageId,
10743 std::string const& content,
10745{
10746 assert(state_ == DiscordObjectState::Owned);
10747 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
10748 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10749 auto cb__userData = new Tcb__UserData(cb);
10750 Discord_Client_EditUserMessageCallback cb__native = [](auto result, void* userData__) {
10751 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10752 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10753 userData__typed->delegate(std::move(result__obj));
10754 };
10755 Discord_Client_EditUserMessage(&instance_,
10756 recipientId,
10757 messageId,
10758 content__str,
10759 cb__native,
10760 Tcb__UserData::Free,
10761 cb__userData);
10762}
10763std::optional<discordpp::ChannelHandle> Client::GetChannelHandle(uint64_t channelId) const
10764{
10765 assert(state_ == DiscordObjectState::Owned);
10766 bool returnIsNonNull__;
10767 Discord_ChannelHandle returnValueNative__;
10768 returnIsNonNull__ =
10769 Discord_Client_GetChannelHandle(&instance_, channelId, &returnValueNative__);
10770 if (!returnIsNonNull__) {
10771 return {};
10772 }
10773 discordpp::ChannelHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
10774 return returnValue__;
10775}
10776void Client::GetLobbyMessagesWithLimit(uint64_t lobbyId,
10777 int32_t limit,
10779{
10780 assert(state_ == DiscordObjectState::Owned);
10781 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10782 auto cb__userData = new Tcb__UserData(cb);
10783 Discord_Client_GetLobbyMessagesCallback cb__native =
10784 [](auto result, auto messages, void* userData__) {
10785 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10786 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10787 std::vector<discordpp::MessageHandle> messages__vec;
10788 messages__vec.reserve(messages.size);
10789 for (size_t i__ = 0; i__ < messages.size; ++i__) {
10790 messages__vec.emplace_back(messages.ptr[i__], DiscordObjectState::Owned);
10791 }
10792 Discord_Free(messages.ptr);
10793 userData__typed->delegate(std::move(result__obj), std::move(messages__vec));
10794 };
10795 Discord_Client_GetLobbyMessagesWithLimit(
10796 &instance_, lobbyId, limit, cb__native, Tcb__UserData::Free, cb__userData);
10797}
10798std::optional<discordpp::MessageHandle> Client::GetMessageHandle(uint64_t messageId) const
10799{
10800 assert(state_ == DiscordObjectState::Owned);
10801 bool returnIsNonNull__;
10802 Discord_MessageHandle returnValueNative__;
10803 returnIsNonNull__ =
10804 Discord_Client_GetMessageHandle(&instance_, messageId, &returnValueNative__);
10805 if (!returnIsNonNull__) {
10806 return {};
10807 }
10808 discordpp::MessageHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
10809 return returnValue__;
10810}
10811void Client::GetUserMessageSummaries(discordpp::Client::UserMessageSummariesCallback cb)
10812{
10813 assert(state_ == DiscordObjectState::Owned);
10814 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10815 auto cb__userData = new Tcb__UserData(cb);
10816 Discord_Client_UserMessageSummariesCallback cb__native =
10817 [](auto result, auto summaries, void* userData__) {
10818 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10819 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10820 std::vector<discordpp::UserMessageSummary> summaries__vec;
10821 summaries__vec.reserve(summaries.size);
10822 for (size_t i__ = 0; i__ < summaries.size; ++i__) {
10823 summaries__vec.emplace_back(summaries.ptr[i__], DiscordObjectState::Owned);
10824 }
10825 Discord_Free(summaries.ptr);
10826 userData__typed->delegate(std::move(result__obj), std::move(summaries__vec));
10827 };
10828 Discord_Client_GetUserMessageSummaries(
10829 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10830}
10831void Client::GetUserMessagesWithLimit(uint64_t recipientId,
10832 int32_t limit,
10834{
10835 assert(state_ == DiscordObjectState::Owned);
10836 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10837 auto cb__userData = new Tcb__UserData(cb);
10838 Discord_Client_UserMessagesWithLimitCallback cb__native =
10839 [](auto result, auto messages, void* userData__) {
10840 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10841 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10842 std::vector<discordpp::MessageHandle> messages__vec;
10843 messages__vec.reserve(messages.size);
10844 for (size_t i__ = 0; i__ < messages.size; ++i__) {
10845 messages__vec.emplace_back(messages.ptr[i__], DiscordObjectState::Owned);
10846 }
10847 Discord_Free(messages.ptr);
10848 userData__typed->delegate(std::move(result__obj), std::move(messages__vec));
10849 };
10850 Discord_Client_GetUserMessagesWithLimit(
10851 &instance_, recipientId, limit, cb__native, Tcb__UserData::Free, cb__userData);
10852}
10853void Client::OpenMessageInDiscord(
10854 uint64_t messageId,
10855 discordpp::Client::ProvisionalUserMergeRequiredCallback provisionalUserMergeRequiredCallback,
10857{
10858 assert(state_ == DiscordObjectState::Owned);
10859 using TprovisionalUserMergeRequiredCallback__UserData =
10860 TDelegateUserData<std::remove_reference_t<decltype(provisionalUserMergeRequiredCallback)>>;
10861 auto provisionalUserMergeRequiredCallback__userData =
10862 new TprovisionalUserMergeRequiredCallback__UserData(provisionalUserMergeRequiredCallback);
10863 Discord_Client_ProvisionalUserMergeRequiredCallback
10864 provisionalUserMergeRequiredCallback__native = [](void* userData__) {
10865 auto userData__typed =
10866 static_cast<TprovisionalUserMergeRequiredCallback__UserData*>(userData__);
10867 userData__typed->delegate();
10868 };
10869 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10870 auto callback__userData = new Tcallback__UserData(callback);
10871 Discord_Client_OpenMessageInDiscordCallback callback__native = [](auto result,
10872 void* userData__) {
10873 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10874 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10875 userData__typed->delegate(std::move(result__obj));
10876 };
10877 Discord_Client_OpenMessageInDiscord(&instance_,
10878 messageId,
10879 provisionalUserMergeRequiredCallback__native,
10880 TprovisionalUserMergeRequiredCallback__UserData::Free,
10881 provisionalUserMergeRequiredCallback__userData,
10882 callback__native,
10883 Tcallback__UserData::Free,
10884 callback__userData);
10885}
10886void Client::SendLobbyMessage(uint64_t lobbyId,
10887 std::string const& content,
10889{
10890 assert(state_ == DiscordObjectState::Owned);
10891 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
10892 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10893 auto cb__userData = new Tcb__UserData(cb);
10894 Discord_Client_SendUserMessageCallback cb__native =
10895 [](auto result, auto messageId, void* userData__) {
10896 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10897 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10898 userData__typed->delegate(std::move(result__obj), messageId);
10899 };
10900 Discord_Client_SendLobbyMessage(
10901 &instance_, lobbyId, content__str, cb__native, Tcb__UserData::Free, cb__userData);
10902}
10903void Client::SendLobbyMessageWithMetadata(
10904 uint64_t lobbyId,
10905 std::string const& content,
10906 std::unordered_map<std::string, std::string> const& metadata,
10908{
10909 assert(state_ == DiscordObjectState::Owned);
10910 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
10911 ConvertedProperties metadata__convert(metadata);
10912 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10913 auto cb__userData = new Tcb__UserData(cb);
10914 Discord_Client_SendUserMessageCallback cb__native =
10915 [](auto result, auto messageId, void* userData__) {
10916 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10917 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10918 userData__typed->delegate(std::move(result__obj), messageId);
10919 };
10920 Discord_Client_SendLobbyMessageWithMetadata(&instance_,
10921 lobbyId,
10922 content__str,
10923 metadata__convert.Properties,
10924 cb__native,
10925 Tcb__UserData::Free,
10926 cb__userData);
10927}
10928void Client::SendUserMessage(uint64_t recipientId,
10929 std::string const& content,
10931{
10932 assert(state_ == DiscordObjectState::Owned);
10933 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
10934 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10935 auto cb__userData = new Tcb__UserData(cb);
10936 Discord_Client_SendUserMessageCallback cb__native =
10937 [](auto result, auto messageId, void* userData__) {
10938 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10939 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10940 userData__typed->delegate(std::move(result__obj), messageId);
10941 };
10942 Discord_Client_SendUserMessage(
10943 &instance_, recipientId, content__str, cb__native, Tcb__UserData::Free, cb__userData);
10944}
10945void Client::SendUserMessageWithMetadata(
10946 uint64_t recipientId,
10947 std::string const& content,
10948 std::unordered_map<std::string, std::string> const& metadata,
10950{
10951 assert(state_ == DiscordObjectState::Owned);
10952 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
10953 ConvertedProperties metadata__convert(metadata);
10954 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10955 auto cb__userData = new Tcb__UserData(cb);
10956 Discord_Client_SendUserMessageCallback cb__native =
10957 [](auto result, auto messageId, void* userData__) {
10958 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10959 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10960 userData__typed->delegate(std::move(result__obj), messageId);
10961 };
10962 Discord_Client_SendUserMessageWithMetadata(&instance_,
10963 recipientId,
10964 content__str,
10965 metadata__convert.Properties,
10966 cb__native,
10967 Tcb__UserData::Free,
10968 cb__userData);
10969}
10970void Client::SetMessageCreatedCallback(discordpp::Client::MessageCreatedCallback cb)
10971{
10972 assert(state_ == DiscordObjectState::Owned);
10973 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10974 auto cb__userData = new Tcb__UserData(cb);
10975 Discord_Client_MessageCreatedCallback cb__native = [](auto messageId, void* userData__) {
10976 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10977 userData__typed->delegate(messageId);
10978 };
10979 Discord_Client_SetMessageCreatedCallback(
10980 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10981}
10982void Client::SetMessageDeletedCallback(discordpp::Client::MessageDeletedCallback cb)
10983{
10984 assert(state_ == DiscordObjectState::Owned);
10985 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10986 auto cb__userData = new Tcb__UserData(cb);
10987 Discord_Client_MessageDeletedCallback cb__native =
10988 [](auto messageId, auto channelId, void* userData__) {
10989 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10990 userData__typed->delegate(messageId, channelId);
10991 };
10992 Discord_Client_SetMessageDeletedCallback(
10993 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10994}
10995void Client::SetMessageUpdatedCallback(discordpp::Client::MessageUpdatedCallback cb)
10996{
10997 assert(state_ == DiscordObjectState::Owned);
10998 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10999 auto cb__userData = new Tcb__UserData(cb);
11000 Discord_Client_MessageUpdatedCallback cb__native = [](auto messageId, void* userData__) {
11001 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11002 userData__typed->delegate(messageId);
11003 };
11004 Discord_Client_SetMessageUpdatedCallback(
11005 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11006}
11007void Client::SetShowingChat(bool showingChat)
11008{
11009 assert(state_ == DiscordObjectState::Owned);
11010 Discord_Client_SetShowingChat(&instance_, showingChat);
11011}
11012void Client::AddLogCallback(discordpp::Client::LogCallback callback,
11013 discordpp::LoggingSeverity minSeverity)
11014{
11015 assert(state_ == DiscordObjectState::Owned);
11016 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
11017 auto callback__userData = new Tcallback__UserData(callback);
11018 Discord_Client_LogCallback callback__native = [](
11019 auto message, auto severity, void* userData__) {
11020 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
11021 std::string message__str(reinterpret_cast<char*>(message.ptr), message.size);
11022 userData__typed->delegate(std::move(message__str),
11023 static_cast<discordpp::LoggingSeverity>(severity));
11024 Discord_Free(message.ptr);
11025 };
11026 Discord_Client_AddLogCallback(&instance_,
11027 callback__native,
11028 Tcallback__UserData::Free,
11029 callback__userData,
11030 static_cast<Discord_LoggingSeverity>(minSeverity));
11031}
11032void Client::AddVoiceLogCallback(discordpp::Client::LogCallback callback,
11033 discordpp::LoggingSeverity minSeverity)
11034{
11035 assert(state_ == DiscordObjectState::Owned);
11036 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
11037 auto callback__userData = new Tcallback__UserData(callback);
11038 Discord_Client_LogCallback callback__native = [](
11039 auto message, auto severity, void* userData__) {
11040 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
11041 std::string message__str(reinterpret_cast<char*>(message.ptr), message.size);
11042 userData__typed->delegate(std::move(message__str),
11043 static_cast<discordpp::LoggingSeverity>(severity));
11044 Discord_Free(message.ptr);
11045 };
11046 Discord_Client_AddVoiceLogCallback(&instance_,
11047 callback__native,
11048 Tcallback__UserData::Free,
11049 callback__userData,
11050 static_cast<Discord_LoggingSeverity>(minSeverity));
11051}
11052void Client::Connect()
11053{
11054 assert(state_ == DiscordObjectState::Owned);
11055 Discord_Client_Connect(&instance_);
11056}
11057void Client::Disconnect()
11058{
11059 assert(state_ == DiscordObjectState::Owned);
11060 Discord_Client_Disconnect(&instance_);
11061}
11062discordpp::Client::Status Client::GetStatus() const
11063{
11064 assert(state_ == DiscordObjectState::Owned);
11065 Discord_Client_Status returnValue__;
11066 returnValue__ = Discord_Client_GetStatus(&instance_);
11067 return static_cast<discordpp::Client::Status>(returnValue__);
11068}
11069void Client::OpenConnectedGamesSettingsInDiscord(
11071{
11072 assert(state_ == DiscordObjectState::Owned);
11073 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
11074 auto callback__userData = new Tcallback__UserData(callback);
11075 Discord_Client_OpenConnectedGamesSettingsInDiscordCallback callback__native =
11076 [](auto result, void* userData__) {
11077 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
11078 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11079 userData__typed->delegate(std::move(result__obj));
11080 };
11081 Discord_Client_OpenConnectedGamesSettingsInDiscord(
11082 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
11083}
11084void Client::SetApplicationId(uint64_t applicationId)
11085{
11086 assert(state_ == DiscordObjectState::Owned);
11087 Discord_Client_SetApplicationId(&instance_, applicationId);
11088}
11089bool Client::SetLogDir(std::string const& path, discordpp::LoggingSeverity minSeverity)
11090{
11091 assert(state_ == DiscordObjectState::Owned);
11092 bool returnValue__;
11093 Discord_String path__str{(uint8_t*)(path.data()), path.size()};
11094 returnValue__ = Discord_Client_SetLogDir(
11095 &instance_, path__str, static_cast<Discord_LoggingSeverity>(minSeverity));
11096 return returnValue__;
11097}
11098void Client::SetStatusChangedCallback(discordpp::Client::OnStatusChanged cb)
11099{
11100 assert(state_ == DiscordObjectState::Owned);
11101 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11102 auto cb__userData = new Tcb__UserData(cb);
11103 Discord_Client_OnStatusChanged cb__native =
11104 [](auto status, auto error, auto errorDetail, void* userData__) {
11105 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11106 userData__typed->delegate(static_cast<discordpp::Client::Status>(status),
11107 static_cast<discordpp::Client::Error>(error),
11108 errorDetail);
11109 };
11110 Discord_Client_SetStatusChangedCallback(
11111 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11112}
11113void Client::SetVoiceLogDir(std::string const& path, discordpp::LoggingSeverity minSeverity)
11114{
11115 assert(state_ == DiscordObjectState::Owned);
11116 Discord_String path__str{(uint8_t*)(path.data()), path.size()};
11117 Discord_Client_SetVoiceLogDir(
11118 &instance_, path__str, static_cast<Discord_LoggingSeverity>(minSeverity));
11119}
11120void Client::CreateOrJoinLobby(std::string const& secret,
11122{
11123 assert(state_ == DiscordObjectState::Owned);
11124 Discord_String secret__str{(uint8_t*)(secret.data()), secret.size()};
11125 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
11126 auto callback__userData = new Tcallback__UserData(callback);
11127 Discord_Client_CreateOrJoinLobbyCallback callback__native =
11128 [](auto result, auto lobbyId, void* userData__) {
11129 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
11130 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11131 userData__typed->delegate(std::move(result__obj), lobbyId);
11132 };
11133 Discord_Client_CreateOrJoinLobby(
11134 &instance_, secret__str, callback__native, Tcallback__UserData::Free, callback__userData);
11135}
11136void Client::CreateOrJoinLobbyWithMetadata(
11137 std::string const& secret,
11138 std::unordered_map<std::string, std::string> const& lobbyMetadata,
11139 std::unordered_map<std::string, std::string> const& memberMetadata,
11141{
11142 assert(state_ == DiscordObjectState::Owned);
11143 Discord_String secret__str{(uint8_t*)(secret.data()), secret.size()};
11144 ConvertedProperties lobbyMetadata__convert(lobbyMetadata);
11145 ConvertedProperties memberMetadata__convert(memberMetadata);
11146 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
11147 auto callback__userData = new Tcallback__UserData(callback);
11148 Discord_Client_CreateOrJoinLobbyCallback callback__native =
11149 [](auto result, auto lobbyId, void* userData__) {
11150 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
11151 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11152 userData__typed->delegate(std::move(result__obj), lobbyId);
11153 };
11154 Discord_Client_CreateOrJoinLobbyWithMetadata(&instance_,
11155 secret__str,
11156 lobbyMetadata__convert.Properties,
11157 memberMetadata__convert.Properties,
11158 callback__native,
11159 Tcallback__UserData::Free,
11160 callback__userData);
11161}
11162void Client::GetGuildChannels(uint64_t guildId, discordpp::Client::GetGuildChannelsCallback cb)
11163{
11164 assert(state_ == DiscordObjectState::Owned);
11165 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11166 auto cb__userData = new Tcb__UserData(cb);
11167 Discord_Client_GetGuildChannelsCallback cb__native =
11168 [](auto result, auto guildChannels, void* userData__) {
11169 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11170 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11171 std::vector<discordpp::GuildChannel> guildChannels__vec;
11172 guildChannels__vec.reserve(guildChannels.size);
11173 for (size_t i__ = 0; i__ < guildChannels.size; ++i__) {
11174 guildChannels__vec.emplace_back(guildChannels.ptr[i__], DiscordObjectState::Owned);
11175 }
11176 Discord_Free(guildChannels.ptr);
11177 userData__typed->delegate(std::move(result__obj), std::move(guildChannels__vec));
11178 };
11179 Discord_Client_GetGuildChannels(
11180 &instance_, guildId, cb__native, Tcb__UserData::Free, cb__userData);
11181}
11182std::optional<discordpp::LobbyHandle> Client::GetLobbyHandle(uint64_t lobbyId) const
11183{
11184 assert(state_ == DiscordObjectState::Owned);
11185 bool returnIsNonNull__;
11186 Discord_LobbyHandle returnValueNative__;
11187 returnIsNonNull__ = Discord_Client_GetLobbyHandle(&instance_, lobbyId, &returnValueNative__);
11188 if (!returnIsNonNull__) {
11189 return {};
11190 }
11191 discordpp::LobbyHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
11192 return returnValue__;
11193}
11194std::vector<uint64_t> Client::GetLobbyIds() const
11195{
11196 assert(state_ == DiscordObjectState::Owned);
11197 Discord_UInt64Span returnValueNative__;
11198 Discord_Client_GetLobbyIds(&instance_, &returnValueNative__);
11199 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
11200 returnValueNative__.ptr + returnValueNative__.size);
11201 Discord_Free(returnValueNative__.ptr);
11202 return returnValue__;
11203}
11204void Client::GetUserGuilds(discordpp::Client::GetUserGuildsCallback cb)
11205{
11206 assert(state_ == DiscordObjectState::Owned);
11207 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11208 auto cb__userData = new Tcb__UserData(cb);
11209 Discord_Client_GetUserGuildsCallback cb__native =
11210 [](auto result, auto guilds, void* userData__) {
11211 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11212 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11213 std::vector<discordpp::GuildMinimal> guilds__vec;
11214 guilds__vec.reserve(guilds.size);
11215 for (size_t i__ = 0; i__ < guilds.size; ++i__) {
11216 guilds__vec.emplace_back(guilds.ptr[i__], DiscordObjectState::Owned);
11217 }
11218 Discord_Free(guilds.ptr);
11219 userData__typed->delegate(std::move(result__obj), std::move(guilds__vec));
11220 };
11221 Discord_Client_GetUserGuilds(&instance_, cb__native, Tcb__UserData::Free, cb__userData);
11222}
11223void Client::JoinLinkedLobbyGuild(
11224 uint64_t lobbyId,
11225 discordpp::Client::ProvisionalUserMergeRequiredCallback provisionalUserMergeRequiredCallback,
11227{
11228 assert(state_ == DiscordObjectState::Owned);
11229 using TprovisionalUserMergeRequiredCallback__UserData =
11230 TDelegateUserData<std::remove_reference_t<decltype(provisionalUserMergeRequiredCallback)>>;
11231 auto provisionalUserMergeRequiredCallback__userData =
11232 new TprovisionalUserMergeRequiredCallback__UserData(provisionalUserMergeRequiredCallback);
11233 Discord_Client_ProvisionalUserMergeRequiredCallback
11234 provisionalUserMergeRequiredCallback__native = [](void* userData__) {
11235 auto userData__typed =
11236 static_cast<TprovisionalUserMergeRequiredCallback__UserData*>(userData__);
11237 userData__typed->delegate();
11238 };
11239 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
11240 auto callback__userData = new Tcallback__UserData(callback);
11241 Discord_Client_JoinLinkedLobbyGuildCallback callback__native =
11242 [](auto result, auto inviteUrl, void* userData__) {
11243 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
11244 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11245 std::string inviteUrl__str(reinterpret_cast<char*>(inviteUrl.ptr), inviteUrl.size);
11246 userData__typed->delegate(std::move(result__obj), std::move(inviteUrl__str));
11247 Discord_Free(inviteUrl.ptr);
11248 };
11249 Discord_Client_JoinLinkedLobbyGuild(&instance_,
11250 lobbyId,
11251 provisionalUserMergeRequiredCallback__native,
11252 TprovisionalUserMergeRequiredCallback__UserData::Free,
11253 provisionalUserMergeRequiredCallback__userData,
11254 callback__native,
11255 Tcallback__UserData::Free,
11256 callback__userData);
11257}
11258void Client::LeaveLobby(uint64_t lobbyId, discordpp::Client::LeaveLobbyCallback callback)
11259{
11260 assert(state_ == DiscordObjectState::Owned);
11261 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
11262 auto callback__userData = new Tcallback__UserData(callback);
11263 Discord_Client_LeaveLobbyCallback callback__native = [](auto result, void* userData__) {
11264 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
11265 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11266 userData__typed->delegate(std::move(result__obj));
11267 };
11268 Discord_Client_LeaveLobby(
11269 &instance_, lobbyId, callback__native, Tcallback__UserData::Free, callback__userData);
11270}
11271void Client::LinkChannelToLobby(uint64_t lobbyId,
11272 uint64_t channelId,
11274{
11275 assert(state_ == DiscordObjectState::Owned);
11276 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
11277 auto callback__userData = new Tcallback__UserData(callback);
11278 Discord_Client_LinkOrUnlinkChannelCallback callback__native = [](auto result,
11279 void* userData__) {
11280 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
11281 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11282 userData__typed->delegate(std::move(result__obj));
11283 };
11284 Discord_Client_LinkChannelToLobby(&instance_,
11285 lobbyId,
11286 channelId,
11287 callback__native,
11288 Tcallback__UserData::Free,
11289 callback__userData);
11290}
11291void Client::SetLobbyCreatedCallback(discordpp::Client::LobbyCreatedCallback cb)
11292{
11293 assert(state_ == DiscordObjectState::Owned);
11294 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11295 auto cb__userData = new Tcb__UserData(cb);
11296 Discord_Client_LobbyCreatedCallback cb__native = [](auto lobbyId, void* userData__) {
11297 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11298 userData__typed->delegate(lobbyId);
11299 };
11300 Discord_Client_SetLobbyCreatedCallback(
11301 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11302}
11303void Client::SetLobbyDeletedCallback(discordpp::Client::LobbyDeletedCallback cb)
11304{
11305 assert(state_ == DiscordObjectState::Owned);
11306 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11307 auto cb__userData = new Tcb__UserData(cb);
11308 Discord_Client_LobbyDeletedCallback cb__native = [](auto lobbyId, void* userData__) {
11309 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11310 userData__typed->delegate(lobbyId);
11311 };
11312 Discord_Client_SetLobbyDeletedCallback(
11313 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11314}
11315void Client::SetLobbyMemberAddedCallback(discordpp::Client::LobbyMemberAddedCallback cb)
11316{
11317 assert(state_ == DiscordObjectState::Owned);
11318 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11319 auto cb__userData = new Tcb__UserData(cb);
11320 Discord_Client_LobbyMemberAddedCallback cb__native =
11321 [](auto lobbyId, auto memberId, void* userData__) {
11322 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11323 userData__typed->delegate(lobbyId, memberId);
11324 };
11325 Discord_Client_SetLobbyMemberAddedCallback(
11326 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11327}
11328void Client::SetLobbyMemberRemovedCallback(discordpp::Client::LobbyMemberRemovedCallback cb)
11329{
11330 assert(state_ == DiscordObjectState::Owned);
11331 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11332 auto cb__userData = new Tcb__UserData(cb);
11333 Discord_Client_LobbyMemberRemovedCallback cb__native =
11334 [](auto lobbyId, auto memberId, void* userData__) {
11335 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11336 userData__typed->delegate(lobbyId, memberId);
11337 };
11338 Discord_Client_SetLobbyMemberRemovedCallback(
11339 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11340}
11341void Client::SetLobbyMemberUpdatedCallback(discordpp::Client::LobbyMemberUpdatedCallback cb)
11342{
11343 assert(state_ == DiscordObjectState::Owned);
11344 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11345 auto cb__userData = new Tcb__UserData(cb);
11346 Discord_Client_LobbyMemberUpdatedCallback cb__native =
11347 [](auto lobbyId, auto memberId, void* userData__) {
11348 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11349 userData__typed->delegate(lobbyId, memberId);
11350 };
11351 Discord_Client_SetLobbyMemberUpdatedCallback(
11352 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11353}
11354void Client::SetLobbyUpdatedCallback(discordpp::Client::LobbyUpdatedCallback cb)
11355{
11356 assert(state_ == DiscordObjectState::Owned);
11357 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11358 auto cb__userData = new Tcb__UserData(cb);
11359 Discord_Client_LobbyUpdatedCallback cb__native = [](auto lobbyId, void* userData__) {
11360 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11361 userData__typed->delegate(lobbyId);
11362 };
11363 Discord_Client_SetLobbyUpdatedCallback(
11364 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11365}
11366void Client::UnlinkChannelFromLobby(uint64_t lobbyId,
11368{
11369 assert(state_ == DiscordObjectState::Owned);
11370 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
11371 auto callback__userData = new Tcallback__UserData(callback);
11372 Discord_Client_LinkOrUnlinkChannelCallback callback__native = [](auto result,
11373 void* userData__) {
11374 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
11375 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11376 userData__typed->delegate(std::move(result__obj));
11377 };
11378 Discord_Client_UnlinkChannelFromLobby(
11379 &instance_, lobbyId, callback__native, Tcallback__UserData::Free, callback__userData);
11380}
11381void Client::AcceptActivityInvite(discordpp::ActivityInvite invite,
11383{
11384 assert(state_ == DiscordObjectState::Owned);
11385 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11386 auto cb__userData = new Tcb__UserData(cb);
11387 Discord_Client_AcceptActivityInviteCallback cb__native =
11388 [](auto result, auto joinSecret, void* userData__) {
11389 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11390 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11391 std::string joinSecret__str(reinterpret_cast<char*>(joinSecret.ptr), joinSecret.size);
11392 userData__typed->delegate(std::move(result__obj), std::move(joinSecret__str));
11393 Discord_Free(joinSecret.ptr);
11394 };
11395 Discord_Client_AcceptActivityInvite(
11396 &instance_, invite.instance(), cb__native, Tcb__UserData::Free, cb__userData);
11397}
11398void Client::ClearRichPresence()
11399{
11400 assert(state_ == DiscordObjectState::Owned);
11401 Discord_Client_ClearRichPresence(&instance_);
11402}
11403bool Client::RegisterLaunchCommand(uint64_t applicationId, std::string command)
11404{
11405 assert(state_ == DiscordObjectState::Owned);
11406 bool returnValue__;
11407 Discord_String command__str{(uint8_t*)(command.data()), command.size()};
11408 returnValue__ = Discord_Client_RegisterLaunchCommand(&instance_, applicationId, command__str);
11409 return returnValue__;
11410}
11411bool Client::RegisterLaunchSteamApplication(uint64_t applicationId, uint32_t steamAppId)
11412{
11413 assert(state_ == DiscordObjectState::Owned);
11414 bool returnValue__;
11415 returnValue__ =
11416 Discord_Client_RegisterLaunchSteamApplication(&instance_, applicationId, steamAppId);
11417 return returnValue__;
11418}
11419void Client::SendActivityInvite(uint64_t userId,
11420 std::string const& content,
11422{
11423 assert(state_ == DiscordObjectState::Owned);
11424 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
11425 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11426 auto cb__userData = new Tcb__UserData(cb);
11427 Discord_Client_SendActivityInviteCallback cb__native = [](auto result, void* userData__) {
11428 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11429 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11430 userData__typed->delegate(std::move(result__obj));
11431 };
11432 Discord_Client_SendActivityInvite(
11433 &instance_, userId, content__str, cb__native, Tcb__UserData::Free, cb__userData);
11434}
11435void Client::SendActivityJoinRequest(uint64_t userId,
11437{
11438 assert(state_ == DiscordObjectState::Owned);
11439 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11440 auto cb__userData = new Tcb__UserData(cb);
11441 Discord_Client_SendActivityInviteCallback cb__native = [](auto result, void* userData__) {
11442 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11443 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11444 userData__typed->delegate(std::move(result__obj));
11445 };
11446 Discord_Client_SendActivityJoinRequest(
11447 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11448}
11449void Client::SendActivityJoinRequestReply(discordpp::ActivityInvite invite,
11451{
11452 assert(state_ == DiscordObjectState::Owned);
11453 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11454 auto cb__userData = new Tcb__UserData(cb);
11455 Discord_Client_SendActivityInviteCallback cb__native = [](auto result, void* userData__) {
11456 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11457 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11458 userData__typed->delegate(std::move(result__obj));
11459 };
11460 Discord_Client_SendActivityJoinRequestReply(
11461 &instance_, invite.instance(), cb__native, Tcb__UserData::Free, cb__userData);
11462}
11463void Client::SetActivityInviteCreatedCallback(discordpp::Client::ActivityInviteCallback cb)
11464{
11465 assert(state_ == DiscordObjectState::Owned);
11466 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11467 auto cb__userData = new Tcb__UserData(cb);
11468 Discord_Client_ActivityInviteCallback cb__native = [](auto invite, void* userData__) {
11469 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11470 discordpp::ActivityInvite invite__obj(*invite, DiscordObjectState::Owned);
11471 userData__typed->delegate(std::move(invite__obj));
11472 };
11473 Discord_Client_SetActivityInviteCreatedCallback(
11474 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11475}
11476void Client::SetActivityInviteUpdatedCallback(discordpp::Client::ActivityInviteCallback cb)
11477{
11478 assert(state_ == DiscordObjectState::Owned);
11479 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11480 auto cb__userData = new Tcb__UserData(cb);
11481 Discord_Client_ActivityInviteCallback cb__native = [](auto invite, void* userData__) {
11482 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11483 discordpp::ActivityInvite invite__obj(*invite, DiscordObjectState::Owned);
11484 userData__typed->delegate(std::move(invite__obj));
11485 };
11486 Discord_Client_SetActivityInviteUpdatedCallback(
11487 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11488}
11489void Client::SetActivityJoinCallback(discordpp::Client::ActivityJoinCallback cb)
11490{
11491 assert(state_ == DiscordObjectState::Owned);
11492 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11493 auto cb__userData = new Tcb__UserData(cb);
11494 Discord_Client_ActivityJoinCallback cb__native = [](auto joinSecret, void* userData__) {
11495 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11496 std::string joinSecret__str(reinterpret_cast<char*>(joinSecret.ptr), joinSecret.size);
11497 userData__typed->delegate(std::move(joinSecret__str));
11498 Discord_Free(joinSecret.ptr);
11499 };
11500 Discord_Client_SetActivityJoinCallback(
11501 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11502}
11503void Client::SetActivityJoinWithApplicationCallback(
11505{
11506 assert(state_ == DiscordObjectState::Owned);
11507 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11508 auto cb__userData = new Tcb__UserData(cb);
11509 Discord_Client_ActivityJoinWithApplicationCallback cb__native =
11510 [](auto applicationId, auto joinSecret, void* userData__) {
11511 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11512 std::string joinSecret__str(reinterpret_cast<char*>(joinSecret.ptr), joinSecret.size);
11513 userData__typed->delegate(applicationId, std::move(joinSecret__str));
11514 Discord_Free(joinSecret.ptr);
11515 };
11516 Discord_Client_SetActivityJoinWithApplicationCallback(
11517 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11518}
11519void Client::SetOnlineStatus(discordpp::StatusType status,
11521{
11522 assert(state_ == DiscordObjectState::Owned);
11523 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
11524 auto callback__userData = new Tcallback__UserData(callback);
11525 Discord_Client_UpdateStatusCallback callback__native = [](auto result, void* userData__) {
11526 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
11527 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11528 userData__typed->delegate(std::move(result__obj));
11529 };
11530 Discord_Client_SetOnlineStatus(&instance_,
11531 static_cast<Discord_StatusType>(status),
11532 callback__native,
11533 Tcallback__UserData::Free,
11534 callback__userData);
11535}
11536void Client::UpdateRichPresence(discordpp::Activity activity,
11538{
11539 assert(state_ == DiscordObjectState::Owned);
11540 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11541 auto cb__userData = new Tcb__UserData(cb);
11542 Discord_Client_UpdateRichPresenceCallback cb__native = [](auto result, void* userData__) {
11543 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11544 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11545 userData__typed->delegate(std::move(result__obj));
11546 };
11547 Discord_Client_UpdateRichPresence(
11548 &instance_, activity.instance(), cb__native, Tcb__UserData::Free, cb__userData);
11549}
11550void Client::AcceptDiscordFriendRequest(uint64_t userId,
11552{
11553 assert(state_ == DiscordObjectState::Owned);
11554 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11555 auto cb__userData = new Tcb__UserData(cb);
11556 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11557 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11558 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11559 userData__typed->delegate(std::move(result__obj));
11560 };
11561 Discord_Client_AcceptDiscordFriendRequest(
11562 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11563}
11564void Client::AcceptGameFriendRequest(uint64_t userId,
11566{
11567 assert(state_ == DiscordObjectState::Owned);
11568 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11569 auto cb__userData = new Tcb__UserData(cb);
11570 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11571 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11572 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11573 userData__typed->delegate(std::move(result__obj));
11574 };
11575 Discord_Client_AcceptGameFriendRequest(
11576 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11577}
11578void Client::BlockUser(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
11579{
11580 assert(state_ == DiscordObjectState::Owned);
11581 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11582 auto cb__userData = new Tcb__UserData(cb);
11583 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11584 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11585 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11586 userData__typed->delegate(std::move(result__obj));
11587 };
11588 Discord_Client_BlockUser(&instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11589}
11590void Client::CancelDiscordFriendRequest(uint64_t userId,
11592{
11593 assert(state_ == DiscordObjectState::Owned);
11594 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11595 auto cb__userData = new Tcb__UserData(cb);
11596 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11597 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11598 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11599 userData__typed->delegate(std::move(result__obj));
11600 };
11601 Discord_Client_CancelDiscordFriendRequest(
11602 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11603}
11604void Client::CancelGameFriendRequest(uint64_t userId,
11606{
11607 assert(state_ == DiscordObjectState::Owned);
11608 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11609 auto cb__userData = new Tcb__UserData(cb);
11610 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11611 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11612 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11613 userData__typed->delegate(std::move(result__obj));
11614 };
11615 Discord_Client_CancelGameFriendRequest(
11616 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11617}
11618discordpp::RelationshipHandle Client::GetRelationshipHandle(uint64_t userId) const
11619{
11620 assert(state_ == DiscordObjectState::Owned);
11621 Discord_RelationshipHandle returnValueNative__{};
11622 Discord_Client_GetRelationshipHandle(&instance_, userId, &returnValueNative__);
11623 discordpp::RelationshipHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
11624 return returnValue__;
11625}
11626std::vector<discordpp::RelationshipHandle> Client::GetRelationships() const
11627{
11628 assert(state_ == DiscordObjectState::Owned);
11629 Discord_RelationshipHandleSpan returnValueNative__;
11630 Discord_Client_GetRelationships(&instance_, &returnValueNative__);
11631 std::vector<discordpp::RelationshipHandle> returnValue__;
11632 returnValue__.reserve(returnValueNative__.size);
11633 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
11634 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
11635 }
11636 Discord_Free(returnValueNative__.ptr);
11637 return returnValue__;
11638}
11639std::vector<discordpp::RelationshipHandle> Client::GetRelationshipsByGroup(
11640 discordpp::RelationshipGroupType groupType) const
11641{
11642 assert(state_ == DiscordObjectState::Owned);
11643 Discord_RelationshipHandleSpan returnValueNative__;
11644 Discord_Client_GetRelationshipsByGroup(
11645 &instance_, static_cast<Discord_RelationshipGroupType>(groupType), &returnValueNative__);
11646 std::vector<discordpp::RelationshipHandle> returnValue__;
11647 returnValue__.reserve(returnValueNative__.size);
11648 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
11649 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
11650 }
11651 Discord_Free(returnValueNative__.ptr);
11652 return returnValue__;
11653}
11654void Client::RejectDiscordFriendRequest(uint64_t userId,
11656{
11657 assert(state_ == DiscordObjectState::Owned);
11658 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11659 auto cb__userData = new Tcb__UserData(cb);
11660 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11661 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11662 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11663 userData__typed->delegate(std::move(result__obj));
11664 };
11665 Discord_Client_RejectDiscordFriendRequest(
11666 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11667}
11668void Client::RejectGameFriendRequest(uint64_t userId,
11670{
11671 assert(state_ == DiscordObjectState::Owned);
11672 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11673 auto cb__userData = new Tcb__UserData(cb);
11674 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11675 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11676 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11677 userData__typed->delegate(std::move(result__obj));
11678 };
11679 Discord_Client_RejectGameFriendRequest(
11680 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11681}
11682void Client::RemoveDiscordAndGameFriend(uint64_t userId,
11684{
11685 assert(state_ == DiscordObjectState::Owned);
11686 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11687 auto cb__userData = new Tcb__UserData(cb);
11688 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11689 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11690 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11691 userData__typed->delegate(std::move(result__obj));
11692 };
11693 Discord_Client_RemoveDiscordAndGameFriend(
11694 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11695}
11696void Client::RemoveGameFriend(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
11697{
11698 assert(state_ == DiscordObjectState::Owned);
11699 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11700 auto cb__userData = new Tcb__UserData(cb);
11701 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11702 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11703 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11704 userData__typed->delegate(std::move(result__obj));
11705 };
11706 Discord_Client_RemoveGameFriend(
11707 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11708}
11709std::vector<discordpp::UserHandle> Client::SearchFriendsByUsername(std::string searchStr) const
11710{
11711 assert(state_ == DiscordObjectState::Owned);
11712 Discord_UserHandleSpan returnValueNative__;
11713 Discord_String searchStr__str{(uint8_t*)(searchStr.data()), searchStr.size()};
11714 Discord_Client_SearchFriendsByUsername(&instance_, searchStr__str, &returnValueNative__);
11715 std::vector<discordpp::UserHandle> returnValue__;
11716 returnValue__.reserve(returnValueNative__.size);
11717 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
11718 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
11719 }
11720 Discord_Free(returnValueNative__.ptr);
11721 return returnValue__;
11722}
11723void Client::SendDiscordFriendRequest(std::string const& username,
11725{
11726 assert(state_ == DiscordObjectState::Owned);
11727 Discord_String username__str{(uint8_t*)(username.data()), username.size()};
11728 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11729 auto cb__userData = new Tcb__UserData(cb);
11730 Discord_Client_SendFriendRequestCallback cb__native = [](auto result, void* userData__) {
11731 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11732 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11733 userData__typed->delegate(std::move(result__obj));
11734 };
11735 Discord_Client_SendDiscordFriendRequest(
11736 &instance_, username__str, cb__native, Tcb__UserData::Free, cb__userData);
11737}
11738void Client::SendDiscordFriendRequestById(uint64_t userId,
11740{
11741 assert(state_ == DiscordObjectState::Owned);
11742 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11743 auto cb__userData = new Tcb__UserData(cb);
11744 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11745 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11746 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11747 userData__typed->delegate(std::move(result__obj));
11748 };
11749 Discord_Client_SendDiscordFriendRequestById(
11750 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11751}
11752void Client::SendGameFriendRequest(std::string const& username,
11754{
11755 assert(state_ == DiscordObjectState::Owned);
11756 Discord_String username__str{(uint8_t*)(username.data()), username.size()};
11757 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11758 auto cb__userData = new Tcb__UserData(cb);
11759 Discord_Client_SendFriendRequestCallback cb__native = [](auto result, void* userData__) {
11760 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11761 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11762 userData__typed->delegate(std::move(result__obj));
11763 };
11764 Discord_Client_SendGameFriendRequest(
11765 &instance_, username__str, cb__native, Tcb__UserData::Free, cb__userData);
11766}
11767void Client::SendGameFriendRequestById(uint64_t userId,
11769{
11770 assert(state_ == DiscordObjectState::Owned);
11771 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11772 auto cb__userData = new Tcb__UserData(cb);
11773 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11774 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11775 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11776 userData__typed->delegate(std::move(result__obj));
11777 };
11778 Discord_Client_SendGameFriendRequestById(
11779 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11780}
11781void Client::SetRelationshipCreatedCallback(discordpp::Client::RelationshipCreatedCallback cb)
11782{
11783 assert(state_ == DiscordObjectState::Owned);
11784 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11785 auto cb__userData = new Tcb__UserData(cb);
11786 Discord_Client_RelationshipCreatedCallback cb__native =
11787 [](auto userId, auto isDiscordRelationshipUpdate, void* userData__) {
11788 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11789 userData__typed->delegate(userId, isDiscordRelationshipUpdate);
11790 };
11791 Discord_Client_SetRelationshipCreatedCallback(
11792 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11793}
11794void Client::SetRelationshipDeletedCallback(discordpp::Client::RelationshipDeletedCallback cb)
11795{
11796 assert(state_ == DiscordObjectState::Owned);
11797 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11798 auto cb__userData = new Tcb__UserData(cb);
11799 Discord_Client_RelationshipDeletedCallback cb__native =
11800 [](auto userId, auto isDiscordRelationshipUpdate, void* userData__) {
11801 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11802 userData__typed->delegate(userId, isDiscordRelationshipUpdate);
11803 };
11804 Discord_Client_SetRelationshipDeletedCallback(
11805 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11806}
11807void Client::UnblockUser(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
11808{
11809 assert(state_ == DiscordObjectState::Owned);
11810 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11811 auto cb__userData = new Tcb__UserData(cb);
11812 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
11813 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11814 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11815 userData__typed->delegate(std::move(result__obj));
11816 };
11817 Discord_Client_UnblockUser(&instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
11818}
11819discordpp::UserHandle Client::GetCurrentUser() const
11820{
11821 assert(state_ == DiscordObjectState::Owned);
11822 Discord_UserHandle returnValueNative__{};
11823 Discord_Client_GetCurrentUser(&instance_, &returnValueNative__);
11824 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
11825 return returnValue__;
11826}
11827std::optional<discordpp::UserHandle> Client::GetCurrentUserV2() const
11828{
11829 assert(state_ == DiscordObjectState::Owned);
11830 bool returnIsNonNull__;
11831 Discord_UserHandle returnValueNative__;
11832 returnIsNonNull__ = Discord_Client_GetCurrentUserV2(&instance_, &returnValueNative__);
11833 if (!returnIsNonNull__) {
11834 return {};
11835 }
11836 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
11837 return returnValue__;
11838}
11839void Client::GetDiscordClientConnectedUser(
11840 uint64_t applicationId,
11842{
11843 assert(state_ == DiscordObjectState::Owned);
11844 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
11845 auto callback__userData = new Tcallback__UserData(callback);
11846 Discord_Client_GetDiscordClientConnectedUserCallback callback__native =
11847 [](auto result, auto user, void* userData__) {
11848 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
11849 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
11850 std::optional<discordpp::UserHandle> user__opt{};
11851 if (user) {
11852 user__opt = discordpp::UserHandle(*user, DiscordObjectState::Owned);
11853 }
11854 userData__typed->delegate(std::move(result__obj), std::move(user__opt));
11855 };
11856 Discord_Client_GetDiscordClientConnectedUser(
11857 &instance_, applicationId, callback__native, Tcallback__UserData::Free, callback__userData);
11858}
11859std::optional<discordpp::UserHandle> Client::GetUser(uint64_t userId) const
11860{
11861 assert(state_ == DiscordObjectState::Owned);
11862 bool returnIsNonNull__;
11863 Discord_UserHandle returnValueNative__;
11864 returnIsNonNull__ = Discord_Client_GetUser(&instance_, userId, &returnValueNative__);
11865 if (!returnIsNonNull__) {
11866 return {};
11867 }
11868 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
11869 return returnValue__;
11870}
11871void Client::SetRelationshipGroupsUpdatedCallback(
11873{
11874 assert(state_ == DiscordObjectState::Owned);
11875 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11876 auto cb__userData = new Tcb__UserData(cb);
11877 Discord_Client_RelationshipGroupsUpdatedCallback cb__native = [](auto userId,
11878 void* userData__) {
11879 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11880 userData__typed->delegate(userId);
11881 };
11882 Discord_Client_SetRelationshipGroupsUpdatedCallback(
11883 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11884}
11885void Client::SetUserUpdatedCallback(discordpp::Client::UserUpdatedCallback cb)
11886{
11887 assert(state_ == DiscordObjectState::Owned);
11888 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
11889 auto cb__userData = new Tcb__UserData(cb);
11890 Discord_Client_UserUpdatedCallback cb__native = [](auto userId, void* userData__) {
11891 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
11892 userData__typed->delegate(userId);
11893 };
11894 Discord_Client_SetUserUpdatedCallback(
11895 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
11896}
11897const CallInfoHandle CallInfoHandle::nullobj{{}, DiscordObjectState::Invalid};
11898CallInfoHandle::~CallInfoHandle()
11899{
11900 if (state_ == DiscordObjectState::Owned) {
11901 Drop();
11902 state_ = DiscordObjectState::Invalid;
11903 }
11904}
11905CallInfoHandle::CallInfoHandle(CallInfoHandle&& other) noexcept
11906 : instance_(other.instance_)
11907 , state_(other.state_)
11908{
11909 other.state_ = DiscordObjectState::Invalid;
11910}
11911CallInfoHandle& CallInfoHandle::operator=(CallInfoHandle&& other) noexcept
11912{
11913 if (this != &other) {
11914 if (state_ == DiscordObjectState::Owned) {
11915 Drop();
11916 }
11917 instance_ = other.instance_;
11918 state_ = other.state_;
11919 other.state_ = DiscordObjectState::Invalid;
11920 }
11921 return *this;
11922}
11923CallInfoHandle::CallInfoHandle(const CallInfoHandle& other)
11924 : instance_{}
11925 , state_(DiscordObjectState::Invalid)
11926{
11927 if (other.state_ == DiscordObjectState::Owned) {
11928 Discord_CallInfoHandle_Clone(&instance_, other.instance());
11929
11930 state_ = DiscordObjectState::Owned;
11931 }
11932}
11933CallInfoHandle& CallInfoHandle::operator=(const CallInfoHandle& other)
11934{
11935 if (this != &other) {
11936 if (state_ == DiscordObjectState::Owned) {
11937 Drop();
11938 state_ = DiscordObjectState::Invalid;
11939 }
11940 if (other.state_ == DiscordObjectState::Owned) {
11941 Discord_CallInfoHandle_Clone(&instance_, other.instance());
11942
11943 state_ = DiscordObjectState::Owned;
11944 }
11945 }
11946 return *this;
11947}
11948CallInfoHandle::CallInfoHandle(Discord_CallInfoHandle instance, DiscordObjectState state)
11949 : instance_(instance)
11950 , state_(state)
11951{
11952}
11953void CallInfoHandle::Drop()
11954{
11955 if (state_ != DiscordObjectState::Owned) {
11956 return;
11957 }
11958 Discord_CallInfoHandle_Drop(&instance_);
11959 state_ = DiscordObjectState::Invalid;
11960}
11961uint64_t CallInfoHandle::ChannelId() const
11962{
11963 assert(state_ == DiscordObjectState::Owned);
11964 uint64_t returnValue__;
11965 returnValue__ = Discord_CallInfoHandle_ChannelId(&instance_);
11966 return returnValue__;
11967}
11968std::vector<uint64_t> CallInfoHandle::GetParticipants() const
11969{
11970 assert(state_ == DiscordObjectState::Owned);
11971 Discord_UInt64Span returnValueNative__;
11972 Discord_CallInfoHandle_GetParticipants(&instance_, &returnValueNative__);
11973 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
11974 returnValueNative__.ptr + returnValueNative__.size);
11975 Discord_Free(returnValueNative__.ptr);
11976 return returnValue__;
11977}
11978std::optional<discordpp::VoiceStateHandle> CallInfoHandle::GetVoiceStateHandle(
11979 uint64_t userId) const
11980{
11981 assert(state_ == DiscordObjectState::Owned);
11982 bool returnIsNonNull__;
11983 Discord_VoiceStateHandle returnValueNative__;
11984 returnIsNonNull__ =
11985 Discord_CallInfoHandle_GetVoiceStateHandle(&instance_, userId, &returnValueNative__);
11986 if (!returnIsNonNull__) {
11987 return {};
11988 }
11989 discordpp::VoiceStateHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
11990 return returnValue__;
11991}
11992uint64_t CallInfoHandle::GuildId() const
11993{
11994 assert(state_ == DiscordObjectState::Owned);
11995 uint64_t returnValue__;
11996 returnValue__ = Discord_CallInfoHandle_GuildId(&instance_);
11997 return returnValue__;
11998}
11999} // namespace discordpp
12000
12001#endif // DISCORDPP_IMPLEMENTATION
Struct which controls what your rich presence looks like in the Discord client. If you don't specify ...
Definition discordpp.h:778
void SetLargeImage(std::optional< std::string > LargeImage)
Setter for ActivityAssets::LargeImage.
std::optional< std::string > SmallText() const
A tooltip string that is shown when the user hovers over the small image.
void SetLargeText(std::optional< std::string > LargeText)
Setter for ActivityAssets::LargeText.
ActivityAssets(ActivityAssets &&other) noexcept
Move constructor for ActivityAssets.
std::optional< std::string > SmallImage() const
The secondary image, rendered as a small circle over the largeImage.
ActivityAssets(const ActivityAssets &arg0)
Copy constructor for ActivityAssets.
void SetLargeUrl(std::optional< std::string > LargeUrl)
Setter for ActivityAssets::LargeUrl.
std::optional< std::string > LargeText() const
A tooltip string that is shown when the user hovers over the large image.
void SetSmallImage(std::optional< std::string > SmallImage)
Setter for ActivityAssets::SmallImage.
std::optional< std::string > SmallUrl() const
A URL that opens when the user clicks/taps the small image.
ActivityAssets & operator=(const ActivityAssets &arg0)
Copy assignment operator for ActivityAssets.
static const ActivityAssets nullobj
Uninitialized instance of ActivityAssets.
Definition discordpp.h:797
std::optional< std::string > LargeImage() const
The primary image identifier or URL, rendered as a large square icon on a user's rich presence.
std::optional< std::string > LargeUrl() const
A URL that opens when the user clicks/taps the large image.
void SetSmallText(std::optional< std::string > SmallText)
Setter for ActivityAssets::SmallText.
ActivityAssets & operator=(ActivityAssets &&other) noexcept
Move assignment operator for ActivityAssets.
void SetSmallUrl(std::optional< std::string > SmallUrl)
Setter for ActivityAssets::SmallUrl.
Definition discordpp.h:1017
ActivityButton(ActivityButton &&other) noexcept
Move constructor for ActivityButton.
static const ActivityButton nullobj
Uninitialized instance of ActivityButton.
Definition discordpp.h:1036
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:680
static const ActivityInvite nullobj
Uninitialized instance of ActivityInvite.
Definition discordpp.h:699
std::string SessionId() const
The session id of the user who sent the invite.
void SetIsValid(bool IsValid)
Setter for ActivityInvite::IsValid.
void SetSessionId(std::string SessionId)
Setter for ActivityInvite::SessionId.
uint64_t ApplicationId() const
The target application of the invite.
uint64_t MessageId() const
The id of the Discord message that contains the invite.
uint64_t SenderId() const
The user id of the user who sent the invite.
void SetApplicationId(uint64_t ApplicationId)
Setter for ActivityInvite::ApplicationId.
void SetSenderId(uint64_t SenderId)
Setter for ActivityInvite::SenderId.
void SetParentApplicationId(uint64_t ParentApplicationId)
Setter for ActivityInvite::ParentApplicationId.
bool IsValid() const
Whether or not this invite is currently joinable. An invite becomes invalid if it was sent more than ...
void SetChannelId(uint64_t ChannelId)
Setter for ActivityInvite::ChannelId.
uint64_t ChannelId() const
The id of the Discord channel in which the invite was sent.
void SetMessageId(uint64_t MessageId)
Setter for ActivityInvite::MessageId.
std::string PartyId() const
The id of the party the invite was sent for.
ActivityInvite & operator=(ActivityInvite &&other) noexcept
Move assignment operator for ActivityInvite.
ActivityInvite(const ActivityInvite &rhs)
Copy constructor for ActivityInvite.
void SetType(discordpp::ActivityActionTypes Type)
Setter for ActivityInvite::Type.
uint64_t ParentApplicationId() const
The application id of the parent - this is only applicable if there is a parent for a publisher's sui...
void SetPartyId(std::string PartyId)
Setter for ActivityInvite::PartyId.
ActivityInvite & operator=(const ActivityInvite &rhs)
Copy assignment operator for ActivityInvite.
discordpp::ActivityActionTypes Type() const
The type of invite that was sent.
ActivityInvite(ActivityInvite &&other) noexcept
Move constructor for ActivityInvite.
Definition discordpp.h:911
void SetMaxSize(int32_t MaxSize)
Setter for ActivityParty::MaxSize.
ActivityParty(ActivityParty &&other) noexcept
Move constructor for ActivityParty.
void SetCurrentSize(int32_t CurrentSize)
Setter for ActivityParty::CurrentSize.
void SetId(std::string Id)
Setter for ActivityParty::Id.
int32_t CurrentSize() const
The number of people currently in the party, must be at least 1.
int32_t MaxSize() const
The maximum number of people that can be in the party, must be at least 0. When 0,...
ActivityParty(const ActivityParty &arg0)
Copy constructor for ActivityParty.
ActivityParty & operator=(ActivityParty &&other) noexcept
Move assignment operator for ActivityParty.
void SetPrivacy(discordpp::ActivityPartyPrivacy Privacy)
Setter for ActivityParty::Privacy.
discordpp::ActivityPartyPrivacy Privacy() const
The privacy of the party.
std::string Id() const
Specifies the id of the party. "Party" is used colloquially to refer to a group of players in a share...
static const ActivityParty nullobj
Uninitialized instance of ActivityParty.
Definition discordpp.h:930
ActivityParty & operator=(const ActivityParty &arg0)
Copy assignment operator for ActivityParty.
Definition discordpp.h:973
ActivitySecrets & operator=(ActivitySecrets &&other) noexcept
Move assignment operator for ActivitySecrets.
std::string Join() const
A secret string that is shared with users who are accepted into the party so the game knows how to jo...
ActivitySecrets & operator=(const ActivitySecrets &arg0)
Copy assignment operator for ActivitySecrets.
ActivitySecrets(ActivitySecrets &&other) noexcept
Move constructor for ActivitySecrets.
ActivitySecrets(const ActivitySecrets &arg0)
Copy constructor for ActivitySecrets.
void SetJoin(std::string Join)
Setter for ActivitySecrets::Join.
static const ActivitySecrets nullobj
Uninitialized instance of ActivitySecrets.
Definition discordpp.h:992
Definition discordpp.h:857
ActivityTimestamps(ActivityTimestamps &&other) noexcept
Move constructor for ActivityTimestamps.
ActivityTimestamps(const ActivityTimestamps &arg0)
Copy constructor for ActivityTimestamps.
uint64_t Start() const
The time the activity started, in milliseconds since Unix epoch.
void SetStart(uint64_t Start)
Setter for ActivityTimestamps::Start.
static const ActivityTimestamps nullobj
Uninitialized instance of ActivityTimestamps.
Definition discordpp.h:876
ActivityTimestamps & operator=(ActivityTimestamps &&other) noexcept
Move assignment operator for ActivityTimestamps.
void SetEnd(uint64_t End)
Setter for ActivityTimestamps::End.
uint64_t End() const
The time the activity will end at, in milliseconds since Unix epoch.
ActivityTimestamps & operator=(const ActivityTimestamps &arg0)
Copy assignment operator for ActivityTimestamps.
An Activity represents one "thing" a user is doing on Discord and is part of their rich presence.
Definition discordpp.h:1242
std::vector< discordpp::ActivityButton > GetButtons() const
Returns the custom buttons for the rich presence.
void SetDetailsUrl(std::optional< std::string > DetailsUrl)
Setter for Activity::DetailsUrl.
std::optional< uint64_t > ParentApplicationId() const
The application ID of the parent application that the activity is associated with if it exists....
static const Activity nullobj
Uninitialized instance of Activity.
Definition discordpp.h:1261
std::optional< uint64_t > ApplicationId() const
The application ID of the game that the activity is associated with.
std::string Name() const
The name of the game or application that the activity is associated with.
void SetStateUrl(std::optional< std::string > StateUrl)
Setter for Activity::StateUrl.
void SetDetails(std::optional< std::string > Details)
Setter for Activity::Details.
Activity & operator=(Activity &&other) noexcept
Move assignment operator for Activity.
void SetParentApplicationId(std::optional< uint64_t > ParentApplicationId)
Setter for Activity::ParentApplicationId.
void SetType(discordpp::ActivityTypes Type)
Setter for Activity::Type.
std::optional< discordpp::ActivityAssets > Assets() const
Images used to customize how the Activity is displayed in the Discord client.
void SetTimestamps(std::optional< discordpp::ActivityTimestamps > Timestamps)
Setter for Activity::Timestamps.
bool Equals(discordpp::Activity other) const
Compares each field of the Activity struct for equality.
void SetApplicationId(std::optional< uint64_t > ApplicationId)
Setter for Activity::ApplicationId.
void SetName(std::string Name)
Setter for Activity::Name.
void SetSecrets(std::optional< discordpp::ActivitySecrets > Secrets)
Setter for Activity::Secrets.
Activity(const Activity &arg0)
Copy constructor for Activity.
void SetAssets(std::optional< discordpp::ActivityAssets > Assets)
Setter for Activity::Assets.
std::optional< discordpp::StatusDisplayTypes > StatusDisplayType() const
Controls which field is used for the user's status message.
std::optional< discordpp::ActivityTimestamps > Timestamps() const
The timestamps struct can be used to render either:
void SetParty(std::optional< discordpp::ActivityParty > Party)
Setter for Activity::Party.
void SetStatusDisplayType(std::optional< discordpp::StatusDisplayTypes > StatusDisplayType)
Setter for Activity::StatusDisplayType.
Activity & operator=(const Activity &arg0)
Copy assignment operator for Activity.
std::optional< discordpp::ActivityParty > Party() const
The party struct is used to indicate the size and members of the people the current user is playing w...
void AddButton(discordpp::ActivityButton button)
Adds a custom button to the rich presence.
std::optional< std::string > DetailsUrl() const
A URL that opens when the user clicks/taps the details text.
void SetSupportedPlatforms(discordpp::ActivityGamePlatforms SupportedPlatforms)
Setter for Activity::SupportedPlatforms.
std::optional< std::string > Details() const
The state of the what the user is doing for this activity.
void SetState(std::optional< std::string > State)
Setter for Activity::State.
Activity(Activity &&other) noexcept
Move constructor for Activity.
discordpp::ActivityGamePlatforms SupportedPlatforms() const
If an activity is joinable, but only on certain platforms, this field can be used to indicate which p...
std::optional< std::string > StateUrl() const
A URL that opens when the user clicks/taps the state text.
std::optional< discordpp::ActivitySecrets > Secrets() const
The secrets struct is used in combination with the party struct to make an Activity joinable.
std::optional< std::string > State() const
The state of the party for this activity.
discordpp::ActivityTypes Type() const
The type of activity this is.
Contains information about non-text content in a message that likely cannot be rendered in game such ...
Definition discordpp.h:2766
static std::string TypeToString(discordpp::AdditionalContentType type)
Converts the AdditionalContentType enum to a string.
AdditionalContent & operator=(AdditionalContent &&other) noexcept
Move assignment operator for AdditionalContent.
void SetCount(uint8_t Count)
Setter for AdditionalContent::Count.
void SetType(discordpp::AdditionalContentType Type)
Setter for AdditionalContent::Type.
std::optional< std::string > Title() const
When the additional content is a poll or thread, this field will contain the name of the poll or thre...
discordpp::AdditionalContentType Type() const
Represents the type of additional content in the message.
uint8_t Count() const
Represents the number of pieces of additional content so you could for example renders "2 additional ...
bool Equals(discordpp::AdditionalContent rhs) const
Compares each field of the AdditionalContent struct for equality.
AdditionalContent(AdditionalContent &&other) noexcept
Move constructor for AdditionalContent.
AdditionalContent & operator=(const AdditionalContent &arg0)
Copy assignment operator for AdditionalContent.
AdditionalContent(const AdditionalContent &arg0)
Copy constructor for AdditionalContent.
void SetTitle(std::optional< std::string > Title)
Setter for AdditionalContent::Title.
static const AdditionalContent nullobj
Uninitialized instance of AdditionalContent.
Definition discordpp.h:2785
Represents a single input or output audio device available to the user.
Definition discordpp.h:2991
AudioDevice & operator=(const AudioDevice &arg0)
Copy assignment operator for AudioDevice.
bool Equals(discordpp::AudioDevice rhs)
Compares the ID of two AudioDevice objects for equality.
std::string Name() const
The display name of the audio device.
bool IsDefault() const
Whether the audio device is the system default device.
std::string Id() const
The ID of the audio device.
AudioDevice(AudioDevice &&other) noexcept
Move constructor for AudioDevice.
AudioDevice & operator=(AudioDevice &&other) noexcept
Move assignment operator for AudioDevice.
static const AudioDevice nullobj
Uninitialized instance of AudioDevice.
Definition discordpp.h:3010
void SetId(std::string Id)
Setter for AudioDevice::Id.
void SetIsDefault(bool IsDefault)
Setter for AudioDevice::IsDefault.
void SetName(std::string Name)
Setter for AudioDevice::Name.
AudioDevice(const AudioDevice &arg0)
Copy constructor for AudioDevice.
Arguments to the Client::Authorize function.
Definition discordpp.h:1583
void SetIntegrationType(std::optional< discordpp::IntegrationType > IntegrationType)
Setter for AuthorizationArgs::IntegrationType.
std::optional< std::string > State() const
See https://discord.com/developers/docs/topics/oauth2#state-and-security for details on this field.
AuthorizationArgs & operator=(AuthorizationArgs &&other) noexcept
Move assignment operator for AuthorizationArgs.
void SetCustomSchemeParam(std::optional< std::string > CustomSchemeParam)
Setter for AuthorizationArgs::CustomSchemeParam.
std::optional< std::string > Nonce() const
The nonce field is generally only useful for backend integrations using ID tokens.
std::optional< discordpp::AuthorizationCodeChallenge > CodeChallenge() const
If using the Client::GetToken flow, you will need to generate a code challenge and verifier.
uint64_t ClientId() const
Optional. The Discord application ID for your game. Defaults to the value set by Client::SetApplicati...
AuthorizationArgs(const AuthorizationArgs &arg0)
Copy constructor for AuthorizationArgs.
void SetScopes(std::string Scopes)
Setter for AuthorizationArgs::Scopes.
static const AuthorizationArgs nullobj
Uninitialized instance of AuthorizationArgs.
Definition discordpp.h:1602
void SetClientId(uint64_t ClientId)
Setter for AuthorizationArgs::ClientId.
std::optional< std::string > CustomSchemeParam() const
Custom URI scheme for mobile redirects.
std::optional< discordpp::IntegrationType > IntegrationType() const
The type of integration the app will be installed as.
void SetCodeChallenge(std::optional< discordpp::AuthorizationCodeChallenge > CodeChallenge)
Setter for AuthorizationArgs::CodeChallenge.
AuthorizationArgs(AuthorizationArgs &&other) noexcept
Move constructor for AuthorizationArgs.
AuthorizationArgs & operator=(const AuthorizationArgs &arg0)
Copy assignment operator for AuthorizationArgs.
std::string Scopes() const
Scopes is a space separated string of the oauth scopes your game is requesting.
void SetNonce(std::optional< std::string > Nonce)
Setter for AuthorizationArgs::Nonce.
void SetState(std::optional< std::string > State)
Setter for AuthorizationArgs::State.
Struct that encapsulates the challenge part of the code verification flow.
Definition discordpp.h:1491
discordpp::AuthenticationCodeChallengeMethod Method() const
The method used to generate the challenge. The only method used by the SDK is sha256.
AuthorizationCodeChallenge(const AuthorizationCodeChallenge &arg0)
Copy constructor for AuthorizationCodeChallenge.
std::string Challenge() const
The challenge value.
AuthorizationCodeChallenge & operator=(AuthorizationCodeChallenge &&other) noexcept
Move assignment operator for AuthorizationCodeChallenge.
void SetMethod(discordpp::AuthenticationCodeChallengeMethod Method)
Setter for AuthorizationCodeChallenge::Method.
static const AuthorizationCodeChallenge nullobj
Uninitialized instance of AuthorizationCodeChallenge.
Definition discordpp.h:1511
AuthorizationCodeChallenge & operator=(const AuthorizationCodeChallenge &arg0)
Copy assignment operator for AuthorizationCodeChallenge.
AuthorizationCodeChallenge(AuthorizationCodeChallenge &&other) noexcept
Move constructor for AuthorizationCodeChallenge.
void SetChallenge(std::string Challenge)
Setter for AuthorizationCodeChallenge::Challenge.
Struct that encapsulates both parts of the code verification flow.
Definition discordpp.h:1538
AuthorizationCodeVerifier(const AuthorizationCodeVerifier &arg0)
Copy constructor for AuthorizationCodeVerifier.
AuthorizationCodeVerifier & operator=(const AuthorizationCodeVerifier &arg0)
Copy assignment operator for AuthorizationCodeVerifier.
void SetVerifier(std::string Verifier)
Setter for AuthorizationCodeVerifier::Verifier.
AuthorizationCodeVerifier(AuthorizationCodeVerifier &&other) noexcept
Move constructor for AuthorizationCodeVerifier.
std::string Verifier() const
The verifier part of the code verification flow.
void SetChallenge(discordpp::AuthorizationCodeChallenge Challenge)
Setter for AuthorizationCodeVerifier::Challenge.
static const AuthorizationCodeVerifier nullobj
Uninitialized instance of AuthorizationCodeVerifier.
Definition discordpp.h:1558
discordpp::AuthorizationCodeChallenge Challenge() const
The challenge part of the code verification flow.
AuthorizationCodeVerifier & operator=(AuthorizationCodeVerifier &&other) noexcept
Move assignment operator for AuthorizationCodeVerifier.
Convenience class that represents the state of a single Discord call in a lobby.
Definition discordpp.h:5024
std::optional< discordpp::VoiceStateHandle > GetVoiceStateHandle(uint64_t userId) const
Accesses the voice state for a single user so you can know if they have muted or deafened themselves.
std::vector< uint64_t > GetParticipants() const
Returns a list of the user IDs of the participants in the call.
CallInfoHandle & operator=(const CallInfoHandle &other)
Copy assignment operator for CallInfoHandle.
CallInfoHandle(const CallInfoHandle &other)
Copy constructor for CallInfoHandle.
CallInfoHandle & operator=(CallInfoHandle &&other) noexcept
Move assignment operator for CallInfoHandle.
uint64_t GuildId() const
Returns the lobby ID of the call.
static const CallInfoHandle nullobj
Uninitialized instance of CallInfoHandle.
Definition discordpp.h:5043
CallInfoHandle(CallInfoHandle &&other) noexcept
Move constructor for CallInfoHandle.
uint64_t ChannelId() const
Returns the lobby ID of the call.
Class that manages an active voice session in a Lobby.
Definition discordpp.h:1843
static std::string ErrorToString(discordpp::Call::Error type)
Converts the Error enum to a string.
Call & operator=(const Call &other)
Copy assignment operator for Call.
void SetSelfDeaf(bool deaf)
Mutes all audio from the currently active call for the current user. They will not be able to hear an...
std::function< void(uint64_t userId, bool isPlayingSound)> OnSpeakingStatusChanged
Callback function for Call::SetSpeakingStatusChangedCallback.
Definition discordpp.h:1904
static const Call nullobj
Uninitialized instance of Call.
Definition discordpp.h:1921
Call(Call &&other) noexcept
Move constructor for Call.
void SetOnVoiceStateChangedCallback(discordpp::Call::OnVoiceStateChanged cb)
Sets a callback function to generally be invoked whenever a field on a VoiceStateHandle object for a ...
Call & operator=(Call &&other) noexcept
Move assignment operator for Call.
discordpp::AudioModeType GetAudioMode()
Returns whether the call is configured to use voice auto detection or push to talk for the current us...
bool GetPTTActive()
Returns whether push to talk is currently active, meaning the user is currently pressing their config...
discordpp::VADThresholdSettings GetVADThreshold() const
Returns the current configuration for void auto detection thresholds. See the description of the VADT...
std::optional< discordpp::VoiceStateHandle > GetVoiceStateHandle(uint64_t userId) const
Returns a reference to the VoiceStateHandle for the user ID of the given call participant.
static std::string StatusToString(discordpp::Call::Status type)
Converts the Status enum to a string.
void SetVADThreshold(bool automatic, float threshold)
Customizes the void auto detection thresholds for picking up activity from a user's mic.
bool GetSelfDeaf()
Returns whether the current user is deafened.
Error
Enum that represents any network errors with the Call.
Definition discordpp.h:1851
@ None
None.
Definition discordpp.h:1854
@ Forbidden
Forbidden.
Definition discordpp.h:1869
@ SignalingConnectionFailed
SignalingConnectionFailed.
Definition discordpp.h:1857
@ SignalingUnexpectedClose
SignalingUnexpectedClose.
Definition discordpp.h:1860
@ JoinTimeout
JoinTimeout.
Definition discordpp.h:1866
@ VoiceConnectionFailed
VoiceConnectionFailed.
Definition discordpp.h:1863
Status
Enum that respresents the state of the Call's network connection.
Definition discordpp.h:1873
@ Disconnecting
Disconnecting.
Definition discordpp.h:1894
@ Connected
Connected.
Definition discordpp.h:1888
@ Reconnecting
Reconnecting.
Definition discordpp.h:1891
@ Connecting
Connecting.
Definition discordpp.h:1882
@ SignalingConnected
SignalingConnected.
Definition discordpp.h:1885
@ Disconnected
Disconnected.
Definition discordpp.h:1876
@ Joining
Joining.
Definition discordpp.h:1879
void SetLocalMute(uint64_t userId, bool mute)
Locally mutes the given userId, so that the current user cannot hear them anymore.
void SetSpeakingStatusChangedCallback(discordpp::Call::OnSpeakingStatusChanged cb)
Sets a callback function to be invoked whenever a user starts or stops speaking and is passed in the ...
std::function< void(discordpp::Call::Status status, discordpp::Call::Error error, int32_t errorDetail)> OnStatusChanged
Callback function for Call::SetStatusChangedCallback.
Definition discordpp.h:1907
uint32_t GetPTTReleaseDelay()
Returns the time that PTT is active after the user releases the PTT key and SetPTTActive(false) is ca...
uint64_t GetGuildId() const
Returns the ID of the lobby with which this call is associated.
Call(const Call &other)
Copy constructor for Call.
void SetPTTActive(bool active)
When push to talk is enabled, this should be called whenever the user pushes or releases their config...
void SetParticipantChangedCallback(discordpp::Call::OnParticipantChanged cb)
Sets a callback function to be invoked whenever some joins or leaves a voice call.
std::vector< uint64_t > GetParticipants() const
Returns a list of all of the user IDs of the participants in the call.
bool GetSelfMute()
Returns whether the current user's microphone is muted.
void SetPTTReleaseDelay(uint32_t releaseDelayMs)
If set, extends the time that PTT is active after the user releases the PTT key and SetPTTActive(fals...
discordpp::Call::Status GetStatus() const
Returns the current call status.
std::function< void(uint64_t userId, bool added)> OnParticipantChanged
Callback function for Call::SetParticipantChangedCallback.
Definition discordpp.h:1901
void SetParticipantVolume(uint64_t userId, float volume)
Locally changes the playout volume of the given userId.
void SetStatusChangedCallback(discordpp::Call::OnStatusChanged cb)
Sets a callback function to be invoked when the call status changes, such as when it fully connects o...
void SetAudioMode(discordpp::AudioModeType audioMode)
Sets whether to use voice auto detection or push to talk for the current user on this call.
bool GetLocalMute(uint64_t userId)
Returns whether the current user has locally muted the given userId for themselves.
float GetParticipantVolume(uint64_t userId)
Returns the locally set playout volume of the given userId.
void SetSelfMute(bool mute)
Mutes the current user's microphone so that no other participant in their active calls can hear them.
std::function< void(uint64_t userId)> OnVoiceStateChanged
Callback function for Call::SetOnVoiceStateChangedCallback.
Definition discordpp.h:1898
uint64_t GetChannelId() const
Returns the ID of the lobby with which this call is associated.
All messages sent on Discord are done so in a Channel. MessageHandle::ChannelId will contain the ID o...
Definition discordpp.h:2070
ChannelHandle(const ChannelHandle &other)
Copy constructor for ChannelHandle.
ChannelHandle & operator=(const ChannelHandle &other)
Copy assignment operator for ChannelHandle.
static const ChannelHandle nullobj
Uninitialized instance of ChannelHandle.
Definition discordpp.h:2089
uint64_t Id() const
Returns the ID of the channel.
ChannelHandle & operator=(ChannelHandle &&other) noexcept
Move assignment operator for ChannelHandle.
ChannelHandle(ChannelHandle &&other) noexcept
Move constructor for ChannelHandle.
std::vector< uint64_t > Recipients() const
For DMs and GroupDMs, returns the user IDs of the members of the channel. For all other channels retu...
std::string Name() const
Returns the name of the channel.
discordpp::ChannelType Type() const
Returns the type of the channel.
Options for creating a new Client instance.
Definition discordpp.h:3085
discordpp::AudioSystem ExperimentalAudioSystem() const
The audio system to use. Defaults to AudioSystem::Standard.
static const ClientCreateOptions nullobj
Uninitialized instance of ClientCreateOptions.
Definition discordpp.h:3104
ClientCreateOptions & operator=(const ClientCreateOptions &arg0)
Copy assignment operator for ClientCreateOptions.
bool ExperimentalAndroidPreventCommsForBluetooth() const
Whether to prevent communications mode on Android when Bluetooth is connected.
std::string WebBase() const
The base URL for the Discord web application.
std::string ApiBase() const
The base URL for the Discord API.
void SetApiBase(std::string ApiBase)
Setter for ClientCreateOptions::ApiBase.
ClientCreateOptions(const ClientCreateOptions &arg0)
Copy constructor for ClientCreateOptions.
void SetExperimentalAudioSystem(discordpp::AudioSystem ExperimentalAudioSystem)
Setter for ClientCreateOptions::ExperimentalAudioSystem.
ClientCreateOptions(ClientCreateOptions &&other) noexcept
Move constructor for ClientCreateOptions.
void SetWebBase(std::string WebBase)
Setter for ClientCreateOptions::WebBase.
void SetExperimentalAndroidPreventCommsForBluetooth(bool ExperimentalAndroidPreventCommsForBluetooth)
Setter for ClientCreateOptions::ExperimentalAndroidPreventCommsForBluetooth.
ClientCreateOptions & operator=(ClientCreateOptions &&other) noexcept
Move assignment operator for ClientCreateOptions.
Struct that stores information about the result of an SDK function call.
Definition discordpp.h:1398
void SetRetryable(bool Retryable)
Setter for ClientResult::Retryable.
bool Retryable() const
Indicates if, although an API request failed, it is safe and recommended to retry it.
void SetErrorCode(int32_t ErrorCode)
Setter for ClientResult::ErrorCode.
ClientResult & operator=(const ClientResult &arg0)
Copy assignment operator for ClientResult.
void SetStatus(discordpp::HttpStatusCode Status)
Setter for ClientResult::Status.
std::string Error() const
A description of the error that occurred.
discordpp::ErrorType Type() const
The type of error that occurred. See ErrorType for more information.
void SetResponseBody(std::string ResponseBody)
Setter for ClientResult::ResponseBody.
ClientResult(ClientResult &&other) noexcept
Move constructor for ClientResult.
void SetSuccessful(bool Successful)
Setter for ClientResult::Successful.
std::string ToString() const
Returns the error message if any of the ClientResult.
static const ClientResult nullobj
Uninitialized instance of ClientResult.
Definition discordpp.h:1417
ClientResult & operator=(ClientResult &&other) noexcept
Move assignment operator for ClientResult.
int32_t ErrorCode() const
A more detailed error code for this failure. Currently the only use of this is when an API request is...
void SetRetryAfter(float RetryAfter)
Setter for ClientResult::RetryAfter.
float RetryAfter() const
When a user is being rate limited by Discord (and so status == 429), this field should be set and is ...
std::string ResponseBody() const
The full HTTP response body, which will usually be a JSON string.
discordpp::HttpStatusCode Status() const
The HTTP status code of the API call.
void SetError(std::string Error)
Setter for ClientResult::Error.
ClientResult(const ClientResult &arg0)
Copy constructor for ClientResult.
bool Successful() const
Equivalent to type == ErrorType::None.
void SetType(discordpp::ErrorType Type)
Setter for ClientResult::Type.
The Client class is the main entry point for the Discord SDK. All functionality is exposed through th...
Definition discordpp.h:3159
std::function< void(discordpp::ClientResult result)> UnmergeIntoProvisionalAccountCallback
Callback function for the Client::UnmergeIntoProvisionalAccount method.
Definition discordpp.h:3332
std::function< void(std::vector< discordpp::AudioDevice > devices)> GetOutputDevicesCallback
Callback function for Client::GetOutputDevices.
Definition discordpp.h:3256
std::function< void(discordpp::ClientResult result, std::string inviteUrl)> JoinLinkedLobbyGuildCallback
Callback function for Client::JoinLinkedLobbyGuild.
Definition discordpp.h:3414
bool RegisterLaunchCommand(uint64_t applicationId, std::string command)
When a user accepts an activity invite for your game within the Discord client, Discord needs to know...
void SetRelationshipCreatedCallback(discordpp::Client::RelationshipCreatedCallback cb)
Sets a callback to be invoked whenever a relationship for this user is established or changes type.
void GetUserMessagesWithLimit(uint64_t recipientId, int32_t limit, discordpp::Client::UserMessagesWithLimitCallback cb)
Retrieves messages from the DM conversation with the specified user.
void GetLobbyMessagesWithLimit(uint64_t lobbyId, int32_t limit, discordpp::Client::GetLobbyMessagesCallback cb)
Retrieves recent messages from the specified lobby.
std::function< void(uint64_t messageId)> MessageCreatedCallback
Callback function for Client::SetMessageCreatedCallback.
Definition discordpp.h:3377
discordpp::Call GetCall(uint64_t channelId)
Returns a reference to the currently active call, if any.
std::function< void(uint64_t userId)> RelationshipGroupsUpdatedCallback
Callback function for Client::SetRelationshipGroupsUpdatedCallback.
Definition discordpp.h:3494
std::function< void(discordpp::ClientResult result)> UpdateRelationshipCallback
Callback function for most other Relationship functions such as Client::SendDiscordFriendRequestById.
Definition discordpp.h:3468
void EndCalls(discordpp::Client::EndCallsCallback callback)
Ends any active call, if any. Any references you have to Call objects are invalid after they are ende...
static std::string StatusToString(discordpp::Client::Status type)
Converts the Status enum to a string.
void Disconnect()
Asynchronously disconnects the client.
void SendDiscordFriendRequest(std::string const &username, discordpp::Client::SendFriendRequestCallback cb)
Sends a Discord friend request to the target user.
void RefreshToken(uint64_t applicationId, std::string const &refreshToken, discordpp::Client::TokenExchangeCallback callback)
Generates a new access token for the current user from a refresh token.
void SendLobbyMessageWithMetadata(uint64_t lobbyId, std::string const &content, std::unordered_map< std::string, std::string > const &metadata, discordpp::Client::SendUserMessageCallback cb)
Variant of Client::SendLobbyMessage that also accepts metadata to be sent with the message.
void SetEchoCancellation(bool on)
Enables or disables the basic echo cancellation provided by the WebRTC library.
void GetInputDevices(discordpp::Client::GetInputDevicesCallback cb)
Asynchronously fetches the list of audio input devices available to the user.
void CancelGameFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Cancels an outgoing game friend request to the target user.
void AbortGetTokenFromDevice()
This function is used to abort/cleanup the device authorization flow.
bool SetLogDir(std::string const &path, discordpp::LoggingSeverity minSeverity)
Causes logs generated by the SDK to be written to disk in the specified directory.
void OpenConnectedGamesSettingsInDiscord(discordpp::Client::OpenConnectedGamesSettingsInDiscordCallback callback)
Opens the Connected Games settings in the Discord client, which is where users can manage their setti...
void SetAuthorizeDeviceScreenClosedCallback(discordpp::Client::AuthorizeDeviceScreenClosedCallback cb)
Sets a callback function to be invoked when the device authorization screen is closed.
void SetMessageCreatedCallback(discordpp::Client::MessageCreatedCallback cb)
Sets a callback to be invoked whenever a new message is received in either a lobby or a DM.
std::function< void(discordpp::ClientResult result)> UpdateProvisionalAccountDisplayNameCallback
Callback function for Client::UpdateProvisionalAccountDisplayName.
Definition discordpp.h:3336
std::function< void(bool inputDetected)> NoAudioInputCallback
Callback function for Client::SetNoAudioInputCallback.
Definition discordpp.h:3268
void UnlinkChannelFromLobby(uint64_t lobbyId, discordpp::Client::LinkOrUnlinkChannelCallback callback)
Removes any existing channel link from the specified lobby.
std::function< void()> ProvisionalUserMergeRequiredCallback
Callback function for when Client::ProvisionalUserMergeCompleted completes.
Definition discordpp.h:3365
void SetMessageDeletedCallback(discordpp::Client::MessageDeletedCallback cb)
Sets a callback to be invoked whenever a message is deleted.
void DeleteUserMessage(uint64_t recipientId, uint64_t messageId, discordpp::Client::DeleteUserMessageCallback cb)
Deletes the specified message sent by the current user to the specified recipient.
void SetVoiceParticipantChangedCallback(discordpp::Client::VoiceParticipantChangedCallback cb)
Callback invoked whenever a user in a lobby joins or leaves a voice call.
void UnmergeIntoProvisionalAccount(uint64_t applicationId, discordpp::AuthenticationExternalAuthType externalAuthType, std::string const &externalAuthToken, discordpp::Client::UnmergeIntoProvisionalAccountCallback callback)
This function is used to unlink/unmerge a external identity from a Discord account....
std::function< void(discordpp::ClientResult result, std::vector< discordpp::GuildMinimal > guilds)> GetUserGuildsCallback
Callback function for Client::GetUserGuilds.
Definition discordpp.h:3410
Client(std::string apiBase, std::string webBase)
Creates a new instance of the Client but allows customizing the Discord URL to use.
void RevokeToken(uint64_t applicationId, std::string const &token, discordpp::Client::RevokeTokenCallback callback)
Revoke all application access/refresh tokens associated with a user with any valid access/refresh tok...
void LinkChannelToLobby(uint64_t lobbyId, uint64_t channelId, discordpp::Client::LinkOrUnlinkChannelCallback callback)
Links the specified channel on Discord to the specified in-game lobby.
std::function< void(uint64_t lobbyId)> LobbyDeletedCallback
Callback function for Client::SetLobbyDeletedCallback.
Definition discordpp.h:3427
std::function< void(std::string message, discordpp::LoggingSeverity severity)> LogCallback
Callback function invoked when a new log message is generated.
Definition discordpp.h:3386
void SetDeviceChangeCallback(discordpp::Client::DeviceChangeCallback callback)
Sets a callback function to be invoked when Discord detects a change in the available audio devices.
void GetUserMessageSummaries(discordpp::Client::UserMessageSummariesCallback cb)
Retrieves message conversation summaries for all users the current user has DM conversations with.
std::function< void(discordpp::ClientResult result)> LinkOrUnlinkChannelCallback
Callback function for Client::LinkChannelToLobby.
Definition discordpp.h:3421
std::function< void(discordpp::AudioDevice device)> GetCurrentOutputDeviceCallback
Callback function for Client::GetCurrentOutputDevice.
Definition discordpp.h:3249
std::vector< uint64_t > GetLobbyIds() const
Returns a list of all the lobbies that the user is a member of and the SDK has loaded.
void SetUserUpdatedCallback(discordpp::Client::UserUpdatedCallback cb)
The UserUpdatedCallback is invoked whenever any user the current session knows about changes,...
std::function< void()> TokenExpirationCallback
Callback function for Client::SetTokenExpirationCallback.
Definition discordpp.h:3329
std::function< void(discordpp::ClientResult result)> SetOutputDeviceCallback
Callback function for Client::SetOutputDevice.
Definition discordpp.h:3271
void SetAecDump(bool on)
Enables or disables AEC diagnostic recording.
std::function< void(discordpp::ClientResult result, std::optional< discordpp::UserHandle > user)> GetDiscordClientConnectedUserCallback
Callback function for when Client::GetDiscordClientConnectedUser completes.
Definition discordpp.h:3489
void SetActivityInviteCreatedCallback(discordpp::Client::ActivityInviteCallback cb)
Sets a callback function that is invoked when the current user receives an activity invite from anoth...
std::function< void(uint64_t lobbyId, uint64_t memberId)> LobbyMemberUpdatedCallback
Callback function for Client::SetLobbyMemberUpdatedCallback.
Definition discordpp.h:3436
void SendUserMessage(uint64_t recipientId, std::string const &content, discordpp::Client::SendUserMessageCallback cb)
Sends a direct message to the specified user.
Client & operator=(Client &&other) noexcept
Move assignment operator for Client.
void GetTokenFromProvisionalMerge(uint64_t applicationId, std::string const &code, std::string const &codeVerifier, std::string const &redirectUri, discordpp::AuthenticationExternalAuthType externalAuthType, std::string const &externalAuthToken, discordpp::Client::TokenExchangeCallback callback)
This function should be used with the Client::Authorize function whenever a user with a provisional a...
static std::string GetVersionHash()
Returns the git commit hash this version was built from.
bool RegisterLaunchSteamApplication(uint64_t applicationId, uint32_t steamAppId)
When a user accepts an activity invite for your game within the Discord client, Discord needs to know...
void FetchCurrentUser(discordpp::AuthorizationTokenType tokenType, std::string const &token, discordpp::Client::FetchCurrentUserCallback callback)
Fetches basic information about the user associated with the given auth token.
void SetNoAudioInputCallback(discordpp::Client::NoAudioInputCallback callback)
Callback function invoked when the above threshold is set and there is a change in whether audio is b...
std::vector< discordpp::UserHandle > SearchFriendsByUsername(std::string searchStr) const
Searches all of your friends by both username and display name, returning a list of all friends that ...
void SetVoiceLogDir(std::string const &path, discordpp::LoggingSeverity minSeverity)
Causes logs generated by the voice subsystem of the SDK to be written to disk in the specified direct...
std::function< void(uint64_t userId, int16_t *data, uint64_t samplesPerChannel, int32_t sampleRate, uint64_t channels, bool &outShouldMute)> UserAudioReceivedCallback
Callback function for Client::StartCallWithAudioCallbacks.
Definition discordpp.h:3280
std::function< void(discordpp::ClientResult result)> LeaveLobbyCallback
Callback function for Client::LeaveLobby.
Definition discordpp.h:3418
std::function< void(uint64_t lobbyId)> LobbyUpdatedCallback
Callback function for Client::SetLobbyUpdatedCallback.
Definition discordpp.h:3439
void GetTokenFromDevice(discordpp::DeviceAuthorizationArgs args, discordpp::Client::TokenExchangeCallback callback)
This function is a combination of Client::Authorize and Client::GetToken, but is used for the case wh...
void CloseAuthorizeDeviceScreen()
This function is used to hide the device authorization screen and is used for the case where the user...
void SetOpusHardwareCoding(bool encode, bool decode)
Enables or disables hardware encoding and decoding for audio, if it is available.
void JoinLinkedLobbyGuild(uint64_t lobbyId, discordpp::Client::ProvisionalUserMergeRequiredCallback provisionalUserMergeRequiredCallback, discordpp::Client::JoinLinkedLobbyGuildCallback callback)
Invites the current user to the Discord guild of the channel that is linked to the specified lobby....
bool ShowAudioRoutePicker()
On iOS devices, show the system audio route picker.
void SetActivityJoinCallback(discordpp::Client::ActivityJoinCallback cb)
Sets a callback function that is invoked when the current user also has Discord running on their comp...
void GetOutputDevices(discordpp::Client::GetOutputDevicesCallback cb)
Asynchronously fetches the list of audio output devices available to the user.
std::function< void()> AuthorizeDeviceScreenClosedCallback
Callback function for Client::SetAuthorizeDeviceScreenClosedCallback.
Definition discordpp.h:3326
void SetSelfDeafAll(bool deaf)
Mutes all audio from the currently active call for the current user in all calls. They will not be ab...
void ExchangeChildToken(std::string const &parentApplicationToken, uint64_t childApplicationId, discordpp::Client::ExchangeChildTokenCallback callback)
Exchanges a parent application token for a child application token.
std::function< void(discordpp::ClientResult result)> UpdateRichPresenceCallback
Callback function for when Client::UpdateRichPresence completes.
Definition discordpp.h:3464
std::function< void(discordpp::ClientResult result, std::vector< discordpp::MessageHandle > messages)> UserMessagesWithLimitCallback
Callback function for Client::GetUserMessagesWithLimit.
Definition discordpp.h:3360
void CreateOrJoinLobbyWithMetadata(std::string const &secret, std::unordered_map< std::string, std::string > const &lobbyMetadata, std::unordered_map< std::string, std::string > const &memberMetadata, discordpp::Client::CreateOrJoinLobbyCallback callback)
Variant of Client::CreateOrJoinLobby that also accepts developer-supplied metadata.
Client()
Creates a new instance of the Client.
std::function< void(discordpp::ClientResult result)> SendFriendRequestCallback
Callback function for Client::SendDiscordFriendRequest and Client::SendGameFriendRequest.
Definition discordpp.h:3472
std::function< void(discordpp::ClientResult result, std::vector< discordpp::MessageHandle > messages)> GetLobbyMessagesCallback
Callback function for Client::GetLobbyMessagesWithLimit.
Definition discordpp.h:3350
void UpdateToken(discordpp::AuthorizationTokenType tokenType, std::string token, discordpp::Client::UpdateTokenCallback callback)
Asynchronously sets a new auth token for this client to use.
std::function< void(discordpp::Client::Status status, discordpp::Client::Error error, int32_t errorDetail)> OnStatusChanged
Callback function for Client::SetStatusChangedCallback.
Definition discordpp.h:3397
std::function< void(uint64_t applicationId, std::string joinSecret)> ActivityJoinWithApplicationCallback
Callback function for Client::SetActivityJoinWithApplicationCallback.
Definition discordpp.h:3457
void SetOutputVolume(float outputVolume)
Sets the speaker volume for the current user.
std::function< void()> EndCallsCallback
Callback invoked when Client::EndCalls completes.
Definition discordpp.h:3243
void SendGameFriendRequestById(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Sends (or accepts) a game friend request to the target user.
void OpenMessageInDiscord(uint64_t messageId, discordpp::Client::ProvisionalUserMergeRequiredCallback provisionalUserMergeRequiredCallback, discordpp::Client::OpenMessageInDiscordCallback callback)
Opens the given message in the Discord client.
void RemoveGameFriend(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Removes any game friendship between the current user and the target user.
std::vector< discordpp::Call > GetCalls()
Returns a reference to all currently active calls, if any.
std::optional< discordpp::ChannelHandle > GetChannelHandle(uint64_t channelId) const
Returns a reference to the Discord channel object for the given ID.
std::function< void(discordpp::ClientResult result)> RevokeTokenCallback
Callback function for the Client::RevokeToken method.
Definition discordpp.h:3323
void SendActivityJoinRequest(uint64_t userId, discordpp::Client::SendActivityInviteCallback cb)
Requests to join the activity of the specified user.
std::function< void(discordpp::ClientResult result, std::string joinSecret)> AcceptActivityInviteCallback
Callback function for Client::AcceptActivityInvite.
Definition discordpp.h:3442
void RejectDiscordFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Declines an incoming Discord friend request from the target user.
Status
This enum refers to the status of the internal websocket the SDK uses to communicate with Discord The...
Definition discordpp.h:3202
@ Disconnecting
Disconnecting.
Definition discordpp.h:3220
@ Connected
Connected.
Definition discordpp.h:3211
@ HttpWait
HttpWait.
Definition discordpp.h:3223
@ Reconnecting
Reconnecting.
Definition discordpp.h:3217
@ Connecting
Connecting.
Definition discordpp.h:3208
@ Ready
Ready.
Definition discordpp.h:3214
@ Disconnected
Disconnected.
Definition discordpp.h:3205
static std::string GetDefaultCommunicationScopes()
Returns the default set of OAuth2 scopes that should be used with the Discord SDK when making use of ...
void SetRelationshipDeletedCallback(discordpp::Client::RelationshipDeletedCallback cb)
Sets a callback to be invoked whenever a relationship for this user is removed, such as when the user...
void UpdateProvisionalAccountDisplayName(std::string const &name, discordpp::Client::UpdateProvisionalAccountDisplayNameCallback callback)
Updates the display name of a provisional account to the specified name.
static std::string GetDefaultPresenceScopes()
Returns the default set of OAuth2 scopes that should be used with the Discord SDK when leveraging bas...
void SendLobbyMessage(uint64_t lobbyId, std::string const &content, discordpp::Client::SendUserMessageCallback cb)
Sends a message in a lobby chat to all members of the lobby.
std::optional< discordpp::MessageHandle > GetMessageHandle(uint64_t messageId) const
Returns a reference to the Discord message object for the given ID.
float GetOutputVolume()
Returns the output volume for the current user.
std::function< void(discordpp::ClientResult result, std::string accessToken, std::string refreshToken, discordpp::AuthorizationTokenType tokenType, int32_t expiresIn, std::string scopes)> TokenExchangeCallback
Callback function for the token exchange APIs such as Client::GetToken.
Definition discordpp.h:3315
void SetThreadPriority(discordpp::Client::Thread thread, int32_t priority)
Allows setting the priority of various SDK threads.
discordpp::UserHandle GetCurrentUser() const
Returns the user associated with the current client.
std::function< void(discordpp::ClientResult result)> OpenMessageInDiscordCallback
Callback function for when Client::OpenMessageInDiscord completes.
Definition discordpp.h:3368
void GetProvisionalToken(uint64_t applicationId, discordpp::AuthenticationExternalAuthType externalAuthType, std::string const &externalAuthToken, discordpp::Client::TokenExchangeCallback callback)
Provisional accounts are a way for users that have not signed up for Discord to still access SDK func...
void GetCurrentInputDevice(discordpp::Client::GetCurrentInputDeviceCallback cb)
Asynchronously fetches the current audio input device in use by the client.
void SetAutomaticGainControl(bool on)
When enabled, automatically adjusts the microphone volume to keep it clear and consistent.
void EditUserMessage(uint64_t recipientId, uint64_t messageId, std::string const &content, discordpp::Client::EditUserMessageCallback cb)
Edits the specified message sent by the current user to the specified recipient.
std::function< void()> EndCallCallback
Callback invoked when Client::EndCall completes.
Definition discordpp.h:3240
std::function< void(discordpp::ClientResult result)> EditUserMessageCallback
Callback function for Client::EditUserMessage.
Definition discordpp.h:3347
void Connect()
Asynchronously connects the client to Discord.
void SetLobbyDeletedCallback(discordpp::Client::LobbyDeletedCallback cb)
Sets a callback to be invoked when a lobby is no longer available.
void GetDiscordClientConnectedUser(uint64_t applicationId, discordpp::Client::GetDiscordClientConnectedUserCallback callback) const
If the Discord app is running on the user's computer and the SDK establishes a connection to it,...
static int32_t GetVersionPatch()
Returns the patch version of the Discord Social SDK.
void CreateOrJoinLobby(std::string const &secret, discordpp::Client::CreateOrJoinLobbyCallback callback)
Joins the user to the specified lobby, creating one if it does not exist.
void LeaveLobby(uint64_t lobbyId, discordpp::Client::LeaveLobbyCallback callback)
Removes the current user from the specified lobby.
float GetInputVolume()
Returns the input volume for the current user's microphone.
std::function< void(discordpp::ClientResult result)> SetInputDeviceCallback
Callback function for Client::SetInputDevice.
Definition discordpp.h:3265
void SetLobbyMemberRemovedCallback(discordpp::Client::LobbyMemberRemovedCallback cb)
Sets a callback function to be invoked whenever a member of a lobby is removed and can no longer conn...
Client(Client &&other) noexcept
Move constructor for Client.
static std::string GetDefaultAudioDeviceId()
Returns the ID of the system default audio device if the user has not explicitly chosen one.
void CancelDiscordFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Cancels an outgoing Discord friend request to the target user.
std::function< void(uint64_t lobbyId, uint64_t memberId)> LobbyMemberAddedCallback
Callback function for Client::SetLobbyMemberAddedCallback.
Definition discordpp.h:3430
void SetOnlineStatus(discordpp::StatusType status, discordpp::Client::UpdateStatusCallback callback)
Sets whether a user is online/invisible/idle/dnd on Discord.
void ClearRichPresence()
Clears the right presence for the current user.
void SetSelfMuteAll(bool mute)
Mutes the current user's microphone so that no other participant in their active calls can hear them ...
void SetStatusChangedCallback(discordpp::Client::OnStatusChanged cb)
Sets a callback function to be invoked whenever the SDKs status changes.
std::function< void(discordpp::ActivityInvite invite)> ActivityInviteCallback
Callback function for Client::SetActivityInviteCreatedCallback and Client::SetActivityInviteUpdatedCa...
Definition discordpp.h:3451
std::vector< discordpp::RelationshipHandle > GetRelationshipsByGroup(discordpp::RelationshipGroupType groupType) const
Returns a list of relationships that belong to the specified relationship group type....
std::function< void(discordpp::ClientResult result)> UpdateTokenCallback
Callback invoked when Client::UpdateToken completes. Once this is done it is safe to call Client::Con...
Definition discordpp.h:3341
void SetMessageUpdatedCallback(discordpp::Client::MessageUpdatedCallback cb)
Sets a callback to be invoked whenever a message is edited.
void SetOutputDevice(std::string deviceId, discordpp::Client::SetOutputDeviceCallback cb)
Asynchronously changes the audio output device in use by the client to the specified device....
void SendUserMessageWithMetadata(uint64_t recipientId, std::string const &content, std::unordered_map< std::string, std::string > const &metadata, discordpp::Client::SendUserMessageCallback cb)
Variant of Client::SendUserMessage that also accepts metadata to be sent with the message.
std::function< void(uint64_t lobbyId)> LobbyCreatedCallback
Callback function for Client::SetLobbyCreatedCallback.
Definition discordpp.h:3424
void RemoveDiscordAndGameFriend(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Removes any friendship between the current user and the target user. This function will remove BOTH a...
std::function< void(uint64_t lobbyId, uint64_t memberId)> LobbyMemberRemovedCallback
Callback function for Client::SetLobbyMemberRemovedCallback.
Definition discordpp.h:3433
void SetTokenExpirationCallback(discordpp::Client::TokenExpirationCallback callback)
Get a notification when the current token is about to expire or expired.
void GetUserGuilds(discordpp::Client::GetUserGuildsCallback cb)
Fetches all of the guilds (also known as Discord servers) that the current user is a member of.
void SetGameWindowPid(int32_t pid)
When users are linking their account with Discord, which involves an OAuth2 flow, the SDK can streaml...
void GetToken(uint64_t applicationId, std::string const &code, std::string const &codeVerifier, std::string const &redirectUri, discordpp::Client::TokenExchangeCallback callback)
Exchanges an authorization code that was returned from the Client::Authorize function for an access t...
std::function< void(discordpp::ClientResult result, std::string code, std::string redirectUri)> AuthorizationCallback
Callback invoked when the Authorize function completes.
Definition discordpp.h:3299
void SetActivityInviteUpdatedCallback(discordpp::Client::ActivityInviteCallback cb)
Sets a callback function that is invoked when an existing activity invite changes....
void SetNoAudioInputThreshold(float dBFSThreshold)
Threshold that can be set to indicate when no audio is being received by the user's mic.
std::function< void(std::string joinSecret)> ActivityJoinCallback
Callback function for Client::SetActivityJoinCallback.
Definition discordpp.h:3454
static std::string ErrorToString(discordpp::Client::Error type)
Converts the Error enum to a string.
std::optional< discordpp::UserHandle > GetUser(uint64_t userId) const
Returns the UserHandle associated with the given user ID.
discordpp::RelationshipHandle GetRelationshipHandle(uint64_t userId) const
Returns the RelationshipHandle that corresponds to the relationship between the current user and the ...
std::function< void(discordpp::ClientResult result)> SendActivityInviteCallback
Callback function for Client::SendActivityInvite, Client::SendActivityJoinRequest,...
Definition discordpp.h:3447
discordpp::AuthorizationCodeVerifier CreateAuthorizationCodeVerifier()
Helper function that can create a code challenge and verifier for use in the Client::Authorize + Clie...
std::function< void(uint64_t lobbyId, uint64_t memberId, bool added)> VoiceParticipantChangedCallback
Callback function for Client::SetVoiceParticipantChangedCallback.
Definition discordpp.h:3274
discordpp::Call StartCallWithAudioCallbacks(uint64_t lobbyId, discordpp::Client::UserAudioReceivedCallback receivedCb, discordpp::Client::UserAudioCapturedCallback capturedCb)
Starts or joins a call in the specified lobby.
uint64_t GetApplicationId()
This function is used to get the application ID for the client. This is used to identify the applicat...
std::function< void(uint64_t userId, bool isDiscordRelationshipUpdate)> RelationshipDeletedCallback
Callback function for Client::SetRelationshipDeletedCallback.
Definition discordpp.h:3485
bool GetSelfDeafAll() const
Returns whether the current user is deafened in all calls.
bool SetSpeakerMode(bool speakerMode)
(deprecated) On mobile devices, enable speakerphone mode.
static int32_t GetVersionMinor()
Returns the minor version of the Discord Social SDK.
void AddVoiceLogCallback(discordpp::Client::LogCallback callback, discordpp::LoggingSeverity minSeverity)
Adds a callback function to be invoked for each new log message generated by the voice subsystem of t...
void AbortAuthorize()
This will abort the authorize flow if it is in progress and tear down any associated state.
Error
Represents an error state for the socket connection that the Discord SDK maintains with the Discord b...
Definition discordpp.h:3173
@ None
None.
Definition discordpp.h:3176
@ ConnectionCanceled
ConnectionCanceled.
Definition discordpp.h:3185
@ ConnectionFailed
ConnectionFailed.
Definition discordpp.h:3179
@ UnexpectedClose
UnexpectedClose.
Definition discordpp.h:3182
void UnblockUser(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Unblocks the target user. Does not restore any old relationship between the users though.
void SetShowingChat(bool showingChat)
Sets whether chat messages are currently being shown in the game.
static int32_t GetVersionMajor()
Returns the major version of the Discord Social SDK.
std::function< void(discordpp::ClientResult result, uint64_t messageId)> SendUserMessageCallback
This is used for all kinds of 'send message' calls despite the name, to make sure engine bindings use...
Definition discordpp.h:3373
std::function< void(discordpp::AudioDevice device)> GetCurrentInputDeviceCallback
Callback function for Client::GetCurrentInputDevice.
Definition discordpp.h:3246
void SetLobbyCreatedCallback(discordpp::Client::LobbyCreatedCallback cb)
Sets a callback to be invoked when a lobby "becomes available" to the client.
void Authorize(discordpp::AuthorizationArgs args, discordpp::Client::AuthorizationCallback callback)
Initiates an OAuth2 flow for a user to "sign in with Discord". This flow is intended for desktop and ...
std::function< void(uint64_t userId)> UserUpdatedCallback
Callback function for Client::SetUserUpdatedCallback.
Definition discordpp.h:3497
void AcceptActivityInvite(discordpp::ActivityInvite invite, discordpp::Client::AcceptActivityInviteCallback cb)
Accepts an activity invite that the current user has received.
void SetInputDevice(std::string deviceId, discordpp::Client::SetInputDeviceCallback cb)
Asynchronously changes the audio input device in use by the client to the specified device....
void RejectGameFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Declines an incoming game friend request from the target user.
void SetInputVolume(float inputVolume)
Sets the microphone volume for the current user.
void SetApplicationId(uint64_t applicationId)
This function is used to set the application ID for the client. This is used to identify the applicat...
std::vector< discordpp::RelationshipHandle > GetRelationships() const
Returns a list of all of the relationships the current user has with others, including all Discord re...
std::function< void(uint64_t messageId, uint64_t channelId)> MessageDeletedCallback
Callback function for Client::SetMessageDeletedCallback.
Definition discordpp.h:3380
void SetLobbyUpdatedCallback(discordpp::Client::LobbyUpdatedCallback cb)
Sets a callback to be invoked when a lobby is edited, for example if the lobby's metadata is changed.
std::function< void(discordpp::ClientResult result)> OpenConnectedGamesSettingsInDiscordCallback
Callback function for when Client::OpenConnectedGamesSettingsInDiscord completes.
Definition discordpp.h:3390
Thread
Represents the type of thread to control thread priority on.
Definition discordpp.h:3227
@ Client
Client.
Definition discordpp.h:3230
@ Voice
Voice.
Definition discordpp.h:3233
@ Network
Network.
Definition discordpp.h:3236
void SendActivityJoinRequestReply(discordpp::ActivityInvite invite, discordpp::Client::SendActivityInviteCallback cb)
When another user requests to join the current user's party, this function is called to to allow that...
void GetGuildChannels(uint64_t guildId, discordpp::Client::GetGuildChannelsCallback cb)
Fetches all of the channels that the current user can access in the given guild.
static std::string ThreadToString(discordpp::Client::Thread type)
Converts the Thread enum to a string.
void BlockUser(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Blocks the target user so that they cannot send the user friend or activity invites and cannot messag...
std::function< void(uint64_t messageId)> MessageUpdatedCallback
Callback function for Client::SetMessageUpdatedCallback.
Definition discordpp.h:3383
void SetEngineManagedAudioSession(bool isEngineManaged)
On mobile devices, set whether the audio environment is managed by the engine or the SDK....
void SetLobbyMemberUpdatedCallback(discordpp::Client::LobbyMemberUpdatedCallback cb)
Sets a callback function to be invoked whenever a member of a lobby is changed.
void SetActivityJoinWithApplicationCallback(discordpp::Client::ActivityJoinWithApplicationCallback cb)
Sets a callback function that is invoked when the current user also has Discord running on their comp...
bool GetSelfMuteAll() const
Returns whether the current user's microphone is muted in all calls.
std::function< void(uint64_t userId, bool isDiscordRelationshipUpdate)> RelationshipCreatedCallback
Callback function for Client::SetRelationshipCreatedCallback.
Definition discordpp.h:3478
std::function< void(discordpp::ClientResult result)> DeleteUserMessageCallback
Callback function for Client::DeleteUserMessage.
Definition discordpp.h:3344
std::function< void(discordpp::ClientResult result, std::string accessToken, discordpp::AuthorizationTokenType tokenType, int32_t expiresIn, std::string scopes)> ExchangeChildTokenCallback
Callback function for Client::ExchangeChildToken.
Definition discordpp.h:3303
bool CanOpenMessageInDiscord(uint64_t messageId)
Returns true if the given message is able to be viewed in a Discord client.
void SetNoiseSuppression(bool on)
Enables basic background noise suppression.
std::optional< discordpp::UserHandle > GetCurrentUserV2() const
Returns the UserHandle associated with the current user, if one is available.
void SetLobbyMemberAddedCallback(discordpp::Client::LobbyMemberAddedCallback cb)
Sets a callback function to be invoked whenever a user is added to a lobby.
void GetCurrentOutputDevice(discordpp::Client::GetCurrentOutputDeviceCallback cb)
Asynchronously fetches the current audio output device in use by the client.
void SetHttpRequestTimeout(int32_t httpTimeoutInMilliseconds)
This function is used to override the default HTTP timeout for the websocket client.
void EndCall(uint64_t channelId, discordpp::Client::EndCallCallback callback)
Ends any active call, if any. Any references you have to Call objects are invalid after they are ende...
void AcceptGameFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Accepts an incoming game friend request from the target user.
std::function< void(discordpp::ClientResult result, uint64_t id, std::string name)> FetchCurrentUserCallback
Callback function for Client::FetchCurrentUser.
Definition discordpp.h:3311
std::function< void(discordpp::ClientResult result, std::vector< discordpp::GuildChannel > guildChannels)> GetGuildChannelsCallback
Callback function for Client::GetGuildChannels.
Definition discordpp.h:3405
std::function< void(discordpp::ClientResult result)> UpdateStatusCallback
Callback function for when Client::SetOnlineStatus completes.
Definition discordpp.h:3461
std::optional< discordpp::LobbyHandle > GetLobbyHandle(uint64_t lobbyId) const
Returns a reference to the Discord lobby object for the given ID.
std::function< void(discordpp::ClientResult result, uint64_t lobbyId)> CreateOrJoinLobbyCallback
Callback function for Client::CreateOrJoinLobby.
Definition discordpp.h:3401
std::function< void(discordpp::ClientResult result, std::vector< discordpp::UserMessageSummary > summaries)> UserMessageSummariesCallback
Callback function for Client::GetUserMessageSummaries.
Definition discordpp.h:3355
discordpp::Call StartCall(uint64_t channelId)
Starts or joins a call in the lobby specified by channelId (For a lobby, simply pass in the lobbyId).
void UpdateRichPresence(discordpp::Activity activity, discordpp::Client::UpdateRichPresenceCallback cb)
Updates the rich presence for the current user.
void SetRelationshipGroupsUpdatedCallback(discordpp::Client::RelationshipGroupsUpdatedCallback cb)
The RelationshipGroupsUpdatedCallback is invoked whenever any user in the friends list changes....
Client(discordpp::ClientCreateOptions options)
Creates a new instance of the Client with custom options.
void OpenAuthorizeDeviceScreen(uint64_t clientId, std::string const &userCode)
This function is used to show the device authorization screen and is used for the case where the user...
std::function< void(int16_t *data, uint64_t samplesPerChannel, int32_t sampleRate, uint64_t channels)> UserAudioCapturedCallback
Callback function for Client::StartCallWithAudioCallbacks.
Definition discordpp.h:3290
std::function< void(std::vector< discordpp::AudioDevice > inputDevices, std::vector< discordpp::AudioDevice > outputDevices)> DeviceChangeCallback
Callback function for Client::SetDeviceChangeCallback.
Definition discordpp.h:3260
void AddLogCallback(discordpp::Client::LogCallback callback, discordpp::LoggingSeverity minSeverity)
Adds a callback function to be invoked for each new log message generated by the SDK.
void ProvisionalUserMergeCompleted(bool success)
Some functions don't work for provisional accounts, and require the user merge their account into a f...
void AcceptDiscordFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Accepts an incoming Discord friend request from the target user.
void SendDiscordFriendRequestById(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Sends a Discord friend request to the target user.
void SendGameFriendRequest(std::string const &username, discordpp::Client::SendFriendRequestCallback cb)
Sends (or accepts) a game friend request to the target user.
void SendActivityInvite(uint64_t userId, std::string const &content, discordpp::Client::SendActivityInviteCallback cb)
Sends a Discord activity invite to the specified user.
std::function< void(std::vector< discordpp::AudioDevice > devices)> GetInputDevicesCallback
Callback function for Client::GetInputDevices.
Definition discordpp.h:3252
void GetTokenFromDeviceProvisionalMerge(discordpp::DeviceAuthorizationArgs args, discordpp::AuthenticationExternalAuthType externalAuthType, std::string const &externalAuthToken, discordpp::Client::TokenExchangeCallback callback)
This function is a combination of Client::Authorize and Client::GetTokenFromProvisionalMerge,...
bool IsAuthenticated()
Returns true if the SDK has a non-empty OAuth2 token set, regardless of whether that token is valid o...
static const Client nullobj
Uninitialized instance of Client.
Definition discordpp.h:3510
discordpp::Client::Status GetStatus() const
Returns the current status of the client, see the Status enum for an explanation of the possible valu...
Arguments to the Client::GetTokenFromDevice function.
Definition discordpp.h:1689
DeviceAuthorizationArgs(DeviceAuthorizationArgs &&other) noexcept
Move constructor for DeviceAuthorizationArgs.
DeviceAuthorizationArgs(const DeviceAuthorizationArgs &arg0)
Copy constructor for DeviceAuthorizationArgs.
uint64_t ClientId() const
Optional. The Discord application ID for your game. Defaults to the value set by Client::SetApplicati...
static const DeviceAuthorizationArgs nullobj
Uninitialized instance of DeviceAuthorizationArgs.
Definition discordpp.h:1709
void SetClientId(uint64_t ClientId)
Setter for DeviceAuthorizationArgs::ClientId.
void SetScopes(std::string Scopes)
Setter for DeviceAuthorizationArgs::Scopes.
DeviceAuthorizationArgs & operator=(const DeviceAuthorizationArgs &arg0)
Copy assignment operator for DeviceAuthorizationArgs.
std::string Scopes() const
Scopes is a space separated string of the oauth scopes your game is requesting.
DeviceAuthorizationArgs & operator=(DeviceAuthorizationArgs &&other) noexcept
Move assignment operator for DeviceAuthorizationArgs.
void SetIsLinkable(bool IsLinkable)
Setter for GuildChannel::IsLinkable.
bool IsViewableAndWriteableByAllMembers() const
Whether the channel is "fully public" which means every member of the guild is able to view and send ...
std::optional< discordpp::LinkedLobby > LinkedLobby() const
Information about the currently linked lobby, if any. Currently Discord enforces that a channel can o...
uint64_t Id() const
The id of the channel.
void SetName(std::string Name)
Setter for GuildChannel::Name.
GuildChannel(const GuildChannel &arg0)
Copy constructor for GuildChannel.
void SetId(uint64_t Id)
Setter for GuildChannel::Id.
std::string Name() const
The name of the channel.
GuildChannel & operator=(const GuildChannel &arg0)
Copy assignment operator for GuildChannel.
GuildChannel & operator=(GuildChannel &&other) noexcept
Move assignment operator for GuildChannel.
GuildChannel(GuildChannel &&other) noexcept
Move constructor for GuildChannel.
bool IsLinkable() const
Whether the current user is able to link this channel to a lobby.
void SetLinkedLobby(std::optional< discordpp::LinkedLobby > LinkedLobby)
Setter for GuildChannel::LinkedLobby.
void SetIsViewableAndWriteableByAllMembers(bool IsViewableAndWriteableByAllMembers)
Setter for GuildChannel::IsViewableAndWriteableByAllMembers.
static const GuildChannel nullobj
Uninitialized instance of GuildChannel.
Definition discordpp.h:2185
void SetName(std::string Name)
Setter for GuildMinimal::Name.
std::string Name() const
The name of the guild.
void SetId(uint64_t Id)
Setter for GuildMinimal::Id.
static const GuildMinimal nullobj
Uninitialized instance of GuildMinimal.
Definition discordpp.h:2140
GuildMinimal & operator=(GuildMinimal &&other) noexcept
Move assignment operator for GuildMinimal.
GuildMinimal & operator=(const GuildMinimal &arg0)
Copy assignment operator for GuildMinimal.
GuildMinimal(const GuildMinimal &arg0)
Copy constructor for GuildMinimal.
GuildMinimal(GuildMinimal &&other) noexcept
Move constructor for GuildMinimal.
uint64_t Id() const
The id of the guild.
Struct that stores information about the channel that a lobby is linked to.
Definition discordpp.h:2293
uint64_t GuildId() const
The id of the guild (aka server) that owns the linked channel.
void SetName(std::string Name)
Setter for LinkedChannel::Name.
LinkedChannel & operator=(LinkedChannel &&other) noexcept
Move assignment operator for LinkedChannel.
LinkedChannel & operator=(const LinkedChannel &arg0)
Copy assignment operator for LinkedChannel.
std::string Name() const
The name of the linked channel.
void SetGuildId(uint64_t GuildId)
Setter for LinkedChannel::GuildId.
static const LinkedChannel nullobj
Uninitialized instance of LinkedChannel.
Definition discordpp.h:2312
LinkedChannel(const LinkedChannel &arg0)
Copy constructor for LinkedChannel.
void SetId(uint64_t Id)
Setter for LinkedChannel::Id.
uint64_t Id() const
The id of the linked channel.
LinkedChannel(LinkedChannel &&other) noexcept
Move constructor for LinkedChannel.
Struct that stores information about the lobby linked to a channel.
Definition discordpp.h:2247
LinkedLobby & operator=(const LinkedLobby &arg0)
Copy assignment operator for LinkedLobby.
LinkedLobby(const LinkedLobby &arg0)
Copy constructor for LinkedLobby.
uint64_t ApplicationId() const
The ID of the application that owns the lobby.
void SetLobbyId(uint64_t LobbyId)
Setter for LinkedLobby::LobbyId.
static const LinkedLobby nullobj
Uninitialized instance of LinkedLobby.
Definition discordpp.h:2266
void SetApplicationId(uint64_t ApplicationId)
Setter for LinkedLobby::ApplicationId.
LinkedLobby & operator=(LinkedLobby &&other) noexcept
Move assignment operator for LinkedLobby.
uint64_t LobbyId() const
The ID of the lobby.
LinkedLobby(LinkedLobby &&other) noexcept
Move constructor for LinkedLobby.
A LobbyHandle represents a single lobby in the SDK. A lobby can be thought of as just an arbitrary,...
Definition discordpp.h:2702
LobbyHandle(LobbyHandle &&other) noexcept
Move constructor for LobbyHandle.
std::optional< discordpp::LinkedChannel > LinkedChannel() const
Returns information about the channel linked to this lobby, if any.
static const LobbyHandle nullobj
Uninitialized instance of LobbyHandle.
Definition discordpp.h:2721
LobbyHandle & operator=(const LobbyHandle &other)
Copy assignment operator for LobbyHandle.
std::optional< discordpp::CallInfoHandle > GetCallInfoHandle() const
Returns a reference to the CallInfoHandle if there is an active voice call in this lobby.
std::unordered_map< std::string, std::string > Metadata() const
Returns any developer supplied metadata for this lobby.
std::optional< discordpp::LobbyMemberHandle > GetLobbyMemberHandle(uint64_t memberId) const
Returns a reference to the LobbyMemberHandle for the given user ID, if they are a member of this lobb...
LobbyHandle(const LobbyHandle &other)
Copy constructor for LobbyHandle.
std::vector< discordpp::LobbyMemberHandle > LobbyMembers() const
Returns a list of the LobbyMemberHandle objects for each member of this lobby.
uint64_t Id() const
Returns the id of the lobby.
std::vector< uint64_t > LobbyMemberIds() const
Returns a list of the user IDs that are members of this lobby.
LobbyHandle & operator=(LobbyHandle &&other) noexcept
Move assignment operator for LobbyHandle.
A LobbyMemberHandle represents the state of a single user in a Lobby.
Definition discordpp.h:2559
LobbyMemberHandle & operator=(const LobbyMemberHandle &other)
Copy assignment operator for LobbyMemberHandle.
static const LobbyMemberHandle nullobj
Uninitialized instance of LobbyMemberHandle.
Definition discordpp.h:2578
uint64_t Id() const
The user id of the lobby member.
LobbyMemberHandle(const LobbyMemberHandle &other)
Copy constructor for LobbyMemberHandle.
bool Connected() const
Returns true if the user is currently connected to the lobby.
LobbyMemberHandle & operator=(LobbyMemberHandle &&other) noexcept
Move assignment operator for LobbyMemberHandle.
std::optional< discordpp::UserHandle > User() const
The UserHandle of the lobby member.
bool CanLinkLobby() const
Returns true if the user is allowed to link a channel to this lobby.
LobbyMemberHandle(LobbyMemberHandle &&other) noexcept
Move constructor for LobbyMemberHandle.
std::unordered_map< std::string, std::string > Metadata() const
Metadata is a set of string key/value pairs that the game developer can use.
A MessageHandle represents a single message received by the SDK.
Definition discordpp.h:2878
uint64_t AuthorId() const
Returns the user ID of the user who sent this message.
std::optional< discordpp::ChannelHandle > Channel() const
Returns the ChannelHandle for the channel this message was sent in.
static const MessageHandle nullobj
Uninitialized instance of MessageHandle.
Definition discordpp.h:2897
std::optional< discordpp::UserHandle > Recipient() const
Returns the UserHandle for the other participant in a DM, if this message was sent in a DM.
std::optional< uint64_t > ApplicationId() const
Returns the application ID associated with this message, if any. You can use this to identify if the ...
MessageHandle & operator=(const MessageHandle &other)
Copy assignment operator for MessageHandle.
uint64_t Id() const
Returns the ID of this message.
std::optional< discordpp::UserHandle > Author() const
Returns the UserHandle for the author of this message.
MessageHandle & operator=(MessageHandle &&other) noexcept
Move assignment operator for MessageHandle.
uint64_t EditedTimestamp() const
The timestamp in millis since the epoch when the message was most recently edited.
MessageHandle(const MessageHandle &other)
Copy constructor for MessageHandle.
std::string Content() const
Returns the content of this message, if any.
std::unordered_map< std::string, std::string > Metadata() const
Returns any metadata the developer included with this message.
std::string RawContent() const
Returns the content of this message, if any, but without replacing any markup from emojis and mention...
std::optional< discordpp::LobbyHandle > Lobby() const
Returns the LobbyHandle this message was sent in, if it was sent in a lobby.
uint64_t RecipientId() const
When this message was sent in a DM or Ephemeral DM, this method will return the ID of the other user ...
uint64_t SentTimestamp() const
The timestamp in millis since the epoch when the message was sent.
std::optional< discordpp::DisclosureTypes > DisclosureType() const
If this is an auto-generated message that is explaining some integration behavior to users,...
uint64_t ChannelId() const
Returns the channel ID this message was sent in.
MessageHandle(MessageHandle &&other) noexcept
Move constructor for MessageHandle.
bool SentFromGame() const
Returns true if this message was sent in-game, otherwise false (i.e. from Discord itself)....
std::optional< discordpp::AdditionalContent > AdditionalContent() const
If the message contains non-text content, such as images, videos, embeds, polls, etc,...
A RelationshipHandle represents the relationship between the current user and a target user on Discor...
Definition discordpp.h:2375
RelationshipHandle & operator=(const RelationshipHandle &other)
Copy assignment operator for RelationshipHandle.
RelationshipHandle(const RelationshipHandle &other)
Copy constructor for RelationshipHandle.
uint64_t Id() const
Returns the ID of the target user in this relationship.
discordpp::RelationshipType DiscordRelationshipType() const
Returns the type of the Discord relationship.
RelationshipHandle(RelationshipHandle &&other) noexcept
Move constructor for RelationshipHandle.
discordpp::RelationshipType GameRelationshipType() const
Returns the type of the Game relationship.
static const RelationshipHandle nullobj
Uninitialized instance of RelationshipHandle.
Definition discordpp.h:2394
bool IsSpamRequest() const
Returns whether this relationship is a spam request.
std::optional< discordpp::UserHandle > User() const
Returns a handle to the target user in this relationship, if one is available. This would be the user...
RelationshipHandle & operator=(RelationshipHandle &&other) noexcept
Move assignment operator for RelationshipHandle.
A UserHandle represents a single user on Discord that the SDK knows about and contains basic account ...
Definition discordpp.h:2434
uint64_t Id() const
Returns the ID of this user.
UserHandle & operator=(UserHandle &&other) noexcept
Move assignment operator for UserHandle.
std::string Username() const
Returns the globally unique username of this user.
static const UserHandle nullobj
Uninitialized instance of UserHandle.
Definition discordpp.h:2468
std::optional< std::string > Avatar() const
Returns the hash of the user's Discord profile avatar, if one is set.
UserHandle(const UserHandle &arg0)
Copy constructor for UserHandle.
discordpp::StatusType Status() const
Returns the user's online/offline/idle status.
UserHandle(UserHandle &&other) noexcept
Move constructor for UserHandle.
std::string AvatarUrl(discordpp::UserHandle::AvatarType animatedType, discordpp::UserHandle::AvatarType staticType) const
Returns a CDN url to the user's Discord profile avatar.
AvatarType
The desired type of avatar url to generate for a User.
Definition discordpp.h:2442
@ Jpeg
Jpeg.
Definition discordpp.h:2454
@ Gif
Gif.
Definition discordpp.h:2445
@ Webp
Webp.
Definition discordpp.h:2448
@ Png
Png.
Definition discordpp.h:2451
bool IsProvisional() const
Returns true if this user is a provisional account.
std::optional< std::string > GlobalName() const
Returns the preferred display name of this user, if one is set.
std::optional< discordpp::Activity > GameActivity() const
Returns the user's rich presence activity that is associated with the current game,...
UserHandle & operator=(const UserHandle &arg0)
Copy assignment operator for UserHandle.
static std::string AvatarTypeToString(discordpp::UserHandle::AvatarType type)
Converts the AvatarType enum to a string.
std::string DisplayName() const
Returns the user's preferred name, if one is set, otherwise returns their unique username.
discordpp::RelationshipHandle Relationship() const
Returns a reference to the RelationshipHandle between the currently authenticated user and this user,...
UserMessageSummary & operator=(const UserMessageSummary &arg0)
Copy assignment operator for UserMessageSummary.
static const UserMessageSummary nullobj
Uninitialized instance of UserMessageSummary.
Definition discordpp.h:3062
UserMessageSummary(UserMessageSummary &&other) noexcept
Move constructor for UserMessageSummary.
uint64_t LastMessageId() const
Returns the ID of the last message sent in the DM conversation.
uint64_t UserId() const
Returns the ID of the other user in the DM conversation.
UserMessageSummary(const UserMessageSummary &arg0)
Copy constructor for UserMessageSummary.
UserMessageSummary & operator=(UserMessageSummary &&other) noexcept
Move assignment operator for UserMessageSummary.
Settings for the void auto detection threshold for picking up activity from a user's mic.
Definition discordpp.h:1799
VADThresholdSettings & operator=(VADThresholdSettings &&other) noexcept
Move assignment operator for VADThresholdSettings.
VADThresholdSettings(VADThresholdSettings &&other) noexcept
Move constructor for VADThresholdSettings.
static const VADThresholdSettings nullobj
Uninitialized instance of VADThresholdSettings.
Definition discordpp.h:1818
bool Automatic() const
Whether or not Discord is currently automatically setting and detecting the appropriate threshold to ...
float VadThreshold() const
The current void auto detection threshold value, has a range of -100, 0 and defaults to -60.
void SetAutomatic(bool Automatic)
Setter for VADThresholdSettings::Automatic.
void SetVadThreshold(float VadThreshold)
Setter for VADThresholdSettings::VadThreshold.
A VoiceStateHandle represents the state of a single participant in a Discord voice call.
Definition discordpp.h:1757
VoiceStateHandle & operator=(VoiceStateHandle &&other) noexcept
Move assignment operator for VoiceStateHandle.
bool SelfMute() const
Returns true if the given user has muted themselves so that no one else in the call can hear them.
static const VoiceStateHandle nullobj
Uninitialized instance of VoiceStateHandle.
Definition discordpp.h:1776
bool SelfDeaf() const
Returns true if the given user has deafened themselves so that no one else in the call can hear them ...
VoiceStateHandle(VoiceStateHandle &&other) noexcept
Move constructor for VoiceStateHandle.
VoiceStateHandle & operator=(const VoiceStateHandle &other)
Copy assignment operator for VoiceStateHandle.
VoiceStateHandle(const VoiceStateHandle &other)
Copy constructor for VoiceStateHandle.
The namespace for the generated Discord SDK bindings.
Definition discordpp.h:16
ActivityPartyPrivacy
Allows your game to control the privacy of the party the user is in.
Definition discordpp.h:51
@ Public
The party is public, which means that the user is in a party which could be joinable by either friend...
Definition discordpp.h:65
@ Private
The party is private (or unknown), which means that the user is in a party but it is not joinable wit...
Definition discordpp.h:59
DisclosureTypes
Enum that represents various informational disclosures that Discord may make to users,...
Definition discordpp.h:573
@ MessageDataVisibleOnDiscord
This disclosure type happens the first time a user sends a message in game, and that message will be ...
Definition discordpp.h:579
const char * EnumToString(discordpp::ActivityActionTypes value)
Converts a discordpp::ActivityActionTypes to a string.
Definition discordpp.h:5070
HttpStatusCode
Enum that represents the various HTTP status codes that can be returned.
Definition discordpp.h:204
@ RequestHeaderFieldsTooLarge
RequestHeaderFieldsTooLarge.
Definition discordpp.h:351
@ PayloadTooLarge
PayloadTooLarge.
Definition discordpp.h:312
@ MultiStatus
MultiStatus.
Definition discordpp.h:243
@ VariantAlsoNegotiates
VariantAlsoNegotiates.
Definition discordpp.h:372
@ Gone
Gone.
Definition discordpp.h:303
@ BadGateway
BadGateway.
Definition discordpp.h:360
@ Created
Created.
Definition discordpp.h:225
@ TemporaryRedirect
TemporaryRedirect.
Definition discordpp.h:267
@ ServiceUnavailable
ServiceUnavailable.
Definition discordpp.h:363
@ MovedPermanently
MovedPermanently.
Definition discordpp.h:255
@ PreconditionFailed
PreconditionFailed.
Definition discordpp.h:309
@ RequestTimeout
RequestTimeout.
Definition discordpp.h:297
@ Accepted
Accepted.
Definition discordpp.h:228
@ NonAuthoritativeInfo
NonAuthoritativeInfo.
Definition discordpp.h:231
@ NotFound
NotFound.
Definition discordpp.h:285
@ FailedDependency
FailedDependency.
Definition discordpp.h:336
@ PaymentRequired
PaymentRequired.
Definition discordpp.h:279
@ PreconditionRequired
PreconditionRequired.
Definition discordpp.h:345
@ ResetContent
ResetContent.
Definition discordpp.h:237
@ SwitchingProtocols
SwitchingProtocols.
Definition discordpp.h:213
@ HttpVersionNotSupported
HttpVersionNotSupported.
Definition discordpp.h:369
@ Found
Found.
Definition discordpp.h:258
@ Processing
Processing.
Definition discordpp.h:216
@ None
None.
Definition discordpp.h:207
@ ExpectationFailed
ExpectationFailed.
Definition discordpp.h:324
@ Forbidden
Forbidden.
Definition discordpp.h:282
@ PartialContent
PartialContent.
Definition discordpp.h:240
@ SeeOther
SeeOther.
Definition discordpp.h:261
@ EarlyHints
EarlyHints.
Definition discordpp.h:219
@ LengthRequired
LengthRequired.
Definition discordpp.h:306
@ MethodNotAllowed
MethodNotAllowed.
Definition discordpp.h:288
@ NotExtended
NotExtended.
Definition discordpp.h:381
@ RangeNotSatisfiable
RangeNotSatisfiable.
Definition discordpp.h:321
@ NotImplemented
NotImplemented.
Definition discordpp.h:357
@ BadRequest
BadRequest.
Definition discordpp.h:273
@ Continue
Continue.
Definition discordpp.h:210
@ LoopDetected
LoopDetected.
Definition discordpp.h:378
@ UnsupportedMediaType
UnsupportedMediaType.
Definition discordpp.h:318
@ NetworkAuthorizationRequired
NetworkAuthorizationRequired.
Definition discordpp.h:384
@ ImUsed
ImUsed.
Definition discordpp.h:249
@ MultipleChoices
MultipleChoices.
Definition discordpp.h:252
@ Ok
Ok.
Definition discordpp.h:222
@ TooManyRequests
TooManyRequests.
Definition discordpp.h:348
@ ProxyAuthRequired
ProxyAuthRequired.
Definition discordpp.h:294
@ UnprocessableEntity
UnprocessableEntity.
Definition discordpp.h:330
@ MisdirectedRequest
MisdirectedRequest.
Definition discordpp.h:327
@ PermanentRedirect
PermanentRedirect.
Definition discordpp.h:270
@ NotModified
NotModified.
Definition discordpp.h:264
@ AlreadyReported
AlreadyReported.
Definition discordpp.h:246
@ NoContent
NoContent.
Definition discordpp.h:234
@ Locked
Locked.
Definition discordpp.h:333
@ GatewayTimeout
GatewayTimeout.
Definition discordpp.h:366
@ Unauthorized
Unauthorized.
Definition discordpp.h:276
@ UpgradeRequired
UpgradeRequired.
Definition discordpp.h:342
@ InsufficientStorage
InsufficientStorage.
Definition discordpp.h:375
@ InternalServerError
InternalServerError.
Definition discordpp.h:354
@ TooEarly
TooEarly.
Definition discordpp.h:339
@ Conflict
Conflict.
Definition discordpp.h:300
@ UriTooLong
UriTooLong.
Definition discordpp.h:315
@ NotAcceptable
NotAcceptable.
Definition discordpp.h:291
AuthorizationTokenType
Represents the type of auth token used by the SDK, either the normal tokens produced by the Discord d...
Definition discordpp.h:584
@ Bearer
Bearer.
Definition discordpp.h:590
@ User
User.
Definition discordpp.h:587
ChannelType
Enum that represents the various channel types on Discord.
Definition discordpp.h:457
@ GuildForum
GuildForum.
Definition discordpp.h:496
@ Dm
Dm.
Definition discordpp.h:463
@ Lobby
Lobby.
Definition discordpp.h:502
@ GuildNews
GuildNews.
Definition discordpp.h:475
@ GuildVoice
GuildVoice.
Definition discordpp.h:466
@ GuildPublicThread
GuildPublicThread.
Definition discordpp.h:484
@ GuildNewsThread
GuildNewsThread.
Definition discordpp.h:481
@ GuildDirectory
GuildDirectory.
Definition discordpp.h:493
@ GuildCategory
GuildCategory.
Definition discordpp.h:472
@ GuildStageVoice
GuildStageVoice.
Definition discordpp.h:490
@ GuildMedia
GuildMedia.
Definition discordpp.h:499
@ GuildStore
GuildStore.
Definition discordpp.h:478
@ GuildText
GuildText.
Definition discordpp.h:460
@ GroupDm
GroupDm.
Definition discordpp.h:469
@ EphemeralDm
EphemeralDm.
Definition discordpp.h:505
@ GuildPrivateThread
GuildPrivateThread.
Definition discordpp.h:487
AuthenticationCodeChallengeMethod
Represents the crypto method used to generate a code challenge.
Definition discordpp.h:390
@ S256
S256.
Definition discordpp.h:393
RelationshipType
Enum that represents the possible types of relationships that can exist between two users.
Definition discordpp.h:509
@ PendingIncoming
The current user has received a friend request from the target user, but it is not yet accepted.
Definition discordpp.h:524
@ Implicit
The Implicit type is documented for visibility, but should be unused in the SDK.
Definition discordpp.h:531
@ Suggestion
The Suggestion type is documented for visibility, but should be unused in the SDK.
Definition discordpp.h:534
@ PendingOutgoing
The current user has sent a friend request to the target user, but it is not yet accepted.
Definition discordpp.h:528
@ Blocked
The current user has blocked the target user, and so certain actions such as sending messages between...
Definition discordpp.h:519
@ None
The user has no relationship with the other user.
Definition discordpp.h:512
@ Friend
The user is friends with the other user.
Definition discordpp.h:515
AuthenticationExternalAuthType
Represents the various identity providers that can be used to authenticate a provisional account user...
Definition discordpp.h:595
@ EpicOnlineServicesIdToken
EpicOnlineServicesIdToken.
Definition discordpp.h:604
@ EpicOnlineServicesAccessToken
EpicOnlineServicesAccessToken.
Definition discordpp.h:601
@ SteamSessionTicket
SteamSessionTicket.
Definition discordpp.h:607
@ OIDC
OIDC.
Definition discordpp.h:598
@ UnityServicesIdToken
UnityServicesIdToken.
Definition discordpp.h:610
LoggingSeverity
Enum that represents the various log levels supported by the SDK.
Definition discordpp.h:614
@ Warning
Warning.
Definition discordpp.h:623
@ Info
Info.
Definition discordpp.h:620
@ None
None.
Definition discordpp.h:629
@ Error
Error.
Definition discordpp.h:626
@ Verbose
Verbose.
Definition discordpp.h:617
RelationshipGroupType
Enum that represents the logical groups of relationships based on online status and game activity.
Definition discordpp.h:634
@ OnlinePlayingGame
Users who are online and currently playing the game.
Definition discordpp.h:637
@ Offline
Users who are offline.
Definition discordpp.h:643
@ OnlineElsewhere
Users who are online but not playing the game.
Definition discordpp.h:640
IntegrationType
Represents the type of integration the app will be installed as.
Definition discordpp.h:397
@ GuildInstall
GuildInstall.
Definition discordpp.h:400
@ UserInstall
UserInstall.
Definition discordpp.h:403
AudioSystem
The Discord Voice audio system to use.
Definition discordpp.h:432
@ Game
Use the game audio system.
Definition discordpp.h:438
@ Standard
Use the standard audio system.
Definition discordpp.h:435
ActivityGamePlatforms
Represents the type of platforms that an activity invite can be accepted on.
Definition discordpp.h:114
@ Embedded
Embedded.
Definition discordpp.h:132
@ Xbox
Xbox.
Definition discordpp.h:120
@ Desktop
Desktop.
Definition discordpp.h:117
@ Samsung
Samsung.
Definition discordpp.h:123
@ PS5
PS5.
Definition discordpp.h:138
@ PS4
PS4.
Definition discordpp.h:135
@ IOS
IOS.
Definition discordpp.h:126
@ Android
Android.
Definition discordpp.h:129
ActivityTypes
Discord RichPresence supports multiple types of activities that a user can be doing.
Definition discordpp.h:74
@ Watching
Watching.
Definition discordpp.h:86
@ Competing
Competing.
Definition discordpp.h:92
@ HangStatus
HangStatus.
Definition discordpp.h:95
@ Listening
Listening.
Definition discordpp.h:83
@ Streaming
Streaming.
Definition discordpp.h:80
@ CustomStatus
CustomStatus.
Definition discordpp.h:89
@ Playing
Playing.
Definition discordpp.h:77
StatusType
Enum that specifies the various online statuses for a user.
Definition discordpp.h:541
@ Blocked
Blocked.
Definition discordpp.h:550
@ Online
The user is online and recently active.
Definition discordpp.h:544
@ Dnd
The user is online, but wishes to suppress notifications for the time being.
Definition discordpp.h:557
@ Unknown
Unknown.
Definition discordpp.h:566
@ Invisible
The user is online, but wishes to appear as if they are offline to other users.
Definition discordpp.h:560
@ Offline
The user is offline and not connected to Discord.
Definition discordpp.h:547
@ Streaming
The user is online and is actively streaming content.
Definition discordpp.h:563
@ Idle
The user is online, but has not been active for a while and may be away from their computer.
Definition discordpp.h:554
StatusDisplayTypes
Controls which Discord RichPresence field is displayed in the user's status.
Definition discordpp.h:101
@ Details
Details.
Definition discordpp.h:110
@ State
State.
Definition discordpp.h:107
@ Name
Name.
Definition discordpp.h:104
void RunCallbacks()
Definition discordpp.h:29
AudioModeType
Represents whether a voice call is using push to talk or auto voice detection.
Definition discordpp.h:442
@ MODE_PTT
MODE_PTT.
Definition discordpp.h:451
@ MODE_VAD
MODE_VAD.
Definition discordpp.h:448
@ MODE_UNINIT
MODE_UNINIT.
Definition discordpp.h:445
ErrorType
Enum representing various types of errors the SDK returns.
Definition discordpp.h:142
@ HTTPError
An HTTP call was made to Discord's servers but a non success HTTP status code was returned....
Definition discordpp.h:157
@ NetworkError
The user is offline or there was some network issue that prevented an underlying HTTP call from succe...
Definition discordpp.h:149
@ AuthorizationFailed
An authorization function failed, but not necessarily as the result of an HTTP call that returned an ...
Definition discordpp.h:191
@ ClientNotReady
An operation such as sending a friend request or joining a lobby was attempted but the Client is not ...
Definition discordpp.h:167
@ None
No error, the operation was successful.
Definition discordpp.h:145
@ Aborted
The user or developer aborted an operation, such as an authorization flow.
Definition discordpp.h:186
@ RPCError
An RPC call was made to Discord's desktop application, but it returned a non-success result....
Definition discordpp.h:196
@ ValidationError
Used when an SDK method is called but the inputs don't pass local validation. For example if one atte...
Definition discordpp.h:183
@ ClientDestroyed
The Client has been destroyed and so this operation cannot complete.
Definition discordpp.h:173
@ Disabled
An operation was temporarily disabled for stability reasons.
Definition discordpp.h:170
DiscordObjectState
Represents the memory state of a Discord object.
Definition discordpp.h:19
@ Invalid
The object has been freed.
Definition discordpp.h:21
@ Owned
The object is owned by the C++ wrapper and methods can be called on it.
Definition discordpp.h:23
AdditionalContentType
Represents the type of additional content contained in a message.
Definition discordpp.h:407
@ Sticker
Sticker.
Definition discordpp.h:428
@ VoiceMessage
VoiceMessage.
Definition discordpp.h:419
@ Other
Other.
Definition discordpp.h:410
@ Poll
Poll.
Definition discordpp.h:416
@ Thread
Thread.
Definition discordpp.h:422
@ Attachment
Attachment.
Definition discordpp.h:413
@ Embed
Embed.
Definition discordpp.h:425
ActivityActionTypes
ActivityActionTypes represents the type of invite being sent to a user.
Definition discordpp.h:41
@ Join
Join.
Definition discordpp.h:44
@ JoinRequest
JoinRequest.
Definition discordpp.h:47