rdiscord_sdk 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +13 -0
- data/.vscode/c_cpp_properties.json +24 -0
- data/.vscode/settings.json +102 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +46 -0
- data/INTERNALS.md +0 -0
- data/LICENSE +674 -0
- data/README.md +187 -0
- data/Rakefile +17 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/ext/rdiscord_sdk/activity.cpp +297 -0
- data/ext/rdiscord_sdk/activity.h +17 -0
- data/ext/rdiscord_sdk/common.cpp +65 -0
- data/ext/rdiscord_sdk/common.h +88 -0
- data/ext/rdiscord_sdk/extconf.rb +54 -0
- data/ext/rdiscord_sdk/gem_activity_manager.cpp +273 -0
- data/ext/rdiscord_sdk/gem_activity_manager.h +8 -0
- data/ext/rdiscord_sdk/gem_user_manager.cpp +114 -0
- data/ext/rdiscord_sdk/gem_user_manager.h +8 -0
- data/ext/rdiscord_sdk/rdiscord_sdk.cpp +77 -0
- data/ext/rdiscord_sdk/rdiscord_sdk.h +17 -0
- data/ext/rdiscord_sdk/user.cpp +98 -0
- data/ext/rdiscord_sdk/user.h +19 -0
- data/lib/rdiscord_sdk/enums.rb +162 -0
- data/lib/rdiscord_sdk/rdiscord_sdk.so +0 -0
- data/lib/rdiscord_sdk/version.rb +16 -0
- data/lib/rdiscord_sdk.rb +3 -0
- data/rdiscord_sdk.gemspec +34 -0
- data/third-party/include/achievement_manager.cpp +98 -0
- data/third-party/include/achievement_manager.h +34 -0
- data/third-party/include/activity_manager.cpp +177 -0
- data/third-party/include/activity_manager.h +42 -0
- data/third-party/include/application_manager.cpp +78 -0
- data/third-party/include/application_manager.h +30 -0
- data/third-party/include/core.cpp +182 -0
- data/third-party/include/core.h +64 -0
- data/third-party/include/discord.h +16 -0
- data/third-party/include/event.h +59 -0
- data/third-party/include/ffi.h +942 -0
- data/third-party/include/image_manager.cpp +57 -0
- data/third-party/include/image_manager.h +28 -0
- data/third-party/include/lobby_manager.cpp +547 -0
- data/third-party/include/lobby_manager.h +88 -0
- data/third-party/include/network_manager.cpp +103 -0
- data/third-party/include/network_manager.h +63 -0
- data/third-party/include/overlay_manager.cpp +112 -0
- data/third-party/include/overlay_manager.h +33 -0
- data/third-party/include/relationship_manager.cpp +90 -0
- data/third-party/include/relationship_manager.h +32 -0
- data/third-party/include/storage_manager.cpp +158 -0
- data/third-party/include/storage_manager.h +46 -0
- data/third-party/include/store_manager.cpp +160 -0
- data/third-party/include/store_manager.h +38 -0
- data/third-party/include/types.cpp +769 -0
- data/third-party/include/types.h +492 -0
- data/third-party/include/user_manager.cpp +80 -0
- data/third-party/include/user_manager.h +31 -0
- data/third-party/include/voice_manager.cpp +124 -0
- data/third-party/include/voice_manager.h +37 -0
- data/third-party/lib/x86/discord_game_sdk.dll +0 -0
- data/third-party/lib/x86/discord_game_sdk.dll.lib +0 -0
- data/third-party/lib/x86_64/discord_game_sdk.bundle +0 -0
- data/third-party/lib/x86_64/discord_game_sdk.dll +0 -0
- data/third-party/lib/x86_64/discord_game_sdk.dll.lib +0 -0
- data/third-party/lib/x86_64/discord_game_sdk.dylib +0 -0
- data/third-party/lib/x86_64/discord_game_sdk.so +0 -0
- metadata +114 -0
@@ -0,0 +1,769 @@
|
|
1
|
+
#if !defined(_CRT_SECURE_NO_WARNINGS)
|
2
|
+
#define _CRT_SECURE_NO_WARNINGS
|
3
|
+
#endif
|
4
|
+
|
5
|
+
#include "types.h"
|
6
|
+
|
7
|
+
#include <cstring>
|
8
|
+
#include <memory>
|
9
|
+
|
10
|
+
namespace discord {
|
11
|
+
|
12
|
+
void User::SetId(UserId id)
|
13
|
+
{
|
14
|
+
internal_.id = id;
|
15
|
+
}
|
16
|
+
|
17
|
+
UserId User::GetId() const
|
18
|
+
{
|
19
|
+
return internal_.id;
|
20
|
+
}
|
21
|
+
|
22
|
+
void User::SetUsername(char const* username)
|
23
|
+
{
|
24
|
+
strncpy(internal_.username, username, 256);
|
25
|
+
internal_.username[256 - 1] = '\0';
|
26
|
+
}
|
27
|
+
|
28
|
+
char const* User::GetUsername() const
|
29
|
+
{
|
30
|
+
return internal_.username;
|
31
|
+
}
|
32
|
+
|
33
|
+
void User::SetDiscriminator(char const* discriminator)
|
34
|
+
{
|
35
|
+
strncpy(internal_.discriminator, discriminator, 8);
|
36
|
+
internal_.discriminator[8 - 1] = '\0';
|
37
|
+
}
|
38
|
+
|
39
|
+
char const* User::GetDiscriminator() const
|
40
|
+
{
|
41
|
+
return internal_.discriminator;
|
42
|
+
}
|
43
|
+
|
44
|
+
void User::SetAvatar(char const* avatar)
|
45
|
+
{
|
46
|
+
strncpy(internal_.avatar, avatar, 128);
|
47
|
+
internal_.avatar[128 - 1] = '\0';
|
48
|
+
}
|
49
|
+
|
50
|
+
char const* User::GetAvatar() const
|
51
|
+
{
|
52
|
+
return internal_.avatar;
|
53
|
+
}
|
54
|
+
|
55
|
+
void User::SetBot(bool bot)
|
56
|
+
{
|
57
|
+
internal_.bot = bot;
|
58
|
+
}
|
59
|
+
|
60
|
+
bool User::GetBot() const
|
61
|
+
{
|
62
|
+
return internal_.bot != 0;
|
63
|
+
}
|
64
|
+
|
65
|
+
void OAuth2Token::SetAccessToken(char const* accessToken)
|
66
|
+
{
|
67
|
+
strncpy(internal_.access_token, accessToken, 128);
|
68
|
+
internal_.access_token[128 - 1] = '\0';
|
69
|
+
}
|
70
|
+
|
71
|
+
char const* OAuth2Token::GetAccessToken() const
|
72
|
+
{
|
73
|
+
return internal_.access_token;
|
74
|
+
}
|
75
|
+
|
76
|
+
void OAuth2Token::SetScopes(char const* scopes)
|
77
|
+
{
|
78
|
+
strncpy(internal_.scopes, scopes, 1024);
|
79
|
+
internal_.scopes[1024 - 1] = '\0';
|
80
|
+
}
|
81
|
+
|
82
|
+
char const* OAuth2Token::GetScopes() const
|
83
|
+
{
|
84
|
+
return internal_.scopes;
|
85
|
+
}
|
86
|
+
|
87
|
+
void OAuth2Token::SetExpires(Timestamp expires)
|
88
|
+
{
|
89
|
+
internal_.expires = expires;
|
90
|
+
}
|
91
|
+
|
92
|
+
Timestamp OAuth2Token::GetExpires() const
|
93
|
+
{
|
94
|
+
return internal_.expires;
|
95
|
+
}
|
96
|
+
|
97
|
+
void ImageHandle::SetType(ImageType type)
|
98
|
+
{
|
99
|
+
internal_.type = static_cast<EDiscordImageType>(type);
|
100
|
+
}
|
101
|
+
|
102
|
+
ImageType ImageHandle::GetType() const
|
103
|
+
{
|
104
|
+
return static_cast<ImageType>(internal_.type);
|
105
|
+
}
|
106
|
+
|
107
|
+
void ImageHandle::SetId(std::int64_t id)
|
108
|
+
{
|
109
|
+
internal_.id = id;
|
110
|
+
}
|
111
|
+
|
112
|
+
std::int64_t ImageHandle::GetId() const
|
113
|
+
{
|
114
|
+
return internal_.id;
|
115
|
+
}
|
116
|
+
|
117
|
+
void ImageHandle::SetSize(std::uint32_t size)
|
118
|
+
{
|
119
|
+
internal_.size = size;
|
120
|
+
}
|
121
|
+
|
122
|
+
std::uint32_t ImageHandle::GetSize() const
|
123
|
+
{
|
124
|
+
return internal_.size;
|
125
|
+
}
|
126
|
+
|
127
|
+
void ImageDimensions::SetWidth(std::uint32_t width)
|
128
|
+
{
|
129
|
+
internal_.width = width;
|
130
|
+
}
|
131
|
+
|
132
|
+
std::uint32_t ImageDimensions::GetWidth() const
|
133
|
+
{
|
134
|
+
return internal_.width;
|
135
|
+
}
|
136
|
+
|
137
|
+
void ImageDimensions::SetHeight(std::uint32_t height)
|
138
|
+
{
|
139
|
+
internal_.height = height;
|
140
|
+
}
|
141
|
+
|
142
|
+
std::uint32_t ImageDimensions::GetHeight() const
|
143
|
+
{
|
144
|
+
return internal_.height;
|
145
|
+
}
|
146
|
+
|
147
|
+
void ActivityTimestamps::SetStart(Timestamp start)
|
148
|
+
{
|
149
|
+
internal_.start = start;
|
150
|
+
}
|
151
|
+
|
152
|
+
Timestamp ActivityTimestamps::GetStart() const
|
153
|
+
{
|
154
|
+
return internal_.start;
|
155
|
+
}
|
156
|
+
|
157
|
+
void ActivityTimestamps::SetEnd(Timestamp end)
|
158
|
+
{
|
159
|
+
internal_.end = end;
|
160
|
+
}
|
161
|
+
|
162
|
+
Timestamp ActivityTimestamps::GetEnd() const
|
163
|
+
{
|
164
|
+
return internal_.end;
|
165
|
+
}
|
166
|
+
|
167
|
+
void ActivityAssets::SetLargeImage(char const* largeImage)
|
168
|
+
{
|
169
|
+
strncpy(internal_.large_image, largeImage, 128);
|
170
|
+
internal_.large_image[128 - 1] = '\0';
|
171
|
+
}
|
172
|
+
|
173
|
+
char const* ActivityAssets::GetLargeImage() const
|
174
|
+
{
|
175
|
+
return internal_.large_image;
|
176
|
+
}
|
177
|
+
|
178
|
+
void ActivityAssets::SetLargeText(char const* largeText)
|
179
|
+
{
|
180
|
+
strncpy(internal_.large_text, largeText, 128);
|
181
|
+
internal_.large_text[128 - 1] = '\0';
|
182
|
+
}
|
183
|
+
|
184
|
+
char const* ActivityAssets::GetLargeText() const
|
185
|
+
{
|
186
|
+
return internal_.large_text;
|
187
|
+
}
|
188
|
+
|
189
|
+
void ActivityAssets::SetSmallImage(char const* smallImage)
|
190
|
+
{
|
191
|
+
strncpy(internal_.small_image, smallImage, 128);
|
192
|
+
internal_.small_image[128 - 1] = '\0';
|
193
|
+
}
|
194
|
+
|
195
|
+
char const* ActivityAssets::GetSmallImage() const
|
196
|
+
{
|
197
|
+
return internal_.small_image;
|
198
|
+
}
|
199
|
+
|
200
|
+
void ActivityAssets::SetSmallText(char const* smallText)
|
201
|
+
{
|
202
|
+
strncpy(internal_.small_text, smallText, 128);
|
203
|
+
internal_.small_text[128 - 1] = '\0';
|
204
|
+
}
|
205
|
+
|
206
|
+
char const* ActivityAssets::GetSmallText() const
|
207
|
+
{
|
208
|
+
return internal_.small_text;
|
209
|
+
}
|
210
|
+
|
211
|
+
void PartySize::SetCurrentSize(std::int32_t currentSize)
|
212
|
+
{
|
213
|
+
internal_.current_size = currentSize;
|
214
|
+
}
|
215
|
+
|
216
|
+
std::int32_t PartySize::GetCurrentSize() const
|
217
|
+
{
|
218
|
+
return internal_.current_size;
|
219
|
+
}
|
220
|
+
|
221
|
+
void PartySize::SetMaxSize(std::int32_t maxSize)
|
222
|
+
{
|
223
|
+
internal_.max_size = maxSize;
|
224
|
+
}
|
225
|
+
|
226
|
+
std::int32_t PartySize::GetMaxSize() const
|
227
|
+
{
|
228
|
+
return internal_.max_size;
|
229
|
+
}
|
230
|
+
|
231
|
+
void ActivityParty::SetId(char const* id)
|
232
|
+
{
|
233
|
+
strncpy(internal_.id, id, 128);
|
234
|
+
internal_.id[128 - 1] = '\0';
|
235
|
+
}
|
236
|
+
|
237
|
+
char const* ActivityParty::GetId() const
|
238
|
+
{
|
239
|
+
return internal_.id;
|
240
|
+
}
|
241
|
+
|
242
|
+
PartySize& ActivityParty::GetSize()
|
243
|
+
{
|
244
|
+
return reinterpret_cast<PartySize&>(internal_.size);
|
245
|
+
}
|
246
|
+
|
247
|
+
PartySize const& ActivityParty::GetSize() const
|
248
|
+
{
|
249
|
+
return reinterpret_cast<PartySize const&>(internal_.size);
|
250
|
+
}
|
251
|
+
|
252
|
+
void ActivitySecrets::SetMatch(char const* match)
|
253
|
+
{
|
254
|
+
strncpy(internal_.match, match, 128);
|
255
|
+
internal_.match[128 - 1] = '\0';
|
256
|
+
}
|
257
|
+
|
258
|
+
char const* ActivitySecrets::GetMatch() const
|
259
|
+
{
|
260
|
+
return internal_.match;
|
261
|
+
}
|
262
|
+
|
263
|
+
void ActivitySecrets::SetJoin(char const* join)
|
264
|
+
{
|
265
|
+
strncpy(internal_.join, join, 128);
|
266
|
+
internal_.join[128 - 1] = '\0';
|
267
|
+
}
|
268
|
+
|
269
|
+
char const* ActivitySecrets::GetJoin() const
|
270
|
+
{
|
271
|
+
return internal_.join;
|
272
|
+
}
|
273
|
+
|
274
|
+
void ActivitySecrets::SetSpectate(char const* spectate)
|
275
|
+
{
|
276
|
+
strncpy(internal_.spectate, spectate, 128);
|
277
|
+
internal_.spectate[128 - 1] = '\0';
|
278
|
+
}
|
279
|
+
|
280
|
+
char const* ActivitySecrets::GetSpectate() const
|
281
|
+
{
|
282
|
+
return internal_.spectate;
|
283
|
+
}
|
284
|
+
|
285
|
+
void Activity::SetType(ActivityType type)
|
286
|
+
{
|
287
|
+
internal_.type = static_cast<EDiscordActivityType>(type);
|
288
|
+
}
|
289
|
+
|
290
|
+
ActivityType Activity::GetType() const
|
291
|
+
{
|
292
|
+
return static_cast<ActivityType>(internal_.type);
|
293
|
+
}
|
294
|
+
|
295
|
+
void Activity::SetApplicationId(std::int64_t applicationId)
|
296
|
+
{
|
297
|
+
internal_.application_id = applicationId;
|
298
|
+
}
|
299
|
+
|
300
|
+
std::int64_t Activity::GetApplicationId() const
|
301
|
+
{
|
302
|
+
return internal_.application_id;
|
303
|
+
}
|
304
|
+
|
305
|
+
void Activity::SetName(char const* name)
|
306
|
+
{
|
307
|
+
strncpy(internal_.name, name, 128);
|
308
|
+
internal_.name[128 - 1] = '\0';
|
309
|
+
}
|
310
|
+
|
311
|
+
char const* Activity::GetName() const
|
312
|
+
{
|
313
|
+
return internal_.name;
|
314
|
+
}
|
315
|
+
|
316
|
+
void Activity::SetState(char const* state)
|
317
|
+
{
|
318
|
+
strncpy(internal_.state, state, 128);
|
319
|
+
internal_.state[128 - 1] = '\0';
|
320
|
+
}
|
321
|
+
|
322
|
+
char const* Activity::GetState() const
|
323
|
+
{
|
324
|
+
return internal_.state;
|
325
|
+
}
|
326
|
+
|
327
|
+
void Activity::SetDetails(char const* details)
|
328
|
+
{
|
329
|
+
strncpy(internal_.details, details, 128);
|
330
|
+
internal_.details[128 - 1] = '\0';
|
331
|
+
}
|
332
|
+
|
333
|
+
char const* Activity::GetDetails() const
|
334
|
+
{
|
335
|
+
return internal_.details;
|
336
|
+
}
|
337
|
+
|
338
|
+
ActivityTimestamps& Activity::GetTimestamps()
|
339
|
+
{
|
340
|
+
return reinterpret_cast<ActivityTimestamps&>(internal_.timestamps);
|
341
|
+
}
|
342
|
+
|
343
|
+
ActivityTimestamps const& Activity::GetTimestamps() const
|
344
|
+
{
|
345
|
+
return reinterpret_cast<ActivityTimestamps const&>(internal_.timestamps);
|
346
|
+
}
|
347
|
+
|
348
|
+
ActivityAssets& Activity::GetAssets()
|
349
|
+
{
|
350
|
+
return reinterpret_cast<ActivityAssets&>(internal_.assets);
|
351
|
+
}
|
352
|
+
|
353
|
+
ActivityAssets const& Activity::GetAssets() const
|
354
|
+
{
|
355
|
+
return reinterpret_cast<ActivityAssets const&>(internal_.assets);
|
356
|
+
}
|
357
|
+
|
358
|
+
ActivityParty& Activity::GetParty()
|
359
|
+
{
|
360
|
+
return reinterpret_cast<ActivityParty&>(internal_.party);
|
361
|
+
}
|
362
|
+
|
363
|
+
ActivityParty const& Activity::GetParty() const
|
364
|
+
{
|
365
|
+
return reinterpret_cast<ActivityParty const&>(internal_.party);
|
366
|
+
}
|
367
|
+
|
368
|
+
ActivitySecrets& Activity::GetSecrets()
|
369
|
+
{
|
370
|
+
return reinterpret_cast<ActivitySecrets&>(internal_.secrets);
|
371
|
+
}
|
372
|
+
|
373
|
+
ActivitySecrets const& Activity::GetSecrets() const
|
374
|
+
{
|
375
|
+
return reinterpret_cast<ActivitySecrets const&>(internal_.secrets);
|
376
|
+
}
|
377
|
+
|
378
|
+
void Activity::SetInstance(bool instance)
|
379
|
+
{
|
380
|
+
internal_.instance = instance;
|
381
|
+
}
|
382
|
+
|
383
|
+
bool Activity::GetInstance() const
|
384
|
+
{
|
385
|
+
return internal_.instance != 0;
|
386
|
+
}
|
387
|
+
|
388
|
+
void Presence::SetStatus(Status status)
|
389
|
+
{
|
390
|
+
internal_.status = static_cast<EDiscordStatus>(status);
|
391
|
+
}
|
392
|
+
|
393
|
+
Status Presence::GetStatus() const
|
394
|
+
{
|
395
|
+
return static_cast<Status>(internal_.status);
|
396
|
+
}
|
397
|
+
|
398
|
+
Activity& Presence::GetActivity()
|
399
|
+
{
|
400
|
+
return reinterpret_cast<Activity&>(internal_.activity);
|
401
|
+
}
|
402
|
+
|
403
|
+
Activity const& Presence::GetActivity() const
|
404
|
+
{
|
405
|
+
return reinterpret_cast<Activity const&>(internal_.activity);
|
406
|
+
}
|
407
|
+
|
408
|
+
void Relationship::SetType(RelationshipType type)
|
409
|
+
{
|
410
|
+
internal_.type = static_cast<EDiscordRelationshipType>(type);
|
411
|
+
}
|
412
|
+
|
413
|
+
RelationshipType Relationship::GetType() const
|
414
|
+
{
|
415
|
+
return static_cast<RelationshipType>(internal_.type);
|
416
|
+
}
|
417
|
+
|
418
|
+
User& Relationship::GetUser()
|
419
|
+
{
|
420
|
+
return reinterpret_cast<User&>(internal_.user);
|
421
|
+
}
|
422
|
+
|
423
|
+
User const& Relationship::GetUser() const
|
424
|
+
{
|
425
|
+
return reinterpret_cast<User const&>(internal_.user);
|
426
|
+
}
|
427
|
+
|
428
|
+
Presence& Relationship::GetPresence()
|
429
|
+
{
|
430
|
+
return reinterpret_cast<Presence&>(internal_.presence);
|
431
|
+
}
|
432
|
+
|
433
|
+
Presence const& Relationship::GetPresence() const
|
434
|
+
{
|
435
|
+
return reinterpret_cast<Presence const&>(internal_.presence);
|
436
|
+
}
|
437
|
+
|
438
|
+
void Lobby::SetId(LobbyId id)
|
439
|
+
{
|
440
|
+
internal_.id = id;
|
441
|
+
}
|
442
|
+
|
443
|
+
LobbyId Lobby::GetId() const
|
444
|
+
{
|
445
|
+
return internal_.id;
|
446
|
+
}
|
447
|
+
|
448
|
+
void Lobby::SetType(LobbyType type)
|
449
|
+
{
|
450
|
+
internal_.type = static_cast<EDiscordLobbyType>(type);
|
451
|
+
}
|
452
|
+
|
453
|
+
LobbyType Lobby::GetType() const
|
454
|
+
{
|
455
|
+
return static_cast<LobbyType>(internal_.type);
|
456
|
+
}
|
457
|
+
|
458
|
+
void Lobby::SetOwnerId(UserId ownerId)
|
459
|
+
{
|
460
|
+
internal_.owner_id = ownerId;
|
461
|
+
}
|
462
|
+
|
463
|
+
UserId Lobby::GetOwnerId() const
|
464
|
+
{
|
465
|
+
return internal_.owner_id;
|
466
|
+
}
|
467
|
+
|
468
|
+
void Lobby::SetSecret(LobbySecret secret)
|
469
|
+
{
|
470
|
+
strncpy(internal_.secret, secret, 128);
|
471
|
+
internal_.secret[128 - 1] = '\0';
|
472
|
+
}
|
473
|
+
|
474
|
+
LobbySecret Lobby::GetSecret() const
|
475
|
+
{
|
476
|
+
return internal_.secret;
|
477
|
+
}
|
478
|
+
|
479
|
+
void Lobby::SetCapacity(std::uint32_t capacity)
|
480
|
+
{
|
481
|
+
internal_.capacity = capacity;
|
482
|
+
}
|
483
|
+
|
484
|
+
std::uint32_t Lobby::GetCapacity() const
|
485
|
+
{
|
486
|
+
return internal_.capacity;
|
487
|
+
}
|
488
|
+
|
489
|
+
void Lobby::SetLocked(bool locked)
|
490
|
+
{
|
491
|
+
internal_.locked = locked;
|
492
|
+
}
|
493
|
+
|
494
|
+
bool Lobby::GetLocked() const
|
495
|
+
{
|
496
|
+
return internal_.locked != 0;
|
497
|
+
}
|
498
|
+
|
499
|
+
void FileStat::SetFilename(char const* filename)
|
500
|
+
{
|
501
|
+
strncpy(internal_.filename, filename, 260);
|
502
|
+
internal_.filename[260 - 1] = '\0';
|
503
|
+
}
|
504
|
+
|
505
|
+
char const* FileStat::GetFilename() const
|
506
|
+
{
|
507
|
+
return internal_.filename;
|
508
|
+
}
|
509
|
+
|
510
|
+
void FileStat::SetSize(std::uint64_t size)
|
511
|
+
{
|
512
|
+
internal_.size = size;
|
513
|
+
}
|
514
|
+
|
515
|
+
std::uint64_t FileStat::GetSize() const
|
516
|
+
{
|
517
|
+
return internal_.size;
|
518
|
+
}
|
519
|
+
|
520
|
+
void FileStat::SetLastModified(std::uint64_t lastModified)
|
521
|
+
{
|
522
|
+
internal_.last_modified = lastModified;
|
523
|
+
}
|
524
|
+
|
525
|
+
std::uint64_t FileStat::GetLastModified() const
|
526
|
+
{
|
527
|
+
return internal_.last_modified;
|
528
|
+
}
|
529
|
+
|
530
|
+
void Entitlement::SetId(Snowflake id)
|
531
|
+
{
|
532
|
+
internal_.id = id;
|
533
|
+
}
|
534
|
+
|
535
|
+
Snowflake Entitlement::GetId() const
|
536
|
+
{
|
537
|
+
return internal_.id;
|
538
|
+
}
|
539
|
+
|
540
|
+
void Entitlement::SetType(EntitlementType type)
|
541
|
+
{
|
542
|
+
internal_.type = static_cast<EDiscordEntitlementType>(type);
|
543
|
+
}
|
544
|
+
|
545
|
+
EntitlementType Entitlement::GetType() const
|
546
|
+
{
|
547
|
+
return static_cast<EntitlementType>(internal_.type);
|
548
|
+
}
|
549
|
+
|
550
|
+
void Entitlement::SetSkuId(Snowflake skuId)
|
551
|
+
{
|
552
|
+
internal_.sku_id = skuId;
|
553
|
+
}
|
554
|
+
|
555
|
+
Snowflake Entitlement::GetSkuId() const
|
556
|
+
{
|
557
|
+
return internal_.sku_id;
|
558
|
+
}
|
559
|
+
|
560
|
+
void SkuPrice::SetAmount(std::uint32_t amount)
|
561
|
+
{
|
562
|
+
internal_.amount = amount;
|
563
|
+
}
|
564
|
+
|
565
|
+
std::uint32_t SkuPrice::GetAmount() const
|
566
|
+
{
|
567
|
+
return internal_.amount;
|
568
|
+
}
|
569
|
+
|
570
|
+
void SkuPrice::SetCurrency(char const* currency)
|
571
|
+
{
|
572
|
+
strncpy(internal_.currency, currency, 16);
|
573
|
+
internal_.currency[16 - 1] = '\0';
|
574
|
+
}
|
575
|
+
|
576
|
+
char const* SkuPrice::GetCurrency() const
|
577
|
+
{
|
578
|
+
return internal_.currency;
|
579
|
+
}
|
580
|
+
|
581
|
+
void Sku::SetId(Snowflake id)
|
582
|
+
{
|
583
|
+
internal_.id = id;
|
584
|
+
}
|
585
|
+
|
586
|
+
Snowflake Sku::GetId() const
|
587
|
+
{
|
588
|
+
return internal_.id;
|
589
|
+
}
|
590
|
+
|
591
|
+
void Sku::SetType(SkuType type)
|
592
|
+
{
|
593
|
+
internal_.type = static_cast<EDiscordSkuType>(type);
|
594
|
+
}
|
595
|
+
|
596
|
+
SkuType Sku::GetType() const
|
597
|
+
{
|
598
|
+
return static_cast<SkuType>(internal_.type);
|
599
|
+
}
|
600
|
+
|
601
|
+
void Sku::SetName(char const* name)
|
602
|
+
{
|
603
|
+
strncpy(internal_.name, name, 256);
|
604
|
+
internal_.name[256 - 1] = '\0';
|
605
|
+
}
|
606
|
+
|
607
|
+
char const* Sku::GetName() const
|
608
|
+
{
|
609
|
+
return internal_.name;
|
610
|
+
}
|
611
|
+
|
612
|
+
SkuPrice& Sku::GetPrice()
|
613
|
+
{
|
614
|
+
return reinterpret_cast<SkuPrice&>(internal_.price);
|
615
|
+
}
|
616
|
+
|
617
|
+
SkuPrice const& Sku::GetPrice() const
|
618
|
+
{
|
619
|
+
return reinterpret_cast<SkuPrice const&>(internal_.price);
|
620
|
+
}
|
621
|
+
|
622
|
+
void InputMode::SetType(InputModeType type)
|
623
|
+
{
|
624
|
+
internal_.type = static_cast<EDiscordInputModeType>(type);
|
625
|
+
}
|
626
|
+
|
627
|
+
InputModeType InputMode::GetType() const
|
628
|
+
{
|
629
|
+
return static_cast<InputModeType>(internal_.type);
|
630
|
+
}
|
631
|
+
|
632
|
+
void InputMode::SetShortcut(char const* shortcut)
|
633
|
+
{
|
634
|
+
strncpy(internal_.shortcut, shortcut, 256);
|
635
|
+
internal_.shortcut[256 - 1] = '\0';
|
636
|
+
}
|
637
|
+
|
638
|
+
char const* InputMode::GetShortcut() const
|
639
|
+
{
|
640
|
+
return internal_.shortcut;
|
641
|
+
}
|
642
|
+
|
643
|
+
void UserAchievement::SetUserId(Snowflake userId)
|
644
|
+
{
|
645
|
+
internal_.user_id = userId;
|
646
|
+
}
|
647
|
+
|
648
|
+
Snowflake UserAchievement::GetUserId() const
|
649
|
+
{
|
650
|
+
return internal_.user_id;
|
651
|
+
}
|
652
|
+
|
653
|
+
void UserAchievement::SetAchievementId(Snowflake achievementId)
|
654
|
+
{
|
655
|
+
internal_.achievement_id = achievementId;
|
656
|
+
}
|
657
|
+
|
658
|
+
Snowflake UserAchievement::GetAchievementId() const
|
659
|
+
{
|
660
|
+
return internal_.achievement_id;
|
661
|
+
}
|
662
|
+
|
663
|
+
void UserAchievement::SetPercentComplete(std::uint8_t percentComplete)
|
664
|
+
{
|
665
|
+
internal_.percent_complete = percentComplete;
|
666
|
+
}
|
667
|
+
|
668
|
+
std::uint8_t UserAchievement::GetPercentComplete() const
|
669
|
+
{
|
670
|
+
return internal_.percent_complete;
|
671
|
+
}
|
672
|
+
|
673
|
+
void UserAchievement::SetUnlockedAt(DateTime unlockedAt)
|
674
|
+
{
|
675
|
+
strncpy(internal_.unlocked_at, unlockedAt, 64);
|
676
|
+
internal_.unlocked_at[64 - 1] = '\0';
|
677
|
+
}
|
678
|
+
|
679
|
+
DateTime UserAchievement::GetUnlockedAt() const
|
680
|
+
{
|
681
|
+
return internal_.unlocked_at;
|
682
|
+
}
|
683
|
+
|
684
|
+
Result LobbyTransaction::SetType(LobbyType type)
|
685
|
+
{
|
686
|
+
auto result = internal_->set_type(internal_, static_cast<EDiscordLobbyType>(type));
|
687
|
+
return static_cast<Result>(result);
|
688
|
+
}
|
689
|
+
|
690
|
+
Result LobbyTransaction::SetOwner(UserId ownerId)
|
691
|
+
{
|
692
|
+
auto result = internal_->set_owner(internal_, ownerId);
|
693
|
+
return static_cast<Result>(result);
|
694
|
+
}
|
695
|
+
|
696
|
+
Result LobbyTransaction::SetCapacity(std::uint32_t capacity)
|
697
|
+
{
|
698
|
+
auto result = internal_->set_capacity(internal_, capacity);
|
699
|
+
return static_cast<Result>(result);
|
700
|
+
}
|
701
|
+
|
702
|
+
Result LobbyTransaction::SetMetadata(MetadataKey key, MetadataValue value)
|
703
|
+
{
|
704
|
+
auto result =
|
705
|
+
internal_->set_metadata(internal_, const_cast<char*>(key), const_cast<char*>(value));
|
706
|
+
return static_cast<Result>(result);
|
707
|
+
}
|
708
|
+
|
709
|
+
Result LobbyTransaction::DeleteMetadata(MetadataKey key)
|
710
|
+
{
|
711
|
+
auto result = internal_->delete_metadata(internal_, const_cast<char*>(key));
|
712
|
+
return static_cast<Result>(result);
|
713
|
+
}
|
714
|
+
|
715
|
+
Result LobbyTransaction::SetLocked(bool locked)
|
716
|
+
{
|
717
|
+
auto result = internal_->set_locked(internal_, (locked ? 1 : 0));
|
718
|
+
return static_cast<Result>(result);
|
719
|
+
}
|
720
|
+
|
721
|
+
Result LobbyMemberTransaction::SetMetadata(MetadataKey key, MetadataValue value)
|
722
|
+
{
|
723
|
+
auto result =
|
724
|
+
internal_->set_metadata(internal_, const_cast<char*>(key), const_cast<char*>(value));
|
725
|
+
return static_cast<Result>(result);
|
726
|
+
}
|
727
|
+
|
728
|
+
Result LobbyMemberTransaction::DeleteMetadata(MetadataKey key)
|
729
|
+
{
|
730
|
+
auto result = internal_->delete_metadata(internal_, const_cast<char*>(key));
|
731
|
+
return static_cast<Result>(result);
|
732
|
+
}
|
733
|
+
|
734
|
+
Result LobbySearchQuery::Filter(MetadataKey key,
|
735
|
+
LobbySearchComparison comparison,
|
736
|
+
LobbySearchCast cast,
|
737
|
+
MetadataValue value)
|
738
|
+
{
|
739
|
+
auto result = internal_->filter(internal_,
|
740
|
+
const_cast<char*>(key),
|
741
|
+
static_cast<EDiscordLobbySearchComparison>(comparison),
|
742
|
+
static_cast<EDiscordLobbySearchCast>(cast),
|
743
|
+
const_cast<char*>(value));
|
744
|
+
return static_cast<Result>(result);
|
745
|
+
}
|
746
|
+
|
747
|
+
Result LobbySearchQuery::Sort(MetadataKey key, LobbySearchCast cast, MetadataValue value)
|
748
|
+
{
|
749
|
+
auto result = internal_->sort(internal_,
|
750
|
+
const_cast<char*>(key),
|
751
|
+
static_cast<EDiscordLobbySearchCast>(cast),
|
752
|
+
const_cast<char*>(value));
|
753
|
+
return static_cast<Result>(result);
|
754
|
+
}
|
755
|
+
|
756
|
+
Result LobbySearchQuery::Limit(std::uint32_t limit)
|
757
|
+
{
|
758
|
+
auto result = internal_->limit(internal_, limit);
|
759
|
+
return static_cast<Result>(result);
|
760
|
+
}
|
761
|
+
|
762
|
+
Result LobbySearchQuery::Distance(LobbySearchDistance distance)
|
763
|
+
{
|
764
|
+
auto result =
|
765
|
+
internal_->distance(internal_, static_cast<EDiscordLobbySearchDistance>(distance));
|
766
|
+
return static_cast<Result>(result);
|
767
|
+
}
|
768
|
+
|
769
|
+
} // namespace discord
|