Skip to content

feat: Add spoiler channel flag and functions - #3252

Open
ToothyDev wants to merge 26 commits into
masterfrom
feat/spoiler-channels
Open

feat: Add spoiler channel flag and functions#3252
ToothyDev wants to merge 26 commits into
masterfrom
feat/spoiler-channels

Conversation

@ToothyDev

@ToothyDev ToothyDev commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

This adds ChannelFlags.is_spoiler_channel (following https://docs.discord.food/resources/channel#channel-flags) as well as a .spoiler property to all applicable channel types (all except category). Same goes for making it possible to create these channels via the regular channel creation methods, again with the exception of category channels. Channel editing with this flag is also functional.

Now that it's officially documented, here's the ddocs PR: discord/discord-api-docs#8465

Depends on discord/discord-api-docs#8465

Information

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed).
  • This PR is not a code change (e.g. documentation, README, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.
  • I have updated the changelog to include these changes.
  • AI Usage has been disclosed.
    • If AI has been used, I understand fully what the code does
  • I have read the Contributing Guidelines

@ToothyDev ToothyDev added upcoming discord feature Involves a feature not yet fully released by Discord on hold labels Jun 5, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Pycord Jun 5, 2026
@pycord-app

pycord-app Bot commented Jun 5, 2026

Copy link
Copy Markdown

Thanks for opening this pull request!
Please make sure you have read the Contributing Guidelines and Code of Conduct.

This pull request can be checked-out with:

git fetch origin pull/3252/head:pr-3252
git checkout pr-3252

This pull request can be installed with:

pip install git+https://github.com/Pycord-Development/pycord@refs/pull/3252/head

@ToothyDev ToothyDev added the hold: testing This pull request requires further testing label Jun 5, 2026

@Lulalaby Lulalaby left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

take a shower <3

@Lulalaby Lulalaby left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

took a shower apparently

@Lulalaby Lulalaby left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can someone request changes reminding me to add editing & creating channels with that flag
and whatever else i may have forgotten

@Soheab Soheab left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a way for bots to create this kind of channel

This message was sponsored by toothyfernsan on discord.

@Soheab Soheab added hold: changelog This pull request is missing a changelog entry and removed hold: changelog This pull request is missing a changelog entry labels Jun 5, 2026
@ToothyDev

Copy link
Copy Markdown
Contributor Author

I tested it with all but MediaChannels since I don't have access to those anywhere, but I'd still like a second pair of testing eyes on this

@ToothyDev ToothyDev moved this from Todo to In Progress in Pycord Jun 5, 2026
@ToothyDev

Copy link
Copy Markdown
Contributor Author

Also, creating a channel with this turned on isn't possible unfortunately, gotta create + edit

@Paillat-dev Paillat-dev added this to the 2.9.0rc1 milestone Jun 7, 2026
ToothyDev and others added 3 commits June 22, 2026 22:13
Signed-off-by: Lala Sabathil <lala@pycord.dev>
Signed-off-by: Lala Sabathil <lala@pycord.dev>
@github-actions github-actions Bot added the invalid This doesn't seem right label Jul 30, 2026
@github-actions

This comment was marked as resolved.

@github-actions github-actions Bot closed this Jul 30, 2026
@github-actions github-actions Bot locked as spam and limited conversation to collaborators Jul 30, 2026
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Pycord Jul 30, 2026
@Pycord-Development Pycord-Development unlocked this conversation Jul 30, 2026
@ToothyDev
ToothyDev requested a review from Paillat-dev August 10, 2026 17:31
Comment thread discord/channel.py Outdated
Comment thread discord/channel.py Outdated
Comment thread discord/channel.py Outdated
Comment on lines +900 to +901
Whether the channel should be a spoiler channel. Mutually exclusive with :attr:`nsfw`, although
this will convert an nsfw channel into a spoiler channel.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Whether the channel should be a spoiler channel. Mutually exclusive with :attr:`nsfw`, although
this will convert an nsfw channel into a spoiler channel.
Whether the channel should be a spoiler channel.
.. warning::
This cannot be enabled alongside :attr:`nsfw`. Applying this to an existing NSFW channel will convert it into a spoiler channel.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something along those lines.

Comment thread discord/guild.py
Comment on lines 1551 to +1573
@@ -1524,6 +1564,13 @@ async def create_text_channel(
The default auto archive duration in minutes for threads created in this channel.

.. versionadded:: 2.7
spoiler: :class:`bool`
Whether the channel is marked as a spoiler channel.

.. versionadded:: 2.9

.. warning::
Passing both this and ``nsfw`` as ``True`` will mark the channel as NSFW and ignore the spoiler flag.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we raised an error instead because passing both is impossible.

@ToothyDev ToothyDev Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing both to the API does work fine and causes the noted behavior

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah and imo warning is better here because we shouldn't assume a specific behavior is disallowed just because it doesn't work. Let Bad Request from discord cascade if it ever becomes a thing

Comment thread CHANGELOG.md Outdated

- Added `Member.vr_status` property.
([#3328](https://github.com/Pycord-Development/pycord/pull/3328))
- Added spoiler channel functionality

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Added spoiler channel functionality
- Added Spoiler Channels.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it lowercase cause that seems to be the convention in the rest of the docs

@Paillat-dev

Copy link
Copy Markdown
Member

@ToothyDev Can you add to the PR body a link to the discord api docs PR for it ?

@ToothyDev ToothyDev removed the hold: testing This pull request requires further testing label Aug 11, 2026
Comment thread discord/channel.py
Comment thread discord/channel.py Outdated
@ToothyDev

Copy link
Copy Markdown
Contributor Author

The Stage Channel edit is a weird case and I'm not sure what to prefer here. The existing edit function doesn't even allow nsfw being passed there at all, while the creation method does allow it. Functionally, stage channels don't support NSFW behavior at all, so idk whether I should add the nsfw param to the edit method too for parity

Comment thread discord/guild.py Outdated
Comment thread discord/channel.py Outdated
Comment thread discord/channel.py Outdated
Comment thread discord/channel.py Outdated
Comment thread discord/guild.py
Comment thread discord/guild.py
@ToothyDev
ToothyDev requested a review from vmphase August 13, 2026 14:14
ToothyDev and others added 2 commits August 14, 2026 23:53

@Paillat-dev Paillat-dev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the warn()s you use NSFW in all caps, and mention that the channel will "become" even when it doesn't exist yet.

A better wording would indicate that the two parameters (with their python name) are exclusive, and which of the two will be ignored.

Comment thread discord/channel.py Outdated
Comment thread discord/channel.py Outdated
Comment thread discord/flags.py
Comment thread discord/guild.py Outdated
Comment thread discord/guild.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

6 participants