Skip to content

feat(channel): modify a thread, tags and all - #13

Merged
mikield merged 1 commit into
masterfrom
feat/thread-builder
Sep 2, 2026
Merged

mikield merged 1 commit into
masterfrom
feat/thread-builder

Conversation

@mikield

@mikield mikield commented Sep 2, 2026

Copy link
Copy Markdown
Member

A forum post's tags can be read off Channel::$applied_tags but never written: no builder carries the field, so there is no way to move a post from "voting" to "accepted" through the library. Every forum workflow turns on exactly that.

$discord->rest->channel->modify($threadId, ThreadChannelBuilder::new()
    ->setAppliedTags([$acceptedTagId])
    ->setLocked(true));

Why its own builder rather than a trait on the existing ones. A thread is not an ordinary channel: it has no topic, no permission overwrites and no parent to move it between, and it has archiving, locking, invitability and tags, which no other channel has. Handing a thread to GuildTextChannelBuilder sends type and whatever else was set — fields Discord rejects for a thread — and offers none of the ones that actually apply.

applied_tags replaces the whole set, because that is what Discord does with the field: a tag left out of the list comes off the post. It is reindexed on the way out, since an array with gaps serialises to a JSON object rather than an array and the call comes back refused — which is the kind of thing you only find in production, after filtering a tag list.

Found while porting a bot whose petitions live in a forum and move between four tags over their life.

🤖 Generated with Claude Code

A forum post's tags could be read off Channel::$applied_tags but never
written: no builder carries the field, so there was no way to move a post
from "voting" to "accepted" through the library. Every forum workflow
turns on exactly that.

A thread is not an ordinary channel. It has no topic, no permission
overwrites and no parent to move it between, and it has archiving,
locking and tags, which no other channel has. Passing one to a guild
channel builder sends fields Discord rejects for a thread and offers none
of the ones that apply, so this is its own builder rather than another
trait bolted onto the existing ones.

applied_tags replaces the whole set, since that is what Discord does with
the field, and is reindexed on the way out: an array with gaps in it
serialises to an object and the call comes back refused.
@mikield
mikield merged commit 999e2ff into master Sep 2, 2026
4 checks passed
@mikield
mikield deleted the feat/thread-builder branch September 2, 2026 02:13
github-actions Bot pushed a commit that referenced this pull request Sep 2, 2026
## [1.3.0](v1.2.0...v1.3.0) (2026-09-02)

### Features

* **channel:** modify a thread, tags and all ([#13](#13)) ([999e2ff](999e2ff))
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.3.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant