1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
import type { BushFetchedThreads, BushThreadChannel } from '#lib';
import {
CachedManager,
NewsChannel,
TextChannel,
ThreadManager,
type BaseFetchOptions,
type FetchArchivedThreadOptions,
type FetchThreadsOptions,
type Snowflake,
type ThreadChannelResolvable,
type ThreadCreateOptions
} from 'discord.js';
import type { RawThreadChannelData } from 'discord.js/typings/rawDataTypes';
/**
* Manages API methods for {@link BushThreadChannel} objects and stores their cache.
*/
export declare class BushThreadManager<AllowedThreadType>
extends CachedManager<Snowflake, BushThreadChannel, ThreadChannelResolvable>
implements ThreadManager<AllowedThreadType>
{
public constructor(channel: TextChannel | NewsChannel, iterable?: Iterable<RawThreadChannelData>);
/**
* The channel this Manager belongs to
*/
public channel: TextChannel | NewsChannel;
/**
* Creates a new thread in the channel.
* @param options Options to create a new thread
* @example
* // Create a new public thread
* channel.threads
* .create({
* name: 'food-talk',
* autoArchiveDuration: 60,
* reason: 'Needed a separate thread for food',
* })
* .then(threadChannel => console.log(threadChannel))
* .catch(console.error);
* @example
* // Create a new private thread
* channel.threads
* .create({
* name: 'mod-talk',
* autoArchiveDuration: 60,
* type: 'GuildPrivateThread',
* reason: 'Needed a separate thread for moderation',
* })
* .then(threadChannel => console.log(threadChannel))
* .catch(console.error);
*/
public create(options: ThreadCreateOptions<AllowedThreadType>): Promise<BushThreadChannel>;
/**
* Obtains a thread from Discord, or the channel cache if it's already available.
* @param options The options to fetch threads. If it is a
* ThreadChannelResolvable then the specified thread will be fetched. Fetches all active threads if `undefined`
* @param cacheOptions Additional options for this fetch. <warn>The `force` field gets ignored
* if `options` is not a {@link ThreadChannelResolvable}</warn>
* @example
* // Fetch a thread by its id
* channel.threads.fetch('831955138126104859')
* .then(channel => console.log(channel.name))
* .catch(console.error);
*/
public fetch(options: ThreadChannelResolvable, cacheOptions?: BaseFetchOptions): Promise<BushThreadChannel | null>;
public fetch(options?: FetchThreadsOptions, cacheOptions?: { cache?: boolean }): Promise<BushFetchedThreads>;
/**
* Obtains a set of archived threads from Discord, requires `READ_MESSAGE_HISTORY` in the parent channel.
* @param options The options to fetch archived threads
* @param cache Whether to cache the new thread objects if they aren't already
*/
public fetchArchived(options?: FetchArchivedThreadOptions, cache?: boolean): Promise<BushFetchedThreads>;
/**
* Obtains the accessible active threads from Discord, requires `READ_MESSAGE_HISTORY` in the parent channel.
* @param cache Whether to cache the new thread objects if they aren't already
*/
public fetchActive(cache?: boolean): Promise<BushFetchedThreads>;
}
|