Discord.PY 2.0 "Guild premium subscription level too low" 创建线程时出错

Discord.PY 2.0 "Guild premium subscription level too low" error when creating threads

我只是想做一个小测试命令来弄清楚线程是如何工作的。

出于测试原因,我想创建一个名为“test”的线程。

当 运行 命令时,我收到一条错误消息:

Command raised an exception: HTTPException: 400 Bad Request (error code: 20035): Guild premium subscription level too low

我的代码看起来像这样:(它在一个齿轮中)

@commands.command()
async def crth(self, ctx):
    await ctx.channel.create_thread(name="test",message=None, type=None, auto_archive_duration=60, reason=None)

再次说明一下,我使用的是 discord.py 2.0

我已经尝试自己查看堆栈溢出并按照那里的答案进行操作,但我仍然收到相同的错误消息。

根据文档,如果您将 None 传递给 message 参数,它将创建一个私有线程,您需要在服务器上使用 Boost Level 2 才能创建该线程。

https://discordpy.readthedocs.io/en/master/api.html?highlight=create%20thread#discord.TextChannel.create_thread

您可以通过将另一条现有消息传递给 message 参数,或者发送一条消息并使用它来创建线程来解决此问题。请记住,您还必须指定 type,因为 None 将默认创建一个私有线程。
对于 auto_archive_duration 如果您的服务器没有任何提升,您可以传入 60 或 1440。

1:

@commands.command()
async def crth(self, ctx):
    msg = await ctx.send("whatever")
    # you could also use msg = await channel.fetch_message(some_id)
    await ctx.channel.create_thread(name="test",message=msg, type=discord.ChannelType.public_thread, auto_archive_duration=60, reason=None)

2:

@commands.command()
async def crth(self, ctx):
    msg = await ctx.send("whatever")
    # message.create_thread has no reason, message or type argument
    await msg.create_thread(name="test", auto_archive_duration=60)