discord.py

Is there a way to create a thread in discord.py?


I am trying to make a bot that creates a thread upon a message in a specific channel. If there is a way to create a thread in a text channel in discord.py, please let me know.


Solution

  • Yes, but with a catch.

    The current version of discord.py (1.0+) does not support threads. But there is a beta version of discord.py 2.0 that allows users to use threads, but it is in beta and may be prone to bugs. Instead, I recommend Pycord, which supports threads and is a community-driven fork of discord 2.0 beta and is much better.

    You can install Pycord by following instructions on the Github Page.

    And to create a thread with Pycord you can use:

    await create_thread(*, name, auto_archive_duration=in-minutes)
    

    You can view everything including how to create a thread in more detail on the docs.