0
# Discord Entities
1
2
Comprehensive object model representing all Discord entities including users, guilds, channels, messages, and roles with full CRUD operations and relationship management.
3
4
## Capabilities
5
6
### User System
7
8
Core user representation and management functionality.
9
10
```java { .api }
11
/**
12
* Represents a Discord User. Contains all publicly available information about a specific Discord User.
13
*/
14
interface User extends ISnowflake, IMentionable {
15
/** Get username */
16
String getName();
17
18
/** Get user discriminator (legacy, mostly #0000 now) */
19
String getDiscriminator();
20
21
/** Get global display name */
22
String getGlobalName();
23
24
/** Get effective name (global name or username) */
25
String getEffectiveName();
26
27
/** Get avatar hash */
28
String getAvatarId();
29
30
/** Get avatar URL with default size */
31
String getAvatarUrl();
32
33
/** Get avatar URL with specific size and format */
34
String getAvatarUrl(int size);
35
String getAvatarUrl(ImageProxy.Format format);
36
String getAvatarUrl(ImageProxy.Format format, int size);
37
38
/** Get effective avatar URL (avatar or default) */
39
String getEffectiveAvatarUrl();
40
41
/** Get default avatar URL */
42
String getDefaultAvatarUrl();
43
44
/** Check if this is a bot account */
45
boolean isBot();
46
47
/** Check if this is a system account */
48
boolean isSystem();
49
50
/** Get user flags */
51
EnumSet<User.UserFlag> getFlags();
52
53
/** Open private channel with user */
54
RestAction<PrivateChannel> openPrivateChannel();
55
56
/** Retrieve full profile information */
57
RestAction<User.Profile> retrieveProfile();
58
59
/** Get mutual guilds with this user */
60
List<Guild> getMutualGuilds();
61
62
/** Check if user has animated avatar */
63
boolean hasAvatar();
64
}
65
```
66
67
### Member System
68
69
Guild-specific user representation with roles, permissions, and moderation capabilities.
70
71
```java { .api }
72
/**
73
* Represents a Guild-specific User.
74
* Contains all guild-specific information about a User.
75
*/
76
interface Member extends ISnowflake, IMentionable {
77
/** Get underlying User object */
78
User getUser();
79
80
/** Get JDA instance */
81
JDA getJDA();
82
83
/** Get guild this member belongs to */
84
Guild getGuild();
85
86
/** Get guild-specific nickname */
87
String getNickname();
88
89
/** Get effective name in guild (nickname or user name) */
90
String getEffectiveName();
91
92
/** Get member roles in hierarchy order */
93
List<Role> getRoles();
94
95
/** Get member's color from highest colored role */
96
Color getColor();
97
98
/** Get member's color from highest colored role as RGB int */
99
int getColorRaw();
100
101
/** Get effective permissions in guild */
102
EnumSet<Permission> getPermissions();
103
104
/** Get effective permissions in specific channel */
105
EnumSet<Permission> getPermissions(GuildChannel channel);
106
107
/** Get effective permissions with explicit overrides */
108
EnumSet<Permission> getPermissionsExplicit();
109
EnumSet<Permission> getPermissionsExplicit(GuildChannel channel);
110
111
/** Check if member has specific permissions */
112
boolean hasPermission(Permission... permissions);
113
boolean hasPermission(GuildChannel channel, Permission... permissions);
114
115
/** Check if member has specific permissions (collection) */
116
boolean hasPermission(Collection<Permission> permissions);
117
boolean hasPermission(GuildChannel channel, Collection<Permission> permissions);
118
119
/** Get when member joined guild */
120
OffsetDateTime getTimeJoined();
121
122
/** Get when member started boosting guild */
123
OffsetDateTime getTimeBoosted();
124
125
/** Check if member is guild owner */
126
boolean isOwner();
127
128
/** Check if member is pending membership screening */
129
boolean isPending();
130
131
/** Get member's avatar hash (guild-specific) */
132
String getAvatarId();
133
134
/** Get member's avatar URL (guild-specific) */
135
String getAvatarUrl();
136
String getAvatarUrl(int size);
137
String getEffectiveAvatarUrl();
138
139
/** Get member's banner hash */
140
String getBannerId();
141
142
/** Get member's banner URL */
143
String getBannerUrl();
144
145
/** Get voice state if member is in voice channel */
146
GuildVoiceState getVoiceState();
147
148
/** Get current online status */
149
OnlineStatus getOnlineStatus();
150
OnlineStatus getOnlineStatus(ClientType type);
151
152
/** Get current activities */
153
List<Activity> getActivities();
154
155
/** Kick member from guild */
156
AuditableRestAction<Void> kick();
157
AuditableRestAction<Void> kick(String reason);
158
159
/** Ban member from guild */
160
AuditableRestAction<Void> ban(int delDays, TimeUnit unit);
161
AuditableRestAction<Void> ban(int delDays, TimeUnit unit, String reason);
162
163
/** Timeout member (restrict communication) */
164
AuditableRestAction<Void> timeoutFor(long amount, TimeUnit unit);
165
AuditableRestAction<Void> timeoutFor(long amount, TimeUnit unit, String reason);
166
AuditableRestAction<Void> timeoutUntil(TemporalAccessor temporal);
167
AuditableRestAction<Void> timeoutUntil(TemporalAccessor temporal, String reason);
168
169
/** Remove timeout from member */
170
AuditableRestAction<Void> removeTimeout();
171
AuditableRestAction<Void> removeTimeout(String reason);
172
173
/** Move member to different voice channel */
174
AuditableRestAction<Void> modifyNickname(String nickname);
175
AuditableRestAction<Void> modifyNickname(String nickname, String reason);
176
}
177
```
178
179
### Guild System
180
181
Discord server representation with comprehensive management capabilities.
182
183
```java { .api }
184
/**
185
* Represents a Discord Guild (Server).
186
* This provides all information and functionality related to Discord Guilds.
187
*/
188
interface Guild extends ISnowflake, IGuildChannelContainer<GuildChannel> {
189
/** Get guild name */
190
String getName();
191
192
/** Get guild description */
193
String getDescription();
194
195
/** Get guild icon hash */
196
String getIconId();
197
198
/** Get guild icon URL */
199
String getIconUrl();
200
String getIconUrl(int size);
201
String getIconUrl(ImageProxy.Format format);
202
203
/** Get guild features */
204
Set<String> getFeatures();
205
206
/** Get guild splash hash */
207
String getSplashId();
208
209
/** Get guild splash URL */
210
String getSplashUrl();
211
String getSplashUrl(int size);
212
213
/** Get guild banner hash */
214
String getBannerId();
215
216
/** Get guild banner URL */
217
String getBannerUrl();
218
String getBannerUrl(int size);
219
220
/** Get guild discovery splash hash */
221
String getDiscoverySplashId();
222
223
/** Get guild discovery splash URL */
224
String getDiscoverySplashUrl();
225
226
/** Get guild owner */
227
Member getOwner();
228
long getOwnerIdLong();
229
String getOwnerId();
230
231
/** Get guild region */
232
String getRegion();
233
234
/** Get guild locale */
235
Locale getLocale();
236
237
/** Get verification level */
238
Guild.VerificationLevel getVerificationLevel();
239
240
/** Get default notification level */
241
Guild.NotificationLevel getDefaultNotificationLevel();
242
243
/** Get explicit content filter level */
244
Guild.ExplicitContentLevel getExplicitContentLevel();
245
246
/** Get required MFA level */
247
Guild.MFALevel getMFALevel();
248
249
/** Get boost tier */
250
Guild.BoostTier getBoostTier();
251
252
/** Get boost count */
253
int getBoostCount();
254
255
/** Get boosters */
256
List<Member> getBoosters();
257
258
/** Get max members */
259
int getMaxMembers();
260
261
/** Get max presences */
262
int getMaxPresences();
263
264
/** Get vanity URL code */
265
String getVanityCode();
266
267
/** Get vanity URL */
268
String getVanityUrl();
269
270
/** Get all guild members */
271
List<Member> getMembers();
272
273
/** Get member cache */
274
SnowflakeCacheView<Member> getMemberCache();
275
276
/** Get member by ID */
277
Member getMemberById(long userId);
278
Member getMemberById(String userId);
279
280
/** Get members by name */
281
List<Member> getMembersByName(String name, boolean ignoreCase);
282
283
/** Get members by nickname */
284
List<Member> getMembersByNickname(String nickname, boolean ignoreCase);
285
286
/** Get members by effective name */
287
List<Member> getMembersByEffectiveName(String name, boolean ignoreCase);
288
289
/** Get members with specific role */
290
List<Member> getMembersWithRoles(Role... roles);
291
List<Member> getMembersWithRoles(Collection<Role> roles);
292
293
/** Get all guild roles */
294
List<Role> getRoles();
295
296
/** Get role cache */
297
SnowflakeCacheView<Role> getRoleCache();
298
299
/** Get role by ID */
300
Role getRoleById(long roleId);
301
Role getRoleById(String roleId);
302
303
/** Get roles by name */
304
List<Role> getRolesByName(String name, boolean ignoreCase);
305
306
/** Get public role (@everyone) */
307
Role getPublicRole();
308
309
/** Get all guild channels */
310
List<GuildChannel> getChannels();
311
312
/** Get all text channels */
313
List<TextChannel> getTextChannels();
314
315
/** Get all voice channels */
316
List<VoiceChannel> getVoiceChannels();
317
318
/** Get all stage channels */
319
List<StageChannel> getStageChannels();
320
321
/** Get all forum channels */
322
List<ForumChannel> getForumChannels();
323
324
/** Get all thread channels */
325
List<ThreadChannel> getThreadChannels();
326
327
/** Get all categories */
328
List<Category> getCategories();
329
330
/** Get system channel (default channel for system messages) */
331
TextChannel getSystemChannel();
332
333
/** Get rules channel */
334
TextChannel getRulesChannel();
335
336
/** Get community updates channel */
337
TextChannel getCommunityUpdatesChannel();
338
339
/** Get AFK channel */
340
VoiceChannel getAfkChannel();
341
342
/** Get AFK timeout */
343
Guild.Timeout getAfkTimeout();
344
345
/** Create role */
346
RoleAction createRole();
347
348
/** Create text channel */
349
ChannelAction<TextChannel> createTextChannel(String name);
350
ChannelAction<TextChannel> createTextChannel(String name, Category parent);
351
352
/** Create voice channel */
353
ChannelAction<VoiceChannel> createVoiceChannel(String name);
354
ChannelAction<VoiceChannel> createVoiceChannel(String name, Category parent);
355
356
/** Create stage channel */
357
ChannelAction<StageChannel> createStageChannel(String name);
358
ChannelAction<StageChannel> createStageChannel(String name, Category parent);
359
360
/** Create forum channel */
361
ChannelAction<ForumChannel> createForumChannel(String name);
362
ChannelAction<ForumChannel> createForumChannel(String name, Category parent);
363
364
/** Create category */
365
ChannelAction<Category> createCategory(String name);
366
367
/** Ban user */
368
AuditableRestAction<Void> ban(UserSnowflake user, int delDays, TimeUnit unit);
369
AuditableRestAction<Void> ban(UserSnowflake user, int delDays, TimeUnit unit, String reason);
370
371
/** Unban user */
372
AuditableRestAction<Void> unban(UserSnowflake user);
373
AuditableRestAction<Void> unban(UserSnowflake user, String reason);
374
375
/** Kick member */
376
AuditableRestAction<Void> kick(UserSnowflake user);
377
AuditableRestAction<Void> kick(UserSnowflake user, String reason);
378
379
/** Retrieve ban list */
380
RestAction<List<Guild.Ban>> retrieveBans();
381
382
/** Retrieve ban by user */
383
RestAction<Guild.Ban> retrieveBan(UserSnowflake user);
384
385
/** Retrieve audit logs */
386
PaginationAction<AuditLogEntry> retrieveAuditLogs();
387
388
/** Retrieve member by ID */
389
RestAction<Member> retrieveMemberById(long userId);
390
RestAction<Member> retrieveMemberById(String userId);
391
392
/** Retrieve members */
393
Task<List<Member>> loadMembers();
394
395
/** Get guild manager */
396
GuildManager getManager();
397
398
/** Leave guild */
399
RestAction<Void> leave();
400
401
/** Delete guild (owner only) */
402
RestAction<Void> delete();
403
404
/** Get audio manager */
405
AudioManager getAudioManager();
406
}
407
```
408
409
### Channel System
410
411
Comprehensive channel hierarchy with all Discord channel types and their specific functionalities.
412
413
```java { .api }
414
/**
415
* Base interface for all Discord channels.
416
*/
417
interface Channel extends ISnowflake {
418
/** Get channel name */
419
String getName();
420
421
/** Get channel type */
422
ChannelType getType();
423
424
/** Get JDA instance */
425
JDA getJDA();
426
427
/** Format as mention */
428
String getAsMention();
429
}
430
431
/**
432
* Represents a Text Channel in a Guild.
433
*/
434
interface TextChannel extends StandardGuildMessageChannel, IMemberContainer,
435
IThreadContainer, IWebhookContainer {
436
/** Get channel topic */
437
String getTopic();
438
439
/** Check if channel is NSFW */
440
boolean isNSFW();
441
442
/** Get slowmode delay in seconds */
443
int getSlowmode();
444
445
/** Send message */
446
MessageCreateAction sendMessage(CharSequence text);
447
MessageCreateAction sendMessage(MessageEmbed embed);
448
MessageCreateAction sendMessage(MessageCreateData message);
449
450
/** Send message embeds */
451
MessageCreateAction sendMessageEmbeds(MessageEmbed... embeds);
452
MessageCreateAction sendMessageEmbeds(Collection<? extends MessageEmbed> embeds);
453
454
/** Send files */
455
MessageCreateAction sendFiles(FileUpload... files);
456
MessageCreateAction sendFiles(Collection<? extends FileUpload> files);
457
458
/** Get message history */
459
MessageHistory getHistory();
460
461
/** Retrieve message by ID */
462
RestAction<Message> retrieveMessageById(long messageId);
463
RestAction<Message> retrieveMessageById(String messageId);
464
465
/** Retrieve pinned messages */
466
RestAction<List<Message>> retrievePinnedMessages();
467
468
/** Create invite */
469
InviteAction createInvite();
470
471
/** Retrieve invites */
472
RestAction<List<Invite>> retrieveInvites();
473
474
/** Create webhook */
475
WebhookAction createWebhook(String name);
476
477
/** Retrieve webhooks */
478
RestAction<List<Webhook>> retrieveWebhooks();
479
480
/** Create thread from message */
481
ThreadChannelAction createThreadChannel(String name, long messageId);
482
483
/** Create forum post thread */
484
ForumPostAction createForumPost(String name, MessageCreateData message);
485
486
/** Get channel manager */
487
TextChannelManager getManager();
488
489
/** Delete channel */
490
AuditableRestAction<Void> delete();
491
}
492
493
/**
494
* Represents a Voice Channel in a Guild.
495
*/
496
interface VoiceChannel extends StandardGuildChannel, IAudioChannel {
497
/** Get user limit (0 = unlimited) */
498
int getUserLimit();
499
500
/** Get bitrate */
501
int getBitrate();
502
503
/** Get RTC region */
504
String getRegion();
505
506
/** Get members currently connected */
507
List<Member> getMembers();
508
509
/** Create invite */
510
InviteAction createInvite();
511
512
/** Get channel manager */
513
VoiceChannelManager getManager();
514
}
515
516
/**
517
* Represents a Private Channel (Direct Message).
518
*/
519
interface PrivateChannel extends MessageChannel {
520
/** Get the user this DM is with */
521
User getUser();
522
523
/** Close private channel */
524
RestAction<Void> close();
525
}
526
```
527
528
### Role System
529
530
Role representation and management with permissions and hierarchy.
531
532
```java { .api }
533
/**
534
* Represents a Guild's Role.
535
*/
536
interface Role extends ISnowflake, IMentionable, IPermissionHolder, Comparable<Role> {
537
/** Get role name */
538
String getName();
539
540
/** Check if role is managed by integration */
541
boolean isManaged();
542
543
/** Check if role is hoisted (displayed separately) */
544
boolean isHoisted();
545
546
/** Check if role is mentionable by everyone */
547
boolean isMentionable();
548
549
/** Check if role is public role (@everyone) */
550
boolean isPublicRole();
551
552
/** Check if role can interact with other role */
553
boolean canInteract(Role role);
554
555
/** Check if role can interact with member */
556
boolean canInteract(Member member);
557
558
/** Get role color */
559
Color getColor();
560
561
/** Get role color as RGB int */
562
int getColorRaw();
563
564
/** Get role position in hierarchy */
565
int getPosition();
566
567
/** Get role position relative to other roles */
568
int getPositionRaw();
569
570
/** Get role permissions */
571
EnumSet<Permission> getPermissions();
572
long getPermissionsRaw();
573
574
/** Get role icon hash */
575
String getIconId();
576
577
/** Get role icon URL */
578
String getIconUrl();
579
String getIconUrl(int size);
580
581
/** Get role emoji */
582
RoleIcon getIcon();
583
584
/** Get role tags */
585
RoleTag getTags();
586
587
/** Get guild this role belongs to */
588
Guild getGuild();
589
590
/** Get role manager */
591
RoleManager getManager();
592
593
/** Delete role */
594
AuditableRestAction<Void> delete();
595
AuditableRestAction<Void> delete(String reason);
596
}
597
```
598
599
## Types
600
601
```java { .api }
602
// User flags
603
enum UserFlag {
604
STAFF, PARTNER, HYPESQUAD, BUG_HUNTER_LEVEL_1, HYPESQUAD_ONLINE_HOUSE_1,
605
HYPESQUAD_ONLINE_HOUSE_2, HYPESQUAD_ONLINE_HOUSE_3, PREMIUM_EARLY_SUPPORTER,
606
TEAM_PSEUDO_USER, BUG_HUNTER_LEVEL_2, VERIFIED_BOT, VERIFIED_DEVELOPER,
607
CERTIFIED_MODERATOR, BOT_HTTP_INTERACTIONS, ACTIVE_DEVELOPER
608
}
609
610
// Guild verification levels
611
enum VerificationLevel {
612
NONE, LOW, MEDIUM, HIGH, VERY_HIGH
613
}
614
615
// Guild notification levels
616
enum NotificationLevel {
617
ALL_MESSAGES, MENTIONS_ONLY
618
}
619
620
// Guild explicit content filter levels
621
enum ExplicitContentLevel {
622
OFF, MEMBERS_WITHOUT_ROLES, ALL_MEMBERS
623
}
624
625
// Guild MFA levels
626
enum MFALevel {
627
NONE, ELEVATED
628
}
629
630
// Guild boost tiers
631
enum BoostTier {
632
NONE, TIER_1, TIER_2, TIER_3
633
}
634
635
// AFK timeout options
636
enum Timeout {
637
SECONDS_60, SECONDS_300, SECONDS_900, SECONDS_1800, SECONDS_3600
638
}
639
```