Skip to content

feat: add sort order for forums #1488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 15, 2023
Merged

feat: add sort order for forums #1488

merged 2 commits into from
Jul 15, 2023

Conversation

LordOfPolls
Copy link
Contributor

@LordOfPolls LordOfPolls commented Jul 15, 2023

Pull Request Type

  • Feature addition
  • Bugfix
  • Documentation update
  • Code refactor
  • Tests improvement
  • CI/CD pipeline enhancement
  • Other: [Replace with a description]

Description

Per title

Changes

  • Create needed enum
  • add enum as a param for create_guild_forum

Related Issues

Test Scenarios

    try:
        channel = await guild.create_forum_channel(
            name="test name list",
            topic="test guidelines",
            layout=ForumLayoutType.LIST,
            category=category,
            reason="test reason",
        )

        await channel.create_post("Test title", "test content")
        to_delete.append(channel)

        channel = await guild.create_forum_channel(
            name="test name grid",
            topic="test guidelines",
            layout=ForumLayoutType.GALLERY,
            category=category,
            reason="test reason",
        )

        await channel.create_post("Test title", "test content")
        to_delete.append(channel)

        overwrite = PermissionOverwrite.for_target(member)
        overwrite.add_denies(Permissions.CREATE_POSTS)

        channel = await guild.create_forum_channel(
            name="test name all params list",
            position=1,
            permission_overwrites=[overwrite],
            category=category,
            topic="test guidelines",
            rate_limit_per_user=10,
            nsfw=True,
            layout=ForumLayoutType.LIST,
            sort_order=ForumSortOrder.CREATION_DATE,
            default_reaction_emoji="👍",
            available_tags=[ThreadTag.create("test tag", emoji="👍")],
            reason="test reason",
        )

        await channel.create_post("Test title", "test content")
        to_delete.append(channel)

        channel = await guild.create_forum_channel(
            name="test name all params grid",
            permission_overwrites=[overwrite],
            category=category,
            topic="test guidelines",
            rate_limit_per_user=10,
            nsfw=True,
            layout=ForumLayoutType.GALLERY,
            sort_order=ForumSortOrder.LATEST_ACTIVITY,
            default_reaction_emoji="👍",
            available_tags=[ThreadTag.create("test tag", emoji="👍")],
            reason="test reason",
        )

        await channel.create_post("Test title", "test content")
        to_delete.append(channel)


    finally:
        breakpoint()
        for channel in to_delete:
            await channel.delete()
        await category.delete()

Python Compatibility

  • I've ensured my code works on Python 3.10.x
  • I've ensured my code works on Python 3.11.x

Checklist

  • I've run the pre-commit code linter over all edited files
  • I've tested my changes on supported Python versions
  • I've added tests for my code, if applicable
  • I've updated / added documentation, where applicable

@codecov-commenter
Copy link

codecov-commenter commented Jul 15, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02 🎉

Comparison is base (c5c5045) 58.31% compared to head (7fe27cf) 58.34%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1488      +/-   ##
============================================
+ Coverage     58.31%   58.34%   +0.02%     
============================================
  Files           143      143              
  Lines         15236    15246      +10     
============================================
+ Hits           8885     8895      +10     
  Misses         6351     6351              
Impacted Files Coverage Δ
interactions/__init__.py 88.88% <ø> (ø)
interactions/models/__init__.py 100.00% <ø> (ø)
interactions/models/discord/__init__.py 100.00% <ø> (ø)
interactions/models/discord/guild.py 60.42% <ø> (ø)
interactions/models/discord/channel.py 52.40% <100.00%> (+0.26%) ⬆️
interactions/models/discord/enums.py 96.65% <100.00%> (+0.02%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@LordOfPolls LordOfPolls changed the base branch from stable to unstable July 15, 2023 08:10
@Damego
Copy link
Member

Damego commented Jul 15, 2023

You also can add change sort order for channel edit method
https://discord.com/developers/docs/resources/channel#modify-channel

@LordOfPolls
Copy link
Contributor Author

You also can add change sort order for channel edit method https://discord.com/developers/docs/resources/channel#modify-channel

give me a mo

@LordOfPolls
Copy link
Contributor Author

forum channels dont have a subclassed edit method which means that change would be out-of-scope of this pr.
That said, we should probably add a edit method for forums rather than relying on BaseChannels

@LordOfPolls LordOfPolls requested a review from Damego July 15, 2023 08:22
@LordOfPolls LordOfPolls merged commit 6a2d8e6 into unstable Jul 15, 2023
@LordOfPolls LordOfPolls deleted the forum_sort_order branch July 15, 2023 09:33
i0bs added a commit that referenced this pull request Aug 8, 2023
* feat: add args, kwargs to task (#1478)

* modified:   interactions/models/internal/tasks/task.py

* reset to set_last_call_time

Signed-off-by: kennhh <133614589+kennhh@users.noreply.github.com>

---------

Signed-off-by: kennhh <133614589+kennhh@users.noreply.github.com>

* feat: add id attr to app perms update event

* revert: commit signoff err

* ci: show pre-commit diff on failure (#1484)

* feat: add alt methods for multi-arg params for prefixed cmds (#1471)

* feat: add alt methods for multi-arg params for prefixed cmds

* fix: use empty if the typehint is just tuple

* ci: correct from checks.

* fix: support ConsumeRest without typehint

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* feat: cache channel data from interactions (#1479)

* fix: account for BaseChannel for channel mentions (#1480)

* feat: add default to delete/edit init interaction msg (#1481)

* docs: remove outdated cookiecutter template (#1483)

* docs: remove outdated cookiecutter template

* docs: add boilerplate mention

* feat: add id attr to app perms update event (#1485)

* feat: add sort order for forums (#1488)

* feat: add forum sort order

* feat: cache layout and sort order for forums

* feat: add rate limit per user where needed (#1489)

Signed-off-by: LordOfPolls <dev@lordofpolls.com>

* fix: use message channel for PrefixedContext (#1491)

* fix: bound app_permissions for HybridContext (#1492)

* feat: add start_time(s) for AutoShardedClient (#1482)

* feat: add start_time(s) for AutoShardedClient

* feat: make start_times a dict

* docs: make start_times docstring clearer

Co-authored-by: Sophia <41456914+i0bs@users.noreply.github.com>
Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com>

---------

Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com>
Co-authored-by: Sophia <41456914+i0bs@users.noreply.github.com>

* fix: correct listen typehint (#1495)

* chore: move mutable class ref/attrs to ClassVar typing (#1497)

* ci: weekly check. (#1460)

* ci: weekly check.

updates:
- https://github.com/charliermarsh/ruff-pre-commithttps://github.com/astral-sh/ruff-pre-commit
- [github.com/astral-sh/ruff-pre-commit: v0.0.272 → v0.0.278](astral-sh/ruff-pre-commit@v0.0.272...v0.0.278)
- [github.com/psf/black: 23.3.0 → 23.7.0](psf/black@23.3.0...23.7.0)

* ci: correct from checks.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* feat: add ability to use different arg name than option name (#1493)

* feat: add ability to use different arg name than option name

* feat: raise better error if arg name doesnt exist

* fix: use ValueError instead of TypeError

TypeError seems to be suppressed

* fix: make sure exported auto_defer is deco, not module (#1496)

* fix/feat: adjust invite obj to respect event variants (#1500)

* fix/feat: adjust invite obj to respect event variants

* docs: update docs for event object

* revert: keep MISSING for backwards compatibility

* style: consistency

Co-authored-by: Sophia <41456914+i0bs@users.noreply.github.com>
Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com>

---------

Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com>
Co-authored-by: Sophia <41456914+i0bs@users.noreply.github.com>

* fix: address issues with tag usage for guild forums (#1499)

* fix: address issues with tags for guild forums

* fix: is this breaking? better be safe than sorry

* docs💥: revamp extension guide (#1494)

* docs💥: revamp extension guide

* docs: update extension example

* docs: oops, forgot a word

Co-authored-by: Max <maxyolo01.ytb@gmail.com>
Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com>

* docs: add section for loading all extensions in folder

* docs: turns out ipy can load multi exts in one file

* docs: lots of wording adjustments

---------

Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com>
Co-authored-by: Max <maxyolo01.ytb@gmail.com>
Co-authored-by: LordOfPolls <dev@lordofpolls.com>

* feat: add `guild` & `channel` properties to `ThreadMembersUpdate` (#1504)

* ci: weekly check. (#1503)

* ci: weekly check.

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.278 → v0.0.280](astral-sh/ruff-pre-commit@v0.0.278...v0.0.280)

* ci: correct from checks.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* fix(http): incorrect path for delete permission endpoint (#1506)

* fix delete_permissions api endpoint

fix API Endpoint in delete_channel_permission
adding "permissions/" in Endpoint

* ci: correct from checks.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* ci: weekly check. (#1511)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.280 → v0.0.281](astral-sh/ruff-pre-commit@v0.0.280...v0.0.281)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* feat: Implement missing stuff for scheduled events (#1507)

* feat: Implement gateway support for scheduled events

* fix: add optional to user add/remove

* refactor: pre-commit'ed

* refactor: change attrs to props and add `attrs.field`

* refactor: set repr to True

* feat(client): add `get_scheduled_event` helper method

* refactor: use cache helpers in methods

* chore: replace typing

* docs: clarify intents in example (#1516)

* feat: infer modal/component callback names from coroutine (#1519)

* feat: infer callback decor from coroutine name

* docs: add new logic notation

* chore: add doc notation to component callback definition

* docs: clarify intents for extensions

* ci: weekly check. (#1521)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.281 → v0.0.282](astral-sh/ruff-pre-commit@v0.0.281...v0.0.282)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

---------

Signed-off-by: kennhh <133614589+kennhh@users.noreply.github.com>
Signed-off-by: LordOfPolls <dev@lordofpolls.com>
Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com>
Co-authored-by: kennhh <133614589+kennhh@users.noreply.github.com>
Co-authored-by: i0bs <41456914+i0bs@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: LordOfPolls <dev@lordofpolls.com>
Co-authored-by: Max <maxyolo01.ytb@gmail.com>
Co-authored-by: Damego <damego.dev@gmail.com>
Co-authored-by: Donbur4156 <janpfister@t-online.de>
i0bs added a commit that referenced this pull request Aug 8, 2023
* feat: add args, kwargs to task (#1478)

* modified:   interactions/models/internal/tasks/task.py

* reset to set_last_call_time

Signed-off-by: kennhh <133614589+kennhh@users.noreply.github.com>

---------

Signed-off-by: kennhh <133614589+kennhh@users.noreply.github.com>

* feat: add id attr to app perms update event

* revert: commit signoff err

* ci: show pre-commit diff on failure (#1484)

* feat: add alt methods for multi-arg params for prefixed cmds (#1471)

* feat: add alt methods for multi-arg params for prefixed cmds

* fix: use empty if the typehint is just tuple

* ci: correct from checks.

* fix: support ConsumeRest without typehint

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* feat: cache channel data from interactions (#1479)

* fix: account for BaseChannel for channel mentions (#1480)

* feat: add default to delete/edit init interaction msg (#1481)

* docs: remove outdated cookiecutter template (#1483)

* docs: remove outdated cookiecutter template

* docs: add boilerplate mention

* feat: add id attr to app perms update event (#1485)

* feat: add sort order for forums (#1488)

* feat: add forum sort order

* feat: cache layout and sort order for forums

* feat: add rate limit per user where needed (#1489)

Signed-off-by: LordOfPolls <dev@lordofpolls.com>

* fix: use message channel for PrefixedContext (#1491)

* fix: bound app_permissions for HybridContext (#1492)

* feat: add start_time(s) for AutoShardedClient (#1482)

* feat: add start_time(s) for AutoShardedClient

* feat: make start_times a dict

* docs: make start_times docstring clearer

Co-authored-by: Sophia <41456914+i0bs@users.noreply.github.com>
Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com>

---------

Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com>
Co-authored-by: Sophia <41456914+i0bs@users.noreply.github.com>

* fix: correct listen typehint (#1495)

* chore: move mutable class ref/attrs to ClassVar typing (#1497)

* ci: weekly check. (#1460)

* ci: weekly check.

updates:
- https://github.com/charliermarsh/ruff-pre-commithttps://github.com/astral-sh/ruff-pre-commit
- [github.com/astral-sh/ruff-pre-commit: v0.0.272 → v0.0.278](astral-sh/ruff-pre-commit@v0.0.272...v0.0.278)
- [github.com/psf/black: 23.3.0 → 23.7.0](psf/black@23.3.0...23.7.0)

* ci: correct from checks.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* feat: add ability to use different arg name than option name (#1493)

* feat: add ability to use different arg name than option name

* feat: raise better error if arg name doesnt exist

* fix: use ValueError instead of TypeError

TypeError seems to be suppressed

* fix: make sure exported auto_defer is deco, not module (#1496)

* fix/feat: adjust invite obj to respect event variants (#1500)

* fix/feat: adjust invite obj to respect event variants

* docs: update docs for event object

* revert: keep MISSING for backwards compatibility

* style: consistency

Co-authored-by: Sophia <41456914+i0bs@users.noreply.github.com>
Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com>

---------

Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com>
Co-authored-by: Sophia <41456914+i0bs@users.noreply.github.com>

* fix: address issues with tag usage for guild forums (#1499)

* fix: address issues with tags for guild forums

* fix: is this breaking? better be safe than sorry

* docs💥: revamp extension guide (#1494)

* docs💥: revamp extension guide

* docs: update extension example

* docs: oops, forgot a word

Co-authored-by: Max <maxyolo01.ytb@gmail.com>
Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com>

* docs: add section for loading all extensions in folder

* docs: turns out ipy can load multi exts in one file

* docs: lots of wording adjustments

---------

Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com>
Co-authored-by: Max <maxyolo01.ytb@gmail.com>
Co-authored-by: LordOfPolls <dev@lordofpolls.com>

* feat: add `guild` & `channel` properties to `ThreadMembersUpdate` (#1504)

* ci: weekly check. (#1503)

* ci: weekly check.

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.278 → v0.0.280](astral-sh/ruff-pre-commit@v0.0.278...v0.0.280)

* ci: correct from checks.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* fix(http): incorrect path for delete permission endpoint (#1506)

* fix delete_permissions api endpoint

fix API Endpoint in delete_channel_permission
adding "permissions/" in Endpoint

* ci: correct from checks.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* ci: weekly check. (#1511)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.280 → v0.0.281](astral-sh/ruff-pre-commit@v0.0.280...v0.0.281)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* feat: Implement missing stuff for scheduled events (#1507)

* feat: Implement gateway support for scheduled events

* fix: add optional to user add/remove

* refactor: pre-commit'ed

* refactor: change attrs to props and add `attrs.field`

* refactor: set repr to True

* feat(client): add `get_scheduled_event` helper method

* refactor: use cache helpers in methods

* chore: replace typing

* chore: pyproject version bump

---------

Signed-off-by: kennhh <133614589+kennhh@users.noreply.github.com>
Signed-off-by: LordOfPolls <dev@lordofpolls.com>
Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com>
Signed-off-by: Sophia <41456914+i0bs@users.noreply.github.com>
Co-authored-by: kennhh <133614589+kennhh@users.noreply.github.com>
Co-authored-by: i0bs <41456914+i0bs@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: LordOfPolls <dev@lordofpolls.com>
Co-authored-by: Max <maxyolo01.ytb@gmail.com>
Co-authored-by: Damego <damego.dev@gmail.com>
Co-authored-by: Donbur4156 <janpfister@t-online.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants