Skip to content

Commit

Permalink
feat(ThreadChannel): add fetchStarterMessage method
Browse files Browse the repository at this point in the history
  • Loading branch information
ImRodry committed Aug 21, 2021
1 parent d6e6244 commit 8a9519f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/structures/ThreadChannel.js
Expand Up @@ -253,6 +253,17 @@ class ThreadChannel extends Channel {
return members.get(this.ownerId) ?? null;
}

/**
* Fetches the message that started this thread, if any.
* <info>This in only available when the thread started from a message in the parent channel.
* If you just need the id of that message, use {@link ThreadChannel#id this channel's id} instead.</info>
* @param {BaseFetchOptions} [options] Additional options for this fetch
* @returns {Promise<?Message>}
*/
fetchStarterMessage(options) {
return this.channel.messages.fetch(this.id, options);
}

/**
* The options used to edit a thread channel
* @typedef {Object} ThreadEditData
Expand Down
1 change: 1 addition & 0 deletions typings/index.d.ts
Expand Up @@ -1812,6 +1812,7 @@ export class ThreadChannel extends TextBasedChannel(Channel) {
public permissionsFor(memberOrRole: GuildMember | Role): Readonly<Permissions>;
public permissionsFor(memberOrRole: GuildMemberResolvable | RoleResolvable): Readonly<Permissions> | null;
public fetchOwner(options?: FetchOwnerOptions): Promise<ThreadMember | null>;
public fetchStarterMessage(options?: BaseFetchOptions): Promise<Message | null>;
public setArchived(archived?: boolean, reason?: string): Promise<ThreadChannel>;
public setAutoArchiveDuration(
autoArchiveDuration: ThreadAutoArchiveDuration,
Expand Down

0 comments on commit 8a9519f

Please sign in to comment.