I am trying to start a thread using the Pycord library. Aside from the official documentation, I couldn't find any real life examples of how this goes.
So far I am running into a Error 400 Bad Request (error code: 20035): Guild Premium subscription level too low
.
I have tried the solutions mentioned here, but so far no luck.
Here is my current code, any idea of how could I approach it?
class MyClient(discord.Client):
def __init__(self, *args, **kwargs):
self.comments = kwargs.pop("comments")
super().__init__(*args, **kwargs)
async def on_ready(self):
channel = self.get_channel(xxx) # Your channel ID goes here
for comment in comments:
# await channel.send(comment['data']['author'])
# await channel.create_thread(comment['data']['link_title'])
await channel.create_thread(name="wop")
Also, my bot seems to have the correct permissions, as seen here:
As per the error (Guild Premium subscription level too low
), your server has not been boosted enough to use private threads, which is the default in pycord.
You can change this behaviour by modifying the type
argument you pass to create_thread
, as follows:
from pycord.enums import ChannelType
class MyClient(discord.Client):
def __init__(self, *args, **kwargs):
self.comments = kwargs.pop("comments")
super().__init__(*args, **kwargs)
async def on_ready(self):
channel = self.get_channel(xxx) # Your channel ID goes here
for comment in comments:
# await channel.send(comment['data']['author'])
# await channel.create_thread(comment['data']['link_title'])
await channel.create_thread(name="wop", type=ChannelType.public_thread)
Note that ChannelType
was imported from pycord.enums
https://discord.com/developers/docs/resources/channel#start-thread-without-message
- Creating a private thread requires the server to be boosted. The guild features will indicate if that is possible for the guild.