#Forum create_thread & applied_tags

1 messages · Page 1 of 1 (latest)

tawdry jacinth
#

Does anyone have an example of creating a Forum thread and using applied_tags?

What do I pass to applied_tags here?

await announce_channel.create_thread(name='name', content='message', applied_tags=news_tag_id)

I see in the documentation says Sequence[abc.Snowflake], and it seems to just be the ID of the tag. So I pass the ID of the tag and I receive a TypeError: 'int' object is not iterable

#

Ahhh I got it, yay for rubber duck troubleshooting....

river gull
#

Sequence is a general type, like lists, tuples or dicts

#

so even you only have one item you need to pass it in for example a list

simple raptor
#

Sequence[abc.Snowflake]

  • Sequence is an actual sequence, an ordered collection of items, think a list/tuple, etc
  • Snowflake is an object that has a .id property, which is that snowflake's id on discord
river gull
#

Show off...

tawdry jacinth
river gull
#

/solved if you don't have follow up questions catlove

tawdry jacinth
#

Just in case someone else runs across this, here's what I ended up doing:

    for tag in announce_channel.available_tags:
        if tag.name == 'News':
            news_tag_id = tag

    await announce_channel.create_thread(name='name', content='message', applied_tags=[news_tag_id])