Threads
In this section, you’ll learn how to integrate threads in your bot.
Make sure your bot has
SEND_MESSAGES_IN_THREADS
permission.
Content
Functions Used > Archive Duration > $startThread[] > $editThread[] > $threadAddMember[] > $threadRemoveMember[] > Simple Code
Functions Used
Archive Duration
60
- 1 Hour
1440
- 1 Day
4320
- 3 Days (Only for servers with level 1 boosted)
10080
- 7 Days (Only for servers with level 2 boosted)
$startThread
Creates a new thread in the provided channel.
Syntax
$startThread[Thread name;Channel ID;Message ID;(Archive duration;Return thread ID?)]
Required permissions that the bot must have for this function to work properly:
createpublicthreads
Parameters
Thread name
(Type: String || Flag: Required)
: The name of the newly created thread.Channel ID
(Type: Snowflake || Flag: Required)
: The channel where the thread will be created.Message ID
(Type: Snowflake || Flag: Emptiable)
: The message from which the thread will be created. Can be left empty.Archive duration
(Type: Integer || Flag: Optional)
: The archive duration after which the thread will be auto-archived due to inactivity. Defaults to60
.Return thread ID?
(Type: Bool || Flag: Optional)
: Whether to return the thread channel ID or not. Defaults tono
.
Example
$nomention
I created a new thread! <#$startThread[Cool Thread;$channelID;;1440;yes]>
$editThread
Modifies an existing thread.
Syntax
$editThread[Thread ID;(Thread name;Archived?;Archive duration;Locked?;Slowmode)]
Parameters
Thread ID
(Type: Snowflake || Flag: Required)
: The thread channel to edit.Thread name
(Type: String || Flag: Optional)
: The new name of the thread.Archived?
(Type: Bool || Flag: Optional)
: Whether to archive this thread or not.Archive duration
(Type: Integer || Flag: Optional)
: The archive duration after which the thread will be auto-archived due to inactivity. Defaults to60
.Locked?
(Type: Bool || Flag: Optional)
: Whether to lock this thread or not. Note that archived threads can’t be locked.Slowmode
(Type: Integer || Flag: Optional)
: The slowmode of this channel, expressed in seconds.
Use
!unchanged
as an argument for the option to remain in its current state.
Example
$nomention
$editThread[1098166444111433819;Cool Thread 😎;no;!unchanged;!unchanged;5]
$threadAddMember
Adds a user to a thread.
Syntax
$threadAddMember[Thread ID;User ID]
Parameters
Thread ID
(Type: Snowflake || Flag: Required)
: The ID of the thread channel to add the user to.User ID
(Type: Snowflake || Flag: Required)
: The user to add to the thread.
Example
$nomention
$threadAddMember[1021054508975009793;$authorID]
- In the thread:
$threadRemoveMember
Removes a user from a thread.
Syntax
$threadRemoveMember[Thread ID;User ID]
Parameters
Thread ID
(Type: Snowflake || Flag: Required)
: The ID of the thread channel to remove the user from.User ID
(Type: Snowflake || Flag: Required)
: The user to remove from the thread.
Example
- In the thread:
Simple Code
$nomention
$var[id;$startThread[Cool Thread;$channelID;;1440;yes]]
New thread - <#$var[id]>
$threadAddMember[$var[id];$authorID]
- In the thread:
If you want to learn more about threads, read Discord’s support article.