I try to get all thread but my loop return only open thread and I want open and archived
@bot.slash_command(name="stats", description="Affiche les statistiques du bot")
async def stats(ctx):
if not ctx.author.guild_permissions.manage_messages:
return await ctx.respond(embed=discord.Embed(description="**`❌` Vous n'avez pas la permission d'utiliser cette commande.**"))
embed = discord.Embed()
guild = bot.get_guild(1169680945016750160)
channel = await guild.fetch_channel(1282319427815346278)
if not channel or isinstance(channel, discord.StageChannel):
return
post_open = 0
post_closed = 0
for post in channel.threads:
print(post.id)
post = guild.get_thread(post.id)
if post.locked or post.archived:
post_closed += 1
else:
post_open += 1
embed.title = "Statistiques du support"
embed.description = f"""**🔓 Poste ouvert**: {post_open}\n\n**🔒 Poste fermé**: {post_closed}"""
await ctx.respond(embed=embed)