@@ -6,35 +6,96 @@ import 'discord_thread_metadata.dart';
6
6
import 'discord_user.dart' ;
7
7
import 'discord_video_quality_mode.dart' ;
8
8
9
- /// TODO: Add Documentation
10
9
class DiscordChannel {
10
+ /// the id of this channel
11
11
final DiscordSnowflake id;
12
+
13
+ /// the [type of channel] (https://discord.com/developers/docs/resources/channel#channel-object-channel-types)
12
14
final int type;
15
+
13
16
late final DiscordChannelType ? _typeAsEnum;
17
+
18
+ /// the id of the guild (may be missing for some channel objects received over gateway guild dispatches)
14
19
final DiscordSnowflake ? guildId;
20
+
21
+ /// sorting position of the channel
15
22
final int ? position;
23
+
24
+ /// explicit permission overewrites for members and roles
16
25
final List <DiscordOverwrite >? permissionOverwrites;
26
+
27
+ /// the name of the channel (1-100 characters)
17
28
final String ? name;
29
+
30
+ /// the channel topic (0-1024 characters)
18
31
final String ? topic;
32
+
33
+ /// whether the channel is nsfw
19
34
final bool ? nsfw;
35
+
36
+ /// the id of the last message sent in this channel (may not point to an existing or valid message)
20
37
final DiscordSnowflake ? lastMessageId;
38
+
39
+ /// the bitrate (in bits) of the voice channel
21
40
final int ? bitrate;
41
+
42
+ /// the user limit of the voice channel
22
43
final int ? userLimit;
44
+
45
+ /// amount of seconds a user has to wait before sending another message (0-21600);
46
+ /// bots, as well as users with the permission `manage_messages` or `manage_channel` , are unaffected
23
47
final int ? rateLimitPerUser;
48
+
49
+ /// the recipients of the DM
24
50
final List <DiscordUser >? recipients;
51
+
52
+ /// icon hash of the group DM
25
53
final String ? icon;
54
+
55
+ /// id of the creator of the group DM or thread
26
56
final DiscordSnowflake ? ownerId;
57
+
58
+ /// application id of the group DM creator if it is bot-created
59
+ final DiscordSnowflake ? applicationId;
60
+
61
+ /// for guild channels: id of the parent category for a channel (each parent category can contain up
62
+ /// to 50 channels), for threads: id of the text channel this thread was created
27
63
final DiscordSnowflake ? parentId;
64
+
65
+ /// when the last pinned message was pinned. This may be null in events such as
66
+ /// GUILD_CREATE when a message is not pinned.
28
67
final String ? lastPinTimestamp;
68
+
29
69
late final DateTime ? _lastPinTimestampAsDateTime;
30
- final String ? rtcRegion; // Id of a voice region
70
+
71
+ /// [voice region] (https://discord.com/developers/docs/resources/voice#voice-region-object)
72
+ /// id for the voice channel, automatic when set to null
73
+ final String ? rtcRegion;
74
+
75
+ /// the camera [video quality mode] (https://discord.com/developers/docs/resources/channel#channel-object-video-quality-modes)
76
+ /// of the voice channel, 1 when not present
31
77
final int ? videoQualityMode;
78
+
32
79
late final DiscordVideoQualityMode ? _videoQualityModeAsEnum;
33
- final int ? messageCount; // approximative + caps at 50
34
- final int ? memberCount; // approximative + caps at 50
80
+
81
+ /// an approximate count of messages in a thread, stops counting at 50
82
+ final int ? messageCount;
83
+
84
+ /// an approximate count of users in a thread, stops counting at 50
85
+ final int ? memberCount;
86
+
87
+ /// thread-specific fields not needed by other channels
35
88
final DiscordThreadMetadata ? threadMetadata;
89
+
90
+ /// thread member object for the current user, if they have joined the thread, only included on certain API endpoints
36
91
final DiscordThreadMember ? member;
92
+
93
+ /// default duration that the clients (not the API) will use for newly created threads, in minutes,
94
+ /// to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
37
95
final int ? defaultAutoArchiveDuration;
96
+
97
+ /// computed permissions for the invoking user in the channel, including overwrites, only included
98
+ /// when part of the `resolved` data received on a slash command interaction
38
99
final String ? permissions;
39
100
40
101
static const idEntry = 'id' ;
@@ -52,6 +113,7 @@ class DiscordChannel {
52
113
static const recipientsEntry = 'recipients' ;
53
114
static const iconEntry = 'icon' ;
54
115
static const ownerIdEntry = 'owner_id' ;
116
+ static const applicationIdEntry = 'application_id' ;
55
117
static const parentIdEntry = 'parent_id' ;
56
118
static const lastPinTimestampEntry = 'last_pin_timestamp' ;
57
119
static const rtcRegionEntry = 'rtc_region' ;
@@ -80,6 +142,7 @@ class DiscordChannel {
80
142
this .recipients,
81
143
this .icon,
82
144
this .ownerId,
145
+ this .applicationId,
83
146
this .parentId,
84
147
this .lastPinTimestamp,
85
148
this .rtcRegion,
@@ -135,6 +198,9 @@ class DiscordChannel {
135
198
ownerId: json[ownerIdEntry] != null
136
199
? DiscordSnowflake (json[ownerIdEntry] as String )
137
200
: null ,
201
+ applicationId: json[applicationIdEntry] != null
202
+ ? DiscordSnowflake (json[applicationIdEntry] as String )
203
+ : null ,
138
204
parentId: json[parentIdEntry] != null
139
205
? DiscordSnowflake (json[parentIdEntry] as String )
140
206
: null ,
0 commit comments