Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ForumChannels): Support Forum Channels #1452

Merged
merged 85 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
e499899
Prepare for forums
conorwastakenwastaken Apr 26, 2023
e1189e1
Support creating/editing channels with forum props
conorwastakenwastaken May 8, 2023
fc24222
Consistency & lint fixes
conorwastakenwastaken May 8, 2023
4eb9916
Add channel type 15
conorwastakenwastaken May 8, 2023
fb82f6e
Typings
conorwastakenwastaken May 8, 2023
7eec4f8
channelUpdate support
conorwastakenwastaken May 8, 2023
a6f1764
Add applied_tags and flags
conorwastakenwastaken May 8, 2023
53cdc7c
Add rateLimitPerUser option
conorwastakenwastaken May 8, 2023
1f944f5
Add ForumChannel docs and functions
conorwastakenwastaken May 8, 2023
a4341e2
Merge remote-tracking branch 'upstream/dev' into forum-channels
conorwastakenwastaken Jan 25, 2024
ef24e41
createChannel/editChannel props
conorwastakenwastaken Jan 25, 2024
5dc265c
createThreadWith/WithoutMessage props
conorwastakenwastaken Jan 25, 2024
a06f6f4
Move flags to GuildChannel struc
conorwastakenwastaken Jan 25, 2024
ec211c2
Add `totalMessagesSent`
conorwastakenwastaken Jan 25, 2024
acbafc9
Update json
conorwastakenwastaken Jan 25, 2024
02ba11e
Fix missing properties
conorwastakenwastaken Jan 25, 2024
f2e4466
Fix jsdoc
conorwastakenwastaken Jan 25, 2024
1148a22
Update `messageCount` and `totalMessagesSent`
conorwastakenwastaken Jan 25, 2024
02e7d91
Add props to `CHANNEL_UPDATE` & update docs
conorwastakenwastaken Jan 25, 2024
61b23df
i cant read simple english
conorwastakenwastaken Jan 25, 2024
34dd13d
Moved to GuildChannel
conorwastakenwastaken Jan 25, 2024
36970e4
Fix
conorwastakenwastaken Jan 25, 2024
e60d418
Remove unused funcs
conorwastakenwastaken Jan 25, 2024
4db8707
Add `createThread`
conorwastakenwastaken Jan 25, 2024
a72fa16
Deprecate `createThreadWithoutMessage`
conorwastakenwastaken Jan 25, 2024
637b566
JS doc consistency
conorwastakenwastaken Jan 25, 2024
906ff6d
Order alphabetically
conorwastakenwastaken Jan 26, 2024
94cdbe4
Add new fields to THREAD_UPDATE
conorwastakenwastaken Jan 26, 2024
8cf237b
Fix `type` type
conorwastakenwastaken Jan 26, 2024
26ba105
Alphabetize (again)
conorwastakenwastaken Jan 26, 2024
2e88630
Remove accidentally added props
conorwastakenwastaken Jan 26, 2024
f13c30f
TextChannel#createThread()
conorwastakenwastaken Jan 26, 2024
a77cd64
Fix fix fix
conorwastakenwastaken Jan 26, 2024
e89cb4a
Specify all types
conorwastakenwastaken Jan 26, 2024
b5ce3b7
Consistency
conorwastakenwastaken Jan 26, 2024
fc2ca29
update json
conorwastakenwastaken Jan 26, 2024
5d798e1
add more stuff to json :flushed:
conorwastakenwastaken Jan 26, 2024
8110505
Forums can only have public threads
conorwastakenwastaken Jan 26, 2024
b63906f
Clean up typings
bsian03 Jan 27, 2024
806524c
Merge remote-tracking branch 'upstream/dev' into forum-channels
conorwastakenwastaken Jan 29, 2024
898a0e8
Fix
conorwastakenwastaken Jan 29, 2024
c34b7eb
Sort alphabetically
conorwastakenwastaken Jan 29, 2024
5078b67
Merge branch 'forum-channels' of https://github.com/iiFDCT/eris into …
conorwastakenwastaken Jan 29, 2024
e3391a9
Fix
conorwastakenwastaken Jan 29, 2024
6d1c928
Add ForumChannel & alphabetize
conorwastakenwastaken Jan 29, 2024
1ae9f69
Merge branch 'forum-channels' of https://github.com/iiFDCT/eris into …
conorwastakenwastaken Jan 29, 2024
e40ce2f
Update Shard.js
conorwastakenwastaken Jan 29, 2024
db3852a
Revert
conorwastakenwastaken Jan 29, 2024
a8f5416
Revert
conorwastakenwastaken Jan 29, 2024
3687944
Merge remote-tracking branch 'upstream/dev' into forum-channels
conorwastakenwastaken Feb 1, 2024
47a0ba2
Fix
conorwastakenwastaken Feb 1, 2024
98edc9c
TSDocs
conorwastakenwastaken Feb 1, 2024
d179333
Fix
conorwastakenwastaken Feb 4, 2024
92c134f
Del invalid options from ForumChannel.createThread
conorwastakenwastaken Feb 4, 2024
d0b8d3b
Match ddocs
conorwastakenwastaken Feb 4, 2024
d810263
Use .get(...)
conorwastakenwastaken Feb 4, 2024
23158a7
Only apply to forum channels
conorwastakenwastaken Feb 4, 2024
8751621
Document in PublicThreadChannel
conorwastakenwastaken Feb 4, 2024
e62dddf
MEGA SUPER EMERGENCY FIX
conorwastakenwastaken Feb 4, 2024
3b40682
Fix last message ID handling
bsian03 Feb 4, 2024
4da2c4a
Add docs ref link
conorwastakenwastaken Feb 6, 2024
a5b0bdb
Add deprecation warn
conorwastakenwastaken Feb 6, 2024
3ea7d03
Fix fix fix
conorwastakenwastaken Feb 6, 2024
8965aca
Apply suggestions from code review
conorwastakenwastaken Feb 6, 2024
9e6b15a
Add ForumChannel#threads
conorwastakenwastaken Feb 6, 2024
4aebe05
Fix
conorwastakenwastaken Feb 6, 2024
ebf5b0f
Merge branch 'forum-channels' of https://github.com/iiFDCT/eris into …
conorwastakenwastaken Feb 6, 2024
292ce02
Update Client.js
conorwastakenwastaken Feb 6, 2024
2400316
Merge branch 'dev' into forum-channels
conorwastakenwastaken Feb 6, 2024
89bc900
Fix updating PrivateThreadChannel parent class
bsian03 Feb 6, 2024
bdba9c0
Not optional
conorwastakenwastaken Feb 6, 2024
34db4d5
`totalMessagesSent` > `totalMessageSent`
conorwastakenwastaken Feb 6, 2024
1321221
Fix tsdoc typo
conorwastakenwastaken Feb 6, 2024
4e372c8
conor did a silly
bsian03 Feb 6, 2024
4c9033d
Jump over type `14`
conorwastakenwastaken Feb 7, 2024
3dcf5d7
Move to `THREAD_UPDATE`
conorwastakenwastaken Feb 7, 2024
39e01c3
Optional
conorwastakenwastaken Feb 7, 2024
8d82ca9
Fix
conorwastakenwastaken Feb 7, 2024
bd2b22f
Remove type param
conorwastakenwastaken Feb 7, 2024
0128850
appliedTags optional
conorwastakenwastaken Feb 7, 2024
47f39eb
move appliedtags to public thread
conorwastakenwastaken Feb 7, 2024
f2548c8
Add ForumChannel to ChannelTypeConversion
conorwastakenwastaken Feb 7, 2024
27fba6b
Omit type
conorwastakenwastaken Feb 7, 2024
9a823ca
spent way too long on this
conorwastakenwastaken Feb 7, 2024
7e02283
Improved typings for PublicThreadChannel
bsian03 Feb 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions index.d.ts
conorwastakenwastaken marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ declare namespace Eris {
/** valid for KEYWORD_PRESET */
presets: AutoModerationKeywordPresetType[];
}

// Channel
interface ChannelFollow {
channel_id: string;
Expand Down Expand Up @@ -821,6 +822,8 @@ declare namespace Eris {
videoQualityMode: VideoQualityMode;
}
interface OldThread {
appliedTags: string[];
autoArchiveDuration: number;
name: string;
rateLimitPerUser: number;
threadMetadata: ThreadMetadata;
Expand Down Expand Up @@ -1651,8 +1654,6 @@ declare namespace Eris {
guild_connections?: true;
}

// MOVE THIS UNDER CHANNEL

// Forum/Thread
interface CreateThreadOptions {
autoArchiveDuration?: AutoArchiveDuration;
Expand Down Expand Up @@ -1972,6 +1973,7 @@ declare namespace Eris {
GUILD_STAGE_VOICE: 13;
/** @deprecated */
GUILD_STAGE: 13;

GUILD_FORUM: 15;
conorwastakenwastaken marked this conversation as resolved.
Show resolved Hide resolved
};
ComponentTypes: {
Expand Down
1 change: 1 addition & 0 deletions lib/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ module.exports.ChannelTypes = {
GUILD_PUBLIC_THREAD: 11,
GUILD_PRIVATE_THREAD: 12,
GUILD_STAGE_VOICE: 13, GUILD_STAGE: 13, // [DEPRECATED]

GUILD_FORUM: 15
conorwastakenwastaken marked this conversation as resolved.
Show resolved Hide resolved
};

Expand Down
14 changes: 3 additions & 11 deletions lib/gateway/Shard.js
Original file line number Diff line number Diff line change
Expand Up @@ -1712,9 +1712,6 @@ class Shard extends EventEmitter {
};
} else if(channel instanceof GuildChannel) {
oldChannel = {
appliedTags: channel.appliedTags,
archived: channel.archived,
autoArchiveDuration: channel.autoArchiveDuration,
availableTags: channel.availableTags,
bitrate: channel.bitrate,
defaultAutoArchiveDuration: channel.defaultAutoArchiveDuration,
Expand All @@ -1723,8 +1720,6 @@ class Shard extends EventEmitter {
defaultSortOrder: channel.defaultSortOrder,
defaultThreadRateLimitPerUser: channel.defaultThreadRateLimitPerUser,
flags: channel.flags,
invitable: channel.invitable,
locked: channel.locked,
name: channel.name,
nsfw: channel.nsfw,
parentID: channel.parentID,
Expand Down Expand Up @@ -1774,19 +1769,14 @@ class Shard extends EventEmitter {
* @event Client#channelUpdate
* @prop {ForumChannel | TextChannel | TextVoiceChannel | CategoryChannel | NewsChannel | GuildChannel | PrivateChannel} channel The updated channel
* @prop {Object} oldChannel The old channel data
* @prop {Array<String>} oldChannel.appliedTags The IDs of the set of tags that have been applied to a thread in a forum channel (threads created in forum channels only, max 5)
* @prop {Boolean} oldChannel.archived The archive status of the channel (thread channels only)
* @prop {Number} oldChannel.autoArchiveDuration The duration in minutes to automatically archive the thread after recent activity, either 60, 1440, 4320 or 10080 (thread channels only)
* @prop {Array<Object>} oldChannel.availableTags The available tags that can be applied to threads in a forum channel. See [the official Discord API documentation entry](https://discord.com/developers/docs/resources/channel#forum-tag-object) for object structure (forum channels only, max 20)
* @prop {Number} oldChannel.bitrate The bitrate of the channel (voice channels only)
* @prop {Number} oldChannel.defaultAutoArchiveDuration The default duration of newly created threads in minutes to automatically archive the thread after inactivity (60, 1440, 4320, 10080) (text/news/forum channels only)
* @prop {Number} oldChannel.defaultForumLayout The default forum layout type used to display posts in forum channels (forum channels only)
* @prop {Object} oldChannel.defaultReactionEmoji The emoji to show in the add reaction button on a thread in a forum channel (forum channels only)
* @prop {Number} oldChannel.defaultSortOrder The default sort order type used to order posts in forum channels (forum channels only)
* @prop {Number} oldChannel.defaultThreadRateLimitPerUser The initial rateLimitPerUser to set on newly created threads in a channel (text/forum channels only)
* @prop {Number} oldChannel.flags The flags for the channel combined as a bitfield (thread/forum channels only)
* @prop {Boolean} oldChannel.invitable Whether non-moderators can add other non-moderators to the channel (private thread channels only)
* @prop {Boolean} oldChannel.locked The lock status of the channel (thread channels only)
* @prop {Number?} oldChannel.flags The flags for the channel combined as a bitfield (thread/forum channels only)
* @prop {String} oldChannel.name The name of the channel
* @prop {Boolean} oldChannel.nsfw Whether the channel is NSFW or not (text channels only)
* @prop {String?} oldChannel.parentID The ID of the category this channel belongs to (guild channels only)
Expand Down Expand Up @@ -2368,6 +2358,7 @@ class Shard extends EventEmitter {
}
const oldChannel = {
appliedTags: channel.appliedTags,
autoArchiveDuration: channel.autoArchiveDuration,
flags: channel.flags,
name: channel.name,
rateLimitPerUser: channel.rateLimitPerUser,
conorwastakenwastaken marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -2381,6 +2372,7 @@ class Shard extends EventEmitter {
* @prop {NewsThreadChannel | PrivateThreadChannel | PublicThreadChannel} channel The updated channel
* @prop {Object?} oldChannel The old thread channel. This will be null if the channel was uncached
* @prop {Array<String>} oldChannel.appliedTags The IDs of the set of tags that have been applied to a thread in a forum channel
* @prop {Number} oldChannel.autoArchiveDuration The duration in minutes to automatically archive the thread after recent activity, either 60, 1440, 4320 or 10080
* @prop {Number} oldChannel.flags The flags for the channel combined as a bitfield
* @prop {String} oldChannel.name The name of the channel
* @prop {Number} oldChannel.rateLimitPerUser The time in seconds a user has to wait before sending another message (0-21600)
Expand Down
5 changes: 2 additions & 3 deletions lib/structures/ForumChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,13 @@ class ForumChannel extends GuildChannel {

/**
* Get all archived threads in this channel
* @arg {String} type The type of thread channel. Note: Only "public" is available in forum channels
* @arg {Object} [options] Additional options when requesting archived threads
* @arg {Date} [options.before] List of threads to return before the timestamp
* @arg {Number} [options.limit] Maximum number of threads to return
* @returns {Promise<Object>} An object containing an array of `threads`, an array of `members` and whether the response `hasMore` threads that could be returned in a subsequent call
*/
getArchivedThreads(type, options) {
return this.client.getArchivedThreads.call(this.client, this.id, type, options);
getArchivedThreads(options) {
return this.client.getArchivedThreads.call(this.client, this.id, "public", options);
}

/**
Expand Down