Threads
Whatever you think of Threads in Discord, they are a cool feature for support tickets, help channels, etc. in this guide you will learn how to use threads with Py-cord.
Last updated
Was this helpful?
Whatever you think of Threads in Discord, they are a cool feature for support tickets, help channels, etc. in this guide you will learn how to use threads with Py-cord.
Last updated
Was this helpful?
This guide has been moved to . Please visit the new guide instead, since this one might be outdated.
The new guide looks better, has better explanations, and is way better overall.
Whatever you think of Threads in Discord, you gotta admit they can be useful sometimes. They are a cool feature for support tickets, help channels, etc. Besides, the permissions for threads have been made much better by Discord now. Anyways, in this guide you will learn how to create, use and join threads with Py-cord.
With a few lines of code, we can create threads in Py-cord. Now, here are a few things to keep in mind:
- All public threads need a starting message. This message will start the thread. However, private threads (server boost level 2 required) do not require a starting message.
You may also use other ways, say, on_message on by using buttons.
A thread type could be news_thread, public_thread, private_thread. You may use it like type=discord.ChannelType.news_thread
.
If you have a Moderation Bot, you probably want your bot to join all the threads automatically. Only by doing so will you be able to Moderate Threads properly. Thankfully, there's an event for that.
There are ton of things you can do with threads. Reading this guide, you must have gotten a hang of how to use these features. Now, you should head to the docs, view all the things you can do and use the features you want accordingly.
If you get an error looking likediscord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 10008): Unknown Message
There could be multiple reasons, for example,
The message does not exist
The message already has a thread
The message is in channel x, you are trying to start a thread in channel y.
The message was deleted.
This means that your bot does not have the necessary permissions to run the command you wanted. Give it the correct permissions, then try again.
You probably used message.id
instead of message
.
If not, remember that message is an object. You need to get the object, not the specify the message id. You should try to learn about Object Oriented Programming.
This probably means that the bot was unable to fetch the thread. Check the message id, or use try-except.
Docs:
name () – The new name of the thread.
archived () – Whether to archive the thread or not.
locked () – Whether to lock the thread or not.
invitable () – Whether non-moderators can add other non-moderators to this thread. Only available for private threads.
auto_archive_duration () – The new duration in minutes before a thread is automatically archived for inactivity. Must be one of 60
, 1440
, 4320
, or 10080
.
slowmode_delay () – Specifies the slowmode rate limit for user in this thread, in seconds. A value of 0
disables slowmode. The maximum value possible is 21600
.
Docs: