Concord - C Discord API library
A Discord API wrapper library written in C
permissions.h
Go to the documentation of this file.
1
6#ifndef API_PERMISSIONS_H
7#define API_PERMISSIONS_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 * Permissions Datatypes
21 * **************************************************************************/
27#define DISCORD_PERM_CREATE_INSTANT_INVITE 1 << 0
29#define DISCORD_PERM_KICK_MEMBERS 1 << 1
31#define DISCORD_PERM_BAN_MEMBERS 1 << 2
33#define DISCORD_PERM_ADMINISTRATOR 1 << 3
35#define DISCORD_PERM_MANAGE_CHANNELS 1 << 4
37#define DISCORD_PERM_MANAGE_GUILD 1 << 5
39#define DISCORD_PERM_ADD_REACTIONS 1 << 6
41#define DISCORD_PERM_VIEW_AUDIT_LOG 1 << 7
43#define DISCORD_PERM_PRIORITY_SPEAKER 1 << 8
45#define DISCORD_PERM_STREAM 1 << 9
48#define DISCORD_PERM_VIEW_CHANNEL 1 << 10
51#define DISCORD_PERM_SEND_MESSAGES 1 << 11
53#define DISCORD_PERM_SEND_TTS_MESSAGES 1 << 12
55#define DISCORD_PERM_MANAGE_MESSAGES 1 << 13
57#define DISCORD_PERM_EMBED_LINKS 1 << 14
59#define DISCORD_PERM_ATTACH_FILES 1 << 15
61#define DISCORD_PERM_READ_MESSAGE_HISTORY 1 << 16
64#define DISCORD_PERM_MENTION_EVERYONE 1 << 17
66#define DISCORD_PERM_USE_EXTERNAL_EMOJIS 1 << 18
68#define DISCORD_PERM_VIEW_GUILD_INSIGHTS 1 << 19
70#define DISCORD_PERM_CONNECT 1 << 20
72#define DISCORD_PERM_SPEAK 1 << 21
74#define DISCORD_PERM_MUTE_MEMBERS 1 << 22
76#define DISCORD_PERM_DEAFEN_MEMBERS 1 << 23
78#define DISCORD_PERM_MOVE_MEMBERS 1 << 24
80#define DISCORD_PERM_USE_VAD 1 << 25
82#define DISCORD_PERM_CHANGE_NICKNAME 1 << 26
84#define DISCORD_PERM_MANAGE_NICKNAMES 1 << 27
86#define DISCORD_PERM_MANAGE_ROLES 1 << 28
88#define DISCORD_PERM_MANAGE_WEBHOOKS 1 << 29
90#define DISCORD_PERM_MANAGE_EMOJIS_AND_STICKERS 1 << 30
93#define DISCORD_PERM_USE_APPLICATION_COMMANDS 1 << 31
95#define DISCORD_PERM_REQUEST_TO_SPEAK 1 << 32
97#define DISCORD_PERM_MANAGE_EVENTS 1 << 33
100#define DISCORD_PERM_MANAGE_THREADS 1 << 34
102#define DISCORD_PERM_CREATE_PUBLIC_THREADS 1 << 35
104#define DISCORD_PERM_CREATE_PRIVATE_THREADS 1 << 36
106#define DISCORD_PERM_USE_EXTERNAL_STICKERS 1 << 37
108#define DISCORD_PERM_SEND_MESSAGES_IN_THREADS 1 << 38
111#define DISCORD_PERM_START_EMBEDDED_ACTIVITIES 1 << 39
115#define DISCORD_PERM_MODERATE_MEMBERS 1 << 40
122 char * name;
124 int color;
126 bool hoist;
129 char * icon;
130
134
146
147};
149struct discord_roles { int size;
150 struct discord_role *array; int realsize; };
156
160
163};
164#include <stddef.h>
165#include <stdbool.h>
166#define JSMN_STRICT
167#define JSMN_HEADER
168#include "jsmn.h"
169#include "jsmn-find.h"
170#define JSONB_HEADER
171#include "json-build.h"
172#include <inttypes.h>
173#include "carray.h"
174#include "cog-utils.h"
175#include "types.h"
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289long discord_role_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_role *self); size_t discord_role_from_json(const char buf[], size_t size, struct discord_role *self);
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308long discord_roles_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_roles *self); size_t discord_roles_from_json(const char buf[], size_t size, struct discord_roles *self);
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
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
359
360
361jsonbcode discord_role_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_role *self); size_t discord_role_to_json(char buf[], size_t size, const struct discord_role *self);
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380jsonbcode discord_roles_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_roles *self); size_t discord_roles_to_json(char buf[], size_t size, const struct discord_roles *self);
381
382
383
384
385
386
387
388
389
390
391
392#endif /* API_PERMISSIONS_H */
uint64_t u64snowflake
Snowflake datatype.
Definition: types.h:28
uint64_t u64bitmask
Bitmask primitive.
Definition: types.h:35
jsonbcode
json-builder return codes
Definition: json-build.h:34
void discord_roles_cleanup(struct discord_roles *self)
size_t discord_role_from_json(const char buf[], size_t size, struct discord_role *self)
long discord_role_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_role *self)
void discord_role_cleanup(struct discord_role *self)
void discord_role_init(struct discord_role *self)
size_t discord_role_to_json(char buf[], size_t size, const struct discord_role *self)
size_t discord_roles_from_json(const char buf[], size_t size, struct discord_roles *self)
jsonbcode discord_roles_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_roles *self)
size_t discord_roles_to_json(char buf[], size_t size, const struct discord_roles *self)
jsonbcode discord_role_to_jsonb(jsonb *b, char buf[], size_t size, const struct discord_role *self)
long discord_roles_from_jsmnf(jsmnf_pair *root, const char *js, struct discord_roles *self)
Definition: permissions.h:152
u64snowflake integration_id
Definition: permissions.h:159
bool premium_subscribe
Definition: permissions.h:162
u64snowflake bot_id
Definition: permissions.h:155
Definition: permissions.h:118
struct discord_role_tag * tags
Definition: permissions.h:145
char * unicode_emoji
Definition: permissions.h:133
char * name
Definition: permissions.h:122
char * icon
Definition: permissions.h:129
u64snowflake id
Definition: permissions.h:120
int color
Definition: permissions.h:124
bool managed
Definition: permissions.h:140
u64bitmask permissions
Definition: permissions.h:138
bool mentionable
Definition: permissions.h:142
int position
Definition: permissions.h:136
bool hoist
Definition: permissions.h:126
Definition: permissions.h:149
struct discord_role * array
Definition: permissions.h:150
int size
Definition: permissions.h:149
Handle for building a JSON string.
Definition: json-build.h:61