Discord Social SDK
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
discordpp.h
1// Generated with <3 by Discord.Sdk.Derive
2#ifndef DISCORD_HEADER_DISCORDPP_H_
3#define DISCORD_HEADER_DISCORDPP_H_
4#include "cdiscord.h"
5#include <atomic>
6#include <cassert>
7#include <cstring>
8#include <functional>
9#include <memory>
10#include <optional>
11#include <string>
12#include <unordered_map>
13#include <vector>
14
16namespace discordpp {
17
25
29inline void RunCallbacks()
30{
31 Discord_RunCallbacks();
32}
33
42
44 Join = 1,
45
48};
49
52
60
65 Public = 1,
66};
67
74enum class ActivityTypes {
75
78
81
84
87
90
93
96};
97
100
103
105 Xbox = 2,
106
109
111 IOS = 8,
112
115
118
120 PS4 = 64,
121
123 PS5 = 128,
124};
125
127enum class ErrorType {
128
130 None = 0,
131
135
143
153
156
159
169
172
177
182};
183
189enum class HttpStatusCode {
190
192 None = 0,
193
195 Continue = 100,
196
199
202
205
207 Ok = 200,
208
210 Created = 201,
211
213 Accepted = 202,
214
217
220
223
226
229
232
234 ImUsed = 209,
235
238
241
243 Found = 302,
244
246 SeeOther = 303,
247
250
253
256
259
262
265
268
270 NotFound = 404,
271
274
277
280
283
285 Conflict = 409,
286
288 Gone = 410,
289
292
295
298
301
304
307
310
313
316
318 Locked = 423,
319
322
324 TooEarly = 425,
325
328
331
334
337
340
343
346
349
352
355
358
361
364
367
370};
371
376
378 S256 = 0,
379};
380
383
385 Other = 0,
386
389
391 Poll = 2,
392
395
398
400 Embed = 5,
401
404};
405
407enum class AudioModeType {
408
411
414
417};
418
422enum class ChannelType {
423
426
428 Dm = 1,
429
432
435
438
441
444
447
450
453
456
459
462
465
467 Lobby = 17,
468
471};
472
475
477 None = 0,
478
481
485
490
494
497
500};
501
506enum class StatusType {
507
510
513
516
519 Idle = 3,
520
522 Dnd = 4,
523
526
529
532};
533
546
550
552 User = 0,
553
556};
557
577
579enum class LoggingSeverity {
580
583
585 Info = 2,
586
589
591 Error = 4,
592
594 None = 5,
595};
596class ActivityInvite;
597class ActivityAssets;
598class ActivityTimestamps;
599class ActivityParty;
600class ActivitySecrets;
601class ActivityButton;
602class Activity;
603class ClientResult;
604class AuthorizationCodeChallenge;
605class AuthorizationCodeVerifier;
606class AuthorizationArgs;
607class DeviceAuthorizationArgs;
608class VoiceStateHandle;
609class VADThresholdSettings;
610class Call;
611class ChannelHandle;
612class GuildMinimal;
613class GuildChannel;
614class LinkedLobby;
615class LinkedChannel;
616class RelationshipHandle;
617class UserHandle;
618class LobbyMemberHandle;
619class LobbyHandle;
620class AdditionalContent;
621class MessageHandle;
622class AudioDevice;
623class Client;
624class CallInfoHandle;
625
631 mutable Discord_ActivityInvite instance_{};
634
635public:
637 Discord_ActivityInvite* instance() const { return &instance_; }
640 explicit ActivityInvite(Discord_ActivityInvite instance, DiscordObjectState state);
650 operator bool() const { return state_ != DiscordObjectState::Invalid; }
651
656
657 explicit ActivityInvite();
658
660 void Drop();
662
664 uint64_t SenderId() const;
666 void SetSenderId(uint64_t SenderId);
667
669 uint64_t ChannelId() const;
671 void SetChannelId(uint64_t ChannelId);
672
674 uint64_t MessageId() const;
676 void SetMessageId(uint64_t MessageId);
677
682
684 uint64_t ApplicationId() const;
687
689 std::string PartyId() const;
691 void SetPartyId(std::string PartyId);
692
694 std::string SessionId() const;
696 void SetSessionId(std::string SessionId);
697
700 bool IsValid() const;
702 void SetIsValid(bool IsValid);
703};
704
723 mutable Discord_ActivityAssets instance_{};
726
727public:
729 Discord_ActivityAssets* instance() const { return &instance_; }
732 explicit ActivityAssets(Discord_ActivityAssets instance, DiscordObjectState state);
742 operator bool() const { return state_ != DiscordObjectState::Invalid; }
743
748
749 explicit ActivityAssets();
750
752 void Drop();
754
759 std::optional<std::string> LargeImage() const;
761 void SetLargeImage(std::optional<std::string> LargeImage);
762
766 std::optional<std::string> LargeText() const;
768 void SetLargeText(std::optional<std::string> LargeText);
769
773 std::optional<std::string> SmallImage() const;
775 void SetSmallImage(std::optional<std::string> SmallImage);
776
780 std::optional<std::string> SmallText() const;
782 void SetSmallText(std::optional<std::string> SmallText);
783};
784
788 mutable Discord_ActivityTimestamps instance_{};
791
792public:
794 Discord_ActivityTimestamps* instance() const { return &instance_; }
797 explicit ActivityTimestamps(Discord_ActivityTimestamps instance, DiscordObjectState state);
807 operator bool() const { return state_ != DiscordObjectState::Invalid; }
808
813
814 explicit ActivityTimestamps();
815
817 void Drop();
819
825 uint64_t Start() const;
827 void SetStart(uint64_t Start);
828
834 uint64_t End() const;
836 void SetEnd(uint64_t End);
837};
838
842 mutable Discord_ActivityParty instance_{};
845
846public:
848 Discord_ActivityParty* instance() const { return &instance_; }
851 explicit ActivityParty(Discord_ActivityParty instance, DiscordObjectState state);
855 ActivityParty(ActivityParty&& other) noexcept;
859 static const ActivityParty nullobj;
861 operator bool() const { return state_ != DiscordObjectState::Invalid; }
862
867
868 explicit ActivityParty();
869
871 void Drop();
873
880 std::string Id() const;
882 void SetId(std::string Id);
883
885 int32_t CurrentSize() const;
888
891 int32_t MaxSize() const;
893 void SetMaxSize(int32_t MaxSize);
894
899};
900
904 mutable Discord_ActivitySecrets instance_{};
907
908public:
910 Discord_ActivitySecrets* instance() const { return &instance_; }
913 explicit ActivitySecrets(Discord_ActivitySecrets instance, DiscordObjectState state);
923 operator bool() const { return state_ != DiscordObjectState::Invalid; }
924
929
930 explicit ActivitySecrets();
931
933 void Drop();
935
940 std::string Join() const;
942 void SetJoin(std::string Join);
943};
944
948 mutable Discord_ActivityButton instance_{};
951
952public:
954 Discord_ActivityButton* instance() const { return &instance_; }
957 explicit ActivityButton(Discord_ActivityButton instance, DiscordObjectState state);
967 operator bool() const { return state_ != DiscordObjectState::Invalid; }
968
973
974 explicit ActivityButton();
975
977 void Drop();
979
981 std::string Label() const;
983 void SetLabel(std::string Label);
984
986 std::string Url() const;
988 void SetUrl(std::string Url);
989};
990
1173 mutable Discord_Activity instance_{};
1176
1177public:
1179 Discord_Activity* instance() const { return &instance_; }
1182 explicit Activity(Discord_Activity instance, DiscordObjectState state);
1183 ~Activity();
1186 Activity(Activity&& other) noexcept;
1188 Activity& operator=(Activity&& other) noexcept;
1190 static const Activity nullobj;
1192 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1193
1195 Activity(const Activity& arg0);
1198
1199 explicit Activity();
1200
1202 void Drop();
1204
1207
1209 bool Equals(discordpp::Activity other) const;
1210
1212 std::vector<discordpp::ActivityButton> GetButtons() const;
1213
1217 std::string Name() const;
1219 void SetName(std::string Name);
1220
1227
1232 std::optional<std::string> State() const;
1234 void SetState(std::optional<std::string> State);
1235
1240 std::optional<std::string> Details() const;
1242 void SetDetails(std::optional<std::string> Details);
1243
1248 std::optional<uint64_t> ApplicationId() const;
1250 void SetApplicationId(std::optional<uint64_t> ApplicationId);
1251
1253 std::optional<discordpp::ActivityAssets> Assets() const;
1255 void SetAssets(std::optional<discordpp::ActivityAssets> Assets);
1256
1260 std::optional<discordpp::ActivityTimestamps> Timestamps() const;
1262 void SetTimestamps(std::optional<discordpp::ActivityTimestamps> Timestamps);
1263
1266 std::optional<discordpp::ActivityParty> Party() const;
1268 void SetParty(std::optional<discordpp::ActivityParty> Party);
1269
1272 std::optional<discordpp::ActivitySecrets> Secrets() const;
1274 void SetSecrets(std::optional<discordpp::ActivitySecrets> Secrets);
1275
1284};
1285
1297 mutable Discord_ClientResult instance_{};
1300
1301public:
1303 Discord_ClientResult* instance() const { return &instance_; }
1306 explicit ClientResult(Discord_ClientResult instance, DiscordObjectState state);
1307 ~ClientResult();
1310 ClientResult(ClientResult&& other) noexcept;
1314 static const ClientResult nullobj;
1316 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1317
1322
1324 void Drop();
1326
1328 std::string ToString() const;
1329
1334
1336 std::string Error() const;
1338 void SetError(std::string Error);
1339
1348 int32_t ErrorCode() const;
1351
1358
1366 std::string ResponseBody() const;
1369
1371 bool Successful() const;
1374
1376 bool Retryable() const;
1379
1382 float RetryAfter() const;
1385};
1386
1390 mutable Discord_AuthorizationCodeChallenge instance_{};
1393
1394public:
1396 Discord_AuthorizationCodeChallenge* instance() const { return &instance_; }
1399 explicit AuthorizationCodeChallenge(Discord_AuthorizationCodeChallenge instance,
1400 DiscordObjectState state);
1410 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1411
1416
1417 explicit AuthorizationCodeChallenge();
1418
1420 void Drop();
1422
1427
1429 std::string Challenge() const;
1431 void SetChallenge(std::string Challenge);
1432};
1433
1437 mutable Discord_AuthorizationCodeVerifier instance_{};
1440
1441public:
1443 Discord_AuthorizationCodeVerifier* instance() const { return &instance_; }
1446 explicit AuthorizationCodeVerifier(Discord_AuthorizationCodeVerifier instance,
1447 DiscordObjectState state);
1457 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1458
1463
1465 void Drop();
1467
1472
1474 std::string Verifier() const;
1476 void SetVerifier(std::string Verifier);
1477};
1478
1482 mutable Discord_AuthorizationArgs instance_{};
1485
1486public:
1488 Discord_AuthorizationArgs* instance() const { return &instance_; }
1491 explicit AuthorizationArgs(Discord_AuthorizationArgs instance, DiscordObjectState state);
1501 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1502
1507
1508 explicit AuthorizationArgs();
1509
1511 void Drop();
1513
1516 uint64_t ClientId() const;
1518 void SetClientId(uint64_t ClientId);
1519
1532 std::string Scopes() const;
1534 void SetScopes(std::string Scopes);
1535
1541 std::optional<std::string> State() const;
1543 void SetState(std::optional<std::string> State);
1544
1549 std::optional<std::string> Nonce() const;
1551 void SetNonce(std::optional<std::string> Nonce);
1552
1558 std::optional<discordpp::AuthorizationCodeChallenge> CodeChallenge() const;
1560 void SetCodeChallenge(std::optional<discordpp::AuthorizationCodeChallenge> CodeChallenge);
1561};
1562
1566 mutable Discord_DeviceAuthorizationArgs instance_{};
1569
1570public:
1572 Discord_DeviceAuthorizationArgs* instance() const { return &instance_; }
1575 explicit DeviceAuthorizationArgs(Discord_DeviceAuthorizationArgs instance,
1576 DiscordObjectState state);
1586 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1587
1592
1593 explicit DeviceAuthorizationArgs();
1594
1596 void Drop();
1598
1601 uint64_t ClientId() const;
1603 void SetClientId(uint64_t ClientId);
1604
1617 std::string Scopes() const;
1619 void SetScopes(std::string Scopes);
1620};
1621
1634 mutable Discord_VoiceStateHandle instance_{};
1637
1638public:
1640 Discord_VoiceStateHandle* instance() const { return &instance_; }
1643 explicit VoiceStateHandle(Discord_VoiceStateHandle instance, DiscordObjectState state);
1653 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1654
1659
1661 void Drop();
1663
1666 bool SelfDeaf() const;
1667
1670 bool SelfMute() const;
1671};
1672
1676 mutable Discord_VADThresholdSettings instance_{};
1679
1680public:
1682 Discord_VADThresholdSettings* instance() const { return &instance_; }
1685 explicit VADThresholdSettings(Discord_VADThresholdSettings instance, DiscordObjectState state);
1695 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1696
1699
1701 void Drop();
1703
1706 float VadThreshold() const;
1709
1712 bool Automatic() const;
1715};
1716
1718class Call {
1720 mutable Discord_Call instance_{};
1723
1724public:
1746
1748 enum class Status {
1749
1752
1755
1758
1761
1764
1767
1770 };
1771
1773 using OnVoiceStateChanged = std::function<void(uint64_t userId)>;
1774
1776 using OnParticipantChanged = std::function<void(uint64_t userId, bool added)>;
1777
1779 using OnSpeakingStatusChanged = std::function<void(uint64_t userId, bool isPlayingSound)>;
1780
1782 using OnStatusChanged = std::function<
1783 void(discordpp::Call::Status status, discordpp::Call::Error error, int32_t errorDetail)>;
1785 Discord_Call* instance() const { return &instance_; }
1788 explicit Call(Discord_Call instance, DiscordObjectState state);
1789 ~Call();
1792 Call(Call&& other) noexcept;
1794 Call& operator=(Call&& other) noexcept;
1796 static const Call nullobj;
1798 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1799
1801 Call(const Call& other);
1803 Call& operator=(const Call& other);
1804
1806 void Drop();
1808
1810 static std::string ErrorToString(discordpp::Call::Error type);
1811
1815
1817 uint64_t GetChannelId() const;
1818
1820 uint64_t GetGuildId() const;
1821
1823 bool GetLocalMute(uint64_t userId);
1824
1826 std::vector<uint64_t> GetParticipants() const;
1827
1832 float GetParticipantVolume(uint64_t userId);
1833
1837
1841
1844
1847
1852
1856
1862 std::optional<discordpp::VoiceStateHandle> GetVoiceStateHandle(uint64_t userId) const;
1863
1870
1874 void SetLocalMute(uint64_t userId, bool mute);
1875
1883
1886
1891 void SetParticipantVolume(uint64_t userId, float volume);
1892
1896 void SetPTTActive(bool active);
1897
1902 void SetPTTReleaseDelay(uint32_t releaseDelayMs);
1903
1907 void SetSelfDeaf(bool deaf);
1908
1911 void SetSelfMute(bool mute);
1912
1919
1923
1930 void SetVADThreshold(bool automatic, float threshold);
1931
1933 static std::string StatusToString(discordpp::Call::Status type);
1934};
1935
1947 mutable Discord_ChannelHandle instance_{};
1950
1951public:
1953 Discord_ChannelHandle* instance() const { return &instance_; }
1956 explicit ChannelHandle(Discord_ChannelHandle instance, DiscordObjectState state);
1960 ChannelHandle(ChannelHandle&& other) noexcept;
1966 operator bool() const { return state_ != DiscordObjectState::Invalid; }
1967
1972
1974 void Drop();
1976
1978 uint64_t Id() const;
1979
1984 std::string Name() const;
1985
1988 std::vector<uint64_t> Recipients() const;
1989
1992};
1993
1998 mutable Discord_GuildMinimal instance_{};
2001
2002public:
2004 Discord_GuildMinimal* instance() const { return &instance_; }
2007 explicit GuildMinimal(Discord_GuildMinimal instance, DiscordObjectState state);
2008 ~GuildMinimal();
2011 GuildMinimal(GuildMinimal&& other) noexcept;
2015 static const GuildMinimal nullobj;
2017 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2018
2023
2025 void Drop();
2027
2029 uint64_t Id() const;
2031 void SetId(uint64_t Id);
2032
2034 std::string Name() const;
2036 void SetName(std::string Name);
2037};
2038
2043 mutable Discord_GuildChannel instance_{};
2046
2047public:
2049 Discord_GuildChannel* instance() const { return &instance_; }
2052 explicit GuildChannel(Discord_GuildChannel instance, DiscordObjectState state);
2053 ~GuildChannel();
2056 GuildChannel(GuildChannel&& other) noexcept;
2060 static const GuildChannel nullobj;
2062 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2063
2068
2070 void Drop();
2072
2074 uint64_t Id() const;
2076 void SetId(uint64_t Id);
2077
2079 std::string Name() const;
2081 void SetName(std::string Name);
2082
2093 bool IsLinkable() const;
2096
2113
2116 std::optional<discordpp::LinkedLobby> LinkedLobby() const;
2118 void SetLinkedLobby(std::optional<discordpp::LinkedLobby> LinkedLobby);
2119};
2120
2124 mutable Discord_LinkedLobby instance_{};
2127
2128public:
2130 Discord_LinkedLobby* instance() const { return &instance_; }
2133 explicit LinkedLobby(Discord_LinkedLobby instance, DiscordObjectState state);
2134 ~LinkedLobby();
2137 LinkedLobby(LinkedLobby&& other) noexcept;
2141 static const LinkedLobby nullobj;
2143 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2144
2149
2150 explicit LinkedLobby();
2151
2153 void Drop();
2155
2157 uint64_t ApplicationId() const;
2160
2162 uint64_t LobbyId() const;
2164 void SetLobbyId(uint64_t LobbyId);
2165};
2166
2170 mutable Discord_LinkedChannel instance_{};
2173
2174public:
2176 Discord_LinkedChannel* instance() const { return &instance_; }
2179 explicit LinkedChannel(Discord_LinkedChannel instance, DiscordObjectState state);
2183 LinkedChannel(LinkedChannel&& other) noexcept;
2189 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2190
2195
2197 void Drop();
2199
2201 uint64_t Id() const;
2203 void SetId(uint64_t Id);
2204
2206 std::string Name() const;
2208 void SetName(std::string Name);
2209
2211 uint64_t GuildId() const;
2213 void SetGuildId(uint64_t GuildId);
2214};
2215
2252 mutable Discord_RelationshipHandle instance_{};
2255
2256public:
2258 Discord_RelationshipHandle* instance() const { return &instance_; }
2261 explicit RelationshipHandle(Discord_RelationshipHandle instance, DiscordObjectState state);
2271 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2272
2277
2279 void Drop();
2281
2284
2287
2289 uint64_t Id() const;
2290
2293 std::optional<discordpp::UserHandle> User() const;
2294};
2295
2308 mutable Discord_UserHandle instance_{};
2311
2312public:
2314 enum class AvatarType {
2315
2317 Gif = 0,
2318
2320 Webp = 1,
2321
2323 Png = 2,
2324
2326 Jpeg = 3,
2327 };
2328
2329 Discord_UserHandle* instance() const { return &instance_; }
2332 explicit UserHandle(Discord_UserHandle instance, DiscordObjectState state);
2333 ~UserHandle();
2336 UserHandle(UserHandle&& other) noexcept;
2338 UserHandle& operator=(UserHandle&& other) noexcept;
2340 static const UserHandle nullobj;
2342 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2343
2348
2350 void Drop();
2352
2354 std::optional<std::string> Avatar() const;
2355
2358
2364 discordpp::UserHandle::AvatarType staticType) const;
2365
2368 std::string DisplayName() const;
2369
2379 std::optional<discordpp::Activity> GameActivity() const;
2380
2389 std::optional<std::string> GlobalName() const;
2390
2394 uint64_t Id() const;
2395
2397 bool IsProvisional() const;
2398
2402
2405
2412 std::string Username() const;
2413};
2414
2433 mutable Discord_LobbyMemberHandle instance_{};
2436
2437public:
2439 Discord_LobbyMemberHandle* instance() const { return &instance_; }
2442 explicit LobbyMemberHandle(Discord_LobbyMemberHandle instance, DiscordObjectState state);
2452 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2453
2458
2460 void Drop();
2462
2469 bool CanLinkLobby() const;
2470
2472 bool Connected() const;
2473
2475 uint64_t Id() const;
2476
2482 std::unordered_map<std::string, std::string> Metadata() const;
2483
2485 std::optional<discordpp::UserHandle> User() const;
2486};
2487
2576 mutable Discord_LobbyHandle instance_{};
2579
2580public:
2582 Discord_LobbyHandle* instance() const { return &instance_; }
2585 explicit LobbyHandle(Discord_LobbyHandle instance, DiscordObjectState state);
2586 ~LobbyHandle();
2589 LobbyHandle(LobbyHandle&& other) noexcept;
2593 static const LobbyHandle nullobj;
2595 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2596
2601
2603 void Drop();
2605
2611 std::optional<discordpp::CallInfoHandle> GetCallInfoHandle() const;
2612
2615 std::optional<discordpp::LobbyMemberHandle> GetLobbyMemberHandle(uint64_t memberId) const;
2616
2618 uint64_t Id() const;
2619
2621 std::optional<discordpp::LinkedChannel> LinkedChannel() const;
2622
2624 std::vector<uint64_t> LobbyMemberIds() const;
2625
2627 std::vector<discordpp::LobbyMemberHandle> LobbyMembers() const;
2628
2633 std::unordered_map<std::string, std::string> Metadata() const;
2634};
2635
2640 mutable Discord_AdditionalContent instance_{};
2643
2644public:
2646 Discord_AdditionalContent* instance() const { return &instance_; }
2649 explicit AdditionalContent(Discord_AdditionalContent instance, DiscordObjectState state);
2659 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2660
2665
2666 explicit AdditionalContent();
2667
2669 void Drop();
2671
2674
2677
2682
2685 std::optional<std::string> Title() const;
2687 void SetTitle(std::optional<std::string> Title);
2688
2691 uint8_t Count() const;
2693 void SetCount(uint8_t Count);
2694};
2695
2752 mutable Discord_MessageHandle instance_{};
2755
2756public:
2758 Discord_MessageHandle* instance() const { return &instance_; }
2761 explicit MessageHandle(Discord_MessageHandle instance, DiscordObjectState state);
2765 MessageHandle(MessageHandle&& other) noexcept;
2771 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2772
2777
2779 void Drop();
2781
2784 std::optional<discordpp::AdditionalContent> AdditionalContent() const;
2785
2787 std::optional<discordpp::UserHandle> Author() const;
2788
2790 uint64_t AuthorId() const;
2791
2793 std::optional<discordpp::ChannelHandle> Channel() const;
2794
2796 uint64_t ChannelId() const;
2797
2803 std::string Content() const;
2804
2807 std::optional<discordpp::DisclosureTypes> DisclosureType() const;
2808
2812 uint64_t EditedTimestamp() const;
2813
2815 uint64_t Id() const;
2816
2818 std::optional<discordpp::LobbyHandle> Lobby() const;
2819
2825 std::unordered_map<std::string, std::string> Metadata() const;
2826
2832 std::string RawContent() const;
2833
2836 std::optional<discordpp::UserHandle> Recipient() const;
2837
2840 uint64_t RecipientId() const;
2841
2844 bool SentFromGame() const;
2845
2847 uint64_t SentTimestamp() const;
2848};
2849
2856 mutable Discord_AudioDevice instance_{};
2859
2860public:
2862 Discord_AudioDevice* instance() const { return &instance_; }
2865 explicit AudioDevice(Discord_AudioDevice instance, DiscordObjectState state);
2866 ~AudioDevice();
2869 AudioDevice(AudioDevice&& other) noexcept;
2873 static const AudioDevice nullobj;
2875 operator bool() const { return state_ != DiscordObjectState::Invalid; }
2876
2881
2883 void Drop();
2885
2888
2890 std::string Id() const;
2892 void SetId(std::string Id);
2893
2895 std::string Name() const;
2897 void SetName(std::string Name);
2898
2900 bool IsDefault() const;
2903};
2904
2909class Client {
2911 mutable Discord_Client instance_{};
2914
2915public:
2923 enum class Error {
2924
2926 None = 0,
2927
2930
2933
2936 };
2937
2952 enum class Status {
2953
2956
2959
2962
2965
2968
2971
2974 };
2975
2977 enum class Thread {
2978
2981
2984
2987 };
2988
2990 using EndCallCallback = std::function<void()>;
2991
2993 using EndCallsCallback = std::function<void()>;
2994
2996 using GetCurrentInputDeviceCallback = std::function<void(discordpp::AudioDevice device)>;
2997
2999 using GetCurrentOutputDeviceCallback = std::function<void(discordpp::AudioDevice device)>;
3000
3003 std::function<void(std::vector<discordpp::AudioDevice> devices)>;
3004
3007 std::function<void(std::vector<discordpp::AudioDevice> devices)>;
3008
3011 std::function<void(std::vector<discordpp::AudioDevice> inputDevices,
3012 std::vector<discordpp::AudioDevice> outputDevices)>;
3013
3015 using SetInputDeviceCallback = std::function<void(discordpp::ClientResult result)>;
3016
3018 using NoAudioInputCallback = std::function<void(bool inputDetected)>;
3019
3021 using SetOutputDeviceCallback = std::function<void(discordpp::ClientResult result)>;
3022
3025 std::function<void(uint64_t lobbyId, uint64_t memberId, bool added)>;
3026
3030 using UserAudioReceivedCallback = std::function<void(uint64_t userId,
3031 int16_t* data,
3032 uint64_t samplesPerChannel,
3033 int32_t sampleRate,
3034 uint64_t channels,
3035 bool& outShouldMute)>;
3036
3040 using UserAudioCapturedCallback = std::function<
3041 void(int16_t* data, uint64_t samplesPerChannel, int32_t sampleRate, uint64_t channels)>;
3042
3049 using AuthorizationCallback = std::function<
3050 void(discordpp::ClientResult result, std::string code, std::string redirectUri)>;
3051
3054 std::function<void(discordpp::ClientResult result, uint64_t id, std::string name)>;
3055
3057 using TokenExchangeCallback = std::function<void(discordpp::ClientResult result,
3058 std::string accessToken,
3059 std::string refreshToken,
3061 int32_t expiresIn,
3062 std::string scopes)>;
3063
3065 using AuthorizeDeviceScreenClosedCallback = std::function<void()>;
3066
3068 using TokenExpirationCallback = std::function<void()>;
3069
3072 std::function<void(discordpp::ClientResult result)>;
3073
3076 using UpdateTokenCallback = std::function<void(discordpp::ClientResult result)>;
3077
3079 using DeleteUserMessageCallback = std::function<void(discordpp::ClientResult result)>;
3080
3082 using EditUserMessageCallback = std::function<void(discordpp::ClientResult result)>;
3083
3085 using ProvisionalUserMergeRequiredCallback = std::function<void()>;
3086
3088 using OpenMessageInDiscordCallback = std::function<void(discordpp::ClientResult result)>;
3089
3094 std::function<void(discordpp::ClientResult result, uint64_t messageId)>;
3095
3097 using MessageCreatedCallback = std::function<void(uint64_t messageId)>;
3098
3100 using MessageDeletedCallback = std::function<void(uint64_t messageId, uint64_t channelId)>;
3101
3103 using MessageUpdatedCallback = std::function<void(uint64_t messageId)>;
3104
3107 std::function<void(std::string message, discordpp::LoggingSeverity severity)>;
3108
3111 std::function<void(discordpp::ClientResult result)>;
3112
3117 using OnStatusChanged = std::function<
3118 void(discordpp::Client::Status status, discordpp::Client::Error error, int32_t errorDetail)>;
3119
3122 std::function<void(discordpp::ClientResult result, uint64_t lobbyId)>;
3123
3126 std::function<void(discordpp::ClientResult result,
3127 std::vector<discordpp::GuildChannel> guildChannels)>;
3128
3130 using GetUserGuildsCallback = std::function<void(discordpp::ClientResult result,
3131 std::vector<discordpp::GuildMinimal> guilds)>;
3132
3134 using LeaveLobbyCallback = std::function<void(discordpp::ClientResult result)>;
3135
3137 using LinkOrUnlinkChannelCallback = std::function<void(discordpp::ClientResult result)>;
3138
3140 using LobbyCreatedCallback = std::function<void(uint64_t lobbyId)>;
3141
3143 using LobbyDeletedCallback = std::function<void(uint64_t lobbyId)>;
3144
3146 using LobbyMemberAddedCallback = std::function<void(uint64_t lobbyId, uint64_t memberId)>;
3147
3149 using LobbyMemberRemovedCallback = std::function<void(uint64_t lobbyId, uint64_t memberId)>;
3150
3152 using LobbyMemberUpdatedCallback = std::function<void(uint64_t lobbyId, uint64_t memberId)>;
3153
3155 using LobbyUpdatedCallback = std::function<void(uint64_t lobbyId)>;
3156
3159 std::function<void(discordpp::ClientResult result, std::string joinSecret)>;
3160
3163 using SendActivityInviteCallback = std::function<void(discordpp::ClientResult result)>;
3164
3167 using ActivityInviteCallback = std::function<void(discordpp::ActivityInvite invite)>;
3168
3170 using ActivityJoinCallback = std::function<void(std::string joinSecret)>;
3171
3173 using UpdateStatusCallback = std::function<void(discordpp::ClientResult result)>;
3174
3176 using UpdateRichPresenceCallback = std::function<void(discordpp::ClientResult result)>;
3177
3180 using UpdateRelationshipCallback = std::function<void(discordpp::ClientResult result)>;
3181
3184 using SendFriendRequestCallback = std::function<void(discordpp::ClientResult result)>;
3185
3191 std::function<void(uint64_t userId, bool isDiscordRelationshipUpdate)>;
3192
3198 std::function<void(uint64_t userId, bool isDiscordRelationshipUpdate)>;
3199
3202 std::function<void(discordpp::ClientResult result,
3203 std::optional<discordpp::UserHandle> user)>;
3204
3206 using UserUpdatedCallback = std::function<void(uint64_t userId)>;
3208 Discord_Client* instance() const { return &instance_; }
3211 explicit Client(Discord_Client instance, DiscordObjectState state);
3212 ~Client();
3215 Client(Client&& other) noexcept;
3217 Client& operator=(Client&& other) noexcept;
3219 static const Client nullobj;
3221 operator bool() const { return state_ != DiscordObjectState::Invalid; }
3222
3223 Client(const Client&) = delete;
3224 Client& operator=(const Client&) = delete;
3225
3227 explicit Client();
3228
3230 explicit Client(std::string apiBase, std::string webBase);
3231
3233 void Drop();
3235
3237 static std::string ErrorToString(discordpp::Client::Error type);
3238
3244
3247 static std::string GetDefaultAudioDeviceId();
3248
3263 static std::string GetDefaultCommunicationScopes();
3264
3275 static std::string GetDefaultPresenceScopes();
3276
3278 static std::string GetVersionHash();
3279
3281 static int32_t GetVersionMajor();
3282
3284 static int32_t GetVersionMinor();
3285
3287 static int32_t GetVersionPatch();
3288
3290 void SetHttpRequestTimeout(int32_t httpTimeoutInMilliseconds);
3291
3294
3297
3300
3303 void EndCall(uint64_t channelId, discordpp::Client::EndCallCallback callback);
3304
3308
3310 discordpp::Call GetCall(uint64_t channelId);
3311
3313 std::vector<discordpp::Call> GetCalls();
3314
3317
3320
3323
3329
3332
3338
3340 bool GetSelfDeafAll() const;
3341
3343 bool GetSelfMuteAll() const;
3344
3353
3357
3364 void SetEchoCancellation(bool on);
3365
3376 void SetEngineManagedAudioSession(bool isEngineManaged);
3377
3382
3387 void SetInputVolume(float inputVolume);
3388
3392
3401 void SetNoAudioInputThreshold(float dBFSThreshold);
3402
3409 void SetNoiseSuppression(bool on);
3410
3417 void SetOpusHardwareCoding(bool encode, bool decode);
3418
3423
3428 void SetOutputVolume(float outputVolume);
3429
3434 void SetSelfDeafAll(bool deaf);
3435
3438 void SetSelfMuteAll(bool mute);
3439
3443 bool SetSpeakerMode(bool speakerMode);
3444
3451 void SetThreadPriority(discordpp::Client::Thread thread, int32_t priority);
3452
3459
3462
3473 discordpp::Call StartCall(uint64_t channelId);
3474
3494 uint64_t lobbyId,
3498
3501
3507
3510
3606
3613
3619
3626 std::string const& token,
3628
3662 void GetProvisionalToken(uint64_t applicationId,
3664 std::string const& externalAuthToken,
3666
3690 void GetToken(uint64_t applicationId,
3691 std::string const& code,
3692 std::string const& codeVerifier,
3693 std::string const& redirectUri,
3695
3723
3763 std::string const& externalAuthToken,
3765
3796 void GetTokenFromProvisionalMerge(uint64_t applicationId,
3797 std::string const& code,
3798 std::string const& codeVerifier,
3799 std::string const& redirectUri,
3801 std::string const& externalAuthToken,
3803
3807
3812 void OpenAuthorizeDeviceScreen(uint64_t clientId, std::string const& userCode);
3813
3821
3836 void RefreshToken(uint64_t applicationId,
3837 std::string const& refreshToken,
3839
3844
3850 void SetGameWindowPid(int32_t pid);
3851
3865
3872 std::string const& name,
3874
3882 std::string token,
3885
3888
3894 bool CanOpenMessageInDiscord(uint64_t messageId);
3895
3897 void DeleteUserMessage(uint64_t recipientId,
3898 uint64_t messageId,
3900
3904 void EditUserMessage(uint64_t recipientId,
3905 uint64_t messageId,
3906 std::string const& content,
3908
3915 std::optional<discordpp::ChannelHandle> GetChannelHandle(uint64_t channelId) const;
3916
3921 std::optional<discordpp::MessageHandle> GetMessageHandle(uint64_t messageId) const;
3922
3929 uint64_t messageId,
3930 discordpp::Client::ProvisionalUserMergeRequiredCallback provisionalUserMergeRequiredCallback,
3932
3943 void SendLobbyMessage(uint64_t lobbyId,
3944 std::string const& content,
3946
3953 void SendLobbyMessageWithMetadata(uint64_t lobbyId,
3954 std::string const& content,
3955 std::unordered_map<std::string, std::string> const& metadata,
3957
3970 void SendUserMessage(uint64_t recipientId,
3971 std::string const& content,
3973
3980 void SendUserMessageWithMetadata(uint64_t recipientId,
3981 std::string const& content,
3982 std::unordered_map<std::string, std::string> const& metadata,
3984
3997
4005
4013
4024 void SetShowingChat(bool showingChat);
4026
4029
4040 discordpp::LoggingSeverity minSeverity);
4041
4048 discordpp::LoggingSeverity minSeverity);
4049
4056 void Connect();
4057
4064
4068
4078
4083 void SetApplicationId(uint64_t applicationId);
4084
4099 bool SetLogDir(std::string const& path, discordpp::LoggingSeverity minSeverity);
4100
4103
4116 void SetVoiceLogDir(std::string const& path, discordpp::LoggingSeverity minSeverity);
4118
4121
4139 void CreateOrJoinLobby(std::string const& secret,
4141
4149 std::string const& secret,
4150 std::unordered_map<std::string, std::string> const& lobbyMetadata,
4151 std::unordered_map<std::string, std::string> const& memberMetadata,
4153
4160
4162 std::optional<discordpp::LobbyHandle> GetLobbyHandle(uint64_t lobbyId) const;
4163
4169 std::vector<uint64_t> GetLobbyIds() const;
4170
4178
4185 void LeaveLobby(uint64_t lobbyId, discordpp::Client::LeaveLobbyCallback callback);
4186
4191 void LinkChannelToLobby(uint64_t lobbyId,
4192 uint64_t channelId,
4194
4207
4218
4227
4236
4243
4247
4253 void UnlinkChannelFromLobby(uint64_t lobbyId,
4256
4259
4267
4270
4290 bool RegisterLaunchCommand(uint64_t applicationId, std::string command);
4291
4298 bool RegisterLaunchSteamApplication(uint64_t applicationId, uint32_t steamAppId);
4299
4310 void SendActivityInvite(uint64_t userId,
4311 std::string const& content,
4313
4321
4327
4337
4344
4352
4356
4376
4379
4385 void AcceptDiscordFriendRequest(uint64_t userId,
4387
4393
4401
4407 void CancelDiscordFriendRequest(uint64_t userId,
4409
4415
4419
4422 std::vector<discordpp::RelationshipHandle> GetRelationships() const;
4423
4429 void RejectDiscordFriendRequest(uint64_t userId,
4431
4437
4442 void RemoveDiscordAndGameFriend(uint64_t userId,
4444
4449
4454 std::vector<discordpp::UserHandle> SearchFriendsByUsername(std::string searchStr) const;
4455
4471 void SendDiscordFriendRequest(std::string const& username,
4473
4489 void SendDiscordFriendRequestById(uint64_t userId,
4491
4507 void SendGameFriendRequest(std::string const& username,
4509
4525 void SendGameFriendRequestById(uint64_t userId,
4527
4534
4541
4548
4551
4559
4564 uint64_t applicationId,
4566
4572 std::optional<discordpp::UserHandle> GetUser(uint64_t userId) const;
4573
4580};
4581
4585 mutable Discord_CallInfoHandle instance_{};
4588
4589public:
4591 Discord_CallInfoHandle* instance() const { return &instance_; }
4594 explicit CallInfoHandle(Discord_CallInfoHandle instance, DiscordObjectState state);
4604 operator bool() const { return state_ != DiscordObjectState::Invalid; }
4605
4610
4612 void Drop();
4614
4616 uint64_t ChannelId() const;
4617
4619 std::vector<uint64_t> GetParticipants() const;
4620
4623 std::optional<discordpp::VoiceStateHandle> GetVoiceStateHandle(uint64_t userId) const;
4624
4626 uint64_t GuildId() const;
4627};
4628
4630{
4631 switch (value) {
4633 return "Join";
4635 return "JoinRequest";
4636 default:
4637 return "unknown";
4638 }
4639}
4640
4642{
4643 switch (value) {
4645 return "Private";
4647 return "Public";
4648 default:
4649 return "unknown";
4650 }
4651}
4652
4654{
4655 switch (value) {
4657 return "Playing";
4659 return "Streaming";
4661 return "Listening";
4663 return "Watching";
4665 return "CustomStatus";
4667 return "Competing";
4669 return "HangStatus";
4670 default:
4671 return "unknown";
4672 }
4673}
4674
4676{
4677 switch (value) {
4679 return "Desktop";
4681 return "Xbox";
4683 return "Samsung";
4685 return "IOS";
4687 return "Android";
4689 return "Embedded";
4691 return "PS4";
4693 return "PS5";
4694 default:
4695 return "unknown";
4696 }
4697}
4698
4699inline const char* EnumToString(discordpp::ErrorType value)
4700{
4701 switch (value) {
4703 return "None";
4705 return "NetworkError";
4707 return "HTTPError";
4709 return "ClientNotReady";
4711 return "Disabled";
4713 return "ClientDestroyed";
4715 return "ValidationError";
4717 return "Aborted";
4719 return "AuthorizationFailed";
4721 return "RPCError";
4722 default:
4723 return "unknown";
4724 }
4725}
4726
4728{
4729 switch (value) {
4731 return "None";
4733 return "Continue";
4735 return "SwitchingProtocols";
4737 return "Processing";
4739 return "EarlyHints";
4741 return "Ok";
4743 return "Created";
4745 return "Accepted";
4747 return "NonAuthoritativeInfo";
4749 return "NoContent";
4751 return "ResetContent";
4753 return "PartialContent";
4755 return "MultiStatus";
4757 return "AlreadyReported";
4759 return "ImUsed";
4761 return "MultipleChoices";
4763 return "MovedPermanently";
4765 return "Found";
4767 return "SeeOther";
4769 return "NotModified";
4771 return "TemporaryRedirect";
4773 return "PermanentRedirect";
4775 return "BadRequest";
4777 return "Unauthorized";
4779 return "PaymentRequired";
4781 return "Forbidden";
4783 return "NotFound";
4785 return "MethodNotAllowed";
4787 return "NotAcceptable";
4789 return "ProxyAuthRequired";
4791 return "RequestTimeout";
4793 return "Conflict";
4795 return "Gone";
4797 return "LengthRequired";
4799 return "PreconditionFailed";
4801 return "PayloadTooLarge";
4803 return "UriTooLong";
4805 return "UnsupportedMediaType";
4807 return "RangeNotSatisfiable";
4809 return "ExpectationFailed";
4811 return "MisdirectedRequest";
4813 return "UnprocessableEntity";
4815 return "Locked";
4817 return "FailedDependency";
4819 return "TooEarly";
4821 return "UpgradeRequired";
4823 return "PreconditionRequired";
4825 return "TooManyRequests";
4827 return "RequestHeaderFieldsTooLarge";
4829 return "InternalServerError";
4831 return "NotImplemented";
4833 return "BadGateway";
4835 return "ServiceUnavailable";
4837 return "GatewayTimeout";
4839 return "HttpVersionNotSupported";
4841 return "VariantAlsoNegotiates";
4843 return "InsufficientStorage";
4845 return "LoopDetected";
4847 return "NotExtended";
4849 return "NetworkAuthorizationRequired";
4850 default:
4851 return "unknown";
4852 }
4853}
4854
4856{
4857 switch (value) {
4859 return "S256";
4860 default:
4861 return "unknown";
4862 }
4863}
4864
4866{
4867 switch (value) {
4869 return "Other";
4871 return "Attachment";
4873 return "Poll";
4875 return "VoiceMessage";
4877 return "Thread";
4879 return "Embed";
4881 return "Sticker";
4882 default:
4883 return "unknown";
4884 }
4885}
4886
4887inline const char* EnumToString(discordpp::Call::Error value)
4888{
4889 switch (value) {
4891 return "None";
4893 return "SignalingConnectionFailed";
4895 return "SignalingUnexpectedClose";
4897 return "VoiceConnectionFailed";
4899 return "JoinTimeout";
4901 return "Forbidden";
4902 default:
4903 return "unknown";
4904 }
4905}
4906
4908{
4909 switch (value) {
4911 return "MODE_UNINIT";
4913 return "MODE_VAD";
4915 return "MODE_PTT";
4916 default:
4917 return "unknown";
4918 }
4919}
4920
4921inline const char* EnumToString(discordpp::Call::Status value)
4922{
4923 switch (value) {
4925 return "Disconnected";
4927 return "Joining";
4929 return "Connecting";
4931 return "SignalingConnected";
4933 return "Connected";
4935 return "Reconnecting";
4937 return "Disconnecting";
4938 default:
4939 return "unknown";
4940 }
4941}
4942
4943inline const char* EnumToString(discordpp::ChannelType value)
4944{
4945 switch (value) {
4947 return "GuildText";
4949 return "Dm";
4951 return "GuildVoice";
4953 return "GroupDm";
4955 return "GuildCategory";
4957 return "GuildNews";
4959 return "GuildStore";
4961 return "GuildNewsThread";
4963 return "GuildPublicThread";
4965 return "GuildPrivateThread";
4967 return "GuildStageVoice";
4969 return "GuildDirectory";
4971 return "GuildForum";
4973 return "GuildMedia";
4975 return "Lobby";
4977 return "EphemeralDm";
4978 default:
4979 return "unknown";
4980 }
4981}
4982
4984{
4985 switch (value) {
4987 return "None";
4989 return "Friend";
4991 return "Blocked";
4993 return "PendingIncoming";
4995 return "PendingOutgoing";
4997 return "Implicit";
4999 return "Suggestion";
5000 default:
5001 return "unknown";
5002 }
5003}
5004
5006{
5007 switch (value) {
5009 return "Gif";
5011 return "Webp";
5013 return "Png";
5015 return "Jpeg";
5016 default:
5017 return "unknown";
5018 }
5019}
5020
5021inline const char* EnumToString(discordpp::StatusType value)
5022{
5023 switch (value) {
5025 return "Online";
5027 return "Offline";
5029 return "Blocked";
5031 return "Idle";
5033 return "Dnd";
5035 return "Invisible";
5037 return "Streaming";
5039 return "Unknown";
5040 default:
5041 return "unknown";
5042 }
5043}
5044
5046{
5047 switch (value) {
5049 return "MessageDataVisibleOnDiscord";
5050 default:
5051 return "unknown";
5052 }
5053}
5054
5056{
5057 switch (value) {
5059 return "None";
5061 return "ConnectionFailed";
5063 return "UnexpectedClose";
5065 return "ConnectionCanceled";
5066 default:
5067 return "unknown";
5068 }
5069}
5070
5072{
5073 switch (value) {
5075 return "Disconnected";
5077 return "Connecting";
5079 return "Connected";
5081 return "Ready";
5083 return "Reconnecting";
5085 return "Disconnecting";
5087 return "HttpWait";
5088 default:
5089 return "unknown";
5090 }
5091}
5092
5094{
5095 switch (value) {
5097 return "Client";
5099 return "Voice";
5101 return "Network";
5102 default:
5103 return "unknown";
5104 }
5105}
5106
5108{
5109 switch (value) {
5111 return "User";
5113 return "Bearer";
5114 default:
5115 return "unknown";
5116 }
5117}
5118
5120{
5121 switch (value) {
5123 return "OIDC";
5125 return "EpicOnlineServicesAccessToken";
5127 return "EpicOnlineServicesIdToken";
5129 return "SteamSessionTicket";
5131 return "UnityServicesIdToken";
5132 default:
5133 return "unknown";
5134 }
5135}
5136
5138{
5139 switch (value) {
5141 return "Verbose";
5143 return "Info";
5145 return "Warning";
5147 return "Error";
5149 return "None";
5150 default:
5151 return "unknown";
5152 }
5153}
5154} // namespace discordpp
5155#endif // DISCORD_HEADER_DISCORDPP_H_
5156#ifdef DISCORDPP_IMPLEMENTATION
5157#undef DISCORDPP_IMPLEMENTATION
5158#ifdef __clang__
5159#pragma clang diagnostic push
5160#pragma clang diagnostic ignored "-Wunused-parameter"
5161#endif
5162namespace discordpp {
5163std::function<void(std::function<void()>)> s_synchronizationContext;
5164
5165inline bool HasSynchronizationContext()
5166{
5167 return !!s_synchronizationContext;
5168}
5169
5170inline void PostTask(std::function<void()> task)
5171{
5172 assert(s_synchronizationContext);
5173 s_synchronizationContext(std::move(task));
5174}
5175
5176void SetSynchronizationContext(std::function<void(std::function<void()>)> executor)
5177{
5178 s_synchronizationContext = std::move(executor);
5179}
5180
5181template <typename T>
5182struct TDelegateUserData {
5183 T delegate;
5184 TDelegateUserData(T delegate)
5185 : delegate{delegate}
5186 {
5187 }
5188
5189 static void Free(void* ptr) { delete reinterpret_cast<TDelegateUserData*>(ptr); }
5190
5191 static T& Get(void* userData)
5192 {
5193 return reinterpret_cast<TDelegateUserData*>(userData)->delegate;
5194 }
5195};
5196
5197struct ConvertedProperties {
5198 ConvertedProperties(std::unordered_map<std::string, std::string> const& PropertyMap)
5199 {
5200 Properties.size = PropertyMap.size();
5201 Properties.keys = reinterpret_cast<Discord_String*>(
5202 Discord_Alloc(Properties.size * sizeof(Discord_String)));
5203 Properties.values = reinterpret_cast<Discord_String*>(
5204 Discord_Alloc(Properties.size * sizeof(Discord_String)));
5205 size_t i = 0;
5206 for (auto& pair : PropertyMap) {
5207 Properties.keys[i] = AllocateString(pair.first);
5208 Properties.values[i] = AllocateString(pair.second);
5209 ++i;
5210 }
5211 }
5212 ~ConvertedProperties() { Discord_FreeProperties(Properties); }
5213 Discord_Properties Properties{};
5214
5215private:
5216 Discord_String AllocateString(std::string const& str)
5217 {
5218 Discord_String result;
5219 result.ptr = reinterpret_cast<uint8_t*>(Discord_Alloc(str.size()));
5220 result.size = str.size();
5221 std::memcpy(result.ptr, str.data(), result.size);
5222 return result;
5223 }
5224};
5225
5226std::unordered_map<std::string, std::string> ConvertReturnedProperties(
5227 Discord_Properties const& Properties)
5228{
5229 std::unordered_map<std::string, std::string> result;
5230 for (size_t i = 0; i < Properties.size; ++i) {
5231 std::string key(reinterpret_cast<char*>(Properties.keys[i].ptr), Properties.keys[i].size);
5232 std::string value(reinterpret_cast<char*>(Properties.values[i].ptr),
5233 Properties.values[i].size);
5234 result.emplace(std::move(key), std::move(value));
5235 }
5236 return result;
5237}
5239ActivityInvite::~ActivityInvite()
5240{
5241 if (state_ == DiscordObjectState::Owned) {
5242 Drop();
5244 }
5245}
5247 : instance_(other.instance_)
5248 , state_(other.state_)
5249{
5250 other.state_ = DiscordObjectState::Invalid;
5251}
5253{
5254 if (this != &other) {
5255 if (state_ == DiscordObjectState::Owned) {
5256 Drop();
5257 }
5258 instance_ = other.instance_;
5259 state_ = other.state_;
5260 other.state_ = DiscordObjectState::Invalid;
5261 }
5262 return *this;
5263}
5265 : instance_{}
5266 , state_(DiscordObjectState::Invalid)
5267{
5268 if (rhs.state_ == DiscordObjectState::Owned) {
5269 Discord_ActivityInvite_Clone(&instance_, rhs.instance());
5270
5271 state_ = DiscordObjectState::Owned;
5272 }
5273}
5274ActivityInvite& ActivityInvite::operator=(const ActivityInvite& rhs)
5275{
5276 if (this != &rhs) {
5277 if (state_ == DiscordObjectState::Owned) {
5278 Drop();
5279 state_ = DiscordObjectState::Invalid;
5280 }
5281 if (rhs.state_ == DiscordObjectState::Owned) {
5282 Discord_ActivityInvite_Clone(&instance_, rhs.instance());
5283
5284 state_ = DiscordObjectState::Owned;
5285 }
5286 }
5287 return *this;
5288}
5289ActivityInvite::ActivityInvite(Discord_ActivityInvite instance, DiscordObjectState state)
5290 : instance_(instance)
5291 , state_(state)
5292{
5293}
5294ActivityInvite::ActivityInvite()
5295{
5296 assert(state_ == DiscordObjectState::Invalid);
5297 Discord_ActivityInvite_Init(&instance_);
5298 state_ = DiscordObjectState::Owned;
5299}
5300void ActivityInvite::Drop()
5301{
5302 if (state_ != DiscordObjectState::Owned) {
5303 return;
5304 }
5305 Discord_ActivityInvite_Drop(&instance_);
5306 state_ = DiscordObjectState::Invalid;
5307}
5308uint64_t ActivityInvite::SenderId() const
5309{
5310 assert(state_ == DiscordObjectState::Owned);
5311 uint64_t returnValue__;
5312 returnValue__ = Discord_ActivityInvite_SenderId(&instance_);
5313 return returnValue__;
5314}
5315void ActivityInvite::SetSenderId(uint64_t SenderId)
5316{
5317 assert(state_ == DiscordObjectState::Owned);
5318 Discord_ActivityInvite_SetSenderId(&instance_, SenderId);
5319}
5320uint64_t ActivityInvite::ChannelId() const
5321{
5322 assert(state_ == DiscordObjectState::Owned);
5323 uint64_t returnValue__;
5324 returnValue__ = Discord_ActivityInvite_ChannelId(&instance_);
5325 return returnValue__;
5326}
5327void ActivityInvite::SetChannelId(uint64_t ChannelId)
5328{
5329 assert(state_ == DiscordObjectState::Owned);
5330 Discord_ActivityInvite_SetChannelId(&instance_, ChannelId);
5331}
5332uint64_t ActivityInvite::MessageId() const
5333{
5334 assert(state_ == DiscordObjectState::Owned);
5335 uint64_t returnValue__;
5336 returnValue__ = Discord_ActivityInvite_MessageId(&instance_);
5337 return returnValue__;
5338}
5339void ActivityInvite::SetMessageId(uint64_t MessageId)
5340{
5341 assert(state_ == DiscordObjectState::Owned);
5342 Discord_ActivityInvite_SetMessageId(&instance_, MessageId);
5343}
5344discordpp::ActivityActionTypes ActivityInvite::Type() const
5345{
5346 assert(state_ == DiscordObjectState::Owned);
5347 Discord_ActivityActionTypes returnValue__;
5348 returnValue__ = Discord_ActivityInvite_Type(&instance_);
5349 return static_cast<discordpp::ActivityActionTypes>(returnValue__);
5350}
5351void ActivityInvite::SetType(discordpp::ActivityActionTypes Type)
5352{
5353 assert(state_ == DiscordObjectState::Owned);
5354 Discord_ActivityInvite_SetType(&instance_, static_cast<Discord_ActivityActionTypes>(Type));
5355}
5356uint64_t ActivityInvite::ApplicationId() const
5357{
5358 assert(state_ == DiscordObjectState::Owned);
5359 uint64_t returnValue__;
5360 returnValue__ = Discord_ActivityInvite_ApplicationId(&instance_);
5361 return returnValue__;
5362}
5363void ActivityInvite::SetApplicationId(uint64_t ApplicationId)
5364{
5365 assert(state_ == DiscordObjectState::Owned);
5366 Discord_ActivityInvite_SetApplicationId(&instance_, ApplicationId);
5367}
5368std::string ActivityInvite::PartyId() const
5369{
5370 assert(state_ == DiscordObjectState::Owned);
5371 Discord_String returnValueNative__;
5372 Discord_ActivityInvite_PartyId(&instance_, &returnValueNative__);
5373 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5374 returnValueNative__.size);
5375 Discord_Free(returnValueNative__.ptr);
5376 return returnValue__;
5377}
5378void ActivityInvite::SetPartyId(std::string PartyId)
5379{
5380 assert(state_ == DiscordObjectState::Owned);
5381 Discord_String PartyId__str{(uint8_t*)(PartyId.data()), PartyId.size()};
5382 Discord_ActivityInvite_SetPartyId(&instance_, PartyId__str);
5383}
5384std::string ActivityInvite::SessionId() const
5385{
5386 assert(state_ == DiscordObjectState::Owned);
5387 Discord_String returnValueNative__;
5388 Discord_ActivityInvite_SessionId(&instance_, &returnValueNative__);
5389 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5390 returnValueNative__.size);
5391 Discord_Free(returnValueNative__.ptr);
5392 return returnValue__;
5393}
5394void ActivityInvite::SetSessionId(std::string SessionId)
5395{
5396 assert(state_ == DiscordObjectState::Owned);
5397 Discord_String SessionId__str{(uint8_t*)(SessionId.data()), SessionId.size()};
5398 Discord_ActivityInvite_SetSessionId(&instance_, SessionId__str);
5399}
5400bool ActivityInvite::IsValid() const
5401{
5402 assert(state_ == DiscordObjectState::Owned);
5403 bool returnValue__;
5404 returnValue__ = Discord_ActivityInvite_IsValid(&instance_);
5405 return returnValue__;
5406}
5407void ActivityInvite::SetIsValid(bool IsValid)
5408{
5409 assert(state_ == DiscordObjectState::Owned);
5410 Discord_ActivityInvite_SetIsValid(&instance_, IsValid);
5411}
5412const ActivityAssets ActivityAssets::nullobj{{}, DiscordObjectState::Invalid};
5413ActivityAssets::~ActivityAssets()
5414{
5415 if (state_ == DiscordObjectState::Owned) {
5416 Drop();
5417 state_ = DiscordObjectState::Invalid;
5418 }
5419}
5420ActivityAssets::ActivityAssets(ActivityAssets&& other) noexcept
5421 : instance_(other.instance_)
5422 , state_(other.state_)
5423{
5424 other.state_ = DiscordObjectState::Invalid;
5425}
5426ActivityAssets& ActivityAssets::operator=(ActivityAssets&& other) noexcept
5427{
5428 if (this != &other) {
5429 if (state_ == DiscordObjectState::Owned) {
5430 Drop();
5431 }
5432 instance_ = other.instance_;
5433 state_ = other.state_;
5434 other.state_ = DiscordObjectState::Invalid;
5435 }
5436 return *this;
5437}
5438ActivityAssets::ActivityAssets(const ActivityAssets& arg0)
5439 : instance_{}
5440 , state_(DiscordObjectState::Invalid)
5441{
5442 if (arg0.state_ == DiscordObjectState::Owned) {
5443 Discord_ActivityAssets_Clone(&instance_, arg0.instance());
5444
5445 state_ = DiscordObjectState::Owned;
5446 }
5447}
5448ActivityAssets& ActivityAssets::operator=(const ActivityAssets& arg0)
5449{
5450 if (this != &arg0) {
5451 if (state_ == DiscordObjectState::Owned) {
5452 Drop();
5453 state_ = DiscordObjectState::Invalid;
5454 }
5455 if (arg0.state_ == DiscordObjectState::Owned) {
5456 Discord_ActivityAssets_Clone(&instance_, arg0.instance());
5457
5458 state_ = DiscordObjectState::Owned;
5459 }
5460 }
5461 return *this;
5462}
5463ActivityAssets::ActivityAssets(Discord_ActivityAssets instance, DiscordObjectState state)
5464 : instance_(instance)
5465 , state_(state)
5466{
5467}
5468ActivityAssets::ActivityAssets()
5469{
5470 assert(state_ == DiscordObjectState::Invalid);
5471 Discord_ActivityAssets_Init(&instance_);
5472 state_ = DiscordObjectState::Owned;
5473}
5474void ActivityAssets::Drop()
5475{
5476 if (state_ != DiscordObjectState::Owned) {
5477 return;
5478 }
5479 Discord_ActivityAssets_Drop(&instance_);
5480 state_ = DiscordObjectState::Invalid;
5481}
5482std::optional<std::string> ActivityAssets::LargeImage() const
5483{
5484 assert(state_ == DiscordObjectState::Owned);
5485 bool returnIsNonNull__;
5486 Discord_String returnValueNative__;
5487 returnIsNonNull__ = Discord_ActivityAssets_LargeImage(&instance_, &returnValueNative__);
5488 if (!returnIsNonNull__) {
5489 return {};
5490 }
5491 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5492 returnValueNative__.size);
5493 Discord_Free(returnValueNative__.ptr);
5494 return returnValue__;
5495}
5496void ActivityAssets::SetLargeImage(std::optional<std::string> LargeImage)
5497{
5498 assert(state_ == DiscordObjectState::Owned);
5499 Discord_String LargeImage__str{};
5500 if (LargeImage.has_value()) {
5501 LargeImage__str.ptr = reinterpret_cast<uint8_t*>(LargeImage->data());
5502 LargeImage__str.size = LargeImage->size();
5503 }
5504 Discord_ActivityAssets_SetLargeImage(&instance_,
5505 (LargeImage.has_value() ? &LargeImage__str : nullptr));
5506}
5507std::optional<std::string> ActivityAssets::LargeText() const
5508{
5509 assert(state_ == DiscordObjectState::Owned);
5510 bool returnIsNonNull__;
5511 Discord_String returnValueNative__;
5512 returnIsNonNull__ = Discord_ActivityAssets_LargeText(&instance_, &returnValueNative__);
5513 if (!returnIsNonNull__) {
5514 return {};
5515 }
5516 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5517 returnValueNative__.size);
5518 Discord_Free(returnValueNative__.ptr);
5519 return returnValue__;
5520}
5521void ActivityAssets::SetLargeText(std::optional<std::string> LargeText)
5522{
5523 assert(state_ == DiscordObjectState::Owned);
5524 Discord_String LargeText__str{};
5525 if (LargeText.has_value()) {
5526 LargeText__str.ptr = reinterpret_cast<uint8_t*>(LargeText->data());
5527 LargeText__str.size = LargeText->size();
5528 }
5529 Discord_ActivityAssets_SetLargeText(&instance_,
5530 (LargeText.has_value() ? &LargeText__str : nullptr));
5531}
5532std::optional<std::string> ActivityAssets::SmallImage() const
5533{
5534 assert(state_ == DiscordObjectState::Owned);
5535 bool returnIsNonNull__;
5536 Discord_String returnValueNative__;
5537 returnIsNonNull__ = Discord_ActivityAssets_SmallImage(&instance_, &returnValueNative__);
5538 if (!returnIsNonNull__) {
5539 return {};
5540 }
5541 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5542 returnValueNative__.size);
5543 Discord_Free(returnValueNative__.ptr);
5544 return returnValue__;
5545}
5546void ActivityAssets::SetSmallImage(std::optional<std::string> SmallImage)
5547{
5548 assert(state_ == DiscordObjectState::Owned);
5549 Discord_String SmallImage__str{};
5550 if (SmallImage.has_value()) {
5551 SmallImage__str.ptr = reinterpret_cast<uint8_t*>(SmallImage->data());
5552 SmallImage__str.size = SmallImage->size();
5553 }
5554 Discord_ActivityAssets_SetSmallImage(&instance_,
5555 (SmallImage.has_value() ? &SmallImage__str : nullptr));
5556}
5557std::optional<std::string> ActivityAssets::SmallText() const
5558{
5559 assert(state_ == DiscordObjectState::Owned);
5560 bool returnIsNonNull__;
5561 Discord_String returnValueNative__;
5562 returnIsNonNull__ = Discord_ActivityAssets_SmallText(&instance_, &returnValueNative__);
5563 if (!returnIsNonNull__) {
5564 return {};
5565 }
5566 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5567 returnValueNative__.size);
5568 Discord_Free(returnValueNative__.ptr);
5569 return returnValue__;
5570}
5571void ActivityAssets::SetSmallText(std::optional<std::string> SmallText)
5572{
5573 assert(state_ == DiscordObjectState::Owned);
5574 Discord_String SmallText__str{};
5575 if (SmallText.has_value()) {
5576 SmallText__str.ptr = reinterpret_cast<uint8_t*>(SmallText->data());
5577 SmallText__str.size = SmallText->size();
5578 }
5579 Discord_ActivityAssets_SetSmallText(&instance_,
5580 (SmallText.has_value() ? &SmallText__str : nullptr));
5581}
5582const ActivityTimestamps ActivityTimestamps::nullobj{{}, DiscordObjectState::Invalid};
5583ActivityTimestamps::~ActivityTimestamps()
5584{
5585 if (state_ == DiscordObjectState::Owned) {
5586 Drop();
5587 state_ = DiscordObjectState::Invalid;
5588 }
5589}
5590ActivityTimestamps::ActivityTimestamps(ActivityTimestamps&& other) noexcept
5591 : instance_(other.instance_)
5592 , state_(other.state_)
5593{
5594 other.state_ = DiscordObjectState::Invalid;
5595}
5596ActivityTimestamps& ActivityTimestamps::operator=(ActivityTimestamps&& other) noexcept
5597{
5598 if (this != &other) {
5599 if (state_ == DiscordObjectState::Owned) {
5600 Drop();
5601 }
5602 instance_ = other.instance_;
5603 state_ = other.state_;
5604 other.state_ = DiscordObjectState::Invalid;
5605 }
5606 return *this;
5607}
5608ActivityTimestamps::ActivityTimestamps(const ActivityTimestamps& arg0)
5609 : instance_{}
5610 , state_(DiscordObjectState::Invalid)
5611{
5612 if (arg0.state_ == DiscordObjectState::Owned) {
5613 Discord_ActivityTimestamps_Clone(&instance_, arg0.instance());
5614
5615 state_ = DiscordObjectState::Owned;
5616 }
5617}
5618ActivityTimestamps& ActivityTimestamps::operator=(const ActivityTimestamps& arg0)
5619{
5620 if (this != &arg0) {
5621 if (state_ == DiscordObjectState::Owned) {
5622 Drop();
5623 state_ = DiscordObjectState::Invalid;
5624 }
5625 if (arg0.state_ == DiscordObjectState::Owned) {
5626 Discord_ActivityTimestamps_Clone(&instance_, arg0.instance());
5627
5628 state_ = DiscordObjectState::Owned;
5629 }
5630 }
5631 return *this;
5632}
5633ActivityTimestamps::ActivityTimestamps(Discord_ActivityTimestamps instance,
5634 DiscordObjectState state)
5635 : instance_(instance)
5636 , state_(state)
5637{
5638}
5639ActivityTimestamps::ActivityTimestamps()
5640{
5641 assert(state_ == DiscordObjectState::Invalid);
5642 Discord_ActivityTimestamps_Init(&instance_);
5643 state_ = DiscordObjectState::Owned;
5644}
5645void ActivityTimestamps::Drop()
5646{
5647 if (state_ != DiscordObjectState::Owned) {
5648 return;
5649 }
5650 Discord_ActivityTimestamps_Drop(&instance_);
5651 state_ = DiscordObjectState::Invalid;
5652}
5653uint64_t ActivityTimestamps::Start() const
5654{
5655 assert(state_ == DiscordObjectState::Owned);
5656 uint64_t returnValue__;
5657 returnValue__ = Discord_ActivityTimestamps_Start(&instance_);
5658 return returnValue__;
5659}
5660void ActivityTimestamps::SetStart(uint64_t Start)
5661{
5662 assert(state_ == DiscordObjectState::Owned);
5663 Discord_ActivityTimestamps_SetStart(&instance_, Start);
5664}
5665uint64_t ActivityTimestamps::End() const
5666{
5667 assert(state_ == DiscordObjectState::Owned);
5668 uint64_t returnValue__;
5669 returnValue__ = Discord_ActivityTimestamps_End(&instance_);
5670 return returnValue__;
5671}
5672void ActivityTimestamps::SetEnd(uint64_t End)
5673{
5674 assert(state_ == DiscordObjectState::Owned);
5675 Discord_ActivityTimestamps_SetEnd(&instance_, End);
5676}
5677const ActivityParty ActivityParty::nullobj{{}, DiscordObjectState::Invalid};
5678ActivityParty::~ActivityParty()
5679{
5680 if (state_ == DiscordObjectState::Owned) {
5681 Drop();
5682 state_ = DiscordObjectState::Invalid;
5683 }
5684}
5685ActivityParty::ActivityParty(ActivityParty&& other) noexcept
5686 : instance_(other.instance_)
5687 , state_(other.state_)
5688{
5689 other.state_ = DiscordObjectState::Invalid;
5690}
5691ActivityParty& ActivityParty::operator=(ActivityParty&& other) noexcept
5692{
5693 if (this != &other) {
5694 if (state_ == DiscordObjectState::Owned) {
5695 Drop();
5696 }
5697 instance_ = other.instance_;
5698 state_ = other.state_;
5699 other.state_ = DiscordObjectState::Invalid;
5700 }
5701 return *this;
5702}
5703ActivityParty::ActivityParty(const ActivityParty& arg0)
5704 : instance_{}
5705 , state_(DiscordObjectState::Invalid)
5706{
5707 if (arg0.state_ == DiscordObjectState::Owned) {
5708 Discord_ActivityParty_Clone(&instance_, arg0.instance());
5709
5710 state_ = DiscordObjectState::Owned;
5711 }
5712}
5713ActivityParty& ActivityParty::operator=(const ActivityParty& arg0)
5714{
5715 if (this != &arg0) {
5716 if (state_ == DiscordObjectState::Owned) {
5717 Drop();
5718 state_ = DiscordObjectState::Invalid;
5719 }
5720 if (arg0.state_ == DiscordObjectState::Owned) {
5721 Discord_ActivityParty_Clone(&instance_, arg0.instance());
5722
5723 state_ = DiscordObjectState::Owned;
5724 }
5725 }
5726 return *this;
5727}
5728ActivityParty::ActivityParty(Discord_ActivityParty instance, DiscordObjectState state)
5729 : instance_(instance)
5730 , state_(state)
5731{
5732}
5733ActivityParty::ActivityParty()
5734{
5735 assert(state_ == DiscordObjectState::Invalid);
5736 Discord_ActivityParty_Init(&instance_);
5737 state_ = DiscordObjectState::Owned;
5738}
5739void ActivityParty::Drop()
5740{
5741 if (state_ != DiscordObjectState::Owned) {
5742 return;
5743 }
5744 Discord_ActivityParty_Drop(&instance_);
5745 state_ = DiscordObjectState::Invalid;
5746}
5747std::string ActivityParty::Id() const
5748{
5749 assert(state_ == DiscordObjectState::Owned);
5750 Discord_String returnValueNative__;
5751 Discord_ActivityParty_Id(&instance_, &returnValueNative__);
5752 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5753 returnValueNative__.size);
5754 Discord_Free(returnValueNative__.ptr);
5755 return returnValue__;
5756}
5757void ActivityParty::SetId(std::string Id)
5758{
5759 assert(state_ == DiscordObjectState::Owned);
5760 Discord_String Id__str{(uint8_t*)(Id.data()), Id.size()};
5761 Discord_ActivityParty_SetId(&instance_, Id__str);
5762}
5763int32_t ActivityParty::CurrentSize() const
5764{
5765 assert(state_ == DiscordObjectState::Owned);
5766 int32_t returnValue__;
5767 returnValue__ = Discord_ActivityParty_CurrentSize(&instance_);
5768 return returnValue__;
5769}
5770void ActivityParty::SetCurrentSize(int32_t CurrentSize)
5771{
5772 assert(state_ == DiscordObjectState::Owned);
5773 Discord_ActivityParty_SetCurrentSize(&instance_, CurrentSize);
5774}
5775int32_t ActivityParty::MaxSize() const
5776{
5777 assert(state_ == DiscordObjectState::Owned);
5778 int32_t returnValue__;
5779 returnValue__ = Discord_ActivityParty_MaxSize(&instance_);
5780 return returnValue__;
5781}
5782void ActivityParty::SetMaxSize(int32_t MaxSize)
5783{
5784 assert(state_ == DiscordObjectState::Owned);
5785 Discord_ActivityParty_SetMaxSize(&instance_, MaxSize);
5786}
5787discordpp::ActivityPartyPrivacy ActivityParty::Privacy() const
5788{
5789 assert(state_ == DiscordObjectState::Owned);
5790 Discord_ActivityPartyPrivacy returnValue__;
5791 returnValue__ = Discord_ActivityParty_Privacy(&instance_);
5792 return static_cast<discordpp::ActivityPartyPrivacy>(returnValue__);
5793}
5794void ActivityParty::SetPrivacy(discordpp::ActivityPartyPrivacy Privacy)
5795{
5796 assert(state_ == DiscordObjectState::Owned);
5797 Discord_ActivityParty_SetPrivacy(&instance_,
5798 static_cast<Discord_ActivityPartyPrivacy>(Privacy));
5799}
5800const ActivitySecrets ActivitySecrets::nullobj{{}, DiscordObjectState::Invalid};
5801ActivitySecrets::~ActivitySecrets()
5802{
5803 if (state_ == DiscordObjectState::Owned) {
5804 Drop();
5805 state_ = DiscordObjectState::Invalid;
5806 }
5807}
5808ActivitySecrets::ActivitySecrets(ActivitySecrets&& other) noexcept
5809 : instance_(other.instance_)
5810 , state_(other.state_)
5811{
5812 other.state_ = DiscordObjectState::Invalid;
5813}
5814ActivitySecrets& ActivitySecrets::operator=(ActivitySecrets&& other) noexcept
5815{
5816 if (this != &other) {
5817 if (state_ == DiscordObjectState::Owned) {
5818 Drop();
5819 }
5820 instance_ = other.instance_;
5821 state_ = other.state_;
5822 other.state_ = DiscordObjectState::Invalid;
5823 }
5824 return *this;
5825}
5826ActivitySecrets::ActivitySecrets(const ActivitySecrets& arg0)
5827 : instance_{}
5828 , state_(DiscordObjectState::Invalid)
5829{
5830 if (arg0.state_ == DiscordObjectState::Owned) {
5831 Discord_ActivitySecrets_Clone(&instance_, arg0.instance());
5832
5833 state_ = DiscordObjectState::Owned;
5834 }
5835}
5836ActivitySecrets& ActivitySecrets::operator=(const ActivitySecrets& arg0)
5837{
5838 if (this != &arg0) {
5839 if (state_ == DiscordObjectState::Owned) {
5840 Drop();
5841 state_ = DiscordObjectState::Invalid;
5842 }
5843 if (arg0.state_ == DiscordObjectState::Owned) {
5844 Discord_ActivitySecrets_Clone(&instance_, arg0.instance());
5845
5846 state_ = DiscordObjectState::Owned;
5847 }
5848 }
5849 return *this;
5850}
5851ActivitySecrets::ActivitySecrets(Discord_ActivitySecrets instance, DiscordObjectState state)
5852 : instance_(instance)
5853 , state_(state)
5854{
5855}
5856ActivitySecrets::ActivitySecrets()
5857{
5858 assert(state_ == DiscordObjectState::Invalid);
5859 Discord_ActivitySecrets_Init(&instance_);
5860 state_ = DiscordObjectState::Owned;
5861}
5862void ActivitySecrets::Drop()
5863{
5864 if (state_ != DiscordObjectState::Owned) {
5865 return;
5866 }
5867 Discord_ActivitySecrets_Drop(&instance_);
5868 state_ = DiscordObjectState::Invalid;
5869}
5870std::string ActivitySecrets::Join() const
5871{
5872 assert(state_ == DiscordObjectState::Owned);
5873 Discord_String returnValueNative__;
5874 Discord_ActivitySecrets_Join(&instance_, &returnValueNative__);
5875 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5876 returnValueNative__.size);
5877 Discord_Free(returnValueNative__.ptr);
5878 return returnValue__;
5879}
5880void ActivitySecrets::SetJoin(std::string Join)
5881{
5882 assert(state_ == DiscordObjectState::Owned);
5883 Discord_String Join__str{(uint8_t*)(Join.data()), Join.size()};
5884 Discord_ActivitySecrets_SetJoin(&instance_, Join__str);
5885}
5886const ActivityButton ActivityButton::nullobj{{}, DiscordObjectState::Invalid};
5887ActivityButton::~ActivityButton()
5888{
5889 if (state_ == DiscordObjectState::Owned) {
5890 Drop();
5891 state_ = DiscordObjectState::Invalid;
5892 }
5893}
5894ActivityButton::ActivityButton(ActivityButton&& other) noexcept
5895 : instance_(other.instance_)
5896 , state_(other.state_)
5897{
5898 other.state_ = DiscordObjectState::Invalid;
5899}
5900ActivityButton& ActivityButton::operator=(ActivityButton&& other) noexcept
5901{
5902 if (this != &other) {
5903 if (state_ == DiscordObjectState::Owned) {
5904 Drop();
5905 }
5906 instance_ = other.instance_;
5907 state_ = other.state_;
5908 other.state_ = DiscordObjectState::Invalid;
5909 }
5910 return *this;
5911}
5912ActivityButton::ActivityButton(const ActivityButton& arg0)
5913 : instance_{}
5914 , state_(DiscordObjectState::Invalid)
5915{
5916 if (arg0.state_ == DiscordObjectState::Owned) {
5917 Discord_ActivityButton_Clone(&instance_, arg0.instance());
5918
5919 state_ = DiscordObjectState::Owned;
5920 }
5921}
5922ActivityButton& ActivityButton::operator=(const ActivityButton& arg0)
5923{
5924 if (this != &arg0) {
5925 if (state_ == DiscordObjectState::Owned) {
5926 Drop();
5927 state_ = DiscordObjectState::Invalid;
5928 }
5929 if (arg0.state_ == DiscordObjectState::Owned) {
5930 Discord_ActivityButton_Clone(&instance_, arg0.instance());
5931
5932 state_ = DiscordObjectState::Owned;
5933 }
5934 }
5935 return *this;
5936}
5937ActivityButton::ActivityButton(Discord_ActivityButton instance, DiscordObjectState state)
5938 : instance_(instance)
5939 , state_(state)
5940{
5941}
5942ActivityButton::ActivityButton()
5943{
5944 assert(state_ == DiscordObjectState::Invalid);
5945 Discord_ActivityButton_Init(&instance_);
5946 state_ = DiscordObjectState::Owned;
5947}
5948void ActivityButton::Drop()
5949{
5950 if (state_ != DiscordObjectState::Owned) {
5951 return;
5952 }
5953 Discord_ActivityButton_Drop(&instance_);
5954 state_ = DiscordObjectState::Invalid;
5955}
5956std::string ActivityButton::Label() const
5957{
5958 assert(state_ == DiscordObjectState::Owned);
5959 Discord_String returnValueNative__;
5960 Discord_ActivityButton_Label(&instance_, &returnValueNative__);
5961 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5962 returnValueNative__.size);
5963 Discord_Free(returnValueNative__.ptr);
5964 return returnValue__;
5965}
5966void ActivityButton::SetLabel(std::string Label)
5967{
5968 assert(state_ == DiscordObjectState::Owned);
5969 Discord_String Label__str{(uint8_t*)(Label.data()), Label.size()};
5970 Discord_ActivityButton_SetLabel(&instance_, Label__str);
5971}
5972std::string ActivityButton::Url() const
5973{
5974 assert(state_ == DiscordObjectState::Owned);
5975 Discord_String returnValueNative__;
5976 Discord_ActivityButton_Url(&instance_, &returnValueNative__);
5977 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
5978 returnValueNative__.size);
5979 Discord_Free(returnValueNative__.ptr);
5980 return returnValue__;
5981}
5982void ActivityButton::SetUrl(std::string Url)
5983{
5984 assert(state_ == DiscordObjectState::Owned);
5985 Discord_String Url__str{(uint8_t*)(Url.data()), Url.size()};
5986 Discord_ActivityButton_SetUrl(&instance_, Url__str);
5987}
5988const Activity Activity::nullobj{{}, DiscordObjectState::Invalid};
5989Activity::~Activity()
5990{
5991 if (state_ == DiscordObjectState::Owned) {
5992 Drop();
5993 state_ = DiscordObjectState::Invalid;
5994 }
5995}
5996Activity::Activity(Activity&& other) noexcept
5997 : instance_(other.instance_)
5998 , state_(other.state_)
5999{
6000 other.state_ = DiscordObjectState::Invalid;
6001}
6002Activity& Activity::operator=(Activity&& other) noexcept
6003{
6004 if (this != &other) {
6005 if (state_ == DiscordObjectState::Owned) {
6006 Drop();
6007 }
6008 instance_ = other.instance_;
6009 state_ = other.state_;
6010 other.state_ = DiscordObjectState::Invalid;
6011 }
6012 return *this;
6013}
6014Activity::Activity(const Activity& arg0)
6015 : instance_{}
6016 , state_(DiscordObjectState::Invalid)
6017{
6018 if (arg0.state_ == DiscordObjectState::Owned) {
6019 Discord_Activity_Clone(&instance_, arg0.instance());
6020
6021 state_ = DiscordObjectState::Owned;
6022 }
6023}
6024Activity& Activity::operator=(const Activity& arg0)
6025{
6026 if (this != &arg0) {
6027 if (state_ == DiscordObjectState::Owned) {
6028 Drop();
6029 state_ = DiscordObjectState::Invalid;
6030 }
6031 if (arg0.state_ == DiscordObjectState::Owned) {
6032 Discord_Activity_Clone(&instance_, arg0.instance());
6033
6034 state_ = DiscordObjectState::Owned;
6035 }
6036 }
6037 return *this;
6038}
6039Activity::Activity(Discord_Activity instance, DiscordObjectState state)
6040 : instance_(instance)
6041 , state_(state)
6042{
6043}
6044Activity::Activity()
6045{
6046 assert(state_ == DiscordObjectState::Invalid);
6047 Discord_Activity_Init(&instance_);
6048 state_ = DiscordObjectState::Owned;
6049}
6050void Activity::Drop()
6051{
6052 if (state_ != DiscordObjectState::Owned) {
6053 return;
6054 }
6055 Discord_Activity_Drop(&instance_);
6056 state_ = DiscordObjectState::Invalid;
6057}
6058void Activity::AddButton(discordpp::ActivityButton button)
6059{
6060 assert(state_ == DiscordObjectState::Owned);
6061 Discord_Activity_AddButton(&instance_, button.instance());
6062}
6063bool Activity::Equals(discordpp::Activity other) const
6064{
6065 assert(state_ == DiscordObjectState::Owned);
6066 bool returnValue__;
6067 returnValue__ = Discord_Activity_Equals(&instance_, other.instance());
6068 return returnValue__;
6069}
6070std::vector<discordpp::ActivityButton> Activity::GetButtons() const
6071{
6072 assert(state_ == DiscordObjectState::Owned);
6073 Discord_ActivityButtonSpan returnValueNative__;
6074 Discord_Activity_GetButtons(&instance_, &returnValueNative__);
6075 std::vector<discordpp::ActivityButton> returnValue__;
6076 returnValue__.reserve(returnValueNative__.size);
6077 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
6078 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
6079 }
6080 Discord_Free(returnValueNative__.ptr);
6081 return returnValue__;
6082}
6083std::string Activity::Name() const
6084{
6085 assert(state_ == DiscordObjectState::Owned);
6086 Discord_String returnValueNative__;
6087 Discord_Activity_Name(&instance_, &returnValueNative__);
6088 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6089 returnValueNative__.size);
6090 Discord_Free(returnValueNative__.ptr);
6091 return returnValue__;
6092}
6093void Activity::SetName(std::string Name)
6094{
6095 assert(state_ == DiscordObjectState::Owned);
6096 Discord_String Name__str{(uint8_t*)(Name.data()), Name.size()};
6097 Discord_Activity_SetName(&instance_, Name__str);
6098}
6099discordpp::ActivityTypes Activity::Type() const
6100{
6101 assert(state_ == DiscordObjectState::Owned);
6102 Discord_ActivityTypes returnValue__;
6103 returnValue__ = Discord_Activity_Type(&instance_);
6104 return static_cast<discordpp::ActivityTypes>(returnValue__);
6105}
6106void Activity::SetType(discordpp::ActivityTypes Type)
6107{
6108 assert(state_ == DiscordObjectState::Owned);
6109 Discord_Activity_SetType(&instance_, static_cast<Discord_ActivityTypes>(Type));
6110}
6111std::optional<std::string> Activity::State() const
6112{
6113 assert(state_ == DiscordObjectState::Owned);
6114 bool returnIsNonNull__;
6115 Discord_String returnValueNative__;
6116 returnIsNonNull__ = Discord_Activity_State(&instance_, &returnValueNative__);
6117 if (!returnIsNonNull__) {
6118 return {};
6119 }
6120 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6121 returnValueNative__.size);
6122 Discord_Free(returnValueNative__.ptr);
6123 return returnValue__;
6124}
6125void Activity::SetState(std::optional<std::string> State)
6126{
6127 assert(state_ == DiscordObjectState::Owned);
6128 Discord_String State__str{};
6129 if (State.has_value()) {
6130 State__str.ptr = reinterpret_cast<uint8_t*>(State->data());
6131 State__str.size = State->size();
6132 }
6133 Discord_Activity_SetState(&instance_, (State.has_value() ? &State__str : nullptr));
6134}
6135std::optional<std::string> Activity::Details() const
6136{
6137 assert(state_ == DiscordObjectState::Owned);
6138 bool returnIsNonNull__;
6139 Discord_String returnValueNative__;
6140 returnIsNonNull__ = Discord_Activity_Details(&instance_, &returnValueNative__);
6141 if (!returnIsNonNull__) {
6142 return {};
6143 }
6144 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6145 returnValueNative__.size);
6146 Discord_Free(returnValueNative__.ptr);
6147 return returnValue__;
6148}
6149void Activity::SetDetails(std::optional<std::string> Details)
6150{
6151 assert(state_ == DiscordObjectState::Owned);
6152 Discord_String Details__str{};
6153 if (Details.has_value()) {
6154 Details__str.ptr = reinterpret_cast<uint8_t*>(Details->data());
6155 Details__str.size = Details->size();
6156 }
6157 Discord_Activity_SetDetails(&instance_, (Details.has_value() ? &Details__str : nullptr));
6158}
6159std::optional<uint64_t> Activity::ApplicationId() const
6160{
6161 assert(state_ == DiscordObjectState::Owned);
6162 bool returnIsNonNull__;
6163 uint64_t returnValue__;
6164 returnIsNonNull__ = Discord_Activity_ApplicationId(&instance_, &returnValue__);
6165 if (!returnIsNonNull__) {
6166 return std::nullopt;
6167 }
6168 return returnValue__;
6169}
6170void Activity::SetApplicationId(std::optional<uint64_t> ApplicationId)
6171{
6172 assert(state_ == DiscordObjectState::Owned);
6173 Discord_Activity_SetApplicationId(&instance_,
6174 (ApplicationId.has_value() ? &*ApplicationId : nullptr));
6175}
6176std::optional<discordpp::ActivityAssets> Activity::Assets() const
6177{
6178 assert(state_ == DiscordObjectState::Owned);
6179 bool returnIsNonNull__;
6180 Discord_ActivityAssets returnValueNative__;
6181 returnIsNonNull__ = Discord_Activity_Assets(&instance_, &returnValueNative__);
6182 if (!returnIsNonNull__) {
6183 return {};
6184 }
6185 discordpp::ActivityAssets returnValue__(returnValueNative__, DiscordObjectState::Owned);
6186 return returnValue__;
6187}
6188void Activity::SetAssets(std::optional<discordpp::ActivityAssets> Assets)
6189{
6190 assert(state_ == DiscordObjectState::Owned);
6191 Discord_Activity_SetAssets(&instance_, (Assets.has_value() ? Assets->instance() : nullptr));
6192}
6193std::optional<discordpp::ActivityTimestamps> Activity::Timestamps() const
6194{
6195 assert(state_ == DiscordObjectState::Owned);
6196 bool returnIsNonNull__;
6197 Discord_ActivityTimestamps returnValueNative__;
6198 returnIsNonNull__ = Discord_Activity_Timestamps(&instance_, &returnValueNative__);
6199 if (!returnIsNonNull__) {
6200 return {};
6201 }
6202 discordpp::ActivityTimestamps returnValue__(returnValueNative__, DiscordObjectState::Owned);
6203 return returnValue__;
6204}
6205void Activity::SetTimestamps(std::optional<discordpp::ActivityTimestamps> Timestamps)
6206{
6207 assert(state_ == DiscordObjectState::Owned);
6208 Discord_Activity_SetTimestamps(&instance_,
6209 (Timestamps.has_value() ? Timestamps->instance() : nullptr));
6210}
6211std::optional<discordpp::ActivityParty> Activity::Party() const
6212{
6213 assert(state_ == DiscordObjectState::Owned);
6214 bool returnIsNonNull__;
6215 Discord_ActivityParty returnValueNative__;
6216 returnIsNonNull__ = Discord_Activity_Party(&instance_, &returnValueNative__);
6217 if (!returnIsNonNull__) {
6218 return {};
6219 }
6220 discordpp::ActivityParty returnValue__(returnValueNative__, DiscordObjectState::Owned);
6221 return returnValue__;
6222}
6223void Activity::SetParty(std::optional<discordpp::ActivityParty> Party)
6224{
6225 assert(state_ == DiscordObjectState::Owned);
6226 Discord_Activity_SetParty(&instance_, (Party.has_value() ? Party->instance() : nullptr));
6227}
6228std::optional<discordpp::ActivitySecrets> Activity::Secrets() const
6229{
6230 assert(state_ == DiscordObjectState::Owned);
6231 bool returnIsNonNull__;
6232 Discord_ActivitySecrets returnValueNative__;
6233 returnIsNonNull__ = Discord_Activity_Secrets(&instance_, &returnValueNative__);
6234 if (!returnIsNonNull__) {
6235 return {};
6236 }
6237 discordpp::ActivitySecrets returnValue__(returnValueNative__, DiscordObjectState::Owned);
6238 return returnValue__;
6239}
6240void Activity::SetSecrets(std::optional<discordpp::ActivitySecrets> Secrets)
6241{
6242 assert(state_ == DiscordObjectState::Owned);
6243 Discord_Activity_SetSecrets(&instance_, (Secrets.has_value() ? Secrets->instance() : nullptr));
6244}
6245discordpp::ActivityGamePlatforms Activity::SupportedPlatforms() const
6246{
6247 assert(state_ == DiscordObjectState::Owned);
6248 Discord_ActivityGamePlatforms returnValue__;
6249 returnValue__ = Discord_Activity_SupportedPlatforms(&instance_);
6250 return static_cast<discordpp::ActivityGamePlatforms>(returnValue__);
6251}
6252void Activity::SetSupportedPlatforms(discordpp::ActivityGamePlatforms SupportedPlatforms)
6253{
6254 assert(state_ == DiscordObjectState::Owned);
6255 Discord_Activity_SetSupportedPlatforms(
6256 &instance_, static_cast<Discord_ActivityGamePlatforms>(SupportedPlatforms));
6257}
6258const ClientResult ClientResult::nullobj{{}, DiscordObjectState::Invalid};
6259ClientResult::~ClientResult()
6260{
6261 if (state_ == DiscordObjectState::Owned) {
6262 Drop();
6263 state_ = DiscordObjectState::Invalid;
6264 }
6265}
6266ClientResult::ClientResult(ClientResult&& other) noexcept
6267 : instance_(other.instance_)
6268 , state_(other.state_)
6269{
6270 other.state_ = DiscordObjectState::Invalid;
6271}
6272ClientResult& ClientResult::operator=(ClientResult&& other) noexcept
6273{
6274 if (this != &other) {
6275 if (state_ == DiscordObjectState::Owned) {
6276 Drop();
6277 }
6278 instance_ = other.instance_;
6279 state_ = other.state_;
6280 other.state_ = DiscordObjectState::Invalid;
6281 }
6282 return *this;
6283}
6284ClientResult::ClientResult(const ClientResult& arg0)
6285 : instance_{}
6286 , state_(DiscordObjectState::Invalid)
6287{
6288 if (arg0.state_ == DiscordObjectState::Owned) {
6289 Discord_ClientResult_Clone(&instance_, arg0.instance());
6290
6291 state_ = DiscordObjectState::Owned;
6292 }
6293}
6294ClientResult& ClientResult::operator=(const ClientResult& arg0)
6295{
6296 if (this != &arg0) {
6297 if (state_ == DiscordObjectState::Owned) {
6298 Drop();
6299 state_ = DiscordObjectState::Invalid;
6300 }
6301 if (arg0.state_ == DiscordObjectState::Owned) {
6302 Discord_ClientResult_Clone(&instance_, arg0.instance());
6303
6304 state_ = DiscordObjectState::Owned;
6305 }
6306 }
6307 return *this;
6308}
6309ClientResult::ClientResult(Discord_ClientResult instance, DiscordObjectState state)
6310 : instance_(instance)
6311 , state_(state)
6312{
6313}
6314void ClientResult::Drop()
6315{
6316 if (state_ != DiscordObjectState::Owned) {
6317 return;
6318 }
6319 Discord_ClientResult_Drop(&instance_);
6320 state_ = DiscordObjectState::Invalid;
6321}
6322std::string ClientResult::ToString() const
6323{
6324 assert(state_ == DiscordObjectState::Owned);
6325 Discord_String returnValueNative__;
6326 Discord_ClientResult_ToString(&instance_, &returnValueNative__);
6327 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6328 returnValueNative__.size);
6329 Discord_Free(returnValueNative__.ptr);
6330 return returnValue__;
6331}
6332discordpp::ErrorType ClientResult::Type() const
6333{
6334 assert(state_ == DiscordObjectState::Owned);
6335 Discord_ErrorType returnValue__;
6336 returnValue__ = Discord_ClientResult_Type(&instance_);
6337 return static_cast<discordpp::ErrorType>(returnValue__);
6338}
6339void ClientResult::SetType(discordpp::ErrorType Type)
6340{
6341 assert(state_ == DiscordObjectState::Owned);
6342 Discord_ClientResult_SetType(&instance_, static_cast<Discord_ErrorType>(Type));
6343}
6344std::string ClientResult::Error() const
6345{
6346 assert(state_ == DiscordObjectState::Owned);
6347 Discord_String returnValueNative__;
6348 Discord_ClientResult_Error(&instance_, &returnValueNative__);
6349 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6350 returnValueNative__.size);
6351 Discord_Free(returnValueNative__.ptr);
6352 return returnValue__;
6353}
6354void ClientResult::SetError(std::string Error)
6355{
6356 assert(state_ == DiscordObjectState::Owned);
6357 Discord_String Error__str{(uint8_t*)(Error.data()), Error.size()};
6358 Discord_ClientResult_SetError(&instance_, Error__str);
6359}
6360int32_t ClientResult::ErrorCode() const
6361{
6362 assert(state_ == DiscordObjectState::Owned);
6363 int32_t returnValue__;
6364 returnValue__ = Discord_ClientResult_ErrorCode(&instance_);
6365 return returnValue__;
6366}
6367void ClientResult::SetErrorCode(int32_t ErrorCode)
6368{
6369 assert(state_ == DiscordObjectState::Owned);
6370 Discord_ClientResult_SetErrorCode(&instance_, ErrorCode);
6371}
6372discordpp::HttpStatusCode ClientResult::Status() const
6373{
6374 assert(state_ == DiscordObjectState::Owned);
6375 Discord_HttpStatusCode returnValue__;
6376 returnValue__ = Discord_ClientResult_Status(&instance_);
6377 return static_cast<discordpp::HttpStatusCode>(returnValue__);
6378}
6379void ClientResult::SetStatus(discordpp::HttpStatusCode Status)
6380{
6381 assert(state_ == DiscordObjectState::Owned);
6382 Discord_ClientResult_SetStatus(&instance_, static_cast<Discord_HttpStatusCode>(Status));
6383}
6384std::string ClientResult::ResponseBody() const
6385{
6386 assert(state_ == DiscordObjectState::Owned);
6387 Discord_String returnValueNative__;
6388 Discord_ClientResult_ResponseBody(&instance_, &returnValueNative__);
6389 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6390 returnValueNative__.size);
6391 Discord_Free(returnValueNative__.ptr);
6392 return returnValue__;
6393}
6394void ClientResult::SetResponseBody(std::string ResponseBody)
6395{
6396 assert(state_ == DiscordObjectState::Owned);
6397 Discord_String ResponseBody__str{(uint8_t*)(ResponseBody.data()), ResponseBody.size()};
6398 Discord_ClientResult_SetResponseBody(&instance_, ResponseBody__str);
6399}
6400bool ClientResult::Successful() const
6401{
6402 assert(state_ == DiscordObjectState::Owned);
6403 bool returnValue__;
6404 returnValue__ = Discord_ClientResult_Successful(&instance_);
6405 return returnValue__;
6406}
6407void ClientResult::SetSuccessful(bool Successful)
6408{
6409 assert(state_ == DiscordObjectState::Owned);
6410 Discord_ClientResult_SetSuccessful(&instance_, Successful);
6411}
6412bool ClientResult::Retryable() const
6413{
6414 assert(state_ == DiscordObjectState::Owned);
6415 bool returnValue__;
6416 returnValue__ = Discord_ClientResult_Retryable(&instance_);
6417 return returnValue__;
6418}
6419void ClientResult::SetRetryable(bool Retryable)
6420{
6421 assert(state_ == DiscordObjectState::Owned);
6422 Discord_ClientResult_SetRetryable(&instance_, Retryable);
6423}
6424float ClientResult::RetryAfter() const
6425{
6426 assert(state_ == DiscordObjectState::Owned);
6427 float returnValue__;
6428 returnValue__ = Discord_ClientResult_RetryAfter(&instance_);
6429 return returnValue__;
6430}
6431void ClientResult::SetRetryAfter(float RetryAfter)
6432{
6433 assert(state_ == DiscordObjectState::Owned);
6434 Discord_ClientResult_SetRetryAfter(&instance_, RetryAfter);
6435}
6436const AuthorizationCodeChallenge AuthorizationCodeChallenge::nullobj{{},
6437 DiscordObjectState::Invalid};
6438AuthorizationCodeChallenge::~AuthorizationCodeChallenge()
6439{
6440 if (state_ == DiscordObjectState::Owned) {
6441 Drop();
6442 state_ = DiscordObjectState::Invalid;
6443 }
6444}
6445AuthorizationCodeChallenge::AuthorizationCodeChallenge(AuthorizationCodeChallenge&& other) noexcept
6446 : instance_(other.instance_)
6447 , state_(other.state_)
6448{
6449 other.state_ = DiscordObjectState::Invalid;
6450}
6451AuthorizationCodeChallenge& AuthorizationCodeChallenge::operator=(
6452 AuthorizationCodeChallenge&& other) noexcept
6453{
6454 if (this != &other) {
6455 if (state_ == DiscordObjectState::Owned) {
6456 Drop();
6457 }
6458 instance_ = other.instance_;
6459 state_ = other.state_;
6460 other.state_ = DiscordObjectState::Invalid;
6461 }
6462 return *this;
6463}
6464AuthorizationCodeChallenge::AuthorizationCodeChallenge(const AuthorizationCodeChallenge& arg0)
6465 : instance_{}
6466 , state_(DiscordObjectState::Invalid)
6467{
6468 if (arg0.state_ == DiscordObjectState::Owned) {
6469 Discord_AuthorizationCodeChallenge_Clone(&instance_, arg0.instance());
6470
6471 state_ = DiscordObjectState::Owned;
6472 }
6473}
6474AuthorizationCodeChallenge& AuthorizationCodeChallenge::operator=(
6475 const AuthorizationCodeChallenge& arg0)
6476{
6477 if (this != &arg0) {
6478 if (state_ == DiscordObjectState::Owned) {
6479 Drop();
6480 state_ = DiscordObjectState::Invalid;
6481 }
6482 if (arg0.state_ == DiscordObjectState::Owned) {
6483 Discord_AuthorizationCodeChallenge_Clone(&instance_, arg0.instance());
6484
6485 state_ = DiscordObjectState::Owned;
6486 }
6487 }
6488 return *this;
6489}
6490AuthorizationCodeChallenge::AuthorizationCodeChallenge(Discord_AuthorizationCodeChallenge instance,
6491 DiscordObjectState state)
6492 : instance_(instance)
6493 , state_(state)
6494{
6495}
6496AuthorizationCodeChallenge::AuthorizationCodeChallenge()
6497{
6498 assert(state_ == DiscordObjectState::Invalid);
6499 Discord_AuthorizationCodeChallenge_Init(&instance_);
6500 state_ = DiscordObjectState::Owned;
6501}
6502void AuthorizationCodeChallenge::Drop()
6503{
6504 if (state_ != DiscordObjectState::Owned) {
6505 return;
6506 }
6507 Discord_AuthorizationCodeChallenge_Drop(&instance_);
6508 state_ = DiscordObjectState::Invalid;
6509}
6510discordpp::AuthenticationCodeChallengeMethod AuthorizationCodeChallenge::Method() const
6511{
6512 assert(state_ == DiscordObjectState::Owned);
6513 Discord_AuthenticationCodeChallengeMethod returnValue__;
6514 returnValue__ = Discord_AuthorizationCodeChallenge_Method(&instance_);
6515 return static_cast<discordpp::AuthenticationCodeChallengeMethod>(returnValue__);
6516}
6517void AuthorizationCodeChallenge::SetMethod(discordpp::AuthenticationCodeChallengeMethod Method)
6518{
6519 assert(state_ == DiscordObjectState::Owned);
6520 Discord_AuthorizationCodeChallenge_SetMethod(
6521 &instance_, static_cast<Discord_AuthenticationCodeChallengeMethod>(Method));
6522}
6523std::string AuthorizationCodeChallenge::Challenge() const
6524{
6525 assert(state_ == DiscordObjectState::Owned);
6526 Discord_String returnValueNative__;
6527 Discord_AuthorizationCodeChallenge_Challenge(&instance_, &returnValueNative__);
6528 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6529 returnValueNative__.size);
6530 Discord_Free(returnValueNative__.ptr);
6531 return returnValue__;
6532}
6533void AuthorizationCodeChallenge::SetChallenge(std::string Challenge)
6534{
6535 assert(state_ == DiscordObjectState::Owned);
6536 Discord_String Challenge__str{(uint8_t*)(Challenge.data()), Challenge.size()};
6537 Discord_AuthorizationCodeChallenge_SetChallenge(&instance_, Challenge__str);
6538}
6539const AuthorizationCodeVerifier AuthorizationCodeVerifier::nullobj{{}, DiscordObjectState::Invalid};
6540AuthorizationCodeVerifier::~AuthorizationCodeVerifier()
6541{
6542 if (state_ == DiscordObjectState::Owned) {
6543 Drop();
6544 state_ = DiscordObjectState::Invalid;
6545 }
6546}
6547AuthorizationCodeVerifier::AuthorizationCodeVerifier(AuthorizationCodeVerifier&& other) noexcept
6548 : instance_(other.instance_)
6549 , state_(other.state_)
6550{
6551 other.state_ = DiscordObjectState::Invalid;
6552}
6553AuthorizationCodeVerifier& AuthorizationCodeVerifier::operator=(
6554 AuthorizationCodeVerifier&& other) noexcept
6555{
6556 if (this != &other) {
6557 if (state_ == DiscordObjectState::Owned) {
6558 Drop();
6559 }
6560 instance_ = other.instance_;
6561 state_ = other.state_;
6562 other.state_ = DiscordObjectState::Invalid;
6563 }
6564 return *this;
6565}
6566AuthorizationCodeVerifier::AuthorizationCodeVerifier(const AuthorizationCodeVerifier& arg0)
6567 : instance_{}
6568 , state_(DiscordObjectState::Invalid)
6569{
6570 if (arg0.state_ == DiscordObjectState::Owned) {
6571 Discord_AuthorizationCodeVerifier_Clone(&instance_, arg0.instance());
6572
6573 state_ = DiscordObjectState::Owned;
6574 }
6575}
6576AuthorizationCodeVerifier& AuthorizationCodeVerifier::operator=(
6577 const AuthorizationCodeVerifier& arg0)
6578{
6579 if (this != &arg0) {
6580 if (state_ == DiscordObjectState::Owned) {
6581 Drop();
6582 state_ = DiscordObjectState::Invalid;
6583 }
6584 if (arg0.state_ == DiscordObjectState::Owned) {
6585 Discord_AuthorizationCodeVerifier_Clone(&instance_, arg0.instance());
6586
6587 state_ = DiscordObjectState::Owned;
6588 }
6589 }
6590 return *this;
6591}
6592AuthorizationCodeVerifier::AuthorizationCodeVerifier(Discord_AuthorizationCodeVerifier instance,
6593 DiscordObjectState state)
6594 : instance_(instance)
6595 , state_(state)
6596{
6597}
6598void AuthorizationCodeVerifier::Drop()
6599{
6600 if (state_ != DiscordObjectState::Owned) {
6601 return;
6602 }
6603 Discord_AuthorizationCodeVerifier_Drop(&instance_);
6604 state_ = DiscordObjectState::Invalid;
6605}
6606discordpp::AuthorizationCodeChallenge AuthorizationCodeVerifier::Challenge() const
6607{
6608 assert(state_ == DiscordObjectState::Owned);
6609 Discord_AuthorizationCodeChallenge returnValueNative__{};
6610 Discord_AuthorizationCodeVerifier_Challenge(&instance_, &returnValueNative__);
6611 discordpp::AuthorizationCodeChallenge returnValue__(returnValueNative__,
6612 DiscordObjectState::Owned);
6613 return returnValue__;
6614}
6615void AuthorizationCodeVerifier::SetChallenge(discordpp::AuthorizationCodeChallenge Challenge)
6616{
6617 assert(state_ == DiscordObjectState::Owned);
6618 Discord_AuthorizationCodeVerifier_SetChallenge(&instance_, Challenge.instance());
6619}
6620std::string AuthorizationCodeVerifier::Verifier() const
6621{
6622 assert(state_ == DiscordObjectState::Owned);
6623 Discord_String returnValueNative__;
6624 Discord_AuthorizationCodeVerifier_Verifier(&instance_, &returnValueNative__);
6625 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6626 returnValueNative__.size);
6627 Discord_Free(returnValueNative__.ptr);
6628 return returnValue__;
6629}
6630void AuthorizationCodeVerifier::SetVerifier(std::string Verifier)
6631{
6632 assert(state_ == DiscordObjectState::Owned);
6633 Discord_String Verifier__str{(uint8_t*)(Verifier.data()), Verifier.size()};
6634 Discord_AuthorizationCodeVerifier_SetVerifier(&instance_, Verifier__str);
6635}
6636const AuthorizationArgs AuthorizationArgs::nullobj{{}, DiscordObjectState::Invalid};
6637AuthorizationArgs::~AuthorizationArgs()
6638{
6639 if (state_ == DiscordObjectState::Owned) {
6640 Drop();
6641 state_ = DiscordObjectState::Invalid;
6642 }
6643}
6644AuthorizationArgs::AuthorizationArgs(AuthorizationArgs&& other) noexcept
6645 : instance_(other.instance_)
6646 , state_(other.state_)
6647{
6648 other.state_ = DiscordObjectState::Invalid;
6649}
6650AuthorizationArgs& AuthorizationArgs::operator=(AuthorizationArgs&& other) noexcept
6651{
6652 if (this != &other) {
6653 if (state_ == DiscordObjectState::Owned) {
6654 Drop();
6655 }
6656 instance_ = other.instance_;
6657 state_ = other.state_;
6658 other.state_ = DiscordObjectState::Invalid;
6659 }
6660 return *this;
6661}
6662AuthorizationArgs::AuthorizationArgs(const AuthorizationArgs& arg0)
6663 : instance_{}
6664 , state_(DiscordObjectState::Invalid)
6665{
6666 if (arg0.state_ == DiscordObjectState::Owned) {
6667 Discord_AuthorizationArgs_Clone(&instance_, arg0.instance());
6668
6669 state_ = DiscordObjectState::Owned;
6670 }
6671}
6672AuthorizationArgs& AuthorizationArgs::operator=(const AuthorizationArgs& arg0)
6673{
6674 if (this != &arg0) {
6675 if (state_ == DiscordObjectState::Owned) {
6676 Drop();
6677 state_ = DiscordObjectState::Invalid;
6678 }
6679 if (arg0.state_ == DiscordObjectState::Owned) {
6680 Discord_AuthorizationArgs_Clone(&instance_, arg0.instance());
6681
6682 state_ = DiscordObjectState::Owned;
6683 }
6684 }
6685 return *this;
6686}
6687AuthorizationArgs::AuthorizationArgs(Discord_AuthorizationArgs instance, DiscordObjectState state)
6688 : instance_(instance)
6689 , state_(state)
6690{
6691}
6692AuthorizationArgs::AuthorizationArgs()
6693{
6694 assert(state_ == DiscordObjectState::Invalid);
6695 Discord_AuthorizationArgs_Init(&instance_);
6696 state_ = DiscordObjectState::Owned;
6697}
6698void AuthorizationArgs::Drop()
6699{
6700 if (state_ != DiscordObjectState::Owned) {
6701 return;
6702 }
6703 Discord_AuthorizationArgs_Drop(&instance_);
6704 state_ = DiscordObjectState::Invalid;
6705}
6706uint64_t AuthorizationArgs::ClientId() const
6707{
6708 assert(state_ == DiscordObjectState::Owned);
6709 uint64_t returnValue__;
6710 returnValue__ = Discord_AuthorizationArgs_ClientId(&instance_);
6711 return returnValue__;
6712}
6713void AuthorizationArgs::SetClientId(uint64_t ClientId)
6714{
6715 assert(state_ == DiscordObjectState::Owned);
6716 Discord_AuthorizationArgs_SetClientId(&instance_, ClientId);
6717}
6718std::string AuthorizationArgs::Scopes() const
6719{
6720 assert(state_ == DiscordObjectState::Owned);
6721 Discord_String returnValueNative__;
6722 Discord_AuthorizationArgs_Scopes(&instance_, &returnValueNative__);
6723 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6724 returnValueNative__.size);
6725 Discord_Free(returnValueNative__.ptr);
6726 return returnValue__;
6727}
6728void AuthorizationArgs::SetScopes(std::string Scopes)
6729{
6730 assert(state_ == DiscordObjectState::Owned);
6731 Discord_String Scopes__str{(uint8_t*)(Scopes.data()), Scopes.size()};
6732 Discord_AuthorizationArgs_SetScopes(&instance_, Scopes__str);
6733}
6734std::optional<std::string> AuthorizationArgs::State() const
6735{
6736 assert(state_ == DiscordObjectState::Owned);
6737 bool returnIsNonNull__;
6738 Discord_String returnValueNative__;
6739 returnIsNonNull__ = Discord_AuthorizationArgs_State(&instance_, &returnValueNative__);
6740 if (!returnIsNonNull__) {
6741 return {};
6742 }
6743 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6744 returnValueNative__.size);
6745 Discord_Free(returnValueNative__.ptr);
6746 return returnValue__;
6747}
6748void AuthorizationArgs::SetState(std::optional<std::string> State)
6749{
6750 assert(state_ == DiscordObjectState::Owned);
6751 Discord_String State__str{};
6752 if (State.has_value()) {
6753 State__str.ptr = reinterpret_cast<uint8_t*>(State->data());
6754 State__str.size = State->size();
6755 }
6756 Discord_AuthorizationArgs_SetState(&instance_, (State.has_value() ? &State__str : nullptr));
6757}
6758std::optional<std::string> AuthorizationArgs::Nonce() const
6759{
6760 assert(state_ == DiscordObjectState::Owned);
6761 bool returnIsNonNull__;
6762 Discord_String returnValueNative__;
6763 returnIsNonNull__ = Discord_AuthorizationArgs_Nonce(&instance_, &returnValueNative__);
6764 if (!returnIsNonNull__) {
6765 return {};
6766 }
6767 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6768 returnValueNative__.size);
6769 Discord_Free(returnValueNative__.ptr);
6770 return returnValue__;
6771}
6772void AuthorizationArgs::SetNonce(std::optional<std::string> Nonce)
6773{
6774 assert(state_ == DiscordObjectState::Owned);
6775 Discord_String Nonce__str{};
6776 if (Nonce.has_value()) {
6777 Nonce__str.ptr = reinterpret_cast<uint8_t*>(Nonce->data());
6778 Nonce__str.size = Nonce->size();
6779 }
6780 Discord_AuthorizationArgs_SetNonce(&instance_, (Nonce.has_value() ? &Nonce__str : nullptr));
6781}
6782std::optional<discordpp::AuthorizationCodeChallenge> AuthorizationArgs::CodeChallenge() const
6783{
6784 assert(state_ == DiscordObjectState::Owned);
6785 bool returnIsNonNull__;
6786 Discord_AuthorizationCodeChallenge returnValueNative__;
6787 returnIsNonNull__ = Discord_AuthorizationArgs_CodeChallenge(&instance_, &returnValueNative__);
6788 if (!returnIsNonNull__) {
6789 return {};
6790 }
6791 discordpp::AuthorizationCodeChallenge returnValue__(returnValueNative__,
6792 DiscordObjectState::Owned);
6793 return returnValue__;
6794}
6795void AuthorizationArgs::SetCodeChallenge(
6796 std::optional<discordpp::AuthorizationCodeChallenge> CodeChallenge)
6797{
6798 assert(state_ == DiscordObjectState::Owned);
6799 Discord_AuthorizationArgs_SetCodeChallenge(
6800 &instance_, (CodeChallenge.has_value() ? CodeChallenge->instance() : nullptr));
6801}
6802const DeviceAuthorizationArgs DeviceAuthorizationArgs::nullobj{{}, DiscordObjectState::Invalid};
6803DeviceAuthorizationArgs::~DeviceAuthorizationArgs()
6804{
6805 if (state_ == DiscordObjectState::Owned) {
6806 Drop();
6807 state_ = DiscordObjectState::Invalid;
6808 }
6809}
6810DeviceAuthorizationArgs::DeviceAuthorizationArgs(DeviceAuthorizationArgs&& other) noexcept
6811 : instance_(other.instance_)
6812 , state_(other.state_)
6813{
6814 other.state_ = DiscordObjectState::Invalid;
6815}
6816DeviceAuthorizationArgs& DeviceAuthorizationArgs::operator=(
6817 DeviceAuthorizationArgs&& other) noexcept
6818{
6819 if (this != &other) {
6820 if (state_ == DiscordObjectState::Owned) {
6821 Drop();
6822 }
6823 instance_ = other.instance_;
6824 state_ = other.state_;
6825 other.state_ = DiscordObjectState::Invalid;
6826 }
6827 return *this;
6828}
6829DeviceAuthorizationArgs::DeviceAuthorizationArgs(const DeviceAuthorizationArgs& arg0)
6830 : instance_{}
6831 , state_(DiscordObjectState::Invalid)
6832{
6833 if (arg0.state_ == DiscordObjectState::Owned) {
6834 Discord_DeviceAuthorizationArgs_Clone(&instance_, arg0.instance());
6835
6836 state_ = DiscordObjectState::Owned;
6837 }
6838}
6839DeviceAuthorizationArgs& DeviceAuthorizationArgs::operator=(const DeviceAuthorizationArgs& arg0)
6840{
6841 if (this != &arg0) {
6842 if (state_ == DiscordObjectState::Owned) {
6843 Drop();
6844 state_ = DiscordObjectState::Invalid;
6845 }
6846 if (arg0.state_ == DiscordObjectState::Owned) {
6847 Discord_DeviceAuthorizationArgs_Clone(&instance_, arg0.instance());
6848
6849 state_ = DiscordObjectState::Owned;
6850 }
6851 }
6852 return *this;
6853}
6854DeviceAuthorizationArgs::DeviceAuthorizationArgs(Discord_DeviceAuthorizationArgs instance,
6855 DiscordObjectState state)
6856 : instance_(instance)
6857 , state_(state)
6858{
6859}
6860DeviceAuthorizationArgs::DeviceAuthorizationArgs()
6861{
6862 assert(state_ == DiscordObjectState::Invalid);
6863 Discord_DeviceAuthorizationArgs_Init(&instance_);
6864 state_ = DiscordObjectState::Owned;
6865}
6866void DeviceAuthorizationArgs::Drop()
6867{
6868 if (state_ != DiscordObjectState::Owned) {
6869 return;
6870 }
6871 Discord_DeviceAuthorizationArgs_Drop(&instance_);
6872 state_ = DiscordObjectState::Invalid;
6873}
6874uint64_t DeviceAuthorizationArgs::ClientId() const
6875{
6876 assert(state_ == DiscordObjectState::Owned);
6877 uint64_t returnValue__;
6878 returnValue__ = Discord_DeviceAuthorizationArgs_ClientId(&instance_);
6879 return returnValue__;
6880}
6881void DeviceAuthorizationArgs::SetClientId(uint64_t ClientId)
6882{
6883 assert(state_ == DiscordObjectState::Owned);
6884 Discord_DeviceAuthorizationArgs_SetClientId(&instance_, ClientId);
6885}
6886std::string DeviceAuthorizationArgs::Scopes() const
6887{
6888 assert(state_ == DiscordObjectState::Owned);
6889 Discord_String returnValueNative__;
6890 Discord_DeviceAuthorizationArgs_Scopes(&instance_, &returnValueNative__);
6891 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
6892 returnValueNative__.size);
6893 Discord_Free(returnValueNative__.ptr);
6894 return returnValue__;
6895}
6896void DeviceAuthorizationArgs::SetScopes(std::string Scopes)
6897{
6898 assert(state_ == DiscordObjectState::Owned);
6899 Discord_String Scopes__str{(uint8_t*)(Scopes.data()), Scopes.size()};
6900 Discord_DeviceAuthorizationArgs_SetScopes(&instance_, Scopes__str);
6901}
6902const VoiceStateHandle VoiceStateHandle::nullobj{{}, DiscordObjectState::Invalid};
6903VoiceStateHandle::~VoiceStateHandle()
6904{
6905 if (state_ == DiscordObjectState::Owned) {
6906 Drop();
6907 state_ = DiscordObjectState::Invalid;
6908 }
6909}
6910VoiceStateHandle::VoiceStateHandle(VoiceStateHandle&& other) noexcept
6911 : instance_(other.instance_)
6912 , state_(other.state_)
6913{
6914 other.state_ = DiscordObjectState::Invalid;
6915}
6916VoiceStateHandle& VoiceStateHandle::operator=(VoiceStateHandle&& other) noexcept
6917{
6918 if (this != &other) {
6919 if (state_ == DiscordObjectState::Owned) {
6920 Drop();
6921 }
6922 instance_ = other.instance_;
6923 state_ = other.state_;
6924 other.state_ = DiscordObjectState::Invalid;
6925 }
6926 return *this;
6927}
6928VoiceStateHandle::VoiceStateHandle(const VoiceStateHandle& other)
6929 : instance_{}
6930 , state_(DiscordObjectState::Invalid)
6931{
6932 if (other.state_ == DiscordObjectState::Owned) {
6933 Discord_VoiceStateHandle_Clone(&instance_, other.instance());
6934
6935 state_ = DiscordObjectState::Owned;
6936 }
6937}
6938VoiceStateHandle& VoiceStateHandle::operator=(const VoiceStateHandle& other)
6939{
6940 if (this != &other) {
6941 if (state_ == DiscordObjectState::Owned) {
6942 Drop();
6943 state_ = DiscordObjectState::Invalid;
6944 }
6945 if (other.state_ == DiscordObjectState::Owned) {
6946 Discord_VoiceStateHandle_Clone(&instance_, other.instance());
6947
6948 state_ = DiscordObjectState::Owned;
6949 }
6950 }
6951 return *this;
6952}
6953VoiceStateHandle::VoiceStateHandle(Discord_VoiceStateHandle instance, DiscordObjectState state)
6954 : instance_(instance)
6955 , state_(state)
6956{
6957}
6958void VoiceStateHandle::Drop()
6959{
6960 if (state_ != DiscordObjectState::Owned) {
6961 return;
6962 }
6963 Discord_VoiceStateHandle_Drop(&instance_);
6964 state_ = DiscordObjectState::Invalid;
6965}
6966bool VoiceStateHandle::SelfDeaf() const
6967{
6968 assert(state_ == DiscordObjectState::Owned);
6969 bool returnValue__;
6970 returnValue__ = Discord_VoiceStateHandle_SelfDeaf(&instance_);
6971 return returnValue__;
6972}
6973bool VoiceStateHandle::SelfMute() const
6974{
6975 assert(state_ == DiscordObjectState::Owned);
6976 bool returnValue__;
6977 returnValue__ = Discord_VoiceStateHandle_SelfMute(&instance_);
6978 return returnValue__;
6979}
6980const VADThresholdSettings VADThresholdSettings::nullobj{{}, DiscordObjectState::Invalid};
6981VADThresholdSettings::~VADThresholdSettings()
6982{
6983 if (state_ == DiscordObjectState::Owned) {
6984 Drop();
6985 state_ = DiscordObjectState::Invalid;
6986 }
6987}
6988VADThresholdSettings::VADThresholdSettings(VADThresholdSettings&& other) noexcept
6989 : instance_(other.instance_)
6990 , state_(other.state_)
6991{
6992 other.state_ = DiscordObjectState::Invalid;
6993}
6994VADThresholdSettings& VADThresholdSettings::operator=(VADThresholdSettings&& other) noexcept
6995{
6996 if (this != &other) {
6997 if (state_ == DiscordObjectState::Owned) {
6998 Drop();
6999 }
7000 instance_ = other.instance_;
7001 state_ = other.state_;
7002 other.state_ = DiscordObjectState::Invalid;
7003 }
7004 return *this;
7005}
7006VADThresholdSettings::VADThresholdSettings(Discord_VADThresholdSettings instance,
7007 DiscordObjectState state)
7008 : instance_(instance)
7009 , state_(state)
7010{
7011}
7012void VADThresholdSettings::Drop()
7013{
7014 if (state_ != DiscordObjectState::Owned) {
7015 return;
7016 }
7017 Discord_VADThresholdSettings_Drop(&instance_);
7018 state_ = DiscordObjectState::Invalid;
7019}
7020float VADThresholdSettings::VadThreshold() const
7021{
7022 assert(state_ == DiscordObjectState::Owned);
7023 float returnValue__;
7024 returnValue__ = Discord_VADThresholdSettings_VadThreshold(&instance_);
7025 return returnValue__;
7026}
7027void VADThresholdSettings::SetVadThreshold(float VadThreshold)
7028{
7029 assert(state_ == DiscordObjectState::Owned);
7030 Discord_VADThresholdSettings_SetVadThreshold(&instance_, VadThreshold);
7031}
7032bool VADThresholdSettings::Automatic() const
7033{
7034 assert(state_ == DiscordObjectState::Owned);
7035 bool returnValue__;
7036 returnValue__ = Discord_VADThresholdSettings_Automatic(&instance_);
7037 return returnValue__;
7038}
7039void VADThresholdSettings::SetAutomatic(bool Automatic)
7040{
7041 assert(state_ == DiscordObjectState::Owned);
7042 Discord_VADThresholdSettings_SetAutomatic(&instance_, Automatic);
7043}
7044const Call Call::nullobj{{}, DiscordObjectState::Invalid};
7045Call::~Call()
7046{
7047 if (state_ == DiscordObjectState::Owned) {
7048 Drop();
7049 state_ = DiscordObjectState::Invalid;
7050 }
7051}
7052Call::Call(Call&& other) noexcept
7053 : instance_(other.instance_)
7054 , state_(other.state_)
7055{
7056 other.state_ = DiscordObjectState::Invalid;
7057}
7058Call& Call::operator=(Call&& other) noexcept
7059{
7060 if (this != &other) {
7061 if (state_ == DiscordObjectState::Owned) {
7062 Drop();
7063 }
7064 instance_ = other.instance_;
7065 state_ = other.state_;
7066 other.state_ = DiscordObjectState::Invalid;
7067 }
7068 return *this;
7069}
7070Call::Call(const Call& other)
7071 : instance_{}
7072 , state_(DiscordObjectState::Invalid)
7073{
7074 if (other.state_ == DiscordObjectState::Owned) {
7075 Discord_Call_Clone(&instance_, other.instance());
7076
7077 state_ = DiscordObjectState::Owned;
7078 }
7079}
7080Call& Call::operator=(const Call& other)
7081{
7082 if (this != &other) {
7083 if (state_ == DiscordObjectState::Owned) {
7084 Drop();
7085 state_ = DiscordObjectState::Invalid;
7086 }
7087 if (other.state_ == DiscordObjectState::Owned) {
7088 Discord_Call_Clone(&instance_, other.instance());
7089
7090 state_ = DiscordObjectState::Owned;
7091 }
7092 }
7093 return *this;
7094}
7095Call::Call(Discord_Call instance, DiscordObjectState state)
7096 : instance_(instance)
7097 , state_(state)
7098{
7099}
7100void Call::Drop()
7101{
7102 if (state_ != DiscordObjectState::Owned) {
7103 return;
7104 }
7105 Discord_Call_Drop(&instance_);
7106 state_ = DiscordObjectState::Invalid;
7107}
7108std::string Call::ErrorToString(discordpp::Call::Error type)
7109{
7110 Discord_String returnValueNative__;
7111 Discord_Call_ErrorToString(static_cast<Discord_Call_Error>(type), &returnValueNative__);
7112 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7113 returnValueNative__.size);
7114 Discord_Free(returnValueNative__.ptr);
7115 return returnValue__;
7116}
7117discordpp::AudioModeType Call::GetAudioMode()
7118{
7119 assert(state_ == DiscordObjectState::Owned);
7120 Discord_AudioModeType returnValue__;
7121 returnValue__ = Discord_Call_GetAudioMode(&instance_);
7122 return static_cast<discordpp::AudioModeType>(returnValue__);
7123}
7124uint64_t Call::GetChannelId() const
7125{
7126 assert(state_ == DiscordObjectState::Owned);
7127 uint64_t returnValue__;
7128 returnValue__ = Discord_Call_GetChannelId(&instance_);
7129 return returnValue__;
7130}
7131uint64_t Call::GetGuildId() const
7132{
7133 assert(state_ == DiscordObjectState::Owned);
7134 uint64_t returnValue__;
7135 returnValue__ = Discord_Call_GetGuildId(&instance_);
7136 return returnValue__;
7137}
7138bool Call::GetLocalMute(uint64_t userId)
7139{
7140 assert(state_ == DiscordObjectState::Owned);
7141 bool returnValue__;
7142 returnValue__ = Discord_Call_GetLocalMute(&instance_, userId);
7143 return returnValue__;
7144}
7145std::vector<uint64_t> Call::GetParticipants() const
7146{
7147 assert(state_ == DiscordObjectState::Owned);
7148 Discord_UInt64Span returnValueNative__;
7149 Discord_Call_GetParticipants(&instance_, &returnValueNative__);
7150 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
7151 returnValueNative__.ptr + returnValueNative__.size);
7152 Discord_Free(returnValueNative__.ptr);
7153 return returnValue__;
7154}
7155float Call::GetParticipantVolume(uint64_t userId)
7156{
7157 assert(state_ == DiscordObjectState::Owned);
7158 float returnValue__;
7159 returnValue__ = Discord_Call_GetParticipantVolume(&instance_, userId);
7160 return returnValue__;
7161}
7162bool Call::GetPTTActive()
7163{
7164 assert(state_ == DiscordObjectState::Owned);
7165 bool returnValue__;
7166 returnValue__ = Discord_Call_GetPTTActive(&instance_);
7167 return returnValue__;
7168}
7169uint32_t Call::GetPTTReleaseDelay()
7170{
7171 assert(state_ == DiscordObjectState::Owned);
7172 uint32_t returnValue__;
7173 returnValue__ = Discord_Call_GetPTTReleaseDelay(&instance_);
7174 return returnValue__;
7175}
7176bool Call::GetSelfDeaf()
7177{
7178 assert(state_ == DiscordObjectState::Owned);
7179 bool returnValue__;
7180 returnValue__ = Discord_Call_GetSelfDeaf(&instance_);
7181 return returnValue__;
7182}
7183bool Call::GetSelfMute()
7184{
7185 assert(state_ == DiscordObjectState::Owned);
7186 bool returnValue__;
7187 returnValue__ = Discord_Call_GetSelfMute(&instance_);
7188 return returnValue__;
7189}
7190discordpp::Call::Status Call::GetStatus() const
7191{
7192 assert(state_ == DiscordObjectState::Owned);
7193 Discord_Call_Status returnValue__;
7194 returnValue__ = Discord_Call_GetStatus(&instance_);
7195 return static_cast<discordpp::Call::Status>(returnValue__);
7196}
7197discordpp::VADThresholdSettings Call::GetVADThreshold() const
7198{
7199 assert(state_ == DiscordObjectState::Owned);
7200 Discord_VADThresholdSettings returnValueNative__{};
7201 Discord_Call_GetVADThreshold(&instance_, &returnValueNative__);
7202 discordpp::VADThresholdSettings returnValue__(returnValueNative__, DiscordObjectState::Owned);
7203 return returnValue__;
7204}
7205std::optional<discordpp::VoiceStateHandle> Call::GetVoiceStateHandle(uint64_t userId) const
7206{
7207 assert(state_ == DiscordObjectState::Owned);
7208 bool returnIsNonNull__;
7209 Discord_VoiceStateHandle returnValueNative__;
7210 returnIsNonNull__ = Discord_Call_GetVoiceStateHandle(&instance_, userId, &returnValueNative__);
7211 if (!returnIsNonNull__) {
7212 return {};
7213 }
7214 discordpp::VoiceStateHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
7215 return returnValue__;
7216}
7217void Call::SetAudioMode(discordpp::AudioModeType audioMode)
7218{
7219 assert(state_ == DiscordObjectState::Owned);
7220 Discord_Call_SetAudioMode(&instance_, static_cast<Discord_AudioModeType>(audioMode));
7221}
7222void Call::SetLocalMute(uint64_t userId, bool mute)
7223{
7224 assert(state_ == DiscordObjectState::Owned);
7225 Discord_Call_SetLocalMute(&instance_, userId, mute);
7226}
7227void Call::SetOnVoiceStateChangedCallback(discordpp::Call::OnVoiceStateChanged cb)
7228{
7229 assert(state_ == DiscordObjectState::Owned);
7230 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
7231 auto cb__userData = new Tcb__UserData(cb);
7232 Discord_Call_OnVoiceStateChanged cb__native = [](auto userId, void* userData__) {
7233 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
7234 userData__typed->delegate(userId);
7235 };
7236 Discord_Call_SetOnVoiceStateChangedCallback(
7237 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
7238}
7239void Call::SetParticipantChangedCallback(discordpp::Call::OnParticipantChanged cb)
7240{
7241 assert(state_ == DiscordObjectState::Owned);
7242 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
7243 auto cb__userData = new Tcb__UserData(cb);
7244 Discord_Call_OnParticipantChanged cb__native = [](auto userId, auto added, void* userData__) {
7245 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
7246 userData__typed->delegate(userId, added);
7247 };
7248 Discord_Call_SetParticipantChangedCallback(
7249 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
7250}
7251void Call::SetParticipantVolume(uint64_t userId, float volume)
7252{
7253 assert(state_ == DiscordObjectState::Owned);
7254 Discord_Call_SetParticipantVolume(&instance_, userId, volume);
7255}
7256void Call::SetPTTActive(bool active)
7257{
7258 assert(state_ == DiscordObjectState::Owned);
7259 Discord_Call_SetPTTActive(&instance_, active);
7260}
7261void Call::SetPTTReleaseDelay(uint32_t releaseDelayMs)
7262{
7263 assert(state_ == DiscordObjectState::Owned);
7264 Discord_Call_SetPTTReleaseDelay(&instance_, releaseDelayMs);
7265}
7266void Call::SetSelfDeaf(bool deaf)
7267{
7268 assert(state_ == DiscordObjectState::Owned);
7269 Discord_Call_SetSelfDeaf(&instance_, deaf);
7270}
7271void Call::SetSelfMute(bool mute)
7272{
7273 assert(state_ == DiscordObjectState::Owned);
7274 Discord_Call_SetSelfMute(&instance_, mute);
7275}
7276void Call::SetSpeakingStatusChangedCallback(discordpp::Call::OnSpeakingStatusChanged cb)
7277{
7278 assert(state_ == DiscordObjectState::Owned);
7279 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
7280 auto cb__userData = new Tcb__UserData(cb);
7281 Discord_Call_OnSpeakingStatusChanged cb__native =
7282 [](auto userId, auto isPlayingSound, void* userData__) {
7283 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
7284 userData__typed->delegate(userId, isPlayingSound);
7285 };
7286 Discord_Call_SetSpeakingStatusChangedCallback(
7287 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
7288}
7289void Call::SetStatusChangedCallback(discordpp::Call::OnStatusChanged cb)
7290{
7291 assert(state_ == DiscordObjectState::Owned);
7292 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
7293 auto cb__userData = new Tcb__UserData(cb);
7294 Discord_Call_OnStatusChanged cb__native =
7295 [](auto status, auto error, auto errorDetail, void* userData__) {
7296 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
7297 userData__typed->delegate(static_cast<discordpp::Call::Status>(status),
7298 static_cast<discordpp::Call::Error>(error),
7299 errorDetail);
7300 };
7301 Discord_Call_SetStatusChangedCallback(
7302 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
7303}
7304void Call::SetVADThreshold(bool automatic, float threshold)
7305{
7306 assert(state_ == DiscordObjectState::Owned);
7307 Discord_Call_SetVADThreshold(&instance_, automatic, threshold);
7308}
7309std::string Call::StatusToString(discordpp::Call::Status type)
7310{
7311 Discord_String returnValueNative__;
7312 Discord_Call_StatusToString(static_cast<Discord_Call_Status>(type), &returnValueNative__);
7313 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7314 returnValueNative__.size);
7315 Discord_Free(returnValueNative__.ptr);
7316 return returnValue__;
7317}
7318const ChannelHandle ChannelHandle::nullobj{{}, DiscordObjectState::Invalid};
7319ChannelHandle::~ChannelHandle()
7320{
7321 if (state_ == DiscordObjectState::Owned) {
7322 Drop();
7323 state_ = DiscordObjectState::Invalid;
7324 }
7325}
7326ChannelHandle::ChannelHandle(ChannelHandle&& other) noexcept
7327 : instance_(other.instance_)
7328 , state_(other.state_)
7329{
7330 other.state_ = DiscordObjectState::Invalid;
7331}
7332ChannelHandle& ChannelHandle::operator=(ChannelHandle&& other) noexcept
7333{
7334 if (this != &other) {
7335 if (state_ == DiscordObjectState::Owned) {
7336 Drop();
7337 }
7338 instance_ = other.instance_;
7339 state_ = other.state_;
7340 other.state_ = DiscordObjectState::Invalid;
7341 }
7342 return *this;
7343}
7344ChannelHandle::ChannelHandle(const ChannelHandle& other)
7345 : instance_{}
7346 , state_(DiscordObjectState::Invalid)
7347{
7348 if (other.state_ == DiscordObjectState::Owned) {
7349 Discord_ChannelHandle_Clone(&instance_, other.instance());
7350
7351 state_ = DiscordObjectState::Owned;
7352 }
7353}
7354ChannelHandle& ChannelHandle::operator=(const ChannelHandle& other)
7355{
7356 if (this != &other) {
7357 if (state_ == DiscordObjectState::Owned) {
7358 Drop();
7359 state_ = DiscordObjectState::Invalid;
7360 }
7361 if (other.state_ == DiscordObjectState::Owned) {
7362 Discord_ChannelHandle_Clone(&instance_, other.instance());
7363
7364 state_ = DiscordObjectState::Owned;
7365 }
7366 }
7367 return *this;
7368}
7369ChannelHandle::ChannelHandle(Discord_ChannelHandle instance, DiscordObjectState state)
7370 : instance_(instance)
7371 , state_(state)
7372{
7373}
7374void ChannelHandle::Drop()
7375{
7376 if (state_ != DiscordObjectState::Owned) {
7377 return;
7378 }
7379 Discord_ChannelHandle_Drop(&instance_);
7380 state_ = DiscordObjectState::Invalid;
7381}
7382uint64_t ChannelHandle::Id() const
7383{
7384 assert(state_ == DiscordObjectState::Owned);
7385 uint64_t returnValue__;
7386 returnValue__ = Discord_ChannelHandle_Id(&instance_);
7387 return returnValue__;
7388}
7389std::string ChannelHandle::Name() const
7390{
7391 assert(state_ == DiscordObjectState::Owned);
7392 Discord_String returnValueNative__;
7393 Discord_ChannelHandle_Name(&instance_, &returnValueNative__);
7394 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7395 returnValueNative__.size);
7396 Discord_Free(returnValueNative__.ptr);
7397 return returnValue__;
7398}
7399std::vector<uint64_t> ChannelHandle::Recipients() const
7400{
7401 assert(state_ == DiscordObjectState::Owned);
7402 Discord_UInt64Span returnValueNative__;
7403 Discord_ChannelHandle_Recipients(&instance_, &returnValueNative__);
7404 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
7405 returnValueNative__.ptr + returnValueNative__.size);
7406 Discord_Free(returnValueNative__.ptr);
7407 return returnValue__;
7408}
7409discordpp::ChannelType ChannelHandle::Type() const
7410{
7411 assert(state_ == DiscordObjectState::Owned);
7412 Discord_ChannelType returnValue__;
7413 returnValue__ = Discord_ChannelHandle_Type(&instance_);
7414 return static_cast<discordpp::ChannelType>(returnValue__);
7415}
7416const GuildMinimal GuildMinimal::nullobj{{}, DiscordObjectState::Invalid};
7417GuildMinimal::~GuildMinimal()
7418{
7419 if (state_ == DiscordObjectState::Owned) {
7420 Drop();
7421 state_ = DiscordObjectState::Invalid;
7422 }
7423}
7424GuildMinimal::GuildMinimal(GuildMinimal&& other) noexcept
7425 : instance_(other.instance_)
7426 , state_(other.state_)
7427{
7428 other.state_ = DiscordObjectState::Invalid;
7429}
7430GuildMinimal& GuildMinimal::operator=(GuildMinimal&& other) noexcept
7431{
7432 if (this != &other) {
7433 if (state_ == DiscordObjectState::Owned) {
7434 Drop();
7435 }
7436 instance_ = other.instance_;
7437 state_ = other.state_;
7438 other.state_ = DiscordObjectState::Invalid;
7439 }
7440 return *this;
7441}
7442GuildMinimal::GuildMinimal(const GuildMinimal& arg0)
7443 : instance_{}
7444 , state_(DiscordObjectState::Invalid)
7445{
7446 if (arg0.state_ == DiscordObjectState::Owned) {
7447 Discord_GuildMinimal_Clone(&instance_, arg0.instance());
7448
7449 state_ = DiscordObjectState::Owned;
7450 }
7451}
7452GuildMinimal& GuildMinimal::operator=(const GuildMinimal& arg0)
7453{
7454 if (this != &arg0) {
7455 if (state_ == DiscordObjectState::Owned) {
7456 Drop();
7457 state_ = DiscordObjectState::Invalid;
7458 }
7459 if (arg0.state_ == DiscordObjectState::Owned) {
7460 Discord_GuildMinimal_Clone(&instance_, arg0.instance());
7461
7462 state_ = DiscordObjectState::Owned;
7463 }
7464 }
7465 return *this;
7466}
7467GuildMinimal::GuildMinimal(Discord_GuildMinimal instance, DiscordObjectState state)
7468 : instance_(instance)
7469 , state_(state)
7470{
7471}
7472void GuildMinimal::Drop()
7473{
7474 if (state_ != DiscordObjectState::Owned) {
7475 return;
7476 }
7477 Discord_GuildMinimal_Drop(&instance_);
7478 state_ = DiscordObjectState::Invalid;
7479}
7480uint64_t GuildMinimal::Id() const
7481{
7482 assert(state_ == DiscordObjectState::Owned);
7483 uint64_t returnValue__;
7484 returnValue__ = Discord_GuildMinimal_Id(&instance_);
7485 return returnValue__;
7486}
7487void GuildMinimal::SetId(uint64_t Id)
7488{
7489 assert(state_ == DiscordObjectState::Owned);
7490 Discord_GuildMinimal_SetId(&instance_, Id);
7491}
7492std::string GuildMinimal::Name() const
7493{
7494 assert(state_ == DiscordObjectState::Owned);
7495 Discord_String returnValueNative__;
7496 Discord_GuildMinimal_Name(&instance_, &returnValueNative__);
7497 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7498 returnValueNative__.size);
7499 Discord_Free(returnValueNative__.ptr);
7500 return returnValue__;
7501}
7502void GuildMinimal::SetName(std::string Name)
7503{
7504 assert(state_ == DiscordObjectState::Owned);
7505 Discord_String Name__str{(uint8_t*)(Name.data()), Name.size()};
7506 Discord_GuildMinimal_SetName(&instance_, Name__str);
7507}
7508const GuildChannel GuildChannel::nullobj{{}, DiscordObjectState::Invalid};
7509GuildChannel::~GuildChannel()
7510{
7511 if (state_ == DiscordObjectState::Owned) {
7512 Drop();
7513 state_ = DiscordObjectState::Invalid;
7514 }
7515}
7516GuildChannel::GuildChannel(GuildChannel&& other) noexcept
7517 : instance_(other.instance_)
7518 , state_(other.state_)
7519{
7520 other.state_ = DiscordObjectState::Invalid;
7521}
7522GuildChannel& GuildChannel::operator=(GuildChannel&& other) noexcept
7523{
7524 if (this != &other) {
7525 if (state_ == DiscordObjectState::Owned) {
7526 Drop();
7527 }
7528 instance_ = other.instance_;
7529 state_ = other.state_;
7530 other.state_ = DiscordObjectState::Invalid;
7531 }
7532 return *this;
7533}
7534GuildChannel::GuildChannel(const GuildChannel& arg0)
7535 : instance_{}
7536 , state_(DiscordObjectState::Invalid)
7537{
7538 if (arg0.state_ == DiscordObjectState::Owned) {
7539 Discord_GuildChannel_Clone(&instance_, arg0.instance());
7540
7541 state_ = DiscordObjectState::Owned;
7542 }
7543}
7544GuildChannel& GuildChannel::operator=(const GuildChannel& arg0)
7545{
7546 if (this != &arg0) {
7547 if (state_ == DiscordObjectState::Owned) {
7548 Drop();
7549 state_ = DiscordObjectState::Invalid;
7550 }
7551 if (arg0.state_ == DiscordObjectState::Owned) {
7552 Discord_GuildChannel_Clone(&instance_, arg0.instance());
7553
7554 state_ = DiscordObjectState::Owned;
7555 }
7556 }
7557 return *this;
7558}
7559GuildChannel::GuildChannel(Discord_GuildChannel instance, DiscordObjectState state)
7560 : instance_(instance)
7561 , state_(state)
7562{
7563}
7564void GuildChannel::Drop()
7565{
7566 if (state_ != DiscordObjectState::Owned) {
7567 return;
7568 }
7569 Discord_GuildChannel_Drop(&instance_);
7570 state_ = DiscordObjectState::Invalid;
7571}
7572uint64_t GuildChannel::Id() const
7573{
7574 assert(state_ == DiscordObjectState::Owned);
7575 uint64_t returnValue__;
7576 returnValue__ = Discord_GuildChannel_Id(&instance_);
7577 return returnValue__;
7578}
7579void GuildChannel::SetId(uint64_t Id)
7580{
7581 assert(state_ == DiscordObjectState::Owned);
7582 Discord_GuildChannel_SetId(&instance_, Id);
7583}
7584std::string GuildChannel::Name() const
7585{
7586 assert(state_ == DiscordObjectState::Owned);
7587 Discord_String returnValueNative__;
7588 Discord_GuildChannel_Name(&instance_, &returnValueNative__);
7589 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7590 returnValueNative__.size);
7591 Discord_Free(returnValueNative__.ptr);
7592 return returnValue__;
7593}
7594void GuildChannel::SetName(std::string Name)
7595{
7596 assert(state_ == DiscordObjectState::Owned);
7597 Discord_String Name__str{(uint8_t*)(Name.data()), Name.size()};
7598 Discord_GuildChannel_SetName(&instance_, Name__str);
7599}
7600bool GuildChannel::IsLinkable() const
7601{
7602 assert(state_ == DiscordObjectState::Owned);
7603 bool returnValue__;
7604 returnValue__ = Discord_GuildChannel_IsLinkable(&instance_);
7605 return returnValue__;
7606}
7607void GuildChannel::SetIsLinkable(bool IsLinkable)
7608{
7609 assert(state_ == DiscordObjectState::Owned);
7610 Discord_GuildChannel_SetIsLinkable(&instance_, IsLinkable);
7611}
7612bool GuildChannel::IsViewableAndWriteableByAllMembers() const
7613{
7614 assert(state_ == DiscordObjectState::Owned);
7615 bool returnValue__;
7616 returnValue__ = Discord_GuildChannel_IsViewableAndWriteableByAllMembers(&instance_);
7617 return returnValue__;
7618}
7619void GuildChannel::SetIsViewableAndWriteableByAllMembers(bool IsViewableAndWriteableByAllMembers)
7620{
7621 assert(state_ == DiscordObjectState::Owned);
7622 Discord_GuildChannel_SetIsViewableAndWriteableByAllMembers(&instance_,
7623 IsViewableAndWriteableByAllMembers);
7624}
7625std::optional<discordpp::LinkedLobby> GuildChannel::LinkedLobby() const
7626{
7627 assert(state_ == DiscordObjectState::Owned);
7628 bool returnIsNonNull__;
7629 Discord_LinkedLobby returnValueNative__;
7630 returnIsNonNull__ = Discord_GuildChannel_LinkedLobby(&instance_, &returnValueNative__);
7631 if (!returnIsNonNull__) {
7632 return {};
7633 }
7634 discordpp::LinkedLobby returnValue__(returnValueNative__, DiscordObjectState::Owned);
7635 return returnValue__;
7636}
7637void GuildChannel::SetLinkedLobby(std::optional<discordpp::LinkedLobby> LinkedLobby)
7638{
7639 assert(state_ == DiscordObjectState::Owned);
7640 Discord_GuildChannel_SetLinkedLobby(
7641 &instance_, (LinkedLobby.has_value() ? LinkedLobby->instance() : nullptr));
7642}
7643const LinkedLobby LinkedLobby::nullobj{{}, DiscordObjectState::Invalid};
7644LinkedLobby::~LinkedLobby()
7645{
7646 if (state_ == DiscordObjectState::Owned) {
7647 Drop();
7648 state_ = DiscordObjectState::Invalid;
7649 }
7650}
7651LinkedLobby::LinkedLobby(LinkedLobby&& other) noexcept
7652 : instance_(other.instance_)
7653 , state_(other.state_)
7654{
7655 other.state_ = DiscordObjectState::Invalid;
7656}
7657LinkedLobby& LinkedLobby::operator=(LinkedLobby&& other) noexcept
7658{
7659 if (this != &other) {
7660 if (state_ == DiscordObjectState::Owned) {
7661 Drop();
7662 }
7663 instance_ = other.instance_;
7664 state_ = other.state_;
7665 other.state_ = DiscordObjectState::Invalid;
7666 }
7667 return *this;
7668}
7669LinkedLobby::LinkedLobby(const LinkedLobby& arg0)
7670 : instance_{}
7671 , state_(DiscordObjectState::Invalid)
7672{
7673 if (arg0.state_ == DiscordObjectState::Owned) {
7674 Discord_LinkedLobby_Clone(&instance_, arg0.instance());
7675
7676 state_ = DiscordObjectState::Owned;
7677 }
7678}
7679LinkedLobby& LinkedLobby::operator=(const LinkedLobby& arg0)
7680{
7681 if (this != &arg0) {
7682 if (state_ == DiscordObjectState::Owned) {
7683 Drop();
7684 state_ = DiscordObjectState::Invalid;
7685 }
7686 if (arg0.state_ == DiscordObjectState::Owned) {
7687 Discord_LinkedLobby_Clone(&instance_, arg0.instance());
7688
7689 state_ = DiscordObjectState::Owned;
7690 }
7691 }
7692 return *this;
7693}
7694LinkedLobby::LinkedLobby(Discord_LinkedLobby instance, DiscordObjectState state)
7695 : instance_(instance)
7696 , state_(state)
7697{
7698}
7699LinkedLobby::LinkedLobby()
7700{
7701 assert(state_ == DiscordObjectState::Invalid);
7702 Discord_LinkedLobby_Init(&instance_);
7703 state_ = DiscordObjectState::Owned;
7704}
7705void LinkedLobby::Drop()
7706{
7707 if (state_ != DiscordObjectState::Owned) {
7708 return;
7709 }
7710 Discord_LinkedLobby_Drop(&instance_);
7711 state_ = DiscordObjectState::Invalid;
7712}
7713uint64_t LinkedLobby::ApplicationId() const
7714{
7715 assert(state_ == DiscordObjectState::Owned);
7716 uint64_t returnValue__;
7717 returnValue__ = Discord_LinkedLobby_ApplicationId(&instance_);
7718 return returnValue__;
7719}
7720void LinkedLobby::SetApplicationId(uint64_t ApplicationId)
7721{
7722 assert(state_ == DiscordObjectState::Owned);
7723 Discord_LinkedLobby_SetApplicationId(&instance_, ApplicationId);
7724}
7725uint64_t LinkedLobby::LobbyId() const
7726{
7727 assert(state_ == DiscordObjectState::Owned);
7728 uint64_t returnValue__;
7729 returnValue__ = Discord_LinkedLobby_LobbyId(&instance_);
7730 return returnValue__;
7731}
7732void LinkedLobby::SetLobbyId(uint64_t LobbyId)
7733{
7734 assert(state_ == DiscordObjectState::Owned);
7735 Discord_LinkedLobby_SetLobbyId(&instance_, LobbyId);
7736}
7737const LinkedChannel LinkedChannel::nullobj{{}, DiscordObjectState::Invalid};
7738LinkedChannel::~LinkedChannel()
7739{
7740 if (state_ == DiscordObjectState::Owned) {
7741 Drop();
7742 state_ = DiscordObjectState::Invalid;
7743 }
7744}
7745LinkedChannel::LinkedChannel(LinkedChannel&& other) noexcept
7746 : instance_(other.instance_)
7747 , state_(other.state_)
7748{
7749 other.state_ = DiscordObjectState::Invalid;
7750}
7751LinkedChannel& LinkedChannel::operator=(LinkedChannel&& other) noexcept
7752{
7753 if (this != &other) {
7754 if (state_ == DiscordObjectState::Owned) {
7755 Drop();
7756 }
7757 instance_ = other.instance_;
7758 state_ = other.state_;
7759 other.state_ = DiscordObjectState::Invalid;
7760 }
7761 return *this;
7762}
7763LinkedChannel::LinkedChannel(const LinkedChannel& arg0)
7764 : instance_{}
7765 , state_(DiscordObjectState::Invalid)
7766{
7767 if (arg0.state_ == DiscordObjectState::Owned) {
7768 Discord_LinkedChannel_Clone(&instance_, arg0.instance());
7769
7770 state_ = DiscordObjectState::Owned;
7771 }
7772}
7773LinkedChannel& LinkedChannel::operator=(const LinkedChannel& arg0)
7774{
7775 if (this != &arg0) {
7776 if (state_ == DiscordObjectState::Owned) {
7777 Drop();
7778 state_ = DiscordObjectState::Invalid;
7779 }
7780 if (arg0.state_ == DiscordObjectState::Owned) {
7781 Discord_LinkedChannel_Clone(&instance_, arg0.instance());
7782
7783 state_ = DiscordObjectState::Owned;
7784 }
7785 }
7786 return *this;
7787}
7788LinkedChannel::LinkedChannel(Discord_LinkedChannel instance, DiscordObjectState state)
7789 : instance_(instance)
7790 , state_(state)
7791{
7792}
7793void LinkedChannel::Drop()
7794{
7795 if (state_ != DiscordObjectState::Owned) {
7796 return;
7797 }
7798 Discord_LinkedChannel_Drop(&instance_);
7799 state_ = DiscordObjectState::Invalid;
7800}
7801uint64_t LinkedChannel::Id() const
7802{
7803 assert(state_ == DiscordObjectState::Owned);
7804 uint64_t returnValue__;
7805 returnValue__ = Discord_LinkedChannel_Id(&instance_);
7806 return returnValue__;
7807}
7808void LinkedChannel::SetId(uint64_t Id)
7809{
7810 assert(state_ == DiscordObjectState::Owned);
7811 Discord_LinkedChannel_SetId(&instance_, Id);
7812}
7813std::string LinkedChannel::Name() const
7814{
7815 assert(state_ == DiscordObjectState::Owned);
7816 Discord_String returnValueNative__;
7817 Discord_LinkedChannel_Name(&instance_, &returnValueNative__);
7818 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
7819 returnValueNative__.size);
7820 Discord_Free(returnValueNative__.ptr);
7821 return returnValue__;
7822}
7823void LinkedChannel::SetName(std::string Name)
7824{
7825 assert(state_ == DiscordObjectState::Owned);
7826 Discord_String Name__str{(uint8_t*)(Name.data()), Name.size()};
7827 Discord_LinkedChannel_SetName(&instance_, Name__str);
7828}
7829uint64_t LinkedChannel::GuildId() const
7830{
7831 assert(state_ == DiscordObjectState::Owned);
7832 uint64_t returnValue__;
7833 returnValue__ = Discord_LinkedChannel_GuildId(&instance_);
7834 return returnValue__;
7835}
7836void LinkedChannel::SetGuildId(uint64_t GuildId)
7837{
7838 assert(state_ == DiscordObjectState::Owned);
7839 Discord_LinkedChannel_SetGuildId(&instance_, GuildId);
7840}
7841const RelationshipHandle RelationshipHandle::nullobj{{}, DiscordObjectState::Invalid};
7842RelationshipHandle::~RelationshipHandle()
7843{
7844 if (state_ == DiscordObjectState::Owned) {
7845 Drop();
7846 state_ = DiscordObjectState::Invalid;
7847 }
7848}
7849RelationshipHandle::RelationshipHandle(RelationshipHandle&& other) noexcept
7850 : instance_(other.instance_)
7851 , state_(other.state_)
7852{
7853 other.state_ = DiscordObjectState::Invalid;
7854}
7855RelationshipHandle& RelationshipHandle::operator=(RelationshipHandle&& other) noexcept
7856{
7857 if (this != &other) {
7858 if (state_ == DiscordObjectState::Owned) {
7859 Drop();
7860 }
7861 instance_ = other.instance_;
7862 state_ = other.state_;
7863 other.state_ = DiscordObjectState::Invalid;
7864 }
7865 return *this;
7866}
7867RelationshipHandle::RelationshipHandle(const RelationshipHandle& other)
7868 : instance_{}
7869 , state_(DiscordObjectState::Invalid)
7870{
7871 if (other.state_ == DiscordObjectState::Owned) {
7872 Discord_RelationshipHandle_Clone(&instance_, other.instance());
7873
7874 state_ = DiscordObjectState::Owned;
7875 }
7876}
7877RelationshipHandle& RelationshipHandle::operator=(const RelationshipHandle& other)
7878{
7879 if (this != &other) {
7880 if (state_ == DiscordObjectState::Owned) {
7881 Drop();
7882 state_ = DiscordObjectState::Invalid;
7883 }
7884 if (other.state_ == DiscordObjectState::Owned) {
7885 Discord_RelationshipHandle_Clone(&instance_, other.instance());
7886
7887 state_ = DiscordObjectState::Owned;
7888 }
7889 }
7890 return *this;
7891}
7892RelationshipHandle::RelationshipHandle(Discord_RelationshipHandle instance,
7893 DiscordObjectState state)
7894 : instance_(instance)
7895 , state_(state)
7896{
7897}
7898void RelationshipHandle::Drop()
7899{
7900 if (state_ != DiscordObjectState::Owned) {
7901 return;
7902 }
7903 Discord_RelationshipHandle_Drop(&instance_);
7904 state_ = DiscordObjectState::Invalid;
7905}
7906discordpp::RelationshipType RelationshipHandle::DiscordRelationshipType() const
7907{
7908 assert(state_ == DiscordObjectState::Owned);
7909 Discord_RelationshipType returnValue__;
7910 returnValue__ = Discord_RelationshipHandle_DiscordRelationshipType(&instance_);
7911 return static_cast<discordpp::RelationshipType>(returnValue__);
7912}
7913discordpp::RelationshipType RelationshipHandle::GameRelationshipType() const
7914{
7915 assert(state_ == DiscordObjectState::Owned);
7916 Discord_RelationshipType returnValue__;
7917 returnValue__ = Discord_RelationshipHandle_GameRelationshipType(&instance_);
7918 return static_cast<discordpp::RelationshipType>(returnValue__);
7919}
7920uint64_t RelationshipHandle::Id() const
7921{
7922 assert(state_ == DiscordObjectState::Owned);
7923 uint64_t returnValue__;
7924 returnValue__ = Discord_RelationshipHandle_Id(&instance_);
7925 return returnValue__;
7926}
7927std::optional<discordpp::UserHandle> RelationshipHandle::User() const
7928{
7929 assert(state_ == DiscordObjectState::Owned);
7930 bool returnIsNonNull__;
7931 Discord_UserHandle returnValueNative__;
7932 returnIsNonNull__ = Discord_RelationshipHandle_User(&instance_, &returnValueNative__);
7933 if (!returnIsNonNull__) {
7934 return {};
7935 }
7936 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
7937 return returnValue__;
7938}
7939const UserHandle UserHandle::nullobj{{}, DiscordObjectState::Invalid};
7940UserHandle::~UserHandle()
7941{
7942 if (state_ == DiscordObjectState::Owned) {
7943 Drop();
7944 state_ = DiscordObjectState::Invalid;
7945 }
7946}
7947UserHandle::UserHandle(UserHandle&& other) noexcept
7948 : instance_(other.instance_)
7949 , state_(other.state_)
7950{
7951 other.state_ = DiscordObjectState::Invalid;
7952}
7953UserHandle& UserHandle::operator=(UserHandle&& other) noexcept
7954{
7955 if (this != &other) {
7956 if (state_ == DiscordObjectState::Owned) {
7957 Drop();
7958 }
7959 instance_ = other.instance_;
7960 state_ = other.state_;
7961 other.state_ = DiscordObjectState::Invalid;
7962 }
7963 return *this;
7964}
7965UserHandle::UserHandle(const UserHandle& arg0)
7966 : instance_{}
7967 , state_(DiscordObjectState::Invalid)
7968{
7969 if (arg0.state_ == DiscordObjectState::Owned) {
7970 Discord_UserHandle_Clone(&instance_, arg0.instance());
7971
7972 state_ = DiscordObjectState::Owned;
7973 }
7974}
7975UserHandle& UserHandle::operator=(const UserHandle& arg0)
7976{
7977 if (this != &arg0) {
7978 if (state_ == DiscordObjectState::Owned) {
7979 Drop();
7980 state_ = DiscordObjectState::Invalid;
7981 }
7982 if (arg0.state_ == DiscordObjectState::Owned) {
7983 Discord_UserHandle_Clone(&instance_, arg0.instance());
7984
7985 state_ = DiscordObjectState::Owned;
7986 }
7987 }
7988 return *this;
7989}
7990UserHandle::UserHandle(Discord_UserHandle instance, DiscordObjectState state)
7991 : instance_(instance)
7992 , state_(state)
7993{
7994}
7995void UserHandle::Drop()
7996{
7997 if (state_ != DiscordObjectState::Owned) {
7998 return;
7999 }
8000 Discord_UserHandle_Drop(&instance_);
8001 state_ = DiscordObjectState::Invalid;
8002}
8003std::optional<std::string> UserHandle::Avatar() const
8004{
8005 assert(state_ == DiscordObjectState::Owned);
8006 bool returnIsNonNull__;
8007 Discord_String returnValueNative__;
8008 returnIsNonNull__ = Discord_UserHandle_Avatar(&instance_, &returnValueNative__);
8009 if (!returnIsNonNull__) {
8010 return {};
8011 }
8012 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8013 returnValueNative__.size);
8014 Discord_Free(returnValueNative__.ptr);
8015 return returnValue__;
8016}
8017std::string UserHandle::AvatarTypeToString(discordpp::UserHandle::AvatarType type)
8018{
8019 Discord_String returnValueNative__;
8020 Discord_UserHandle_AvatarTypeToString(static_cast<Discord_UserHandle_AvatarType>(type),
8021 &returnValueNative__);
8022 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8023 returnValueNative__.size);
8024 Discord_Free(returnValueNative__.ptr);
8025 return returnValue__;
8026}
8027std::string UserHandle::AvatarUrl(discordpp::UserHandle::AvatarType animatedType,
8028 discordpp::UserHandle::AvatarType staticType) const
8029{
8030 assert(state_ == DiscordObjectState::Owned);
8031 Discord_String returnValueNative__;
8032 Discord_UserHandle_AvatarUrl(&instance_,
8033 static_cast<Discord_UserHandle_AvatarType>(animatedType),
8034 static_cast<Discord_UserHandle_AvatarType>(staticType),
8035 &returnValueNative__);
8036 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8037 returnValueNative__.size);
8038 Discord_Free(returnValueNative__.ptr);
8039 return returnValue__;
8040}
8041std::string UserHandle::DisplayName() const
8042{
8043 assert(state_ == DiscordObjectState::Owned);
8044 Discord_String returnValueNative__;
8045 Discord_UserHandle_DisplayName(&instance_, &returnValueNative__);
8046 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8047 returnValueNative__.size);
8048 Discord_Free(returnValueNative__.ptr);
8049 return returnValue__;
8050}
8051std::optional<discordpp::Activity> UserHandle::GameActivity() const
8052{
8053 assert(state_ == DiscordObjectState::Owned);
8054 bool returnIsNonNull__;
8055 Discord_Activity returnValueNative__;
8056 returnIsNonNull__ = Discord_UserHandle_GameActivity(&instance_, &returnValueNative__);
8057 if (!returnIsNonNull__) {
8058 return {};
8059 }
8060 discordpp::Activity returnValue__(returnValueNative__, DiscordObjectState::Owned);
8061 return returnValue__;
8062}
8063std::optional<std::string> UserHandle::GlobalName() const
8064{
8065 assert(state_ == DiscordObjectState::Owned);
8066 bool returnIsNonNull__;
8067 Discord_String returnValueNative__;
8068 returnIsNonNull__ = Discord_UserHandle_GlobalName(&instance_, &returnValueNative__);
8069 if (!returnIsNonNull__) {
8070 return {};
8071 }
8072 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8073 returnValueNative__.size);
8074 Discord_Free(returnValueNative__.ptr);
8075 return returnValue__;
8076}
8077uint64_t UserHandle::Id() const
8078{
8079 assert(state_ == DiscordObjectState::Owned);
8080 uint64_t returnValue__;
8081 returnValue__ = Discord_UserHandle_Id(&instance_);
8082 return returnValue__;
8083}
8084bool UserHandle::IsProvisional() const
8085{
8086 assert(state_ == DiscordObjectState::Owned);
8087 bool returnValue__;
8088 returnValue__ = Discord_UserHandle_IsProvisional(&instance_);
8089 return returnValue__;
8090}
8091discordpp::RelationshipHandle UserHandle::Relationship() const
8092{
8093 assert(state_ == DiscordObjectState::Owned);
8094 Discord_RelationshipHandle returnValueNative__{};
8095 Discord_UserHandle_Relationship(&instance_, &returnValueNative__);
8096 discordpp::RelationshipHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8097 return returnValue__;
8098}
8099discordpp::StatusType UserHandle::Status() const
8100{
8101 assert(state_ == DiscordObjectState::Owned);
8102 Discord_StatusType returnValue__;
8103 returnValue__ = Discord_UserHandle_Status(&instance_);
8104 return static_cast<discordpp::StatusType>(returnValue__);
8105}
8106std::string UserHandle::Username() const
8107{
8108 assert(state_ == DiscordObjectState::Owned);
8109 Discord_String returnValueNative__;
8110 Discord_UserHandle_Username(&instance_, &returnValueNative__);
8111 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8112 returnValueNative__.size);
8113 Discord_Free(returnValueNative__.ptr);
8114 return returnValue__;
8115}
8116const LobbyMemberHandle LobbyMemberHandle::nullobj{{}, DiscordObjectState::Invalid};
8117LobbyMemberHandle::~LobbyMemberHandle()
8118{
8119 if (state_ == DiscordObjectState::Owned) {
8120 Drop();
8121 state_ = DiscordObjectState::Invalid;
8122 }
8123}
8124LobbyMemberHandle::LobbyMemberHandle(LobbyMemberHandle&& other) noexcept
8125 : instance_(other.instance_)
8126 , state_(other.state_)
8127{
8128 other.state_ = DiscordObjectState::Invalid;
8129}
8130LobbyMemberHandle& LobbyMemberHandle::operator=(LobbyMemberHandle&& other) noexcept
8131{
8132 if (this != &other) {
8133 if (state_ == DiscordObjectState::Owned) {
8134 Drop();
8135 }
8136 instance_ = other.instance_;
8137 state_ = other.state_;
8138 other.state_ = DiscordObjectState::Invalid;
8139 }
8140 return *this;
8141}
8142LobbyMemberHandle::LobbyMemberHandle(const LobbyMemberHandle& other)
8143 : instance_{}
8144 , state_(DiscordObjectState::Invalid)
8145{
8146 if (other.state_ == DiscordObjectState::Owned) {
8147 Discord_LobbyMemberHandle_Clone(&instance_, other.instance());
8148
8149 state_ = DiscordObjectState::Owned;
8150 }
8151}
8152LobbyMemberHandle& LobbyMemberHandle::operator=(const LobbyMemberHandle& other)
8153{
8154 if (this != &other) {
8155 if (state_ == DiscordObjectState::Owned) {
8156 Drop();
8157 state_ = DiscordObjectState::Invalid;
8158 }
8159 if (other.state_ == DiscordObjectState::Owned) {
8160 Discord_LobbyMemberHandle_Clone(&instance_, other.instance());
8161
8162 state_ = DiscordObjectState::Owned;
8163 }
8164 }
8165 return *this;
8166}
8167LobbyMemberHandle::LobbyMemberHandle(Discord_LobbyMemberHandle instance, DiscordObjectState state)
8168 : instance_(instance)
8169 , state_(state)
8170{
8171}
8172void LobbyMemberHandle::Drop()
8173{
8174 if (state_ != DiscordObjectState::Owned) {
8175 return;
8176 }
8177 Discord_LobbyMemberHandle_Drop(&instance_);
8178 state_ = DiscordObjectState::Invalid;
8179}
8180bool LobbyMemberHandle::CanLinkLobby() const
8181{
8182 assert(state_ == DiscordObjectState::Owned);
8183 bool returnValue__;
8184 returnValue__ = Discord_LobbyMemberHandle_CanLinkLobby(&instance_);
8185 return returnValue__;
8186}
8187bool LobbyMemberHandle::Connected() const
8188{
8189 assert(state_ == DiscordObjectState::Owned);
8190 bool returnValue__;
8191 returnValue__ = Discord_LobbyMemberHandle_Connected(&instance_);
8192 return returnValue__;
8193}
8194uint64_t LobbyMemberHandle::Id() const
8195{
8196 assert(state_ == DiscordObjectState::Owned);
8197 uint64_t returnValue__;
8198 returnValue__ = Discord_LobbyMemberHandle_Id(&instance_);
8199 return returnValue__;
8200}
8201std::unordered_map<std::string, std::string> LobbyMemberHandle::Metadata() const
8202{
8203 assert(state_ == DiscordObjectState::Owned);
8204 Discord_Properties returnValueNative__;
8205 Discord_LobbyMemberHandle_Metadata(&instance_, &returnValueNative__);
8206 std::unordered_map<std::string, std::string> returnValue__ =
8207 ConvertReturnedProperties(returnValueNative__);
8208 Discord_FreeProperties(returnValueNative__);
8209 return returnValue__;
8210}
8211std::optional<discordpp::UserHandle> LobbyMemberHandle::User() const
8212{
8213 assert(state_ == DiscordObjectState::Owned);
8214 bool returnIsNonNull__;
8215 Discord_UserHandle returnValueNative__;
8216 returnIsNonNull__ = Discord_LobbyMemberHandle_User(&instance_, &returnValueNative__);
8217 if (!returnIsNonNull__) {
8218 return {};
8219 }
8220 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8221 return returnValue__;
8222}
8223const LobbyHandle LobbyHandle::nullobj{{}, DiscordObjectState::Invalid};
8224LobbyHandle::~LobbyHandle()
8225{
8226 if (state_ == DiscordObjectState::Owned) {
8227 Drop();
8228 state_ = DiscordObjectState::Invalid;
8229 }
8230}
8231LobbyHandle::LobbyHandle(LobbyHandle&& other) noexcept
8232 : instance_(other.instance_)
8233 , state_(other.state_)
8234{
8235 other.state_ = DiscordObjectState::Invalid;
8236}
8237LobbyHandle& LobbyHandle::operator=(LobbyHandle&& other) noexcept
8238{
8239 if (this != &other) {
8240 if (state_ == DiscordObjectState::Owned) {
8241 Drop();
8242 }
8243 instance_ = other.instance_;
8244 state_ = other.state_;
8245 other.state_ = DiscordObjectState::Invalid;
8246 }
8247 return *this;
8248}
8249LobbyHandle::LobbyHandle(const LobbyHandle& other)
8250 : instance_{}
8251 , state_(DiscordObjectState::Invalid)
8252{
8253 if (other.state_ == DiscordObjectState::Owned) {
8254 Discord_LobbyHandle_Clone(&instance_, other.instance());
8255
8256 state_ = DiscordObjectState::Owned;
8257 }
8258}
8259LobbyHandle& LobbyHandle::operator=(const LobbyHandle& other)
8260{
8261 if (this != &other) {
8262 if (state_ == DiscordObjectState::Owned) {
8263 Drop();
8264 state_ = DiscordObjectState::Invalid;
8265 }
8266 if (other.state_ == DiscordObjectState::Owned) {
8267 Discord_LobbyHandle_Clone(&instance_, other.instance());
8268
8269 state_ = DiscordObjectState::Owned;
8270 }
8271 }
8272 return *this;
8273}
8274LobbyHandle::LobbyHandle(Discord_LobbyHandle instance, DiscordObjectState state)
8275 : instance_(instance)
8276 , state_(state)
8277{
8278}
8279void LobbyHandle::Drop()
8280{
8281 if (state_ != DiscordObjectState::Owned) {
8282 return;
8283 }
8284 Discord_LobbyHandle_Drop(&instance_);
8285 state_ = DiscordObjectState::Invalid;
8286}
8287std::optional<discordpp::CallInfoHandle> LobbyHandle::GetCallInfoHandle() const
8288{
8289 assert(state_ == DiscordObjectState::Owned);
8290 bool returnIsNonNull__;
8291 Discord_CallInfoHandle returnValueNative__;
8292 returnIsNonNull__ = Discord_LobbyHandle_GetCallInfoHandle(&instance_, &returnValueNative__);
8293 if (!returnIsNonNull__) {
8294 return {};
8295 }
8296 discordpp::CallInfoHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8297 return returnValue__;
8298}
8299std::optional<discordpp::LobbyMemberHandle> LobbyHandle::GetLobbyMemberHandle(
8300 uint64_t memberId) const
8301{
8302 assert(state_ == DiscordObjectState::Owned);
8303 bool returnIsNonNull__;
8304 Discord_LobbyMemberHandle returnValueNative__;
8305 returnIsNonNull__ =
8306 Discord_LobbyHandle_GetLobbyMemberHandle(&instance_, memberId, &returnValueNative__);
8307 if (!returnIsNonNull__) {
8308 return {};
8309 }
8310 discordpp::LobbyMemberHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8311 return returnValue__;
8312}
8313uint64_t LobbyHandle::Id() const
8314{
8315 assert(state_ == DiscordObjectState::Owned);
8316 uint64_t returnValue__;
8317 returnValue__ = Discord_LobbyHandle_Id(&instance_);
8318 return returnValue__;
8319}
8320std::optional<discordpp::LinkedChannel> LobbyHandle::LinkedChannel() const
8321{
8322 assert(state_ == DiscordObjectState::Owned);
8323 bool returnIsNonNull__;
8324 Discord_LinkedChannel returnValueNative__;
8325 returnIsNonNull__ = Discord_LobbyHandle_LinkedChannel(&instance_, &returnValueNative__);
8326 if (!returnIsNonNull__) {
8327 return {};
8328 }
8329 discordpp::LinkedChannel returnValue__(returnValueNative__, DiscordObjectState::Owned);
8330 return returnValue__;
8331}
8332std::vector<uint64_t> LobbyHandle::LobbyMemberIds() const
8333{
8334 assert(state_ == DiscordObjectState::Owned);
8335 Discord_UInt64Span returnValueNative__;
8336 Discord_LobbyHandle_LobbyMemberIds(&instance_, &returnValueNative__);
8337 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
8338 returnValueNative__.ptr + returnValueNative__.size);
8339 Discord_Free(returnValueNative__.ptr);
8340 return returnValue__;
8341}
8342std::vector<discordpp::LobbyMemberHandle> LobbyHandle::LobbyMembers() const
8343{
8344 assert(state_ == DiscordObjectState::Owned);
8345 Discord_LobbyMemberHandleSpan returnValueNative__;
8346 Discord_LobbyHandle_LobbyMembers(&instance_, &returnValueNative__);
8347 std::vector<discordpp::LobbyMemberHandle> returnValue__;
8348 returnValue__.reserve(returnValueNative__.size);
8349 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
8350 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
8351 }
8352 Discord_Free(returnValueNative__.ptr);
8353 return returnValue__;
8354}
8355std::unordered_map<std::string, std::string> LobbyHandle::Metadata() const
8356{
8357 assert(state_ == DiscordObjectState::Owned);
8358 Discord_Properties returnValueNative__;
8359 Discord_LobbyHandle_Metadata(&instance_, &returnValueNative__);
8360 std::unordered_map<std::string, std::string> returnValue__ =
8361 ConvertReturnedProperties(returnValueNative__);
8362 Discord_FreeProperties(returnValueNative__);
8363 return returnValue__;
8364}
8365const AdditionalContent AdditionalContent::nullobj{{}, DiscordObjectState::Invalid};
8366AdditionalContent::~AdditionalContent()
8367{
8368 if (state_ == DiscordObjectState::Owned) {
8369 Drop();
8370 state_ = DiscordObjectState::Invalid;
8371 }
8372}
8373AdditionalContent::AdditionalContent(AdditionalContent&& other) noexcept
8374 : instance_(other.instance_)
8375 , state_(other.state_)
8376{
8377 other.state_ = DiscordObjectState::Invalid;
8378}
8379AdditionalContent& AdditionalContent::operator=(AdditionalContent&& other) noexcept
8380{
8381 if (this != &other) {
8382 if (state_ == DiscordObjectState::Owned) {
8383 Drop();
8384 }
8385 instance_ = other.instance_;
8386 state_ = other.state_;
8387 other.state_ = DiscordObjectState::Invalid;
8388 }
8389 return *this;
8390}
8391AdditionalContent::AdditionalContent(const AdditionalContent& arg0)
8392 : instance_{}
8393 , state_(DiscordObjectState::Invalid)
8394{
8395 if (arg0.state_ == DiscordObjectState::Owned) {
8396 Discord_AdditionalContent_Clone(&instance_, arg0.instance());
8397
8398 state_ = DiscordObjectState::Owned;
8399 }
8400}
8401AdditionalContent& AdditionalContent::operator=(const AdditionalContent& arg0)
8402{
8403 if (this != &arg0) {
8404 if (state_ == DiscordObjectState::Owned) {
8405 Drop();
8406 state_ = DiscordObjectState::Invalid;
8407 }
8408 if (arg0.state_ == DiscordObjectState::Owned) {
8409 Discord_AdditionalContent_Clone(&instance_, arg0.instance());
8410
8411 state_ = DiscordObjectState::Owned;
8412 }
8413 }
8414 return *this;
8415}
8416AdditionalContent::AdditionalContent(Discord_AdditionalContent instance, DiscordObjectState state)
8417 : instance_(instance)
8418 , state_(state)
8419{
8420}
8421AdditionalContent::AdditionalContent()
8422{
8423 assert(state_ == DiscordObjectState::Invalid);
8424 Discord_AdditionalContent_Init(&instance_);
8425 state_ = DiscordObjectState::Owned;
8426}
8427void AdditionalContent::Drop()
8428{
8429 if (state_ != DiscordObjectState::Owned) {
8430 return;
8431 }
8432 Discord_AdditionalContent_Drop(&instance_);
8433 state_ = DiscordObjectState::Invalid;
8434}
8435bool AdditionalContent::Equals(discordpp::AdditionalContent rhs) const
8436{
8437 assert(state_ == DiscordObjectState::Owned);
8438 bool returnValue__;
8439 returnValue__ = Discord_AdditionalContent_Equals(&instance_, rhs.instance());
8440 return returnValue__;
8441}
8442std::string AdditionalContent::TypeToString(discordpp::AdditionalContentType type)
8443{
8444 Discord_String returnValueNative__;
8445 Discord_AdditionalContent_TypeToString(static_cast<Discord_AdditionalContentType>(type),
8446 &returnValueNative__);
8447 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8448 returnValueNative__.size);
8449 Discord_Free(returnValueNative__.ptr);
8450 return returnValue__;
8451}
8452discordpp::AdditionalContentType AdditionalContent::Type() const
8453{
8454 assert(state_ == DiscordObjectState::Owned);
8455 Discord_AdditionalContentType returnValue__;
8456 returnValue__ = Discord_AdditionalContent_Type(&instance_);
8457 return static_cast<discordpp::AdditionalContentType>(returnValue__);
8458}
8459void AdditionalContent::SetType(discordpp::AdditionalContentType Type)
8460{
8461 assert(state_ == DiscordObjectState::Owned);
8462 Discord_AdditionalContent_SetType(&instance_, static_cast<Discord_AdditionalContentType>(Type));
8463}
8464std::optional<std::string> AdditionalContent::Title() const
8465{
8466 assert(state_ == DiscordObjectState::Owned);
8467 bool returnIsNonNull__;
8468 Discord_String returnValueNative__;
8469 returnIsNonNull__ = Discord_AdditionalContent_Title(&instance_, &returnValueNative__);
8470 if (!returnIsNonNull__) {
8471 return {};
8472 }
8473 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8474 returnValueNative__.size);
8475 Discord_Free(returnValueNative__.ptr);
8476 return returnValue__;
8477}
8478void AdditionalContent::SetTitle(std::optional<std::string> Title)
8479{
8480 assert(state_ == DiscordObjectState::Owned);
8481 Discord_String Title__str{};
8482 if (Title.has_value()) {
8483 Title__str.ptr = reinterpret_cast<uint8_t*>(Title->data());
8484 Title__str.size = Title->size();
8485 }
8486 Discord_AdditionalContent_SetTitle(&instance_, (Title.has_value() ? &Title__str : nullptr));
8487}
8488uint8_t AdditionalContent::Count() const
8489{
8490 assert(state_ == DiscordObjectState::Owned);
8491 uint8_t returnValue__;
8492 returnValue__ = Discord_AdditionalContent_Count(&instance_);
8493 return returnValue__;
8494}
8495void AdditionalContent::SetCount(uint8_t Count)
8496{
8497 assert(state_ == DiscordObjectState::Owned);
8498 Discord_AdditionalContent_SetCount(&instance_, Count);
8499}
8500const MessageHandle MessageHandle::nullobj{{}, DiscordObjectState::Invalid};
8501MessageHandle::~MessageHandle()
8502{
8503 if (state_ == DiscordObjectState::Owned) {
8504 Drop();
8505 state_ = DiscordObjectState::Invalid;
8506 }
8507}
8508MessageHandle::MessageHandle(MessageHandle&& other) noexcept
8509 : instance_(other.instance_)
8510 , state_(other.state_)
8511{
8512 other.state_ = DiscordObjectState::Invalid;
8513}
8514MessageHandle& MessageHandle::operator=(MessageHandle&& other) noexcept
8515{
8516 if (this != &other) {
8517 if (state_ == DiscordObjectState::Owned) {
8518 Drop();
8519 }
8520 instance_ = other.instance_;
8521 state_ = other.state_;
8522 other.state_ = DiscordObjectState::Invalid;
8523 }
8524 return *this;
8525}
8526MessageHandle::MessageHandle(const MessageHandle& other)
8527 : instance_{}
8528 , state_(DiscordObjectState::Invalid)
8529{
8530 if (other.state_ == DiscordObjectState::Owned) {
8531 Discord_MessageHandle_Clone(&instance_, other.instance());
8532
8533 state_ = DiscordObjectState::Owned;
8534 }
8535}
8536MessageHandle& MessageHandle::operator=(const MessageHandle& other)
8537{
8538 if (this != &other) {
8539 if (state_ == DiscordObjectState::Owned) {
8540 Drop();
8541 state_ = DiscordObjectState::Invalid;
8542 }
8543 if (other.state_ == DiscordObjectState::Owned) {
8544 Discord_MessageHandle_Clone(&instance_, other.instance());
8545
8546 state_ = DiscordObjectState::Owned;
8547 }
8548 }
8549 return *this;
8550}
8551MessageHandle::MessageHandle(Discord_MessageHandle instance, DiscordObjectState state)
8552 : instance_(instance)
8553 , state_(state)
8554{
8555}
8556void MessageHandle::Drop()
8557{
8558 if (state_ != DiscordObjectState::Owned) {
8559 return;
8560 }
8561 Discord_MessageHandle_Drop(&instance_);
8562 state_ = DiscordObjectState::Invalid;
8563}
8564std::optional<discordpp::AdditionalContent> MessageHandle::AdditionalContent() const
8565{
8566 assert(state_ == DiscordObjectState::Owned);
8567 bool returnIsNonNull__;
8568 Discord_AdditionalContent returnValueNative__;
8569 returnIsNonNull__ = Discord_MessageHandle_AdditionalContent(&instance_, &returnValueNative__);
8570 if (!returnIsNonNull__) {
8571 return {};
8572 }
8573 discordpp::AdditionalContent returnValue__(returnValueNative__, DiscordObjectState::Owned);
8574 return returnValue__;
8575}
8576std::optional<discordpp::UserHandle> MessageHandle::Author() const
8577{
8578 assert(state_ == DiscordObjectState::Owned);
8579 bool returnIsNonNull__;
8580 Discord_UserHandle returnValueNative__;
8581 returnIsNonNull__ = Discord_MessageHandle_Author(&instance_, &returnValueNative__);
8582 if (!returnIsNonNull__) {
8583 return {};
8584 }
8585 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8586 return returnValue__;
8587}
8588uint64_t MessageHandle::AuthorId() const
8589{
8590 assert(state_ == DiscordObjectState::Owned);
8591 uint64_t returnValue__;
8592 returnValue__ = Discord_MessageHandle_AuthorId(&instance_);
8593 return returnValue__;
8594}
8595std::optional<discordpp::ChannelHandle> MessageHandle::Channel() const
8596{
8597 assert(state_ == DiscordObjectState::Owned);
8598 bool returnIsNonNull__;
8599 Discord_ChannelHandle returnValueNative__;
8600 returnIsNonNull__ = Discord_MessageHandle_Channel(&instance_, &returnValueNative__);
8601 if (!returnIsNonNull__) {
8602 return {};
8603 }
8604 discordpp::ChannelHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8605 return returnValue__;
8606}
8607uint64_t MessageHandle::ChannelId() const
8608{
8609 assert(state_ == DiscordObjectState::Owned);
8610 uint64_t returnValue__;
8611 returnValue__ = Discord_MessageHandle_ChannelId(&instance_);
8612 return returnValue__;
8613}
8614std::string MessageHandle::Content() const
8615{
8616 assert(state_ == DiscordObjectState::Owned);
8617 Discord_String returnValueNative__;
8618 Discord_MessageHandle_Content(&instance_, &returnValueNative__);
8619 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8620 returnValueNative__.size);
8621 Discord_Free(returnValueNative__.ptr);
8622 return returnValue__;
8623}
8624std::optional<discordpp::DisclosureTypes> MessageHandle::DisclosureType() const
8625{
8626 assert(state_ == DiscordObjectState::Owned);
8627 bool returnIsNonNull__;
8628 Discord_DisclosureTypes returnValueNative__;
8629 returnIsNonNull__ = Discord_MessageHandle_DisclosureType(&instance_, &returnValueNative__);
8630 if (!returnIsNonNull__) {
8631 return {};
8632 }
8633 auto returnValue__ = static_cast<discordpp::DisclosureTypes>(returnValueNative__);
8634 return returnValue__;
8635}
8636uint64_t MessageHandle::EditedTimestamp() const
8637{
8638 assert(state_ == DiscordObjectState::Owned);
8639 uint64_t returnValue__;
8640 returnValue__ = Discord_MessageHandle_EditedTimestamp(&instance_);
8641 return returnValue__;
8642}
8643uint64_t MessageHandle::Id() const
8644{
8645 assert(state_ == DiscordObjectState::Owned);
8646 uint64_t returnValue__;
8647 returnValue__ = Discord_MessageHandle_Id(&instance_);
8648 return returnValue__;
8649}
8650std::optional<discordpp::LobbyHandle> MessageHandle::Lobby() const
8651{
8652 assert(state_ == DiscordObjectState::Owned);
8653 bool returnIsNonNull__;
8654 Discord_LobbyHandle returnValueNative__;
8655 returnIsNonNull__ = Discord_MessageHandle_Lobby(&instance_, &returnValueNative__);
8656 if (!returnIsNonNull__) {
8657 return {};
8658 }
8659 discordpp::LobbyHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8660 return returnValue__;
8661}
8662std::unordered_map<std::string, std::string> MessageHandle::Metadata() const
8663{
8664 assert(state_ == DiscordObjectState::Owned);
8665 Discord_Properties returnValueNative__;
8666 Discord_MessageHandle_Metadata(&instance_, &returnValueNative__);
8667 std::unordered_map<std::string, std::string> returnValue__ =
8668 ConvertReturnedProperties(returnValueNative__);
8669 Discord_FreeProperties(returnValueNative__);
8670 return returnValue__;
8671}
8672std::string MessageHandle::RawContent() const
8673{
8674 assert(state_ == DiscordObjectState::Owned);
8675 Discord_String returnValueNative__;
8676 Discord_MessageHandle_RawContent(&instance_, &returnValueNative__);
8677 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8678 returnValueNative__.size);
8679 Discord_Free(returnValueNative__.ptr);
8680 return returnValue__;
8681}
8682std::optional<discordpp::UserHandle> MessageHandle::Recipient() const
8683{
8684 assert(state_ == DiscordObjectState::Owned);
8685 bool returnIsNonNull__;
8686 Discord_UserHandle returnValueNative__;
8687 returnIsNonNull__ = Discord_MessageHandle_Recipient(&instance_, &returnValueNative__);
8688 if (!returnIsNonNull__) {
8689 return {};
8690 }
8691 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
8692 return returnValue__;
8693}
8694uint64_t MessageHandle::RecipientId() const
8695{
8696 assert(state_ == DiscordObjectState::Owned);
8697 uint64_t returnValue__;
8698 returnValue__ = Discord_MessageHandle_RecipientId(&instance_);
8699 return returnValue__;
8700}
8701bool MessageHandle::SentFromGame() const
8702{
8703 assert(state_ == DiscordObjectState::Owned);
8704 bool returnValue__;
8705 returnValue__ = Discord_MessageHandle_SentFromGame(&instance_);
8706 return returnValue__;
8707}
8708uint64_t MessageHandle::SentTimestamp() const
8709{
8710 assert(state_ == DiscordObjectState::Owned);
8711 uint64_t returnValue__;
8712 returnValue__ = Discord_MessageHandle_SentTimestamp(&instance_);
8713 return returnValue__;
8714}
8715const AudioDevice AudioDevice::nullobj{{}, DiscordObjectState::Invalid};
8716AudioDevice::~AudioDevice()
8717{
8718 if (state_ == DiscordObjectState::Owned) {
8719 Drop();
8720 state_ = DiscordObjectState::Invalid;
8721 }
8722}
8723AudioDevice::AudioDevice(AudioDevice&& other) noexcept
8724 : instance_(other.instance_)
8725 , state_(other.state_)
8726{
8727 other.state_ = DiscordObjectState::Invalid;
8728}
8729AudioDevice& AudioDevice::operator=(AudioDevice&& other) noexcept
8730{
8731 if (this != &other) {
8732 if (state_ == DiscordObjectState::Owned) {
8733 Drop();
8734 }
8735 instance_ = other.instance_;
8736 state_ = other.state_;
8737 other.state_ = DiscordObjectState::Invalid;
8738 }
8739 return *this;
8740}
8741AudioDevice::AudioDevice(const AudioDevice& arg0)
8742 : instance_{}
8743 , state_(DiscordObjectState::Invalid)
8744{
8745 if (arg0.state_ == DiscordObjectState::Owned) {
8746 Discord_AudioDevice_Clone(&instance_, arg0.instance());
8747
8748 state_ = DiscordObjectState::Owned;
8749 }
8750}
8751AudioDevice& AudioDevice::operator=(const AudioDevice& arg0)
8752{
8753 if (this != &arg0) {
8754 if (state_ == DiscordObjectState::Owned) {
8755 Drop();
8756 state_ = DiscordObjectState::Invalid;
8757 }
8758 if (arg0.state_ == DiscordObjectState::Owned) {
8759 Discord_AudioDevice_Clone(&instance_, arg0.instance());
8760
8761 state_ = DiscordObjectState::Owned;
8762 }
8763 }
8764 return *this;
8765}
8766AudioDevice::AudioDevice(Discord_AudioDevice instance, DiscordObjectState state)
8767 : instance_(instance)
8768 , state_(state)
8769{
8770}
8771void AudioDevice::Drop()
8772{
8773 if (state_ != DiscordObjectState::Owned) {
8774 return;
8775 }
8776 Discord_AudioDevice_Drop(&instance_);
8777 state_ = DiscordObjectState::Invalid;
8778}
8779bool AudioDevice::Equals(discordpp::AudioDevice rhs)
8780{
8781 assert(state_ == DiscordObjectState::Owned);
8782 bool returnValue__;
8783 returnValue__ = Discord_AudioDevice_Equals(&instance_, rhs.instance());
8784 return returnValue__;
8785}
8786std::string AudioDevice::Id() const
8787{
8788 assert(state_ == DiscordObjectState::Owned);
8789 Discord_String returnValueNative__;
8790 Discord_AudioDevice_Id(&instance_, &returnValueNative__);
8791 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8792 returnValueNative__.size);
8793 Discord_Free(returnValueNative__.ptr);
8794 return returnValue__;
8795}
8796void AudioDevice::SetId(std::string Id)
8797{
8798 assert(state_ == DiscordObjectState::Owned);
8799 Discord_String Id__str{(uint8_t*)(Id.data()), Id.size()};
8800 Discord_AudioDevice_SetId(&instance_, Id__str);
8801}
8802std::string AudioDevice::Name() const
8803{
8804 assert(state_ == DiscordObjectState::Owned);
8805 Discord_String returnValueNative__;
8806 Discord_AudioDevice_Name(&instance_, &returnValueNative__);
8807 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8808 returnValueNative__.size);
8809 Discord_Free(returnValueNative__.ptr);
8810 return returnValue__;
8811}
8812void AudioDevice::SetName(std::string Name)
8813{
8814 assert(state_ == DiscordObjectState::Owned);
8815 Discord_String Name__str{(uint8_t*)(Name.data()), Name.size()};
8816 Discord_AudioDevice_SetName(&instance_, Name__str);
8817}
8818bool AudioDevice::IsDefault() const
8819{
8820 assert(state_ == DiscordObjectState::Owned);
8821 bool returnValue__;
8822 returnValue__ = Discord_AudioDevice_IsDefault(&instance_);
8823 return returnValue__;
8824}
8825void AudioDevice::SetIsDefault(bool IsDefault)
8826{
8827 assert(state_ == DiscordObjectState::Owned);
8828 Discord_AudioDevice_SetIsDefault(&instance_, IsDefault);
8829}
8830const Client Client::nullobj{{}, DiscordObjectState::Invalid};
8831Client::~Client()
8832{
8833 if (state_ == DiscordObjectState::Owned) {
8834 Drop();
8835 state_ = DiscordObjectState::Invalid;
8836 }
8837}
8838Client::Client(Client&& other) noexcept
8839 : instance_(other.instance_)
8840 , state_(other.state_)
8841{
8842 other.state_ = DiscordObjectState::Invalid;
8843}
8844Client& Client::operator=(Client&& other) noexcept
8845{
8846 if (this != &other) {
8847 if (state_ == DiscordObjectState::Owned) {
8848 Drop();
8849 }
8850 instance_ = other.instance_;
8851 state_ = other.state_;
8852 other.state_ = DiscordObjectState::Invalid;
8853 }
8854 return *this;
8855}
8856Client::Client(Discord_Client instance, DiscordObjectState state)
8857 : instance_(instance)
8858 , state_(state)
8859{
8860}
8861Client::Client()
8862{
8863 assert(state_ == DiscordObjectState::Invalid);
8864 Discord_Client_Init(&instance_);
8865 state_ = DiscordObjectState::Owned;
8866}
8867Client::Client(std::string apiBase, std::string webBase)
8868{
8869 assert(state_ == DiscordObjectState::Invalid);
8870 Discord_String apiBase__str{(uint8_t*)(apiBase.data()), apiBase.size()};
8871 Discord_String webBase__str{(uint8_t*)(webBase.data()), webBase.size()};
8872 Discord_Client_InitWithBases(&instance_, apiBase__str, webBase__str);
8873 state_ = DiscordObjectState::Owned;
8874}
8875void Client::Drop()
8876{
8877 if (state_ != DiscordObjectState::Owned) {
8878 return;
8879 }
8880 Discord_Client_Drop(&instance_);
8881 state_ = DiscordObjectState::Invalid;
8882}
8883std::string Client::ErrorToString(discordpp::Client::Error type)
8884{
8885 Discord_String returnValueNative__;
8886 Discord_Client_ErrorToString(static_cast<Discord_Client_Error>(type), &returnValueNative__);
8887 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8888 returnValueNative__.size);
8889 Discord_Free(returnValueNative__.ptr);
8890 return returnValue__;
8891}
8892uint64_t Client::GetApplicationId()
8893{
8894 assert(state_ == DiscordObjectState::Owned);
8895 uint64_t returnValue__;
8896 returnValue__ = Discord_Client_GetApplicationId(&instance_);
8897 return returnValue__;
8898}
8899std::string Client::GetDefaultAudioDeviceId()
8900{
8901 Discord_String returnValueNative__;
8902 Discord_Client_GetDefaultAudioDeviceId(&returnValueNative__);
8903 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8904 returnValueNative__.size);
8905 Discord_Free(returnValueNative__.ptr);
8906 return returnValue__;
8907}
8908std::string Client::GetDefaultCommunicationScopes()
8909{
8910 Discord_String returnValueNative__;
8911 Discord_Client_GetDefaultCommunicationScopes(&returnValueNative__);
8912 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8913 returnValueNative__.size);
8914 Discord_Free(returnValueNative__.ptr);
8915 return returnValue__;
8916}
8917std::string Client::GetDefaultPresenceScopes()
8918{
8919 Discord_String returnValueNative__;
8920 Discord_Client_GetDefaultPresenceScopes(&returnValueNative__);
8921 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8922 returnValueNative__.size);
8923 Discord_Free(returnValueNative__.ptr);
8924 return returnValue__;
8925}
8926std::string Client::GetVersionHash()
8927{
8928 Discord_String returnValueNative__;
8929 Discord_Client_GetVersionHash(&returnValueNative__);
8930 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8931 returnValueNative__.size);
8932 Discord_Free(returnValueNative__.ptr);
8933 return returnValue__;
8934}
8935int32_t Client::GetVersionMajor()
8936{
8937 int32_t returnValue__;
8938 returnValue__ = Discord_Client_GetVersionMajor();
8939 return returnValue__;
8940}
8941int32_t Client::GetVersionMinor()
8942{
8943 int32_t returnValue__;
8944 returnValue__ = Discord_Client_GetVersionMinor();
8945 return returnValue__;
8946}
8947int32_t Client::GetVersionPatch()
8948{
8949 int32_t returnValue__;
8950 returnValue__ = Discord_Client_GetVersionPatch();
8951 return returnValue__;
8952}
8953void Client::SetHttpRequestTimeout(int32_t httpTimeoutInMilliseconds)
8954{
8955 assert(state_ == DiscordObjectState::Owned);
8956 Discord_Client_SetHttpRequestTimeout(&instance_, httpTimeoutInMilliseconds);
8957}
8958std::string Client::StatusToString(discordpp::Client::Status type)
8959{
8960 Discord_String returnValueNative__;
8961 Discord_Client_StatusToString(static_cast<Discord_Client_Status>(type), &returnValueNative__);
8962 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8963 returnValueNative__.size);
8964 Discord_Free(returnValueNative__.ptr);
8965 return returnValue__;
8966}
8967std::string Client::ThreadToString(discordpp::Client::Thread type)
8968{
8969 Discord_String returnValueNative__;
8970 Discord_Client_ThreadToString(static_cast<Discord_Client_Thread>(type), &returnValueNative__);
8971 std::string returnValue__(reinterpret_cast<char*>(returnValueNative__.ptr),
8972 returnValueNative__.size);
8973 Discord_Free(returnValueNative__.ptr);
8974 return returnValue__;
8975}
8976void Client::EndCall(uint64_t channelId, discordpp::Client::EndCallCallback callback)
8977{
8978 assert(state_ == DiscordObjectState::Owned);
8979 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
8980 auto callback__userData = new Tcallback__UserData(callback);
8981 Discord_Client_EndCallCallback callback__native = [](void* userData__) {
8982 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
8983 userData__typed->delegate();
8984 };
8985 Discord_Client_EndCall(
8986 &instance_, channelId, callback__native, Tcallback__UserData::Free, callback__userData);
8987}
8988void Client::EndCalls(discordpp::Client::EndCallsCallback callback)
8989{
8990 assert(state_ == DiscordObjectState::Owned);
8991 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
8992 auto callback__userData = new Tcallback__UserData(callback);
8993 Discord_Client_EndCallsCallback callback__native = [](void* userData__) {
8994 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
8995 userData__typed->delegate();
8996 };
8997 Discord_Client_EndCalls(
8998 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
8999}
9000discordpp::Call Client::GetCall(uint64_t channelId)
9001{
9002 assert(state_ == DiscordObjectState::Owned);
9003 bool returnIsNonNull__;
9004 Discord_Call returnValueNative__{};
9005 returnIsNonNull__ = Discord_Client_GetCall(&instance_, channelId, &returnValueNative__);
9006 discordpp::Call returnValue__(
9007 returnValueNative__,
9008 returnIsNonNull__ ? DiscordObjectState::Owned : DiscordObjectState::Invalid);
9009 return returnValue__;
9010}
9011std::vector<discordpp::Call> Client::GetCalls()
9012{
9013 assert(state_ == DiscordObjectState::Owned);
9014 Discord_CallSpan returnValueNative__;
9015 Discord_Client_GetCalls(&instance_, &returnValueNative__);
9016 std::vector<discordpp::Call> returnValue__;
9017 returnValue__.reserve(returnValueNative__.size);
9018 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
9019 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
9020 }
9021 Discord_Free(returnValueNative__.ptr);
9022 return returnValue__;
9023}
9024void Client::GetCurrentInputDevice(discordpp::Client::GetCurrentInputDeviceCallback cb)
9025{
9026 assert(state_ == DiscordObjectState::Owned);
9027 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9028 auto cb__userData = new Tcb__UserData(cb);
9029 Discord_Client_GetCurrentInputDeviceCallback cb__native = [](auto device, void* userData__) {
9030 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9031 discordpp::AudioDevice device__obj(*device, DiscordObjectState::Owned);
9032 userData__typed->delegate(std::move(device__obj));
9033 };
9034 Discord_Client_GetCurrentInputDevice(&instance_, cb__native, Tcb__UserData::Free, cb__userData);
9035}
9036void Client::GetCurrentOutputDevice(discordpp::Client::GetCurrentOutputDeviceCallback cb)
9037{
9038 assert(state_ == DiscordObjectState::Owned);
9039 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9040 auto cb__userData = new Tcb__UserData(cb);
9041 Discord_Client_GetCurrentOutputDeviceCallback cb__native = [](auto device, void* userData__) {
9042 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9043 discordpp::AudioDevice device__obj(*device, DiscordObjectState::Owned);
9044 userData__typed->delegate(std::move(device__obj));
9045 };
9046 Discord_Client_GetCurrentOutputDevice(
9047 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
9048}
9049void Client::GetInputDevices(discordpp::Client::GetInputDevicesCallback cb)
9050{
9051 assert(state_ == DiscordObjectState::Owned);
9052 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9053 auto cb__userData = new Tcb__UserData(cb);
9054 Discord_Client_GetInputDevicesCallback cb__native = [](auto devices, void* userData__) {
9055 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9056 std::vector<discordpp::AudioDevice> devices__vec;
9057 devices__vec.reserve(devices.size);
9058 for (size_t i__ = 0; i__ < devices.size; ++i__) {
9059 devices__vec.emplace_back(devices.ptr[i__], DiscordObjectState::Owned);
9060 }
9061 Discord_Free(devices.ptr);
9062 userData__typed->delegate(std::move(devices__vec));
9063 };
9064 Discord_Client_GetInputDevices(&instance_, cb__native, Tcb__UserData::Free, cb__userData);
9065}
9066float Client::GetInputVolume()
9067{
9068 assert(state_ == DiscordObjectState::Owned);
9069 float returnValue__;
9070 returnValue__ = Discord_Client_GetInputVolume(&instance_);
9071 return returnValue__;
9072}
9073void Client::GetOutputDevices(discordpp::Client::GetOutputDevicesCallback cb)
9074{
9075 assert(state_ == DiscordObjectState::Owned);
9076 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9077 auto cb__userData = new Tcb__UserData(cb);
9078 Discord_Client_GetOutputDevicesCallback cb__native = [](auto devices, void* userData__) {
9079 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9080 std::vector<discordpp::AudioDevice> devices__vec;
9081 devices__vec.reserve(devices.size);
9082 for (size_t i__ = 0; i__ < devices.size; ++i__) {
9083 devices__vec.emplace_back(devices.ptr[i__], DiscordObjectState::Owned);
9084 }
9085 Discord_Free(devices.ptr);
9086 userData__typed->delegate(std::move(devices__vec));
9087 };
9088 Discord_Client_GetOutputDevices(&instance_, cb__native, Tcb__UserData::Free, cb__userData);
9089}
9090float Client::GetOutputVolume()
9091{
9092 assert(state_ == DiscordObjectState::Owned);
9093 float returnValue__;
9094 returnValue__ = Discord_Client_GetOutputVolume(&instance_);
9095 return returnValue__;
9096}
9097bool Client::GetSelfDeafAll() const
9098{
9099 assert(state_ == DiscordObjectState::Owned);
9100 bool returnValue__;
9101 returnValue__ = Discord_Client_GetSelfDeafAll(&instance_);
9102 return returnValue__;
9103}
9104bool Client::GetSelfMuteAll() const
9105{
9106 assert(state_ == DiscordObjectState::Owned);
9107 bool returnValue__;
9108 returnValue__ = Discord_Client_GetSelfMuteAll(&instance_);
9109 return returnValue__;
9110}
9111void Client::SetAutomaticGainControl(bool on)
9112{
9113 assert(state_ == DiscordObjectState::Owned);
9114 Discord_Client_SetAutomaticGainControl(&instance_, on);
9115}
9116void Client::SetDeviceChangeCallback(discordpp::Client::DeviceChangeCallback callback)
9117{
9118 assert(state_ == DiscordObjectState::Owned);
9119 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9120 auto callback__userData = new Tcallback__UserData(callback);
9121 Discord_Client_DeviceChangeCallback callback__native =
9122 [](auto inputDevices, auto outputDevices, void* userData__) {
9123 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9124 std::vector<discordpp::AudioDevice> inputDevices__vec;
9125 inputDevices__vec.reserve(inputDevices.size);
9126 for (size_t i__ = 0; i__ < inputDevices.size; ++i__) {
9127 inputDevices__vec.emplace_back(inputDevices.ptr[i__], DiscordObjectState::Owned);
9128 }
9129 Discord_Free(inputDevices.ptr);
9130 std::vector<discordpp::AudioDevice> outputDevices__vec;
9131 outputDevices__vec.reserve(outputDevices.size);
9132 for (size_t i__ = 0; i__ < outputDevices.size; ++i__) {
9133 outputDevices__vec.emplace_back(outputDevices.ptr[i__], DiscordObjectState::Owned);
9134 }
9135 Discord_Free(outputDevices.ptr);
9136 userData__typed->delegate(std::move(inputDevices__vec), std::move(outputDevices__vec));
9137 };
9138 Discord_Client_SetDeviceChangeCallback(
9139 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
9140}
9141void Client::SetEchoCancellation(bool on)
9142{
9143 assert(state_ == DiscordObjectState::Owned);
9144 Discord_Client_SetEchoCancellation(&instance_, on);
9145}
9146void Client::SetEngineManagedAudioSession(bool isEngineManaged)
9147{
9148 assert(state_ == DiscordObjectState::Owned);
9149 Discord_Client_SetEngineManagedAudioSession(&instance_, isEngineManaged);
9150}
9151void Client::SetInputDevice(std::string deviceId, discordpp::Client::SetInputDeviceCallback cb)
9152{
9153 assert(state_ == DiscordObjectState::Owned);
9154 Discord_String deviceId__str{(uint8_t*)(deviceId.data()), deviceId.size()};
9155 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9156 auto cb__userData = new Tcb__UserData(cb);
9157 Discord_Client_SetInputDeviceCallback cb__native = [](auto result, void* userData__) {
9158 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9159 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9160 userData__typed->delegate(std::move(result__obj));
9161 };
9162 Discord_Client_SetInputDevice(
9163 &instance_, deviceId__str, cb__native, Tcb__UserData::Free, cb__userData);
9164}
9165void Client::SetInputVolume(float inputVolume)
9166{
9167 assert(state_ == DiscordObjectState::Owned);
9168 Discord_Client_SetInputVolume(&instance_, inputVolume);
9169}
9170void Client::SetNoAudioInputCallback(discordpp::Client::NoAudioInputCallback callback)
9171{
9172 assert(state_ == DiscordObjectState::Owned);
9173 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9174 auto callback__userData = new Tcallback__UserData(callback);
9175 Discord_Client_NoAudioInputCallback callback__native = [](auto inputDetected,
9176 void* userData__) {
9177 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9178 userData__typed->delegate(inputDetected);
9179 };
9180 Discord_Client_SetNoAudioInputCallback(
9181 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
9182}
9183void Client::SetNoAudioInputThreshold(float dBFSThreshold)
9184{
9185 assert(state_ == DiscordObjectState::Owned);
9186 Discord_Client_SetNoAudioInputThreshold(&instance_, dBFSThreshold);
9187}
9188void Client::SetNoiseSuppression(bool on)
9189{
9190 assert(state_ == DiscordObjectState::Owned);
9191 Discord_Client_SetNoiseSuppression(&instance_, on);
9192}
9193void Client::SetOpusHardwareCoding(bool encode, bool decode)
9194{
9195 assert(state_ == DiscordObjectState::Owned);
9196 Discord_Client_SetOpusHardwareCoding(&instance_, encode, decode);
9197}
9198void Client::SetOutputDevice(std::string deviceId, discordpp::Client::SetOutputDeviceCallback cb)
9199{
9200 assert(state_ == DiscordObjectState::Owned);
9201 Discord_String deviceId__str{(uint8_t*)(deviceId.data()), deviceId.size()};
9202 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9203 auto cb__userData = new Tcb__UserData(cb);
9204 Discord_Client_SetOutputDeviceCallback cb__native = [](auto result, void* userData__) {
9205 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9206 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9207 userData__typed->delegate(std::move(result__obj));
9208 };
9209 Discord_Client_SetOutputDevice(
9210 &instance_, deviceId__str, cb__native, Tcb__UserData::Free, cb__userData);
9211}
9212void Client::SetOutputVolume(float outputVolume)
9213{
9214 assert(state_ == DiscordObjectState::Owned);
9215 Discord_Client_SetOutputVolume(&instance_, outputVolume);
9216}
9217void Client::SetSelfDeafAll(bool deaf)
9218{
9219 assert(state_ == DiscordObjectState::Owned);
9220 Discord_Client_SetSelfDeafAll(&instance_, deaf);
9221}
9222void Client::SetSelfMuteAll(bool mute)
9223{
9224 assert(state_ == DiscordObjectState::Owned);
9225 Discord_Client_SetSelfMuteAll(&instance_, mute);
9226}
9227bool Client::SetSpeakerMode(bool speakerMode)
9228{
9229 assert(state_ == DiscordObjectState::Owned);
9230 bool returnValue__;
9231 returnValue__ = Discord_Client_SetSpeakerMode(&instance_, speakerMode);
9232 return returnValue__;
9233}
9234void Client::SetThreadPriority(discordpp::Client::Thread thread, int32_t priority)
9235{
9236 assert(state_ == DiscordObjectState::Owned);
9237 Discord_Client_SetThreadPriority(
9238 &instance_, static_cast<Discord_Client_Thread>(thread), priority);
9239}
9240void Client::SetVoiceParticipantChangedCallback(
9242{
9243 assert(state_ == DiscordObjectState::Owned);
9244 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9245 auto cb__userData = new Tcb__UserData(cb);
9246 Discord_Client_VoiceParticipantChangedCallback cb__native =
9247 [](auto lobbyId, auto memberId, auto added, void* userData__) {
9248 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9249 userData__typed->delegate(lobbyId, memberId, added);
9250 };
9251 Discord_Client_SetVoiceParticipantChangedCallback(
9252 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
9253}
9254bool Client::ShowAudioRoutePicker()
9255{
9256 assert(state_ == DiscordObjectState::Owned);
9257 bool returnValue__;
9258 returnValue__ = Discord_Client_ShowAudioRoutePicker(&instance_);
9259 return returnValue__;
9260}
9261discordpp::Call Client::StartCall(uint64_t channelId)
9262{
9263 assert(state_ == DiscordObjectState::Owned);
9264 bool returnIsNonNull__;
9265 Discord_Call returnValueNative__{};
9266 returnIsNonNull__ = Discord_Client_StartCall(&instance_, channelId, &returnValueNative__);
9267 discordpp::Call returnValue__(
9268 returnValueNative__,
9269 returnIsNonNull__ ? DiscordObjectState::Owned : DiscordObjectState::Invalid);
9270 return returnValue__;
9271}
9272discordpp::Call Client::StartCallWithAudioCallbacks(
9273 uint64_t lobbyId,
9276{
9277 assert(state_ == DiscordObjectState::Owned);
9278 bool returnIsNonNull__;
9279 Discord_Call returnValueNative__{};
9280 using TreceivedCb__UserData = TDelegateUserData<std::remove_reference_t<decltype(receivedCb)>>;
9281 auto receivedCb__userData = new TreceivedCb__UserData(receivedCb);
9282 Discord_Client_UserAudioReceivedCallback receivedCb__native = [](auto userId,
9283 auto data,
9284 auto samplesPerChannel,
9285 auto sampleRate,
9286 auto channels,
9287 auto outShouldMute,
9288 void* userData__) {
9289 auto userData__typed = static_cast<TreceivedCb__UserData*>(userData__);
9290 userData__typed->delegate(
9291 userId, data, samplesPerChannel, sampleRate, channels, *outShouldMute);
9292 };
9293 using TcapturedCb__UserData = TDelegateUserData<std::remove_reference_t<decltype(capturedCb)>>;
9294 auto capturedCb__userData = new TcapturedCb__UserData(capturedCb);
9295 Discord_Client_UserAudioCapturedCallback capturedCb__native =
9296 [](auto data, auto samplesPerChannel, auto sampleRate, auto channels, void* userData__) {
9297 auto userData__typed = static_cast<TcapturedCb__UserData*>(userData__);
9298 userData__typed->delegate(data, samplesPerChannel, sampleRate, channels);
9299 };
9300 returnIsNonNull__ = Discord_Client_StartCallWithAudioCallbacks(&instance_,
9301 lobbyId,
9302 receivedCb__native,
9303 TreceivedCb__UserData::Free,
9304 receivedCb__userData,
9305 capturedCb__native,
9306 TcapturedCb__UserData::Free,
9307 capturedCb__userData,
9308 &returnValueNative__);
9309 discordpp::Call returnValue__(
9310 returnValueNative__,
9311 returnIsNonNull__ ? DiscordObjectState::Owned : DiscordObjectState::Invalid);
9312 return returnValue__;
9313}
9314void Client::AbortAuthorize()
9315{
9316 assert(state_ == DiscordObjectState::Owned);
9317 Discord_Client_AbortAuthorize(&instance_);
9318}
9319void Client::AbortGetTokenFromDevice()
9320{
9321 assert(state_ == DiscordObjectState::Owned);
9322 Discord_Client_AbortGetTokenFromDevice(&instance_);
9323}
9324void Client::Authorize(discordpp::AuthorizationArgs args,
9326{
9327 assert(state_ == DiscordObjectState::Owned);
9328 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9329 auto callback__userData = new Tcallback__UserData(callback);
9330 Discord_Client_AuthorizationCallback callback__native =
9331 [](auto result, auto code, auto redirectUri, void* userData__) {
9332 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9333 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9334 std::string code__str(reinterpret_cast<char*>(code.ptr), code.size);
9335 std::string redirectUri__str(reinterpret_cast<char*>(redirectUri.ptr), redirectUri.size);
9336 userData__typed->delegate(
9337 std::move(result__obj), std::move(code__str), std::move(redirectUri__str));
9338 Discord_Free(redirectUri.ptr);
9339 Discord_Free(code.ptr);
9340 };
9341 Discord_Client_Authorize(
9342 &instance_, args.instance(), callback__native, Tcallback__UserData::Free, callback__userData);
9343}
9344void Client::CloseAuthorizeDeviceScreen()
9345{
9346 assert(state_ == DiscordObjectState::Owned);
9347 Discord_Client_CloseAuthorizeDeviceScreen(&instance_);
9348}
9349discordpp::AuthorizationCodeVerifier Client::CreateAuthorizationCodeVerifier()
9350{
9351 assert(state_ == DiscordObjectState::Owned);
9352 Discord_AuthorizationCodeVerifier returnValueNative__{};
9353 Discord_Client_CreateAuthorizationCodeVerifier(&instance_, &returnValueNative__);
9354 discordpp::AuthorizationCodeVerifier returnValue__(returnValueNative__,
9355 DiscordObjectState::Owned);
9356 return returnValue__;
9357}
9358void Client::FetchCurrentUser(discordpp::AuthorizationTokenType tokenType,
9359 std::string const& token,
9361{
9362 assert(state_ == DiscordObjectState::Owned);
9363 Discord_String token__str{(uint8_t*)(token.data()), token.size()};
9364 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9365 auto callback__userData = new Tcallback__UserData(callback);
9366 Discord_Client_FetchCurrentUserCallback callback__native =
9367 [](auto result, auto id, auto name, void* userData__) {
9368 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9369 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9370 std::string name__str(reinterpret_cast<char*>(name.ptr), name.size);
9371 userData__typed->delegate(std::move(result__obj), id, std::move(name__str));
9372 Discord_Free(name.ptr);
9373 };
9374 Discord_Client_FetchCurrentUser(&instance_,
9375 static_cast<Discord_AuthorizationTokenType>(tokenType),
9376 token__str,
9377 callback__native,
9378 Tcallback__UserData::Free,
9379 callback__userData);
9380}
9381void Client::GetProvisionalToken(uint64_t applicationId,
9383 std::string const& externalAuthToken,
9385{
9386 assert(state_ == DiscordObjectState::Owned);
9387 Discord_String externalAuthToken__str{(uint8_t*)(externalAuthToken.data()),
9388 externalAuthToken.size()};
9389 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9390 auto callback__userData = new Tcallback__UserData(callback);
9391 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
9392 auto accessToken,
9393 auto refreshToken,
9394 auto tokenType,
9395 auto expiresIn,
9396 auto scopes,
9397 void* userData__) {
9398 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9399 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9400 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
9401 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
9402 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
9403 userData__typed->delegate(std::move(result__obj),
9404 std::move(accessToken__str),
9405 std::move(refreshToken__str),
9406 static_cast<discordpp::AuthorizationTokenType>(tokenType),
9407 expiresIn,
9408 std::move(scopes__str));
9409 Discord_Free(scopes.ptr);
9410 Discord_Free(refreshToken.ptr);
9411 Discord_Free(accessToken.ptr);
9412 };
9413 Discord_Client_GetProvisionalToken(
9414 &instance_,
9415 applicationId,
9416 static_cast<Discord_AuthenticationExternalAuthType>(externalAuthType),
9417 externalAuthToken__str,
9418 callback__native,
9419 Tcallback__UserData::Free,
9420 callback__userData);
9421}
9422void Client::GetToken(uint64_t applicationId,
9423 std::string const& code,
9424 std::string const& codeVerifier,
9425 std::string const& redirectUri,
9427{
9428 assert(state_ == DiscordObjectState::Owned);
9429 Discord_String code__str{(uint8_t*)(code.data()), code.size()};
9430 Discord_String codeVerifier__str{(uint8_t*)(codeVerifier.data()), codeVerifier.size()};
9431 Discord_String redirectUri__str{(uint8_t*)(redirectUri.data()), redirectUri.size()};
9432 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9433 auto callback__userData = new Tcallback__UserData(callback);
9434 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
9435 auto accessToken,
9436 auto refreshToken,
9437 auto tokenType,
9438 auto expiresIn,
9439 auto scopes,
9440 void* userData__) {
9441 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9442 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9443 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
9444 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
9445 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
9446 userData__typed->delegate(std::move(result__obj),
9447 std::move(accessToken__str),
9448 std::move(refreshToken__str),
9449 static_cast<discordpp::AuthorizationTokenType>(tokenType),
9450 expiresIn,
9451 std::move(scopes__str));
9452 Discord_Free(scopes.ptr);
9453 Discord_Free(refreshToken.ptr);
9454 Discord_Free(accessToken.ptr);
9455 };
9456 Discord_Client_GetToken(&instance_,
9457 applicationId,
9458 code__str,
9459 codeVerifier__str,
9460 redirectUri__str,
9461 callback__native,
9462 Tcallback__UserData::Free,
9463 callback__userData);
9464}
9465void Client::GetTokenFromDevice(discordpp::DeviceAuthorizationArgs args,
9467{
9468 assert(state_ == DiscordObjectState::Owned);
9469 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9470 auto callback__userData = new Tcallback__UserData(callback);
9471 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
9472 auto accessToken,
9473 auto refreshToken,
9474 auto tokenType,
9475 auto expiresIn,
9476 auto scopes,
9477 void* userData__) {
9478 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9479 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9480 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
9481 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
9482 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
9483 userData__typed->delegate(std::move(result__obj),
9484 std::move(accessToken__str),
9485 std::move(refreshToken__str),
9486 static_cast<discordpp::AuthorizationTokenType>(tokenType),
9487 expiresIn,
9488 std::move(scopes__str));
9489 Discord_Free(scopes.ptr);
9490 Discord_Free(refreshToken.ptr);
9491 Discord_Free(accessToken.ptr);
9492 };
9493 Discord_Client_GetTokenFromDevice(
9494 &instance_, args.instance(), callback__native, Tcallback__UserData::Free, callback__userData);
9495}
9496void Client::GetTokenFromDeviceProvisionalMerge(
9499 std::string const& externalAuthToken,
9501{
9502 assert(state_ == DiscordObjectState::Owned);
9503 Discord_String externalAuthToken__str{(uint8_t*)(externalAuthToken.data()),
9504 externalAuthToken.size()};
9505 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9506 auto callback__userData = new Tcallback__UserData(callback);
9507 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
9508 auto accessToken,
9509 auto refreshToken,
9510 auto tokenType,
9511 auto expiresIn,
9512 auto scopes,
9513 void* userData__) {
9514 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9515 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9516 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
9517 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
9518 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
9519 userData__typed->delegate(std::move(result__obj),
9520 std::move(accessToken__str),
9521 std::move(refreshToken__str),
9522 static_cast<discordpp::AuthorizationTokenType>(tokenType),
9523 expiresIn,
9524 std::move(scopes__str));
9525 Discord_Free(scopes.ptr);
9526 Discord_Free(refreshToken.ptr);
9527 Discord_Free(accessToken.ptr);
9528 };
9529 Discord_Client_GetTokenFromDeviceProvisionalMerge(
9530 &instance_,
9531 args.instance(),
9532 static_cast<Discord_AuthenticationExternalAuthType>(externalAuthType),
9533 externalAuthToken__str,
9534 callback__native,
9535 Tcallback__UserData::Free,
9536 callback__userData);
9537}
9538void Client::GetTokenFromProvisionalMerge(
9539 uint64_t applicationId,
9540 std::string const& code,
9541 std::string const& codeVerifier,
9542 std::string const& redirectUri,
9544 std::string const& externalAuthToken,
9546{
9547 assert(state_ == DiscordObjectState::Owned);
9548 Discord_String code__str{(uint8_t*)(code.data()), code.size()};
9549 Discord_String codeVerifier__str{(uint8_t*)(codeVerifier.data()), codeVerifier.size()};
9550 Discord_String redirectUri__str{(uint8_t*)(redirectUri.data()), redirectUri.size()};
9551 Discord_String externalAuthToken__str{(uint8_t*)(externalAuthToken.data()),
9552 externalAuthToken.size()};
9553 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9554 auto callback__userData = new Tcallback__UserData(callback);
9555 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
9556 auto accessToken,
9557 auto refreshToken,
9558 auto tokenType,
9559 auto expiresIn,
9560 auto scopes,
9561 void* userData__) {
9562 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9563 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9564 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
9565 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
9566 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
9567 userData__typed->delegate(std::move(result__obj),
9568 std::move(accessToken__str),
9569 std::move(refreshToken__str),
9570 static_cast<discordpp::AuthorizationTokenType>(tokenType),
9571 expiresIn,
9572 std::move(scopes__str));
9573 Discord_Free(scopes.ptr);
9574 Discord_Free(refreshToken.ptr);
9575 Discord_Free(accessToken.ptr);
9576 };
9577 Discord_Client_GetTokenFromProvisionalMerge(
9578 &instance_,
9579 applicationId,
9580 code__str,
9581 codeVerifier__str,
9582 redirectUri__str,
9583 static_cast<Discord_AuthenticationExternalAuthType>(externalAuthType),
9584 externalAuthToken__str,
9585 callback__native,
9586 Tcallback__UserData::Free,
9587 callback__userData);
9588}
9589bool Client::IsAuthenticated()
9590{
9591 assert(state_ == DiscordObjectState::Owned);
9592 bool returnValue__;
9593 returnValue__ = Discord_Client_IsAuthenticated(&instance_);
9594 return returnValue__;
9595}
9596void Client::OpenAuthorizeDeviceScreen(uint64_t clientId, std::string const& userCode)
9597{
9598 assert(state_ == DiscordObjectState::Owned);
9599 Discord_String userCode__str{(uint8_t*)(userCode.data()), userCode.size()};
9600 Discord_Client_OpenAuthorizeDeviceScreen(&instance_, clientId, userCode__str);
9601}
9602void Client::ProvisionalUserMergeCompleted(bool success)
9603{
9604 assert(state_ == DiscordObjectState::Owned);
9605 Discord_Client_ProvisionalUserMergeCompleted(&instance_, success);
9606}
9607void Client::RefreshToken(uint64_t applicationId,
9608 std::string const& refreshToken,
9610{
9611 assert(state_ == DiscordObjectState::Owned);
9612 Discord_String refreshToken__str{(uint8_t*)(refreshToken.data()), refreshToken.size()};
9613 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9614 auto callback__userData = new Tcallback__UserData(callback);
9615 Discord_Client_TokenExchangeCallback callback__native = [](auto result,
9616 auto accessToken,
9617 auto refreshToken,
9618 auto tokenType,
9619 auto expiresIn,
9620 auto scopes,
9621 void* userData__) {
9622 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9623 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9624 std::string accessToken__str(reinterpret_cast<char*>(accessToken.ptr), accessToken.size);
9625 std::string refreshToken__str(reinterpret_cast<char*>(refreshToken.ptr), refreshToken.size);
9626 std::string scopes__str(reinterpret_cast<char*>(scopes.ptr), scopes.size);
9627 userData__typed->delegate(std::move(result__obj),
9628 std::move(accessToken__str),
9629 std::move(refreshToken__str),
9630 static_cast<discordpp::AuthorizationTokenType>(tokenType),
9631 expiresIn,
9632 std::move(scopes__str));
9633 Discord_Free(scopes.ptr);
9634 Discord_Free(refreshToken.ptr);
9635 Discord_Free(accessToken.ptr);
9636 };
9637 Discord_Client_RefreshToken(&instance_,
9638 applicationId,
9639 refreshToken__str,
9640 callback__native,
9641 Tcallback__UserData::Free,
9642 callback__userData);
9643}
9644void Client::SetAuthorizeDeviceScreenClosedCallback(
9646{
9647 assert(state_ == DiscordObjectState::Owned);
9648 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9649 auto cb__userData = new Tcb__UserData(cb);
9650 Discord_Client_AuthorizeDeviceScreenClosedCallback cb__native = [](void* userData__) {
9651 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9652 userData__typed->delegate();
9653 };
9654 Discord_Client_SetAuthorizeDeviceScreenClosedCallback(
9655 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
9656}
9657void Client::SetGameWindowPid(int32_t pid)
9658{
9659 assert(state_ == DiscordObjectState::Owned);
9660 Discord_Client_SetGameWindowPid(&instance_, pid);
9661}
9662void Client::SetTokenExpirationCallback(discordpp::Client::TokenExpirationCallback callback)
9663{
9664 assert(state_ == DiscordObjectState::Owned);
9665 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9666 auto callback__userData = new Tcallback__UserData(callback);
9667 Discord_Client_TokenExpirationCallback callback__native = [](void* userData__) {
9668 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9669 userData__typed->delegate();
9670 };
9671 Discord_Client_SetTokenExpirationCallback(
9672 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
9673}
9674void Client::UpdateProvisionalAccountDisplayName(
9675 std::string const& name,
9677{
9678 assert(state_ == DiscordObjectState::Owned);
9679 Discord_String name__str{(uint8_t*)(name.data()), name.size()};
9680 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9681 auto callback__userData = new Tcallback__UserData(callback);
9682 Discord_Client_UpdateProvisionalAccountDisplayNameCallback callback__native =
9683 [](auto result, void* userData__) {
9684 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9685 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9686 userData__typed->delegate(std::move(result__obj));
9687 };
9688 Discord_Client_UpdateProvisionalAccountDisplayName(
9689 &instance_, name__str, callback__native, Tcallback__UserData::Free, callback__userData);
9690}
9691void Client::UpdateToken(discordpp::AuthorizationTokenType tokenType,
9692 std::string token,
9694{
9695 assert(state_ == DiscordObjectState::Owned);
9696 Discord_String token__str{(uint8_t*)(token.data()), token.size()};
9697 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9698 auto callback__userData = new Tcallback__UserData(callback);
9699 Discord_Client_UpdateTokenCallback callback__native = [](auto result, void* userData__) {
9700 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9701 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9702 userData__typed->delegate(std::move(result__obj));
9703 };
9704 Discord_Client_UpdateToken(&instance_,
9705 static_cast<Discord_AuthorizationTokenType>(tokenType),
9706 token__str,
9707 callback__native,
9708 Tcallback__UserData::Free,
9709 callback__userData);
9710}
9711bool Client::CanOpenMessageInDiscord(uint64_t messageId)
9712{
9713 assert(state_ == DiscordObjectState::Owned);
9714 bool returnValue__;
9715 returnValue__ = Discord_Client_CanOpenMessageInDiscord(&instance_, messageId);
9716 return returnValue__;
9717}
9718void Client::DeleteUserMessage(uint64_t recipientId,
9719 uint64_t messageId,
9721{
9722 assert(state_ == DiscordObjectState::Owned);
9723 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9724 auto cb__userData = new Tcb__UserData(cb);
9725 Discord_Client_DeleteUserMessageCallback cb__native = [](auto result, void* userData__) {
9726 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9727 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9728 userData__typed->delegate(std::move(result__obj));
9729 };
9730 Discord_Client_DeleteUserMessage(
9731 &instance_, recipientId, messageId, cb__native, Tcb__UserData::Free, cb__userData);
9732}
9733void Client::EditUserMessage(uint64_t recipientId,
9734 uint64_t messageId,
9735 std::string const& content,
9737{
9738 assert(state_ == DiscordObjectState::Owned);
9739 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
9740 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9741 auto cb__userData = new Tcb__UserData(cb);
9742 Discord_Client_EditUserMessageCallback cb__native = [](auto result, void* userData__) {
9743 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9744 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9745 userData__typed->delegate(std::move(result__obj));
9746 };
9747 Discord_Client_EditUserMessage(&instance_,
9748 recipientId,
9749 messageId,
9750 content__str,
9751 cb__native,
9752 Tcb__UserData::Free,
9753 cb__userData);
9754}
9755std::optional<discordpp::ChannelHandle> Client::GetChannelHandle(uint64_t channelId) const
9756{
9757 assert(state_ == DiscordObjectState::Owned);
9758 bool returnIsNonNull__;
9759 Discord_ChannelHandle returnValueNative__;
9760 returnIsNonNull__ =
9761 Discord_Client_GetChannelHandle(&instance_, channelId, &returnValueNative__);
9762 if (!returnIsNonNull__) {
9763 return {};
9764 }
9765 discordpp::ChannelHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
9766 return returnValue__;
9767}
9768std::optional<discordpp::MessageHandle> Client::GetMessageHandle(uint64_t messageId) const
9769{
9770 assert(state_ == DiscordObjectState::Owned);
9771 bool returnIsNonNull__;
9772 Discord_MessageHandle returnValueNative__;
9773 returnIsNonNull__ =
9774 Discord_Client_GetMessageHandle(&instance_, messageId, &returnValueNative__);
9775 if (!returnIsNonNull__) {
9776 return {};
9777 }
9778 discordpp::MessageHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
9779 return returnValue__;
9780}
9781void Client::OpenMessageInDiscord(
9782 uint64_t messageId,
9783 discordpp::Client::ProvisionalUserMergeRequiredCallback provisionalUserMergeRequiredCallback,
9785{
9786 assert(state_ == DiscordObjectState::Owned);
9787 using TprovisionalUserMergeRequiredCallback__UserData =
9788 TDelegateUserData<std::remove_reference_t<decltype(provisionalUserMergeRequiredCallback)>>;
9789 auto provisionalUserMergeRequiredCallback__userData =
9790 new TprovisionalUserMergeRequiredCallback__UserData(provisionalUserMergeRequiredCallback);
9791 Discord_Client_ProvisionalUserMergeRequiredCallback
9792 provisionalUserMergeRequiredCallback__native = [](void* userData__) {
9793 auto userData__typed =
9794 static_cast<TprovisionalUserMergeRequiredCallback__UserData*>(userData__);
9795 userData__typed->delegate();
9796 };
9797 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9798 auto callback__userData = new Tcallback__UserData(callback);
9799 Discord_Client_OpenMessageInDiscordCallback callback__native = [](auto result,
9800 void* userData__) {
9801 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9802 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9803 userData__typed->delegate(std::move(result__obj));
9804 };
9805 Discord_Client_OpenMessageInDiscord(&instance_,
9806 messageId,
9807 provisionalUserMergeRequiredCallback__native,
9808 TprovisionalUserMergeRequiredCallback__UserData::Free,
9809 provisionalUserMergeRequiredCallback__userData,
9810 callback__native,
9811 Tcallback__UserData::Free,
9812 callback__userData);
9813}
9814void Client::SendLobbyMessage(uint64_t lobbyId,
9815 std::string const& content,
9817{
9818 assert(state_ == DiscordObjectState::Owned);
9819 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
9820 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9821 auto cb__userData = new Tcb__UserData(cb);
9822 Discord_Client_SendUserMessageCallback cb__native =
9823 [](auto result, auto messageId, void* userData__) {
9824 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9825 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9826 userData__typed->delegate(std::move(result__obj), messageId);
9827 };
9828 Discord_Client_SendLobbyMessage(
9829 &instance_, lobbyId, content__str, cb__native, Tcb__UserData::Free, cb__userData);
9830}
9831void Client::SendLobbyMessageWithMetadata(
9832 uint64_t lobbyId,
9833 std::string const& content,
9834 std::unordered_map<std::string, std::string> const& metadata,
9836{
9837 assert(state_ == DiscordObjectState::Owned);
9838 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
9839 ConvertedProperties metadata__convert(metadata);
9840 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9841 auto cb__userData = new Tcb__UserData(cb);
9842 Discord_Client_SendUserMessageCallback cb__native =
9843 [](auto result, auto messageId, void* userData__) {
9844 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9845 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9846 userData__typed->delegate(std::move(result__obj), messageId);
9847 };
9848 Discord_Client_SendLobbyMessageWithMetadata(&instance_,
9849 lobbyId,
9850 content__str,
9851 metadata__convert.Properties,
9852 cb__native,
9853 Tcb__UserData::Free,
9854 cb__userData);
9855}
9856void Client::SendUserMessage(uint64_t recipientId,
9857 std::string const& content,
9859{
9860 assert(state_ == DiscordObjectState::Owned);
9861 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
9862 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9863 auto cb__userData = new Tcb__UserData(cb);
9864 Discord_Client_SendUserMessageCallback cb__native =
9865 [](auto result, auto messageId, void* userData__) {
9866 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9867 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9868 userData__typed->delegate(std::move(result__obj), messageId);
9869 };
9870 Discord_Client_SendUserMessage(
9871 &instance_, recipientId, content__str, cb__native, Tcb__UserData::Free, cb__userData);
9872}
9873void Client::SendUserMessageWithMetadata(
9874 uint64_t recipientId,
9875 std::string const& content,
9876 std::unordered_map<std::string, std::string> const& metadata,
9878{
9879 assert(state_ == DiscordObjectState::Owned);
9880 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
9881 ConvertedProperties metadata__convert(metadata);
9882 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9883 auto cb__userData = new Tcb__UserData(cb);
9884 Discord_Client_SendUserMessageCallback cb__native =
9885 [](auto result, auto messageId, void* userData__) {
9886 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9887 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
9888 userData__typed->delegate(std::move(result__obj), messageId);
9889 };
9890 Discord_Client_SendUserMessageWithMetadata(&instance_,
9891 recipientId,
9892 content__str,
9893 metadata__convert.Properties,
9894 cb__native,
9895 Tcb__UserData::Free,
9896 cb__userData);
9897}
9898void Client::SetMessageCreatedCallback(discordpp::Client::MessageCreatedCallback cb)
9899{
9900 assert(state_ == DiscordObjectState::Owned);
9901 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9902 auto cb__userData = new Tcb__UserData(cb);
9903 Discord_Client_MessageCreatedCallback cb__native = [](auto messageId, void* userData__) {
9904 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9905 userData__typed->delegate(messageId);
9906 };
9907 Discord_Client_SetMessageCreatedCallback(
9908 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
9909}
9910void Client::SetMessageDeletedCallback(discordpp::Client::MessageDeletedCallback cb)
9911{
9912 assert(state_ == DiscordObjectState::Owned);
9913 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9914 auto cb__userData = new Tcb__UserData(cb);
9915 Discord_Client_MessageDeletedCallback cb__native =
9916 [](auto messageId, auto channelId, void* userData__) {
9917 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9918 userData__typed->delegate(messageId, channelId);
9919 };
9920 Discord_Client_SetMessageDeletedCallback(
9921 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
9922}
9923void Client::SetMessageUpdatedCallback(discordpp::Client::MessageUpdatedCallback cb)
9924{
9925 assert(state_ == DiscordObjectState::Owned);
9926 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
9927 auto cb__userData = new Tcb__UserData(cb);
9928 Discord_Client_MessageUpdatedCallback cb__native = [](auto messageId, void* userData__) {
9929 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
9930 userData__typed->delegate(messageId);
9931 };
9932 Discord_Client_SetMessageUpdatedCallback(
9933 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
9934}
9935void Client::SetShowingChat(bool showingChat)
9936{
9937 assert(state_ == DiscordObjectState::Owned);
9938 Discord_Client_SetShowingChat(&instance_, showingChat);
9939}
9940void Client::AddLogCallback(discordpp::Client::LogCallback callback,
9941 discordpp::LoggingSeverity minSeverity)
9942{
9943 assert(state_ == DiscordObjectState::Owned);
9944 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9945 auto callback__userData = new Tcallback__UserData(callback);
9946 Discord_Client_LogCallback callback__native = [](
9947 auto message, auto severity, void* userData__) {
9948 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9949 std::string message__str(reinterpret_cast<char*>(message.ptr), message.size);
9950 userData__typed->delegate(std::move(message__str),
9951 static_cast<discordpp::LoggingSeverity>(severity));
9952 Discord_Free(message.ptr);
9953 };
9954 Discord_Client_AddLogCallback(&instance_,
9955 callback__native,
9956 Tcallback__UserData::Free,
9957 callback__userData,
9958 static_cast<Discord_LoggingSeverity>(minSeverity));
9959}
9960void Client::AddVoiceLogCallback(discordpp::Client::LogCallback callback,
9961 discordpp::LoggingSeverity minSeverity)
9962{
9963 assert(state_ == DiscordObjectState::Owned);
9964 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
9965 auto callback__userData = new Tcallback__UserData(callback);
9966 Discord_Client_LogCallback callback__native = [](
9967 auto message, auto severity, void* userData__) {
9968 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
9969 std::string message__str(reinterpret_cast<char*>(message.ptr), message.size);
9970 userData__typed->delegate(std::move(message__str),
9971 static_cast<discordpp::LoggingSeverity>(severity));
9972 Discord_Free(message.ptr);
9973 };
9974 Discord_Client_AddVoiceLogCallback(&instance_,
9975 callback__native,
9976 Tcallback__UserData::Free,
9977 callback__userData,
9978 static_cast<Discord_LoggingSeverity>(minSeverity));
9979}
9980void Client::Connect()
9981{
9982 assert(state_ == DiscordObjectState::Owned);
9983 Discord_Client_Connect(&instance_);
9984}
9985void Client::Disconnect()
9986{
9987 assert(state_ == DiscordObjectState::Owned);
9988 Discord_Client_Disconnect(&instance_);
9989}
9990discordpp::Client::Status Client::GetStatus() const
9991{
9992 assert(state_ == DiscordObjectState::Owned);
9993 Discord_Client_Status returnValue__;
9994 returnValue__ = Discord_Client_GetStatus(&instance_);
9995 return static_cast<discordpp::Client::Status>(returnValue__);
9996}
9997void Client::OpenConnectedGamesSettingsInDiscord(
9999{
10000 assert(state_ == DiscordObjectState::Owned);
10001 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10002 auto callback__userData = new Tcallback__UserData(callback);
10003 Discord_Client_OpenConnectedGamesSettingsInDiscordCallback callback__native =
10004 [](auto result, void* userData__) {
10005 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10006 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10007 userData__typed->delegate(std::move(result__obj));
10008 };
10009 Discord_Client_OpenConnectedGamesSettingsInDiscord(
10010 &instance_, callback__native, Tcallback__UserData::Free, callback__userData);
10011}
10012void Client::SetApplicationId(uint64_t applicationId)
10013{
10014 assert(state_ == DiscordObjectState::Owned);
10015 Discord_Client_SetApplicationId(&instance_, applicationId);
10016}
10017bool Client::SetLogDir(std::string const& path, discordpp::LoggingSeverity minSeverity)
10018{
10019 assert(state_ == DiscordObjectState::Owned);
10020 bool returnValue__;
10021 Discord_String path__str{(uint8_t*)(path.data()), path.size()};
10022 returnValue__ = Discord_Client_SetLogDir(
10023 &instance_, path__str, static_cast<Discord_LoggingSeverity>(minSeverity));
10024 return returnValue__;
10025}
10026void Client::SetStatusChangedCallback(discordpp::Client::OnStatusChanged cb)
10027{
10028 assert(state_ == DiscordObjectState::Owned);
10029 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10030 auto cb__userData = new Tcb__UserData(cb);
10031 Discord_Client_OnStatusChanged cb__native =
10032 [](auto status, auto error, auto errorDetail, void* userData__) {
10033 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10034 userData__typed->delegate(static_cast<discordpp::Client::Status>(status),
10035 static_cast<discordpp::Client::Error>(error),
10036 errorDetail);
10037 };
10038 Discord_Client_SetStatusChangedCallback(
10039 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10040}
10041void Client::SetVoiceLogDir(std::string const& path, discordpp::LoggingSeverity minSeverity)
10042{
10043 assert(state_ == DiscordObjectState::Owned);
10044 Discord_String path__str{(uint8_t*)(path.data()), path.size()};
10045 Discord_Client_SetVoiceLogDir(
10046 &instance_, path__str, static_cast<Discord_LoggingSeverity>(minSeverity));
10047}
10048void Client::CreateOrJoinLobby(std::string const& secret,
10050{
10051 assert(state_ == DiscordObjectState::Owned);
10052 Discord_String secret__str{(uint8_t*)(secret.data()), secret.size()};
10053 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10054 auto callback__userData = new Tcallback__UserData(callback);
10055 Discord_Client_CreateOrJoinLobbyCallback callback__native =
10056 [](auto result, auto lobbyId, void* userData__) {
10057 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10058 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10059 userData__typed->delegate(std::move(result__obj), lobbyId);
10060 };
10061 Discord_Client_CreateOrJoinLobby(
10062 &instance_, secret__str, callback__native, Tcallback__UserData::Free, callback__userData);
10063}
10064void Client::CreateOrJoinLobbyWithMetadata(
10065 std::string const& secret,
10066 std::unordered_map<std::string, std::string> const& lobbyMetadata,
10067 std::unordered_map<std::string, std::string> const& memberMetadata,
10069{
10070 assert(state_ == DiscordObjectState::Owned);
10071 Discord_String secret__str{(uint8_t*)(secret.data()), secret.size()};
10072 ConvertedProperties lobbyMetadata__convert(lobbyMetadata);
10073 ConvertedProperties memberMetadata__convert(memberMetadata);
10074 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10075 auto callback__userData = new Tcallback__UserData(callback);
10076 Discord_Client_CreateOrJoinLobbyCallback callback__native =
10077 [](auto result, auto lobbyId, void* userData__) {
10078 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10079 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10080 userData__typed->delegate(std::move(result__obj), lobbyId);
10081 };
10082 Discord_Client_CreateOrJoinLobbyWithMetadata(&instance_,
10083 secret__str,
10084 lobbyMetadata__convert.Properties,
10085 memberMetadata__convert.Properties,
10086 callback__native,
10087 Tcallback__UserData::Free,
10088 callback__userData);
10089}
10090void Client::GetGuildChannels(uint64_t guildId, discordpp::Client::GetGuildChannelsCallback cb)
10091{
10092 assert(state_ == DiscordObjectState::Owned);
10093 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10094 auto cb__userData = new Tcb__UserData(cb);
10095 Discord_Client_GetGuildChannelsCallback cb__native =
10096 [](auto result, auto guildChannels, void* userData__) {
10097 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10098 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10099 std::vector<discordpp::GuildChannel> guildChannels__vec;
10100 guildChannels__vec.reserve(guildChannels.size);
10101 for (size_t i__ = 0; i__ < guildChannels.size; ++i__) {
10102 guildChannels__vec.emplace_back(guildChannels.ptr[i__], DiscordObjectState::Owned);
10103 }
10104 Discord_Free(guildChannels.ptr);
10105 userData__typed->delegate(std::move(result__obj), std::move(guildChannels__vec));
10106 };
10107 Discord_Client_GetGuildChannels(
10108 &instance_, guildId, cb__native, Tcb__UserData::Free, cb__userData);
10109}
10110std::optional<discordpp::LobbyHandle> Client::GetLobbyHandle(uint64_t lobbyId) const
10111{
10112 assert(state_ == DiscordObjectState::Owned);
10113 bool returnIsNonNull__;
10114 Discord_LobbyHandle returnValueNative__;
10115 returnIsNonNull__ = Discord_Client_GetLobbyHandle(&instance_, lobbyId, &returnValueNative__);
10116 if (!returnIsNonNull__) {
10117 return {};
10118 }
10119 discordpp::LobbyHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
10120 return returnValue__;
10121}
10122std::vector<uint64_t> Client::GetLobbyIds() const
10123{
10124 assert(state_ == DiscordObjectState::Owned);
10125 Discord_UInt64Span returnValueNative__;
10126 Discord_Client_GetLobbyIds(&instance_, &returnValueNative__);
10127 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
10128 returnValueNative__.ptr + returnValueNative__.size);
10129 Discord_Free(returnValueNative__.ptr);
10130 return returnValue__;
10131}
10132void Client::GetUserGuilds(discordpp::Client::GetUserGuildsCallback cb)
10133{
10134 assert(state_ == DiscordObjectState::Owned);
10135 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10136 auto cb__userData = new Tcb__UserData(cb);
10137 Discord_Client_GetUserGuildsCallback cb__native =
10138 [](auto result, auto guilds, void* userData__) {
10139 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10140 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10141 std::vector<discordpp::GuildMinimal> guilds__vec;
10142 guilds__vec.reserve(guilds.size);
10143 for (size_t i__ = 0; i__ < guilds.size; ++i__) {
10144 guilds__vec.emplace_back(guilds.ptr[i__], DiscordObjectState::Owned);
10145 }
10146 Discord_Free(guilds.ptr);
10147 userData__typed->delegate(std::move(result__obj), std::move(guilds__vec));
10148 };
10149 Discord_Client_GetUserGuilds(&instance_, cb__native, Tcb__UserData::Free, cb__userData);
10150}
10151void Client::LeaveLobby(uint64_t lobbyId, discordpp::Client::LeaveLobbyCallback callback)
10152{
10153 assert(state_ == DiscordObjectState::Owned);
10154 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10155 auto callback__userData = new Tcallback__UserData(callback);
10156 Discord_Client_LeaveLobbyCallback callback__native = [](auto result, void* userData__) {
10157 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10158 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10159 userData__typed->delegate(std::move(result__obj));
10160 };
10161 Discord_Client_LeaveLobby(
10162 &instance_, lobbyId, callback__native, Tcallback__UserData::Free, callback__userData);
10163}
10164void Client::LinkChannelToLobby(uint64_t lobbyId,
10165 uint64_t channelId,
10167{
10168 assert(state_ == DiscordObjectState::Owned);
10169 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10170 auto callback__userData = new Tcallback__UserData(callback);
10171 Discord_Client_LinkOrUnlinkChannelCallback callback__native = [](auto result,
10172 void* userData__) {
10173 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10174 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10175 userData__typed->delegate(std::move(result__obj));
10176 };
10177 Discord_Client_LinkChannelToLobby(&instance_,
10178 lobbyId,
10179 channelId,
10180 callback__native,
10181 Tcallback__UserData::Free,
10182 callback__userData);
10183}
10184void Client::SetLobbyCreatedCallback(discordpp::Client::LobbyCreatedCallback cb)
10185{
10186 assert(state_ == DiscordObjectState::Owned);
10187 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10188 auto cb__userData = new Tcb__UserData(cb);
10189 Discord_Client_LobbyCreatedCallback cb__native = [](auto lobbyId, void* userData__) {
10190 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10191 userData__typed->delegate(lobbyId);
10192 };
10193 Discord_Client_SetLobbyCreatedCallback(
10194 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10195}
10196void Client::SetLobbyDeletedCallback(discordpp::Client::LobbyDeletedCallback cb)
10197{
10198 assert(state_ == DiscordObjectState::Owned);
10199 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10200 auto cb__userData = new Tcb__UserData(cb);
10201 Discord_Client_LobbyDeletedCallback cb__native = [](auto lobbyId, void* userData__) {
10202 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10203 userData__typed->delegate(lobbyId);
10204 };
10205 Discord_Client_SetLobbyDeletedCallback(
10206 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10207}
10208void Client::SetLobbyMemberAddedCallback(discordpp::Client::LobbyMemberAddedCallback cb)
10209{
10210 assert(state_ == DiscordObjectState::Owned);
10211 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10212 auto cb__userData = new Tcb__UserData(cb);
10213 Discord_Client_LobbyMemberAddedCallback cb__native =
10214 [](auto lobbyId, auto memberId, void* userData__) {
10215 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10216 userData__typed->delegate(lobbyId, memberId);
10217 };
10218 Discord_Client_SetLobbyMemberAddedCallback(
10219 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10220}
10221void Client::SetLobbyMemberRemovedCallback(discordpp::Client::LobbyMemberRemovedCallback cb)
10222{
10223 assert(state_ == DiscordObjectState::Owned);
10224 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10225 auto cb__userData = new Tcb__UserData(cb);
10226 Discord_Client_LobbyMemberRemovedCallback cb__native =
10227 [](auto lobbyId, auto memberId, void* userData__) {
10228 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10229 userData__typed->delegate(lobbyId, memberId);
10230 };
10231 Discord_Client_SetLobbyMemberRemovedCallback(
10232 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10233}
10234void Client::SetLobbyMemberUpdatedCallback(discordpp::Client::LobbyMemberUpdatedCallback cb)
10235{
10236 assert(state_ == DiscordObjectState::Owned);
10237 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10238 auto cb__userData = new Tcb__UserData(cb);
10239 Discord_Client_LobbyMemberUpdatedCallback cb__native =
10240 [](auto lobbyId, auto memberId, void* userData__) {
10241 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10242 userData__typed->delegate(lobbyId, memberId);
10243 };
10244 Discord_Client_SetLobbyMemberUpdatedCallback(
10245 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10246}
10247void Client::SetLobbyUpdatedCallback(discordpp::Client::LobbyUpdatedCallback cb)
10248{
10249 assert(state_ == DiscordObjectState::Owned);
10250 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10251 auto cb__userData = new Tcb__UserData(cb);
10252 Discord_Client_LobbyUpdatedCallback cb__native = [](auto lobbyId, void* userData__) {
10253 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10254 userData__typed->delegate(lobbyId);
10255 };
10256 Discord_Client_SetLobbyUpdatedCallback(
10257 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10258}
10259void Client::UnlinkChannelFromLobby(uint64_t lobbyId,
10261{
10262 assert(state_ == DiscordObjectState::Owned);
10263 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10264 auto callback__userData = new Tcallback__UserData(callback);
10265 Discord_Client_LinkOrUnlinkChannelCallback callback__native = [](auto result,
10266 void* userData__) {
10267 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10268 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10269 userData__typed->delegate(std::move(result__obj));
10270 };
10271 Discord_Client_UnlinkChannelFromLobby(
10272 &instance_, lobbyId, callback__native, Tcallback__UserData::Free, callback__userData);
10273}
10274void Client::AcceptActivityInvite(discordpp::ActivityInvite invite,
10276{
10277 assert(state_ == DiscordObjectState::Owned);
10278 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10279 auto cb__userData = new Tcb__UserData(cb);
10280 Discord_Client_AcceptActivityInviteCallback cb__native =
10281 [](auto result, auto joinSecret, void* userData__) {
10282 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10283 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10284 std::string joinSecret__str(reinterpret_cast<char*>(joinSecret.ptr), joinSecret.size);
10285 userData__typed->delegate(std::move(result__obj), std::move(joinSecret__str));
10286 Discord_Free(joinSecret.ptr);
10287 };
10288 Discord_Client_AcceptActivityInvite(
10289 &instance_, invite.instance(), cb__native, Tcb__UserData::Free, cb__userData);
10290}
10291void Client::ClearRichPresence()
10292{
10293 assert(state_ == DiscordObjectState::Owned);
10294 Discord_Client_ClearRichPresence(&instance_);
10295}
10296bool Client::RegisterLaunchCommand(uint64_t applicationId, std::string command)
10297{
10298 assert(state_ == DiscordObjectState::Owned);
10299 bool returnValue__;
10300 Discord_String command__str{(uint8_t*)(command.data()), command.size()};
10301 returnValue__ = Discord_Client_RegisterLaunchCommand(&instance_, applicationId, command__str);
10302 return returnValue__;
10303}
10304bool Client::RegisterLaunchSteamApplication(uint64_t applicationId, uint32_t steamAppId)
10305{
10306 assert(state_ == DiscordObjectState::Owned);
10307 bool returnValue__;
10308 returnValue__ =
10309 Discord_Client_RegisterLaunchSteamApplication(&instance_, applicationId, steamAppId);
10310 return returnValue__;
10311}
10312void Client::SendActivityInvite(uint64_t userId,
10313 std::string const& content,
10315{
10316 assert(state_ == DiscordObjectState::Owned);
10317 Discord_String content__str{(uint8_t*)(content.data()), content.size()};
10318 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10319 auto cb__userData = new Tcb__UserData(cb);
10320 Discord_Client_SendActivityInviteCallback cb__native = [](auto result, void* userData__) {
10321 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10322 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10323 userData__typed->delegate(std::move(result__obj));
10324 };
10325 Discord_Client_SendActivityInvite(
10326 &instance_, userId, content__str, cb__native, Tcb__UserData::Free, cb__userData);
10327}
10328void Client::SendActivityJoinRequest(uint64_t userId,
10330{
10331 assert(state_ == DiscordObjectState::Owned);
10332 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10333 auto cb__userData = new Tcb__UserData(cb);
10334 Discord_Client_SendActivityInviteCallback cb__native = [](auto result, void* userData__) {
10335 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10336 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10337 userData__typed->delegate(std::move(result__obj));
10338 };
10339 Discord_Client_SendActivityJoinRequest(
10340 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
10341}
10342void Client::SendActivityJoinRequestReply(discordpp::ActivityInvite invite,
10344{
10345 assert(state_ == DiscordObjectState::Owned);
10346 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10347 auto cb__userData = new Tcb__UserData(cb);
10348 Discord_Client_SendActivityInviteCallback cb__native = [](auto result, void* userData__) {
10349 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10350 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10351 userData__typed->delegate(std::move(result__obj));
10352 };
10353 Discord_Client_SendActivityJoinRequestReply(
10354 &instance_, invite.instance(), cb__native, Tcb__UserData::Free, cb__userData);
10355}
10356void Client::SetActivityInviteCreatedCallback(discordpp::Client::ActivityInviteCallback cb)
10357{
10358 assert(state_ == DiscordObjectState::Owned);
10359 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10360 auto cb__userData = new Tcb__UserData(cb);
10361 Discord_Client_ActivityInviteCallback cb__native = [](auto invite, void* userData__) {
10362 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10363 discordpp::ActivityInvite invite__obj(*invite, DiscordObjectState::Owned);
10364 userData__typed->delegate(std::move(invite__obj));
10365 };
10366 Discord_Client_SetActivityInviteCreatedCallback(
10367 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10368}
10369void Client::SetActivityInviteUpdatedCallback(discordpp::Client::ActivityInviteCallback cb)
10370{
10371 assert(state_ == DiscordObjectState::Owned);
10372 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10373 auto cb__userData = new Tcb__UserData(cb);
10374 Discord_Client_ActivityInviteCallback cb__native = [](auto invite, void* userData__) {
10375 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10376 discordpp::ActivityInvite invite__obj(*invite, DiscordObjectState::Owned);
10377 userData__typed->delegate(std::move(invite__obj));
10378 };
10379 Discord_Client_SetActivityInviteUpdatedCallback(
10380 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10381}
10382void Client::SetActivityJoinCallback(discordpp::Client::ActivityJoinCallback cb)
10383{
10384 assert(state_ == DiscordObjectState::Owned);
10385 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10386 auto cb__userData = new Tcb__UserData(cb);
10387 Discord_Client_ActivityJoinCallback cb__native = [](auto joinSecret, void* userData__) {
10388 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10389 std::string joinSecret__str(reinterpret_cast<char*>(joinSecret.ptr), joinSecret.size);
10390 userData__typed->delegate(std::move(joinSecret__str));
10391 Discord_Free(joinSecret.ptr);
10392 };
10393 Discord_Client_SetActivityJoinCallback(
10394 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10395}
10396void Client::SetOnlineStatus(discordpp::StatusType status,
10398{
10399 assert(state_ == DiscordObjectState::Owned);
10400 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10401 auto callback__userData = new Tcallback__UserData(callback);
10402 Discord_Client_UpdateStatusCallback callback__native = [](auto result, void* userData__) {
10403 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10404 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10405 userData__typed->delegate(std::move(result__obj));
10406 };
10407 Discord_Client_SetOnlineStatus(&instance_,
10408 static_cast<Discord_StatusType>(status),
10409 callback__native,
10410 Tcallback__UserData::Free,
10411 callback__userData);
10412}
10413void Client::UpdateRichPresence(discordpp::Activity activity,
10415{
10416 assert(state_ == DiscordObjectState::Owned);
10417 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10418 auto cb__userData = new Tcb__UserData(cb);
10419 Discord_Client_UpdateRichPresenceCallback cb__native = [](auto result, void* userData__) {
10420 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10421 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10422 userData__typed->delegate(std::move(result__obj));
10423 };
10424 Discord_Client_UpdateRichPresence(
10425 &instance_, activity.instance(), cb__native, Tcb__UserData::Free, cb__userData);
10426}
10427void Client::AcceptDiscordFriendRequest(uint64_t userId,
10429{
10430 assert(state_ == DiscordObjectState::Owned);
10431 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10432 auto cb__userData = new Tcb__UserData(cb);
10433 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
10434 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10435 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10436 userData__typed->delegate(std::move(result__obj));
10437 };
10438 Discord_Client_AcceptDiscordFriendRequest(
10439 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
10440}
10441void Client::AcceptGameFriendRequest(uint64_t userId,
10443{
10444 assert(state_ == DiscordObjectState::Owned);
10445 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10446 auto cb__userData = new Tcb__UserData(cb);
10447 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
10448 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10449 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10450 userData__typed->delegate(std::move(result__obj));
10451 };
10452 Discord_Client_AcceptGameFriendRequest(
10453 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
10454}
10455void Client::BlockUser(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
10456{
10457 assert(state_ == DiscordObjectState::Owned);
10458 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10459 auto cb__userData = new Tcb__UserData(cb);
10460 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
10461 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10462 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10463 userData__typed->delegate(std::move(result__obj));
10464 };
10465 Discord_Client_BlockUser(&instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
10466}
10467void Client::CancelDiscordFriendRequest(uint64_t userId,
10469{
10470 assert(state_ == DiscordObjectState::Owned);
10471 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10472 auto cb__userData = new Tcb__UserData(cb);
10473 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
10474 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10475 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10476 userData__typed->delegate(std::move(result__obj));
10477 };
10478 Discord_Client_CancelDiscordFriendRequest(
10479 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
10480}
10481void Client::CancelGameFriendRequest(uint64_t userId,
10483{
10484 assert(state_ == DiscordObjectState::Owned);
10485 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10486 auto cb__userData = new Tcb__UserData(cb);
10487 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
10488 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10489 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10490 userData__typed->delegate(std::move(result__obj));
10491 };
10492 Discord_Client_CancelGameFriendRequest(
10493 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
10494}
10495discordpp::RelationshipHandle Client::GetRelationshipHandle(uint64_t userId) const
10496{
10497 assert(state_ == DiscordObjectState::Owned);
10498 Discord_RelationshipHandle returnValueNative__{};
10499 Discord_Client_GetRelationshipHandle(&instance_, userId, &returnValueNative__);
10500 discordpp::RelationshipHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
10501 return returnValue__;
10502}
10503std::vector<discordpp::RelationshipHandle> Client::GetRelationships() const
10504{
10505 assert(state_ == DiscordObjectState::Owned);
10506 Discord_RelationshipHandleSpan returnValueNative__;
10507 Discord_Client_GetRelationships(&instance_, &returnValueNative__);
10508 std::vector<discordpp::RelationshipHandle> returnValue__;
10509 returnValue__.reserve(returnValueNative__.size);
10510 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
10511 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
10512 }
10513 Discord_Free(returnValueNative__.ptr);
10514 return returnValue__;
10515}
10516void Client::RejectDiscordFriendRequest(uint64_t userId,
10518{
10519 assert(state_ == DiscordObjectState::Owned);
10520 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10521 auto cb__userData = new Tcb__UserData(cb);
10522 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
10523 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10524 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10525 userData__typed->delegate(std::move(result__obj));
10526 };
10527 Discord_Client_RejectDiscordFriendRequest(
10528 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
10529}
10530void Client::RejectGameFriendRequest(uint64_t userId,
10532{
10533 assert(state_ == DiscordObjectState::Owned);
10534 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10535 auto cb__userData = new Tcb__UserData(cb);
10536 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
10537 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10538 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10539 userData__typed->delegate(std::move(result__obj));
10540 };
10541 Discord_Client_RejectGameFriendRequest(
10542 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
10543}
10544void Client::RemoveDiscordAndGameFriend(uint64_t userId,
10546{
10547 assert(state_ == DiscordObjectState::Owned);
10548 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10549 auto cb__userData = new Tcb__UserData(cb);
10550 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
10551 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10552 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10553 userData__typed->delegate(std::move(result__obj));
10554 };
10555 Discord_Client_RemoveDiscordAndGameFriend(
10556 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
10557}
10558void Client::RemoveGameFriend(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
10559{
10560 assert(state_ == DiscordObjectState::Owned);
10561 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10562 auto cb__userData = new Tcb__UserData(cb);
10563 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
10564 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10565 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10566 userData__typed->delegate(std::move(result__obj));
10567 };
10568 Discord_Client_RemoveGameFriend(
10569 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
10570}
10571std::vector<discordpp::UserHandle> Client::SearchFriendsByUsername(std::string searchStr) const
10572{
10573 assert(state_ == DiscordObjectState::Owned);
10574 Discord_UserHandleSpan returnValueNative__;
10575 Discord_String searchStr__str{(uint8_t*)(searchStr.data()), searchStr.size()};
10576 Discord_Client_SearchFriendsByUsername(&instance_, searchStr__str, &returnValueNative__);
10577 std::vector<discordpp::UserHandle> returnValue__;
10578 returnValue__.reserve(returnValueNative__.size);
10579 for (size_t i__ = 0; i__ < returnValueNative__.size; ++i__) {
10580 returnValue__.emplace_back(returnValueNative__.ptr[i__], DiscordObjectState::Owned);
10581 }
10582 Discord_Free(returnValueNative__.ptr);
10583 return returnValue__;
10584}
10585void Client::SendDiscordFriendRequest(std::string const& username,
10587{
10588 assert(state_ == DiscordObjectState::Owned);
10589 Discord_String username__str{(uint8_t*)(username.data()), username.size()};
10590 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10591 auto cb__userData = new Tcb__UserData(cb);
10592 Discord_Client_SendFriendRequestCallback cb__native = [](auto result, void* userData__) {
10593 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10594 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10595 userData__typed->delegate(std::move(result__obj));
10596 };
10597 Discord_Client_SendDiscordFriendRequest(
10598 &instance_, username__str, cb__native, Tcb__UserData::Free, cb__userData);
10599}
10600void Client::SendDiscordFriendRequestById(uint64_t userId,
10602{
10603 assert(state_ == DiscordObjectState::Owned);
10604 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10605 auto cb__userData = new Tcb__UserData(cb);
10606 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
10607 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10608 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10609 userData__typed->delegate(std::move(result__obj));
10610 };
10611 Discord_Client_SendDiscordFriendRequestById(
10612 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
10613}
10614void Client::SendGameFriendRequest(std::string const& username,
10616{
10617 assert(state_ == DiscordObjectState::Owned);
10618 Discord_String username__str{(uint8_t*)(username.data()), username.size()};
10619 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10620 auto cb__userData = new Tcb__UserData(cb);
10621 Discord_Client_SendFriendRequestCallback cb__native = [](auto result, void* userData__) {
10622 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10623 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10624 userData__typed->delegate(std::move(result__obj));
10625 };
10626 Discord_Client_SendGameFriendRequest(
10627 &instance_, username__str, cb__native, Tcb__UserData::Free, cb__userData);
10628}
10629void Client::SendGameFriendRequestById(uint64_t userId,
10631{
10632 assert(state_ == DiscordObjectState::Owned);
10633 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10634 auto cb__userData = new Tcb__UserData(cb);
10635 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
10636 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10637 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10638 userData__typed->delegate(std::move(result__obj));
10639 };
10640 Discord_Client_SendGameFriendRequestById(
10641 &instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
10642}
10643void Client::SetRelationshipCreatedCallback(discordpp::Client::RelationshipCreatedCallback cb)
10644{
10645 assert(state_ == DiscordObjectState::Owned);
10646 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10647 auto cb__userData = new Tcb__UserData(cb);
10648 Discord_Client_RelationshipCreatedCallback cb__native =
10649 [](auto userId, auto isDiscordRelationshipUpdate, void* userData__) {
10650 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10651 userData__typed->delegate(userId, isDiscordRelationshipUpdate);
10652 };
10653 Discord_Client_SetRelationshipCreatedCallback(
10654 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10655}
10656void Client::SetRelationshipDeletedCallback(discordpp::Client::RelationshipDeletedCallback cb)
10657{
10658 assert(state_ == DiscordObjectState::Owned);
10659 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10660 auto cb__userData = new Tcb__UserData(cb);
10661 Discord_Client_RelationshipDeletedCallback cb__native =
10662 [](auto userId, auto isDiscordRelationshipUpdate, void* userData__) {
10663 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10664 userData__typed->delegate(userId, isDiscordRelationshipUpdate);
10665 };
10666 Discord_Client_SetRelationshipDeletedCallback(
10667 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10668}
10669void Client::UnblockUser(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
10670{
10671 assert(state_ == DiscordObjectState::Owned);
10672 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10673 auto cb__userData = new Tcb__UserData(cb);
10674 Discord_Client_UpdateRelationshipCallback cb__native = [](auto result, void* userData__) {
10675 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10676 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10677 userData__typed->delegate(std::move(result__obj));
10678 };
10679 Discord_Client_UnblockUser(&instance_, userId, cb__native, Tcb__UserData::Free, cb__userData);
10680}
10681discordpp::UserHandle Client::GetCurrentUser() const
10682{
10683 assert(state_ == DiscordObjectState::Owned);
10684 Discord_UserHandle returnValueNative__{};
10685 Discord_Client_GetCurrentUser(&instance_, &returnValueNative__);
10686 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
10687 return returnValue__;
10688}
10689void Client::GetDiscordClientConnectedUser(
10690 uint64_t applicationId,
10692{
10693 assert(state_ == DiscordObjectState::Owned);
10694 using Tcallback__UserData = TDelegateUserData<std::remove_reference_t<decltype(callback)>>;
10695 auto callback__userData = new Tcallback__UserData(callback);
10696 Discord_Client_GetDiscordClientConnectedUserCallback callback__native =
10697 [](auto result, auto user, void* userData__) {
10698 auto userData__typed = static_cast<Tcallback__UserData*>(userData__);
10699 discordpp::ClientResult result__obj(*result, DiscordObjectState::Owned);
10700 std::optional<discordpp::UserHandle> user__opt{};
10701 if (user) {
10702 user__opt = discordpp::UserHandle(*user, DiscordObjectState::Owned);
10703 }
10704 userData__typed->delegate(std::move(result__obj), std::move(user__opt));
10705 };
10706 Discord_Client_GetDiscordClientConnectedUser(
10707 &instance_, applicationId, callback__native, Tcallback__UserData::Free, callback__userData);
10708}
10709std::optional<discordpp::UserHandle> Client::GetUser(uint64_t userId) const
10710{
10711 assert(state_ == DiscordObjectState::Owned);
10712 bool returnIsNonNull__;
10713 Discord_UserHandle returnValueNative__;
10714 returnIsNonNull__ = Discord_Client_GetUser(&instance_, userId, &returnValueNative__);
10715 if (!returnIsNonNull__) {
10716 return {};
10717 }
10718 discordpp::UserHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
10719 return returnValue__;
10720}
10721void Client::SetUserUpdatedCallback(discordpp::Client::UserUpdatedCallback cb)
10722{
10723 assert(state_ == DiscordObjectState::Owned);
10724 using Tcb__UserData = TDelegateUserData<std::remove_reference_t<decltype(cb)>>;
10725 auto cb__userData = new Tcb__UserData(cb);
10726 Discord_Client_UserUpdatedCallback cb__native = [](auto userId, void* userData__) {
10727 auto userData__typed = static_cast<Tcb__UserData*>(userData__);
10728 userData__typed->delegate(userId);
10729 };
10730 Discord_Client_SetUserUpdatedCallback(
10731 &instance_, cb__native, Tcb__UserData::Free, cb__userData);
10732}
10733const CallInfoHandle CallInfoHandle::nullobj{{}, DiscordObjectState::Invalid};
10734CallInfoHandle::~CallInfoHandle()
10735{
10736 if (state_ == DiscordObjectState::Owned) {
10737 Drop();
10738 state_ = DiscordObjectState::Invalid;
10739 }
10740}
10741CallInfoHandle::CallInfoHandle(CallInfoHandle&& other) noexcept
10742 : instance_(other.instance_)
10743 , state_(other.state_)
10744{
10745 other.state_ = DiscordObjectState::Invalid;
10746}
10747CallInfoHandle& CallInfoHandle::operator=(CallInfoHandle&& other) noexcept
10748{
10749 if (this != &other) {
10750 if (state_ == DiscordObjectState::Owned) {
10751 Drop();
10752 }
10753 instance_ = other.instance_;
10754 state_ = other.state_;
10755 other.state_ = DiscordObjectState::Invalid;
10756 }
10757 return *this;
10758}
10759CallInfoHandle::CallInfoHandle(const CallInfoHandle& other)
10760 : instance_{}
10761 , state_(DiscordObjectState::Invalid)
10762{
10763 if (other.state_ == DiscordObjectState::Owned) {
10764 Discord_CallInfoHandle_Clone(&instance_, other.instance());
10765
10766 state_ = DiscordObjectState::Owned;
10767 }
10768}
10769CallInfoHandle& CallInfoHandle::operator=(const CallInfoHandle& other)
10770{
10771 if (this != &other) {
10772 if (state_ == DiscordObjectState::Owned) {
10773 Drop();
10774 state_ = DiscordObjectState::Invalid;
10775 }
10776 if (other.state_ == DiscordObjectState::Owned) {
10777 Discord_CallInfoHandle_Clone(&instance_, other.instance());
10778
10779 state_ = DiscordObjectState::Owned;
10780 }
10781 }
10782 return *this;
10783}
10784CallInfoHandle::CallInfoHandle(Discord_CallInfoHandle instance, DiscordObjectState state)
10785 : instance_(instance)
10786 , state_(state)
10787{
10788}
10789void CallInfoHandle::Drop()
10790{
10791 if (state_ != DiscordObjectState::Owned) {
10792 return;
10793 }
10794 Discord_CallInfoHandle_Drop(&instance_);
10795 state_ = DiscordObjectState::Invalid;
10796}
10797uint64_t CallInfoHandle::ChannelId() const
10798{
10799 assert(state_ == DiscordObjectState::Owned);
10800 uint64_t returnValue__;
10801 returnValue__ = Discord_CallInfoHandle_ChannelId(&instance_);
10802 return returnValue__;
10803}
10804std::vector<uint64_t> CallInfoHandle::GetParticipants() const
10805{
10806 assert(state_ == DiscordObjectState::Owned);
10807 Discord_UInt64Span returnValueNative__;
10808 Discord_CallInfoHandle_GetParticipants(&instance_, &returnValueNative__);
10809 std::vector<uint64_t> returnValue__(returnValueNative__.ptr,
10810 returnValueNative__.ptr + returnValueNative__.size);
10811 Discord_Free(returnValueNative__.ptr);
10812 return returnValue__;
10813}
10814std::optional<discordpp::VoiceStateHandle> CallInfoHandle::GetVoiceStateHandle(
10815 uint64_t userId) const
10816{
10817 assert(state_ == DiscordObjectState::Owned);
10818 bool returnIsNonNull__;
10819 Discord_VoiceStateHandle returnValueNative__;
10820 returnIsNonNull__ =
10821 Discord_CallInfoHandle_GetVoiceStateHandle(&instance_, userId, &returnValueNative__);
10822 if (!returnIsNonNull__) {
10823 return {};
10824 }
10825 discordpp::VoiceStateHandle returnValue__(returnValueNative__, DiscordObjectState::Owned);
10826 return returnValue__;
10827}
10828uint64_t CallInfoHandle::GuildId() const
10829{
10830 assert(state_ == DiscordObjectState::Owned);
10831 uint64_t returnValue__;
10832 returnValue__ = Discord_CallInfoHandle_GuildId(&instance_);
10833 return returnValue__;
10834}
10835} // namespace discordpp
10836
10837#endif // DISCORDPP_IMPLEMENTATION
Struct which controls what your rich presence looks like in the Discord client. If you don't specify ...
Definition discordpp.h:721
void SetLargeImage(std::optional< std::string > LargeImage)
Setter for ActivityAssets::LargeImage.
std::optional< std::string > SmallText() const
A tooltip string that is shown when the user hovers over the small image.
void SetLargeText(std::optional< std::string > LargeText)
Setter for ActivityAssets::LargeText.
ActivityAssets(ActivityAssets &&other) noexcept
Move constructor for ActivityAssets.
std::optional< std::string > SmallImage() const
The secondary image, rendered as a small circle over the largeImage.
ActivityAssets(const ActivityAssets &arg0)
Copy constructor for ActivityAssets.
std::optional< std::string > LargeText() const
A tooltip string that is shown when the user hovers over the large image.
void SetSmallImage(std::optional< std::string > SmallImage)
Setter for ActivityAssets::SmallImage.
ActivityAssets & operator=(const ActivityAssets &arg0)
Copy assignment operator for ActivityAssets.
static const ActivityAssets nullobj
Uninitialized instance of ActivityAssets.
Definition discordpp.h:740
std::optional< std::string > LargeImage() const
The primary image identifier or URL, rendered as a large square icon on a user's rich presence.
void SetSmallText(std::optional< std::string > SmallText)
Setter for ActivityAssets::SmallText.
ActivityAssets & operator=(ActivityAssets &&other) noexcept
Move assignment operator for ActivityAssets.
Definition discordpp.h:946
ActivityButton(ActivityButton &&other) noexcept
Move constructor for ActivityButton.
static const ActivityButton nullobj
Uninitialized instance of ActivityButton.
Definition discordpp.h:965
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:629
static const ActivityInvite nullobj
Uninitialized instance of ActivityInvite.
Definition discordpp.h:648
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.
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.
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:840
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:859
ActivityParty & operator=(const ActivityParty &arg0)
Copy assignment operator for ActivityParty.
Definition discordpp.h:902
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:921
Definition discordpp.h:786
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:805
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:1171
std::vector< discordpp::ActivityButton > GetButtons() const
Returns the custom buttons for the rich presence.
static const Activity nullobj
Uninitialized instance of Activity.
Definition discordpp.h:1190
std::optional< uint64_t > ApplicationId() const
The application ID of the game that the activity is associated with.
std::string Name() const
The name of the game or application that the activity is associated with.
void SetDetails(std::optional< std::string > Details)
Setter for Activity::Details.
Activity & operator=(Activity &&other) noexcept
Move assignment operator for Activity.
void SetType(discordpp::ActivityTypes Type)
Setter for Activity::Type.
std::optional< discordpp::ActivityAssets > Assets() const
Images used to customize how the Activity is displayed in the Discord client.
void SetTimestamps(std::optional< discordpp::ActivityTimestamps > Timestamps)
Setter for Activity::Timestamps.
bool Equals(discordpp::Activity other) const
Compares each field of the Activity struct for equality.
void SetApplicationId(std::optional< uint64_t > ApplicationId)
Setter for Activity::ApplicationId.
void SetName(std::string Name)
Setter for Activity::Name.
void SetSecrets(std::optional< discordpp::ActivitySecrets > Secrets)
Setter for Activity::Secrets.
Activity(const Activity &arg0)
Copy constructor for Activity.
void SetAssets(std::optional< discordpp::ActivityAssets > Assets)
Setter for Activity::Assets.
std::optional< discordpp::ActivityTimestamps > Timestamps() const
The timestamps struct can be used to render either:
void SetParty(std::optional< discordpp::ActivityParty > Party)
Setter for Activity::Party.
Activity & operator=(const Activity &arg0)
Copy assignment operator for Activity.
std::optional< discordpp::ActivityParty > Party() const
The party struct is used to indicate the size and members of the people the current user is playing w...
void AddButton(discordpp::ActivityButton button)
Adds a custom button to the rich presence.
void SetSupportedPlatforms(discordpp::ActivityGamePlatforms SupportedPlatforms)
Setter for Activity::SupportedPlatforms.
std::optional< std::string > Details() const
The state of the what the user is doing for this activity.
void SetState(std::optional< std::string > State)
Setter for Activity::State.
Activity(Activity &&other) noexcept
Move constructor for Activity.
discordpp::ActivityGamePlatforms SupportedPlatforms() const
If an activity is joinable, but only on certain platforms, this field can be used to indicate which p...
std::optional< discordpp::ActivitySecrets > Secrets() const
The secrets struct is used in combination with the party struct to make an Activity joinable.
std::optional< std::string > State() const
The state of the party for this activity.
discordpp::ActivityTypes Type() const
The type of activity this is.
Contains information about non-text content in a message that likely cannot be rendered in game such ...
Definition discordpp.h:2638
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:2657
Represents a single input or output audio device available to the user.
Definition discordpp.h:2854
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:2873
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:1480
std::optional< std::string > State() const
See https://discord.com/developers/docs/topics/oauth2#state-and-security for details on this field.
AuthorizationArgs & operator=(AuthorizationArgs &&other) noexcept
Move assignment operator for AuthorizationArgs.
std::optional< std::string > Nonce() const
The nonce field is generally only useful for backend integrations using ID tokens.
std::optional< discordpp::AuthorizationCodeChallenge > CodeChallenge() const
If using the Client::GetToken flow, you will need to generate a code challenge and verifier.
uint64_t ClientId() const
Optional. The Discord application ID for your game. Defaults to the value set by Client::SetApplicati...
AuthorizationArgs(const AuthorizationArgs &arg0)
Copy constructor for AuthorizationArgs.
void SetScopes(std::string Scopes)
Setter for AuthorizationArgs::Scopes.
static const AuthorizationArgs nullobj
Uninitialized instance of AuthorizationArgs.
Definition discordpp.h:1499
void SetClientId(uint64_t ClientId)
Setter for AuthorizationArgs::ClientId.
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:1388
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:1408
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:1435
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:1455
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:4583
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:4602
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:1718
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:1779
static const Call nullobj
Uninitialized instance of Call.
Definition discordpp.h:1796
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:1726
@ None
None.
Definition discordpp.h:1729
@ Forbidden
Forbidden.
Definition discordpp.h:1744
@ SignalingConnectionFailed
SignalingConnectionFailed.
Definition discordpp.h:1732
@ SignalingUnexpectedClose
SignalingUnexpectedClose.
Definition discordpp.h:1735
@ JoinTimeout
JoinTimeout.
Definition discordpp.h:1741
@ VoiceConnectionFailed
VoiceConnectionFailed.
Definition discordpp.h:1738
Status
Enum that respresents the state of the Call's network connection.
Definition discordpp.h:1748
@ Disconnecting
Disconnecting.
Definition discordpp.h:1769
@ Connected
Connected.
Definition discordpp.h:1763
@ Reconnecting
Reconnecting.
Definition discordpp.h:1766
@ Connecting
Connecting.
Definition discordpp.h:1757
@ SignalingConnected
SignalingConnected.
Definition discordpp.h:1760
@ Disconnected
Disconnected.
Definition discordpp.h:1751
@ Joining
Joining.
Definition discordpp.h:1754
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:1782
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:1776
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:1773
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:1945
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:1964
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.
Struct that stores information about the result of an SDK function call.
Definition discordpp.h:1295
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:1314
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:2909
std::function< void(std::vector< discordpp::AudioDevice > devices)> GetOutputDevicesCallback
Callback function for Client::GetOutputDevices.
Definition discordpp.h:3006
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.
std::function< void(uint64_t messageId)> MessageCreatedCallback
Callback function for Client::SetMessageCreatedCallback.
Definition discordpp.h:3097
discordpp::Call GetCall(uint64_t channelId)
Returns a reference to the currently active call, if any.
std::function< void(discordpp::ClientResult result)> UpdateRelationshipCallback
Callback function for most other Relationship functions such as Client::SendDiscordFriendRequestById.
Definition discordpp.h:3180
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:3071
std::function< void(bool inputDetected)> NoAudioInputCallback
Callback function for Client::SetNoAudioInputCallback.
Definition discordpp.h:3018
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:3085
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.
std::function< void(discordpp::ClientResult result, std::vector< discordpp::GuildMinimal > guilds)> GetUserGuildsCallback
Callback function for Client::GetUserGuilds.
Definition discordpp.h:3130
Client(std::string apiBase, std::string webBase)
Creates a new instance of the Client but allows customizing the Discord URL to use.
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:3143
std::function< void(std::string message, discordpp::LoggingSeverity severity)> LogCallback
Callback function invoked when a new log message is generated.
Definition discordpp.h:3106
void SetDeviceChangeCallback(discordpp::Client::DeviceChangeCallback callback)
Sets a callback function to be invoked when Discord detects a change in the available audio devices.
std::function< void(discordpp::ClientResult result)> LinkOrUnlinkChannelCallback
Callback function for Client::LinkChannelToLobby.
Definition discordpp.h:3137
std::function< void(discordpp::AudioDevice device)> GetCurrentOutputDeviceCallback
Callback function for Client::GetCurrentOutputDevice.
Definition discordpp.h:2999
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:3068
std::function< void(discordpp::ClientResult result)> SetOutputDeviceCallback
Callback function for Client::SetOutputDevice.
Definition discordpp.h:3021
std::function< void(discordpp::ClientResult result, std::optional< discordpp::UserHandle > user)> GetDiscordClientConnectedUserCallback
Callback function for when Client::GetDiscordClientConnectedUser completes.
Definition discordpp.h:3201
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:3152
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:3030
std::function< void(discordpp::ClientResult result)> LeaveLobbyCallback
Callback function for Client::LeaveLobby.
Definition discordpp.h:3134
std::function< void(uint64_t lobbyId)> LobbyUpdatedCallback
Callback function for Client::SetLobbyUpdatedCallback.
Definition discordpp.h:3155
void GetTokenFromDevice(discordpp::DeviceAuthorizationArgs args, discordpp::Client::TokenExchangeCallback callback)
This function is a combination of Client::Authorize and Client::GetToken, but is used for the case wh...
void CloseAuthorizeDeviceScreen()
This function is used to hide the device authorization screen and is used for the case where the user...
void SetOpusHardwareCoding(bool encode, bool decode)
Enables or disables hardware encoding and decoding for audio, if it is available.
bool ShowAudioRoutePicker()
On iOS devices, show the system audio route picker.
void SetActivityJoinCallback(discordpp::Client::ActivityJoinCallback cb)
Sets a callback function that is invoked when the current user also has Discord running on their comp...
void GetOutputDevices(discordpp::Client::GetOutputDevicesCallback cb)
Asynchronously fetches the list of audio output devices available to the user.
std::function< void()> AuthorizeDeviceScreenClosedCallback
Callback function for Client::SetAuthorizeDeviceScreenClosedCallback.
Definition discordpp.h:3065
void SetSelfDeafAll(bool deaf)
Mutes all audio from the currently active call for the current user in all calls. They will not be ab...
std::function< void(discordpp::ClientResult result)> UpdateRichPresenceCallback
Callback function for when Client::UpdateRichPresence completes.
Definition discordpp.h:3176
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:3184
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:3117
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:2993
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.
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:3158
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:2952
@ Disconnecting
Disconnecting.
Definition discordpp.h:2970
@ Connected
Connected.
Definition discordpp.h:2961
@ HttpWait
HttpWait.
Definition discordpp.h:2973
@ Reconnecting
Reconnecting.
Definition discordpp.h:2967
@ Connecting
Connecting.
Definition discordpp.h:2958
@ Ready
Ready.
Definition discordpp.h:2964
@ Disconnected
Disconnected.
Definition discordpp.h:2955
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:3057
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:3088
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:2990
std::function< void(discordpp::ClientResult result)> EditUserMessageCallback
Callback function for Client::EditUserMessage.
Definition discordpp.h:3082
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:3015
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:3146
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:3167
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:3076
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:3140
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:3149
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:3049
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:3170
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:3163
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:3024
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:3197
bool GetSelfDeafAll() const
Returns whether the current user is deafened in all calls.
bool SetSpeakerMode(bool speakerMode)
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:2923
@ None
None.
Definition discordpp.h:2926
@ ConnectionCanceled
ConnectionCanceled.
Definition discordpp.h:2935
@ ConnectionFailed
ConnectionFailed.
Definition discordpp.h:2929
@ UnexpectedClose
UnexpectedClose.
Definition discordpp.h:2932
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:3093
std::function< void(discordpp::AudioDevice device)> GetCurrentInputDeviceCallback
Callback function for Client::GetCurrentInputDevice.
Definition discordpp.h:2996
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:3206
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:3100
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:3110
Thread
Represents the type of thread to control thread priority on.
Definition discordpp.h:2977
@ Client
Client.
Definition discordpp.h:2980
@ Voice
Voice.
Definition discordpp.h:2983
@ Network
Network.
Definition discordpp.h:2986
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:3103
void SetEngineManagedAudioSession(bool isEngineManaged)
On mobile devices, set whether the audio environment is managed by the engine or the SDK....
void SetLobbyMemberUpdatedCallback(discordpp::Client::LobbyMemberUpdatedCallback cb)
Sets a callback function to be invoked whenever a member of a lobby is changed.
bool GetSelfMuteAll() const
Returns whether the current user's microphone is muted in all calls.
std::function< void(uint64_t userId, bool isDiscordRelationshipUpdate)> RelationshipCreatedCallback
Callback function for Client::SetRelationshipCreatedCallback.
Definition discordpp.h:3190
std::function< void(discordpp::ClientResult result)> DeleteUserMessageCallback
Callback function for Client::DeleteUserMessage.
Definition discordpp.h:3079
bool CanOpenMessageInDiscord(uint64_t messageId)
Returns true if the given message is able to be viewed in a Discord client.
void SetNoiseSuppression(bool on)
Enables basic background noise suppression.
void SetLobbyMemberAddedCallback(discordpp::Client::LobbyMemberAddedCallback cb)
Sets a callback function to be invoked whenever a user is added to a lobby.
void GetCurrentOutputDevice(discordpp::Client::GetCurrentOutputDeviceCallback cb)
Asynchronously fetches the current audio output device in use by the client.
void SetHttpRequestTimeout(int32_t httpTimeoutInMilliseconds)
This function is used to override the default HTTP timeout for the websocket client.
void EndCall(uint64_t channelId, discordpp::Client::EndCallCallback callback)
Ends any active call, if any. Any references you have to Call objects are invalid after they are ende...
void AcceptGameFriendRequest(uint64_t userId, discordpp::Client::UpdateRelationshipCallback cb)
Accepts an incoming game friend request from the target user.
std::function< void(discordpp::ClientResult result, uint64_t id, std::string name)> FetchCurrentUserCallback
Callback function for Client::FetchCurrentUser.
Definition discordpp.h:3053
std::function< void(discordpp::ClientResult result, std::vector< discordpp::GuildChannel > guildChannels)> GetGuildChannelsCallback
Callback function for Client::GetGuildChannels.
Definition discordpp.h:3125
std::function< void(discordpp::ClientResult result)> UpdateStatusCallback
Callback function for when Client::SetOnlineStatus completes.
Definition discordpp.h:3173
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:3121
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 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:3040
std::function< void(std::vector< discordpp::AudioDevice > inputDevices, std::vector< discordpp::AudioDevice > outputDevices)> DeviceChangeCallback
Callback function for Client::SetDeviceChangeCallback.
Definition discordpp.h:3010
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:3002
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:3219
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:1564
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:1584
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:2060
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:2015
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:2168
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:2187
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:2122
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:2141
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:2574
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:2593
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:2431
LobbyMemberHandle & operator=(const LobbyMemberHandle &other)
Copy assignment operator for LobbyMemberHandle.
static const LobbyMemberHandle nullobj
Uninitialized instance of LobbyMemberHandle.
Definition discordpp.h:2450
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:2750
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:2769
std::optional< discordpp::UserHandle > Recipient() const
Returns the UserHandle for the other participant in a DM, if this message was sent in a DM.
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:2250
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:2269
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:2306
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:2340
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:2314
@ Jpeg
Jpeg.
Definition discordpp.h:2326
@ Gif
Gif.
Definition discordpp.h:2317
@ Webp
Webp.
Definition discordpp.h:2320
@ Png
Png.
Definition discordpp.h:2323
bool IsProvisional() const
Returns true if this user is a provisional account.
std::optional< std::string > GlobalName() const
Returns the preferred display name of this user, if one is set.
std::optional< discordpp::Activity > GameActivity() const
Returns the user's rich presence activity that is associated with the current game,...
UserHandle & operator=(const UserHandle &arg0)
Copy assignment operator for UserHandle.
static std::string AvatarTypeToString(discordpp::UserHandle::AvatarType type)
Converts the AvatarType enum to a string.
std::string DisplayName() const
Returns the user's preferred name, if one is set, otherwise returns their unique username.
discordpp::RelationshipHandle Relationship() const
Returns a reference to the RelationshipHandle between the currently authenticated user and this user,...
Settings for the void auto detection threshold for picking up activity from a user's mic.
Definition discordpp.h:1674
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:1693
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:1632
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:1651
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:538
@ MessageDataVisibleOnDiscord
This disclosure type happens the first time a user sends a message in game, and that message will be ...
Definition discordpp.h:544
const char * EnumToString(discordpp::ActivityActionTypes value)
Converts a discordpp::ActivityActionTypes to a string.
Definition discordpp.h:4629
HttpStatusCode
Enum that represents the various HTTP status codes that can be returned.
Definition discordpp.h:189
@ RequestHeaderFieldsTooLarge
RequestHeaderFieldsTooLarge.
Definition discordpp.h:336
@ PayloadTooLarge
PayloadTooLarge.
Definition discordpp.h:297
@ MultiStatus
MultiStatus.
Definition discordpp.h:228
@ VariantAlsoNegotiates
VariantAlsoNegotiates.
Definition discordpp.h:357
@ Gone
Gone.
Definition discordpp.h:288
@ BadGateway
BadGateway.
Definition discordpp.h:345
@ Created
Created.
Definition discordpp.h:210
@ TemporaryRedirect
TemporaryRedirect.
Definition discordpp.h:252
@ ServiceUnavailable
ServiceUnavailable.
Definition discordpp.h:348
@ MovedPermanently
MovedPermanently.
Definition discordpp.h:240
@ PreconditionFailed
PreconditionFailed.
Definition discordpp.h:294
@ RequestTimeout
RequestTimeout.
Definition discordpp.h:282
@ Accepted
Accepted.
Definition discordpp.h:213
@ NonAuthoritativeInfo
NonAuthoritativeInfo.
Definition discordpp.h:216
@ NotFound
NotFound.
Definition discordpp.h:270
@ FailedDependency
FailedDependency.
Definition discordpp.h:321
@ PaymentRequired
PaymentRequired.
Definition discordpp.h:264
@ PreconditionRequired
PreconditionRequired.
Definition discordpp.h:330
@ ResetContent
ResetContent.
Definition discordpp.h:222
@ SwitchingProtocols
SwitchingProtocols.
Definition discordpp.h:198
@ HttpVersionNotSupported
HttpVersionNotSupported.
Definition discordpp.h:354
@ Found
Found.
Definition discordpp.h:243
@ Processing
Processing.
Definition discordpp.h:201
@ None
None.
Definition discordpp.h:192
@ ExpectationFailed
ExpectationFailed.
Definition discordpp.h:309
@ Forbidden
Forbidden.
Definition discordpp.h:267
@ PartialContent
PartialContent.
Definition discordpp.h:225
@ SeeOther
SeeOther.
Definition discordpp.h:246
@ EarlyHints
EarlyHints.
Definition discordpp.h:204
@ LengthRequired
LengthRequired.
Definition discordpp.h:291
@ MethodNotAllowed
MethodNotAllowed.
Definition discordpp.h:273
@ NotExtended
NotExtended.
Definition discordpp.h:366
@ RangeNotSatisfiable
RangeNotSatisfiable.
Definition discordpp.h:306
@ NotImplemented
NotImplemented.
Definition discordpp.h:342
@ BadRequest
BadRequest.
Definition discordpp.h:258
@ Continue
Continue.
Definition discordpp.h:195
@ LoopDetected
LoopDetected.
Definition discordpp.h:363
@ UnsupportedMediaType
UnsupportedMediaType.
Definition discordpp.h:303
@ NetworkAuthorizationRequired
NetworkAuthorizationRequired.
Definition discordpp.h:369
@ ImUsed
ImUsed.
Definition discordpp.h:234
@ MultipleChoices
MultipleChoices.
Definition discordpp.h:237
@ Ok
Ok.
Definition discordpp.h:207
@ TooManyRequests
TooManyRequests.
Definition discordpp.h:333
@ ProxyAuthRequired
ProxyAuthRequired.
Definition discordpp.h:279
@ UnprocessableEntity
UnprocessableEntity.
Definition discordpp.h:315
@ MisdirectedRequest
MisdirectedRequest.
Definition discordpp.h:312
@ PermanentRedirect
PermanentRedirect.
Definition discordpp.h:255
@ NotModified
NotModified.
Definition discordpp.h:249
@ AlreadyReported
AlreadyReported.
Definition discordpp.h:231
@ NoContent
NoContent.
Definition discordpp.h:219
@ Locked
Locked.
Definition discordpp.h:318
@ GatewayTimeout
GatewayTimeout.
Definition discordpp.h:351
@ Unauthorized
Unauthorized.
Definition discordpp.h:261
@ UpgradeRequired
UpgradeRequired.
Definition discordpp.h:327
@ InsufficientStorage
InsufficientStorage.
Definition discordpp.h:360
@ InternalServerError
InternalServerError.
Definition discordpp.h:339
@ TooEarly
TooEarly.
Definition discordpp.h:324
@ Conflict
Conflict.
Definition discordpp.h:285
@ UriTooLong
UriTooLong.
Definition discordpp.h:300
@ NotAcceptable
NotAcceptable.
Definition discordpp.h:276
AuthorizationTokenType
Represents the type of auth token used by the SDK, either the normal tokens produced by the Discord d...
Definition discordpp.h:549
@ Bearer
Bearer.
Definition discordpp.h:555
@ User
User.
Definition discordpp.h:552
ChannelType
Enum that represents the various channel types on Discord.
Definition discordpp.h:422
@ GuildForum
GuildForum.
Definition discordpp.h:461
@ Dm
Dm.
Definition discordpp.h:428
@ Lobby
Lobby.
Definition discordpp.h:467
@ GuildNews
GuildNews.
Definition discordpp.h:440
@ GuildVoice
GuildVoice.
Definition discordpp.h:431
@ GuildPublicThread
GuildPublicThread.
Definition discordpp.h:449
@ GuildNewsThread
GuildNewsThread.
Definition discordpp.h:446
@ GuildDirectory
GuildDirectory.
Definition discordpp.h:458
@ GuildCategory
GuildCategory.
Definition discordpp.h:437
@ GuildStageVoice
GuildStageVoice.
Definition discordpp.h:455
@ GuildMedia
GuildMedia.
Definition discordpp.h:464
@ GuildStore
GuildStore.
Definition discordpp.h:443
@ GuildText
GuildText.
Definition discordpp.h:425
@ GroupDm
GroupDm.
Definition discordpp.h:434
@ EphemeralDm
EphemeralDm.
Definition discordpp.h:470
@ GuildPrivateThread
GuildPrivateThread.
Definition discordpp.h:452
AuthenticationCodeChallengeMethod
Represents the crypto method used to generate a code challenge.
Definition discordpp.h:375
@ S256
S256.
Definition discordpp.h:378
RelationshipType
Enum that represents the possible types of relationships that can exist between two users.
Definition discordpp.h:474
@ PendingIncoming
The current user has received a friend request from the target user, but it is not yet accepted.
Definition discordpp.h:489
@ Implicit
The Implicit type is documented for visibility, but should be unused in the SDK.
Definition discordpp.h:496
@ Suggestion
The Suggestion type is documented for visibility, but should be unused in the SDK.
Definition discordpp.h:499
@ PendingOutgoing
The current user has sent a friend request to the target user, but it is not yet accepted.
Definition discordpp.h:493
@ Blocked
The current user has blocked the target user, and so certain actions such as sending messages between...
Definition discordpp.h:484
@ None
The user has no relationship with the other user.
Definition discordpp.h:477
@ Friend
The user is friends with the other user.
Definition discordpp.h:480
AuthenticationExternalAuthType
Represents the various identity providers that can be used to authenticate a provisional account user...
Definition discordpp.h:560
@ EpicOnlineServicesIdToken
EpicOnlineServicesIdToken.
Definition discordpp.h:569
@ EpicOnlineServicesAccessToken
EpicOnlineServicesAccessToken.
Definition discordpp.h:566
@ SteamSessionTicket
SteamSessionTicket.
Definition discordpp.h:572
@ OIDC
OIDC.
Definition discordpp.h:563
@ UnityServicesIdToken
UnityServicesIdToken.
Definition discordpp.h:575
LoggingSeverity
Enum that represents the various log levels supported by the SDK.
Definition discordpp.h:579
@ Warning
Warning.
Definition discordpp.h:588
@ Info
Info.
Definition discordpp.h:585
@ None
None.
Definition discordpp.h:594
@ Error
Error.
Definition discordpp.h:591
@ Verbose
Verbose.
Definition discordpp.h:582
ActivityGamePlatforms
Represents the type of platforms that an activity invite can be accepted on.
Definition discordpp.h:99
@ Embedded
Embedded.
Definition discordpp.h:117
@ Xbox
Xbox.
Definition discordpp.h:105
@ Desktop
Desktop.
Definition discordpp.h:102
@ Samsung
Samsung.
Definition discordpp.h:108
@ PS5
PS5.
Definition discordpp.h:123
@ PS4
PS4.
Definition discordpp.h:120
@ IOS
IOS.
Definition discordpp.h:111
@ Android
Android.
Definition discordpp.h:114
ActivityTypes
Discord RichPresence supports multiple types of activities that a user can be doing.
Definition discordpp.h:74
@ Watching
Watching.
Definition discordpp.h:86
@ Competing
Competing.
Definition discordpp.h:92
@ HangStatus
HangStatus.
Definition discordpp.h:95
@ Listening
Listening.
Definition discordpp.h:83
@ Streaming
Streaming.
Definition discordpp.h:80
@ CustomStatus
CustomStatus.
Definition discordpp.h:89
@ Playing
Playing.
Definition discordpp.h:77
StatusType
Enum that specifies the various online statuses for a user.
Definition discordpp.h:506
@ Blocked
Blocked.
Definition discordpp.h:515
@ Online
The user is online and recently active.
Definition discordpp.h:509
@ Dnd
The user is online, but wishes to suppress notifications for the time being.
Definition discordpp.h:522
@ Unknown
Unknown.
Definition discordpp.h:531
@ Invisible
The user is online, but wishes to appear as if they are offline to other users.
Definition discordpp.h:525
@ Offline
The user is offline and not connected to Discord.
Definition discordpp.h:512
@ Streaming
The user is online and is actively streaming content.
Definition discordpp.h:528
@ Idle
The user is online, but has not been active for a while and may be away from their computer.
Definition discordpp.h:519
void RunCallbacks()
Definition discordpp.h:29
AudioModeType
Represents whether a voice call is using push to talk or auto voice detection.
Definition discordpp.h:407
@ MODE_PTT
MODE_PTT.
Definition discordpp.h:416
@ MODE_VAD
MODE_VAD.
Definition discordpp.h:413
@ MODE_UNINIT
MODE_UNINIT.
Definition discordpp.h:410
ErrorType
Enum representing various types of errors the SDK returns.
Definition discordpp.h:127
@ HTTPError
An HTTP call was made to Discord's servers but a non success HTTP status code was returned....
Definition discordpp.h:142
@ NetworkError
The user is offline or there was some network issue that prevented an underlying HTTP call from succe...
Definition discordpp.h:134
@ AuthorizationFailed
An authorization function failed, but not necessarily as the result of an HTTP call that returned an ...
Definition discordpp.h:176
@ ClientNotReady
An operation such as sending a friend request or joining a lobby was attempted but the Client is not ...
Definition discordpp.h:152
@ None
No error, the operation was successful.
Definition discordpp.h:130
@ Aborted
The user or developer aborted an operation, such as an authorization flow.
Definition discordpp.h:171
@ RPCError
An RPC call was made to Discord's desktop application, but it returned a non-success result....
Definition discordpp.h:181
@ ValidationError
Used when an SDK method is called but the inputs don't pass local validation. For example if one atte...
Definition discordpp.h:168
@ ClientDestroyed
The Client has been destroyed and so this operation cannot complete.
Definition discordpp.h:158
@ Disabled
An operation was temporarily disabled for stability reasons.
Definition discordpp.h:155
DiscordObjectState
Represents the memory state of a Discord object.
Definition discordpp.h:19
@ Invalid
The object has been freed.
Definition discordpp.h:21
@ Owned
The object is owned by the C++ wrapper and methods can be called on it.
Definition discordpp.h:23
AdditionalContentType
Represents the type of additional content contained in a message.
Definition discordpp.h:382
@ Sticker
Sticker.
Definition discordpp.h:403
@ VoiceMessage
VoiceMessage.
Definition discordpp.h:394
@ Other
Other.
Definition discordpp.h:385
@ Poll
Poll.
Definition discordpp.h:391
@ Thread
Thread.
Definition discordpp.h:397
@ Attachment
Attachment.
Definition discordpp.h:388
@ Embed
Embed.
Definition discordpp.h:400
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