Concord - C Discord API library
A Discord API wrapper library written in C
application_commands.h
Go to the documentation of this file.
1
6#ifndef API_APPLICATION_COMMANDS_H
7#define API_APPLICATION_COMMANDS_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 * Application Commands Datatypes
21 * **************************************************************************/
32};
50};
55};
60
64
68
69
72
75 char * name;
76
81
85
89
96
100
105
106};
108 struct discord_application_command *array; int realsize; };
114 char * name;
120
124
129
134
137 char * min_value;
138
141 char * max_value;
142
146
147};
153 char * name;
157};
163 char * name;
170
174
177};
190};
201};
205/*****************************************************************************
206 * Application Commands REST parameters
207 * **************************************************************************/
210 char * name;
216
220
231
232};
235 char * name;
241
245
253};
256 char * name;
262
266
277
278};
281 char * name;
287
291
294};
299 char * name;
311
315
324
325};
326#include <stddef.h>
327#include <stdbool.h>
328#define JSMN_STRICT
329#define JSMN_HEADER
330#include "jsmn.h"
331#include "jsmn-find.h"
332#define JSONB_HEADER
333#include "json-build.h"
334#include <inttypes.h>
335#include "carray.h"
336#include "cog-utils.h"
337#include "types.h"
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
362
363
364
365
366
367
368
369
370
371
372
373
374
375
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
412
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
454
456
457
459
460
461
462
464
465
467
468
469
470
471
472
473
474
475
476
477
478
479
480
482
483
484
485
486
487
488
489
490
491
492
494
495
496
497
498
499
500
501
502
503
504
505
506
507
509
510
511
512
513
514
515
516
517
518
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536long discord_application_command_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_application_command *self); size_t discord_application_command_from_json(const char buf[], size_t size, struct discord_application_command *self);
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
571long discord_application_commands_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_application_commands *self); size_t discord_application_commands_from_json(const char buf[], size_t size, struct discord_application_commands *self);
572
573
574
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
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
631
632
634
635
636
637
639
640
642
643
644
645
646
647
648
649
650
651
652
653
654
655
657
658
659
660
661
662
663
664
665
666
667
669
670
671
672
673
674
675
676
677
678
679
680
681
682
684
685
686
687
688
689
690
691
692
693
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
806
807
809
810
811
812
814
815
817
818
819
820
821
822
823
824
825
826
827
828
829
830
832
833
834
835
836
837
838
839
840
841
842
844
845
846
847
848
849
850
851
852
853
854
855
856
857
859
860
861
862
863
864
865
866
867
868
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886#endif /* API_APPLICATION_COMMANDS_H */
size_t discord_guild_application_command_permissions_from_json(const char buf[], size_t size, struct discord_guild_application_command_permissions *self)
size_t discord_application_command_from_json(const char buf[], size_t size, struct discord_application_command *self)
size_t discord_application_command_permissions_to_json(char buf[], size_t size, const struct discord_application_command_permissions *self)
long discord_create_global_application_command_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_create_global_application_command *self)
size_t discord_application_command_to_json(char buf[], size_t size, const struct discord_application_command *self)
size_t discord_application_command_permissions_from_json(const char buf[], size_t size, struct discord_application_command_permissions *self)
size_t discord_create_global_application_command_to_json(char buf[], size_t size, const struct discord_create_global_application_command *self)
discord_application_command_option_types
Definition: application_commands.h:33
@ DISCORD_APPLICATION_OPTION_SUB_COMMAND_GROUP
Definition: application_commands.h:35
@ DISCORD_APPLICATION_OPTION_NUMBER
Definition: application_commands.h:47
@ DISCORD_APPLICATION_OPTION_CHANNEL
Definition: application_commands.h:42
@ DISCORD_APPLICATION_OPTION_ROLE
Definition: application_commands.h:43
@ DISCORD_APPLICATION_OPTION_USER
Definition: application_commands.h:40
@ DISCORD_APPLICATION_OPTION_BOOLEAN
Definition: application_commands.h:39
@ DISCORD_APPLICATION_OPTION_ATTACHMENT
Definition: application_commands.h:49
@ DISCORD_APPLICATION_OPTION_STRING
Definition: application_commands.h:36
@ DISCORD_APPLICATION_OPTION_INTEGER
Definition: application_commands.h:38
@ DISCORD_APPLICATION_OPTION_MENTIONABLE
Definition: application_commands.h:45
@ DISCORD_APPLICATION_OPTION_SUB_COMMAND
Definition: application_commands.h:34
void discord_guild_application_command_permissions_cleanup(struct discord_guild_application_command_permissions *self)
long discord_application_command_permission_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_application_command_permission *self)
size_t discord_create_global_application_command_from_json(const char buf[], size_t size, struct discord_create_global_application_command *self)
void discord_edit_guild_application_command_init(struct discord_edit_guild_application_command *self)
void discord_edit_guild_application_command_cleanup(struct discord_edit_guild_application_command *self)
long discord_application_command_permissions_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_application_command_permissions *self)
long discord_edit_global_application_command_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_edit_global_application_command *self)
jsonbcode discord_guild_application_command_permissions_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_guild_application_command_permissions *self)
jsonbcode discord_bulk_overwrite_guild_application_commands_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_bulk_overwrite_guild_application_commands *self)
size_t discord_edit_guild_application_command_to_json(char buf[], size_t size, const struct discord_edit_guild_application_command *self)
size_t discord_guild_application_command_permissions_to_json(char buf[], size_t size, const struct discord_guild_application_command_permissions *self)
long discord_create_guild_application_command_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_create_guild_application_command *self)
jsonbcode discord_application_command_permissions_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_application_command_permissions *self)
size_t discord_application_commands_from_json(const char buf[], size_t size, struct discord_application_commands *self)
void discord_application_commands_cleanup(struct discord_application_commands *self)
size_t discord_bulk_overwrite_guild_application_commands_to_json(char buf[], size_t size, const struct discord_bulk_overwrite_guild_application_commands *self)
void discord_create_global_application_command_cleanup(struct discord_create_global_application_command *self)
discord_application_command_types
Definition: application_commands.h:22
@ DISCORD_APPLICATION_CHAT_INPUT
Definition: application_commands.h:25
@ DISCORD_APPLICATION_USER
Definition: application_commands.h:28
@ DISCORD_APPLICATION_MESSAGE
Definition: application_commands.h:31
size_t discord_edit_global_application_command_to_json(char buf[], size_t size, const struct discord_edit_global_application_command *self)
size_t discord_edit_global_application_command_from_json(const char buf[], size_t size, struct discord_edit_global_application_command *self)
jsonbcode discord_application_commands_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_application_commands *self)
size_t discord_application_command_permission_from_json(const char buf[], size_t size, struct discord_application_command_permission *self)
jsonbcode discord_application_command_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_application_command *self)
long discord_application_command_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_application_command *self)
void discord_edit_global_application_command_init(struct discord_edit_global_application_command *self)
void discord_edit_global_application_command_cleanup(struct discord_edit_global_application_command *self)
jsonbcode discord_edit_global_application_command_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_edit_global_application_command *self)
void discord_application_command_permission_init(struct discord_application_command_permission *self)
void discord_bulk_overwrite_guild_application_commands_cleanup(struct discord_bulk_overwrite_guild_application_commands *self)
size_t discord_bulk_overwrite_guild_application_commands_from_json(const char buf[], size_t size, struct discord_bulk_overwrite_guild_application_commands *self)
size_t discord_application_command_permission_to_json(char buf[], size_t size, const struct discord_application_command_permission *self)
void discord_application_command_permissions_cleanup(struct discord_application_command_permissions *self)
void discord_application_command_init(struct discord_application_command *self)
void discord_application_command_permission_cleanup(struct discord_application_command_permission *self)
void discord_create_guild_application_command_cleanup(struct discord_create_guild_application_command *self)
jsonbcode discord_edit_guild_application_command_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_edit_guild_application_command *self)
void discord_application_command_cleanup(struct discord_application_command *self)
jsonbcode discord_application_command_permission_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_application_command_permission *self)
void discord_bulk_overwrite_guild_application_commands_init(struct discord_bulk_overwrite_guild_application_commands *self)
jsonbcode discord_create_global_application_command_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_create_global_application_command *self)
size_t discord_create_guild_application_command_to_json(char buf[], size_t size, const struct discord_create_guild_application_command *self)
void discord_create_global_application_command_init(struct discord_create_global_application_command *self)
long discord_edit_guild_application_command_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_edit_guild_application_command *self)
long discord_application_commands_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_application_commands *self)
long discord_guild_application_command_permissions_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_guild_application_command_permissions *self)
size_t discord_edit_guild_application_command_from_json(const char buf[], size_t size, struct discord_edit_guild_application_command *self)
size_t discord_create_guild_application_command_from_json(const char buf[], size_t size, struct discord_create_guild_application_command *self)
long discord_bulk_overwrite_guild_application_commands_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_bulk_overwrite_guild_application_commands *self)
size_t discord_application_commands_to_json(char buf[], size_t size, const struct discord_application_commands *self)
discord_application_command_permission_types
Definition: application_commands.h:51
@ DISCORD_APPLICATION_PERMISSION_USER
Definition: application_commands.h:53
@ DISCORD_APPLICATION_PERMISSION_ROLE
Definition: application_commands.h:52
@ DISCORD_APPLICATION_PERMISSION_CHANNEL
Definition: application_commands.h:54
jsonbcode discord_create_guild_application_command_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_create_guild_application_command *self)
void discord_create_guild_application_command_init(struct discord_create_guild_application_command *self)
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
jsonbcode
json-builder return codes
Definition: json-build.h:34
Definition: application_commands.h:161
char * name
Definition: application_commands.h:163
json_char * value
Definition: application_commands.h:169
struct discord_application_command_interaction_data_options * options
Definition: application_commands.h:173
bool focused
Definition: application_commands.h:176
enum discord_application_command_option_types type
Definition: application_commands.h:165
Definition: application_commands.h:178
int size
Definition: application_commands.h:178
struct discord_application_command_interaction_data_option * array
Definition: application_commands.h:179
Definition: application_commands.h:151
char * name
Definition: application_commands.h:153
json_char * value
Definition: application_commands.h:156
Definition: application_commands.h:158
struct discord_application_command_option_choice * array
Definition: application_commands.h:159
int size
Definition: application_commands.h:158
Definition: application_commands.h:110
char * min_value
Definition: application_commands.h:137
char * name
Definition: application_commands.h:114
char * description
Definition: application_commands.h:116
char * max_value
Definition: application_commands.h:141
struct discord_application_command_options * options
Definition: application_commands.h:128
struct integers * channel_types
Definition: application_commands.h:133
bool required
Definition: application_commands.h:119
enum discord_application_command_option_types type
Definition: application_commands.h:112
bool autocomplete
Definition: application_commands.h:145
struct discord_application_command_option_choices * choices
Definition: application_commands.h:123
Definition: application_commands.h:148
struct discord_application_command_option * array
Definition: application_commands.h:149
int size
Definition: application_commands.h:148
Definition: application_commands.h:194
bool permission
Definition: application_commands.h:200
enum discord_application_command_permission_types type
Definition: application_commands.h:198
u64snowflake id
Definition: application_commands.h:196
Definition: application_commands.h:202
struct discord_application_command_permission * array
Definition: application_commands.h:203
int size
Definition: application_commands.h:202
Definition: application_commands.h:56
u64bitmask default_member_permissions
Definition: application_commands.h:88
struct discord_application_command_options * options
Definition: application_commands.h:84
u64snowflake version
Definition: application_commands.h:104
bool default_permission
Definition: application_commands.h:99
char * description
Definition: application_commands.h:80
bool dm_permission
Definition: application_commands.h:95
u64snowflake id
Definition: application_commands.h:59
char * name
Definition: application_commands.h:75
u64snowflake guild_id
Definition: application_commands.h:71
u64snowflake application_id
Definition: application_commands.h:67
enum discord_application_command_types type
Definition: application_commands.h:63
Definition: application_commands.h:107
struct discord_application_command * array
Definition: application_commands.h:108
int size
Definition: application_commands.h:107
Definition: application_commands.h:295
u64snowflake id
Definition: application_commands.h:297
struct strings * description_localizations
Definition: application_commands.h:307
char * description
Definition: application_commands.h:304
char * name
Definition: application_commands.h:299
struct strings * name_localizations
Definition: application_commands.h:302
bool dm_permission
Definition: application_commands.h:320
enum discord_application_command_types type
Definition: application_commands.h:323
struct discord_application_command_options * options
Definition: application_commands.h:310
u64bitmask default_member_permissions
Definition: application_commands.h:314
Definition: application_commands.h:208
char * name
Definition: application_commands.h:210
bool default_permission
Definition: application_commands.h:227
struct discord_application_command_options * options
Definition: application_commands.h:215
enum discord_application_command_types type
Definition: application_commands.h:230
char * description
Definition: application_commands.h:212
bool dm_permission
Definition: application_commands.h:225
u64bitmask default_member_permissions
Definition: application_commands.h:219
Definition: application_commands.h:254
char * description
Definition: application_commands.h:258
char * name
Definition: application_commands.h:256
enum discord_application_command_types type
Definition: application_commands.h:276
bool default_permission
Definition: application_commands.h:273
bool dm_permission
Definition: application_commands.h:271
struct discord_application_command_options * options
Definition: application_commands.h:261
u64bitmask default_member_permissions
Definition: application_commands.h:265
Definition: application_commands.h:233
struct discord_application_command_options * options
Definition: application_commands.h:240
char * name
Definition: application_commands.h:235
bool dm_permission
Definition: application_commands.h:250
u64bitmask default_member_permissions
Definition: application_commands.h:244
bool default_permission
Definition: application_commands.h:252
char * description
Definition: application_commands.h:237
Definition: application_commands.h:279
char * name
Definition: application_commands.h:281
struct discord_application_command_options * options
Definition: application_commands.h:286
bool default_permission
Definition: application_commands.h:293
char * description
Definition: application_commands.h:283
u64bitmask default_member_permissions
Definition: application_commands.h:290
Definition: application_commands.h:181
struct discord_application_command_permissions * permissions
Definition: application_commands.h:189
u64snowflake guild_id
Definition: application_commands.h:187
u64snowflake application_id
Definition: application_commands.h:185
u64snowflake id
Definition: application_commands.h:183
Definition: application_commands.h:191
struct discord_guild_application_command_permission * array
Definition: application_commands.h:192
int size
Definition: application_commands.h:191
Definition: custom.h:36
Handle for building a JSON string.
Definition: json-build.h:61
Definition: custom.h:20