Concord - C Discord API library
A Discord API wrapper library written in C
interactions.h
Go to the documentation of this file.
1
6#ifndef API_INTERACTIONS_H
7#define API_INTERACTIONS_H
8/* Allow symbols usage without GENCODECS_ prefix */
9#include <stddef.h>
10#include <stdbool.h>
11#include <inttypes.h>
12#include "carray.h"
13#include "cog-utils.h"
14#include "types.h"
15/* Custom JSON encoding macros */
16/* Custom JSON decoding macros */
17/* Custom field macros */
18/* if GENCODECS_READ is not specified then generate for all files */
19/*****************************************************************************
20 * Interactions Datatypes
21 * **************************************************************************/
28};
46};
66 char * token;
72 char * locale;
75};
80 char * name;
88 char * custom_id;
92 struct strings * values;
97};
111};
118 char * name;
123};
131
132};
137
138 /* MESSAGES */
141 bool tts;
142
145 char * content;
146
150
156
160
161 /* AUTOCOMPLETE */
164 /* MODAL */
166 char * custom_id;
168 char * title;
169};
170/*****************************************************************************
171 * Interactions REST parameters
172 * **************************************************************************/
175 /* QUERY FIELDS */
178 /* JSON FIELDS */
180 char * content;
184
188
192
196
197};
200 /* QUERY FIELDS */
204 bool wait;
208 /* JSON FIELDS */
212 bool tts;
216
220
224
228
233
234};
237 /* QUERY FIELDS */
240 /* JSON FIELDS */
242 char * content;
246
250
254
258
259};
260#include <stddef.h>
261#include <stdbool.h>
262#define JSMN_STRICT
263#define JSMN_HEADER
264#include "jsmn.h"
265#include "jsmn-find.h"
266#define JSONB_HEADER
267#include "json-build.h"
268#include <inttypes.h>
269#include "carray.h"
270#include "cog-utils.h"
271#include "types.h"
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412long discord_interaction_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_interaction *self); size_t discord_interaction_from_json(const char buf[], size_t size, struct discord_interaction *self);
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454long discord_interaction_response_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_interaction_response *self); size_t discord_interaction_response_from_json(const char buf[], size_t size, struct discord_interaction_response *self);
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498long discord_create_followup_message_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_create_followup_message *self); size_t discord_create_followup_message_from_json(const char buf[], size_t size, struct discord_create_followup_message *self);
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517long discord_edit_followup_message_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_edit_followup_message *self); size_t discord_edit_followup_message_from_json(const char buf[], size_t size, struct discord_edit_followup_message *self);
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532jsonbcode discord_interaction_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_interaction *self); size_t discord_interaction_to_json(char buf[], size_t size, const struct discord_interaction *self);
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
604
605
606
607
608
609
610
611
612
613
614
615
616
617
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652#endif /* API_INTERACTIONS_H */
discord_application_command_types
Definition: application_commands.h:22
uint64_t u64snowflake
Snowflake datatype.
Definition: types.h:28
uint64_t u64bitmask
Bitmask primitive.
Definition: types.h:35
char json_char
Raw JSON string.
Definition: types.h:44
size_t discord_edit_original_interaction_response_to_json(char buf[], size_t size, const struct discord_edit_original_interaction_response *self)
void discord_create_followup_message_init(struct discord_create_followup_message *self)
void discord_interaction_response_cleanup(struct discord_interaction_response *self)
size_t discord_create_followup_message_to_json(char buf[], size_t size, const struct discord_create_followup_message *self)
void discord_interaction_init(struct discord_interaction *self)
size_t discord_create_followup_message_from_json(const char buf[], size_t size, struct discord_create_followup_message *self)
jsonbcode discord_interaction_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_interaction *self)
size_t discord_interaction_to_json(char buf[], size_t size, const struct discord_interaction *self)
jsonbcode discord_create_followup_message_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_create_followup_message *self)
long discord_edit_original_interaction_response_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_edit_original_interaction_response *self)
void discord_edit_followup_message_init(struct discord_edit_followup_message *self)
long discord_interaction_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_interaction *self)
void discord_interaction_cleanup(struct discord_interaction *self)
void discord_create_followup_message_cleanup(struct discord_create_followup_message *self)
void discord_edit_original_interaction_response_init(struct discord_edit_original_interaction_response *self)
size_t discord_interaction_response_from_json(const char buf[], size_t size, struct discord_interaction_response *self)
jsonbcode discord_edit_original_interaction_response_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_edit_original_interaction_response *self)
void discord_edit_original_interaction_response_cleanup(struct discord_edit_original_interaction_response *self)
long discord_edit_followup_message_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_edit_followup_message *self)
jsonbcode discord_interaction_response_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_interaction_response *self)
size_t discord_edit_followup_message_from_json(const char buf[], size_t size, struct discord_edit_followup_message *self)
jsonbcode discord_edit_followup_message_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_edit_followup_message *self)
void discord_interaction_response_init(struct discord_interaction_response *self)
long discord_create_followup_message_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_create_followup_message *self)
size_t discord_interaction_from_json(const char buf[], size_t size, struct discord_interaction *self)
discord_interaction_types
Definition: interactions.h:22
@ DISCORD_INTERACTION_APPLICATION_COMMAND_AUTOCOMPLETE
Definition: interactions.h:26
@ DISCORD_INTERACTION_MESSAGE_COMPONENT
Definition: interactions.h:25
@ DISCORD_INTERACTION_APPLICATION_COMMAND
Definition: interactions.h:24
@ DISCORD_INTERACTION_PING
Definition: interactions.h:23
@ DISCORD_INTERACTION_MODAL_SUBMIT
Definition: interactions.h:27
size_t discord_interaction_response_to_json(char buf[], size_t size, const struct discord_interaction_response *self)
void discord_edit_followup_message_cleanup(struct discord_edit_followup_message *self)
long discord_interaction_response_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_interaction_response *self)
discord_interaction_callback_types
Definition: interactions.h:29
@ DISCORD_INTERACTION_APPLICATION_COMMAND_AUTOCOMPLETE_RESULT
Definition: interactions.h:43
@ DISCORD_INTERACTION_CHANNEL_MESSAGE_WITH_SOURCE
Definition: interactions.h:33
@ DISCORD_INTERACTION_DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE
Definition: interactions.h:36
@ DISCORD_INTERACTION_UPDATE_MESSAGE
Definition: interactions.h:41
@ DISCORD_INTERACTION_PONG
Definition: interactions.h:31
@ DISCORD_INTERACTION_DEFERRED_UPDATE_MESSAGE
Definition: interactions.h:39
@ DISCORD_INTERACTION_MODAL
Definition: interactions.h:45
size_t discord_edit_followup_message_to_json(char buf[], size_t size, const struct discord_edit_followup_message *self)
size_t discord_edit_original_interaction_response_from_json(const char buf[], size_t size, struct discord_edit_original_interaction_response *self)
jsonbcode
json-builder return codes
Definition: json-build.h:34
discord_component_types
Definition: message_components.h:22
Definition: channel.h:561
Definition: application_commands.h:178
Definition: application_commands.h:158
Definition: channel.h:393
int size
Definition: channel.h:393
Definition: message_components.h:101
Definition: interactions.h:199
struct discord_attachments * attachments
Definition: interactions.h:227
bool tts
Definition: interactions.h:212
bool wait
Definition: interactions.h:204
u64bitmask flags
Definition: interactions.h:232
u64snowflake thread_id
Definition: interactions.h:207
char * avatar_url
Definition: interactions.h:210
struct discord_embeds * embeds
Definition: interactions.h:215
struct discord_components * components
Definition: interactions.h:223
struct discord_allowed_mention * allowed_mentions
Definition: interactions.h:219
Definition: interactions.h:236
struct discord_attachments * attachments
Definition: interactions.h:257
char * content
Definition: interactions.h:242
u64snowflake thread_id
Definition: interactions.h:239
struct discord_components * components
Definition: interactions.h:253
struct discord_embeds * embeds
Definition: interactions.h:245
struct discord_allowed_mention * allowed_mentions
Definition: interactions.h:249
Definition: interactions.h:174
struct discord_allowed_mention * allowed_mentions
Definition: interactions.h:187
struct discord_embeds * embeds
Definition: interactions.h:183
struct discord_attachments * attachments
Definition: interactions.h:195
struct discord_components * components
Definition: interactions.h:191
u64snowflake thread_id
Definition: interactions.h:177
char * content
Definition: interactions.h:180
Definition: channel.h:441
Definition: guild.h:290
Definition: interactions.h:133
struct discord_application_command_option_choices * choices
Definition: interactions.h:163
struct discord_attachments * attachments
Definition: interactions.h:159
char * custom_id
Definition: interactions.h:166
char * title
Definition: interactions.h:168
struct discord_embeds * embeds
Definition: interactions.h:149
char * content
Definition: interactions.h:145
struct discord_components * components
Definition: interactions.h:136
bool tts
Definition: interactions.h:141
u64bitmask flags
Definition: interactions.h:155
Definition: interactions.h:76
struct discord_application_command_interaction_data_options * options
Definition: interactions.h:86
char * name
Definition: interactions.h:80
struct strings * values
Definition: interactions.h:92
struct discord_components * components
Definition: interactions.h:96
u64snowflake target_id
Definition: interactions.h:94
enum discord_component_types component_type
Definition: interactions.h:90
u64snowflake id
Definition: interactions.h:78
struct discord_resolved_data * resolved
Definition: interactions.h:84
char * custom_id
Definition: interactions.h:88
enum discord_application_command_types type
Definition: interactions.h:82
Definition: interactions.h:125
enum discord_interaction_callback_types type
Definition: interactions.h:127
struct discord_interaction_callback_data * data
Definition: interactions.h:130
Definition: interactions.h:48
u64snowflake guild_id
Definition: interactions.h:58
u64snowflake id
Definition: interactions.h:50
struct discord_message * message
Definition: interactions.h:70
u64snowflake channel_id
Definition: interactions.h:60
char * locale
Definition: interactions.h:72
char * guild_locale
Definition: interactions.h:74
struct discord_interaction_data * data
Definition: interactions.h:56
enum discord_interaction_types type
Definition: interactions.h:54
int version
Definition: interactions.h:68
u64snowflake application_id
Definition: interactions.h:52
struct discord_user * user
Definition: interactions.h:64
struct discord_guild_member * member
Definition: interactions.h:62
char * token
Definition: interactions.h:66
Definition: interactions.h:112
u64snowflake id
Definition: interactions.h:114
char * name
Definition: interactions.h:118
enum discord_interaction_types type
Definition: interactions.h:116
struct discord_user * user
Definition: interactions.h:120
struct discord_guild_member * member
Definition: interactions.h:122
Definition: channel.h:195
Definition: interactions.h:98
json_char * users
Definition: interactions.h:100
json_char * attachments
Definition: interactions.h:110
json_char * channels
Definition: interactions.h:106
json_char * roles
Definition: interactions.h:104
json_char * messages
Definition: interactions.h:108
json_char * members
Definition: interactions.h:102
Definition: user.h:69
Handle for building a JSON string.
Definition: json-build.h:61
Definition: custom.h:20