Skip to content

Commit

Permalink
Support editing thread default archive duration
Browse files Browse the repository at this point in the history
  • Loading branch information
bsian03 committed Aug 17, 2021
1 parent 5147bda commit 2b23918
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
11 changes: 6 additions & 5 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ declare namespace Eris {
type Status = "online" | "idle" | "dnd" | "offline";

// Thread
type EditThreadOptions = Pick<EditChannelOptions, "archived" | "autoArchiveDuration" | "locked" | "name" | "rateLimitPerUser">;
type AutoArchiveDuration = 60 | 1440 | 4320 | 10080;

// Voice
type ConverterCommand = "./ffmpeg" | "./avconv" | "ffmpeg" | "avconv";
Expand Down Expand Up @@ -114,7 +114,8 @@ declare namespace Eris {
}
interface EditChannelOptions extends Omit<CreateChannelOptions, "permissionOverwrites" | "reason"> {
archived?: boolean;
autoArchiveDuration?: number;
autoArchiveDuration?: AutoArchiveDuration;
defaultAutoArchiveDuration?: AutoArchiveDuration;
icon?: string;
locked?: boolean;
name?: string;
Expand Down Expand Up @@ -1033,7 +1034,7 @@ declare namespace Eris {
threads: T[];
}
interface CreateThreadOptions {
autoArchiveDuration: number;
autoArchiveDuration: AutoArchiveDuration;
name: string;
}
interface CreateThreadWithoutMessageOptions extends CreateThreadOptions {
Expand All @@ -1046,7 +1047,7 @@ declare namespace Eris {
interface ThreadMetadata {
archiveTimestamp: number;
archived: boolean;
autoArchiveDuration: number;
autoArchiveDuration: AutoArchiveDuration;
locked?: boolean;
}

Expand Down Expand Up @@ -2711,7 +2712,7 @@ declare namespace Eris {
}

export class TextChannel extends GuildChannel implements GuildTextable, Invitable {
defaultAutoArchiveDuration: 60 | 1440 | 4320 | 10080;
defaultAutoArchiveDuration: AutoArchiveDuration;
lastMessageID: string;
lastPinTimestamp: number | null;
messages: Collection<Message<this>>;
Expand Down
2 changes: 2 additions & 0 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,7 @@ class Client extends EventEmitter {
* @arg {Boolean} [options.archived] The archive status of the channel (thread channels only)
* @arg {Number} [options.autoArchiveDuration] The duration in minutes to automatically archive the thread after recent activity, either 60, 1440, 4320 or 10080 (thread channels only)
* @arg {Number} [options.bitrate] The bitrate of the channel (guild voice channels only)
* @arg {Number?} [options.defaultArchiveDuration] The default duration of newly created threads in minutes to automatically archive the thread after inactivity (60, 1440, 4320, 10080) (guild text/news channels only)
* @arg {String} [options.icon] The icon of the channel as a base64 data URI (group channels only). Note: base64 strings alone are not base64 data URI strings
* @arg {Boolean} [options.locked] The lock status of the channel (thread channels only)
* @arg {String} [options.name] The name of the channel
Expand All @@ -1004,6 +1005,7 @@ class Client extends EventEmitter {
archived: options.archived,
auto_archive_duration: options.autoArchiveDuration,
bitrate: options.bitrate,
default_archive_duration: options.defaultArchiveDuration,
icon: options.icon,
locked: options.locked,
name: options.name,
Expand Down
1 change: 1 addition & 0 deletions lib/structures/GuildChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class GuildChannel extends Channel {
* @arg {Object} options The properties to edit
* @arg {Boolean} [options.archived] The archive status of the channel (thread channels only)
* @arg {Number} [options.autoArchiveDuration] The duration in minutes to automatically archive the thread after recent activity, either 60, 1440, 4320 or 10080 (thread channels only)
* @arg {Number?} [options.defaultArchiveDuration] The default duration of newly created threads in minutes to automatically archive the thread after inactivity (60, 1440, 4320, 10080) (guild text/news channels only)
* @arg {Boolean} [options.locked] The lock status of the channel (thread channels only)
* @arg {String} [options.name] The name of the channel
* @arg {String} [options.topic] The topic of the channel (guild text channels only)
Expand Down

0 comments on commit 2b23918

Please sign in to comment.