Skip to content

Commit 8ae4997

Browse files
authored
Merge branch 'master' into async-dynamic-cooldown
2 parents e239ac5 + 8f903aa commit 8ae4997

37 files changed

+1796
-103
lines changed

.github/workflows/release.yml

Lines changed: 119 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
inputs:
66
version:
77
type: string
8-
description: "Version number to release (e.g., 1.2.3, 1.2.3-rc1, 1.2.0)"
8+
description: "Version number to release (e.g., 1.2.3, 1.2.3rc1, 1.2.0)"
99
required: true
1010

1111
permissions: write-all
@@ -41,10 +41,16 @@ jobs:
4141
env:
4242
VERSION: ${{ github.event.inputs.version }}
4343
run: |
44+
# PEP 440 version regex
45+
VALID_VERSION_REGEX='^([0-9]+\.[0-9]+\.[0-9]+((a|b|rc|\.dev|\.post)[0-9]+)?)$'
46+
if ! [[ $VERSION =~ $VALID_VERSION_REGEX ]]; then
47+
echo "::error::Invalid version string '$VERSION'. Must match PEP 440 (e.g. 1.2.0, 1.2.0rc1, 1.2.0.dev1, 1.2.0a1, 1.2.0b1, 1.2.0.post1)"
48+
exit 1
49+
fi
4450
echo "version=$VERSION" >> $GITHUB_OUTPUT
4551
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^)
4652
echo "previous_tag=${PREVIOUS_TAG}" >> $GITHUB_OUTPUT
47-
if [[ $VERSION =~ -rc ]]; then
53+
if [[ $VERSION =~ rc[0-9]+$ ]]; then
4854
MAJOR_MINOR_VERSION=$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')
4955
echo "branch_name=v${MAJOR_MINOR_VERSION}.x" >> $GITHUB_OUTPUT
5056
echo "is_rc=true" >> $GITHUB_OUTPUT
@@ -63,7 +69,7 @@ jobs:
6369
runs-on: ubuntu-latest
6470
environment: release
6571
env:
66-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }}
6773
steps:
6874
- name: "Checkout Repository"
6975
uses: actions/checkout@v5
@@ -75,36 +81,126 @@ jobs:
7581
shell: bash
7682
env:
7783
VERSION_BRANCH: ${{ needs.pre_config.outputs.branch_name }}
78-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }}
7985
run: |
8086
git fetch origin
8187
if ! git show-ref --verify --quiet refs/heads/$VERSION_BRANCH; then
8288
git checkout -b $VERSION_BRANCH
8389
git push origin $VERSION_BRANCH
8490
fi
8591
git checkout $VERSION_BRANCH
86-
- name: "Release Pycord"
87-
id: pycord-release
88-
uses: Aiko-IT-Systems/[email protected]
92+
- name: "Setup Python"
93+
id: python-setup
94+
uses: actions/setup-python@v5
8995
with:
90-
github-token: ${{ secrets.GITHUB_TOKEN }}
91-
pypi-token: ${{ secrets.PYPI_TOKEN }}
92-
version-branch-name: ${{ needs.pre_config.outputs.branch_name }}
93-
ref: ${{ github.ref_name }}
94-
repository: ${{ github.repository }}
9596
python-version: "3.13"
96-
release-requirements: "requirements/_release.txt"
97-
version: ${{ needs.pre_config.outputs.version }}
98-
is-rc: ${{ needs.pre_config.outputs.is_rc }}
99-
pypi-package: "py-cord"
97+
cache: "pip"
98+
cache-dependency-path: "requirements/_release.txt"
99+
- name: "Install Release Dependencies"
100+
id: python-install
101+
env:
102+
REQ_FILE: "requirements/_release.txt"
103+
shell: bash
104+
run: |
105+
python -m pip install --upgrade pip
106+
pip install setuptools setuptools_scm twine build
107+
pip install -r $REQ_FILE
108+
- name: "Prepare and Update CHANGELOG.md"
109+
id: changelog-update
110+
shell: bash
111+
env:
112+
VERSION: ${{ inputs.version }}
113+
REPOSITORY: ${{ github.repository }}
114+
GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }}
115+
BRANCH: ${{ github.ref_name }}
116+
run: |
117+
git config user.name "NyuwBot"
118+
git config user.email "[email protected]"
119+
DATE=$(date +'%Y-%m-%d')
120+
sed -i "/These changes are available on the \`.*\` branch, but have not yet been released\./{N;d;}" CHANGELOG.md
121+
sed -i "s/## \[Unreleased\]/## [$VERSION] - $DATE/" CHANGELOG.md
122+
sed -i "0,/## \[$VERSION\]/ s|## \[$VERSION\]|## [Unreleased]\n\nThese changes are available on the \`$BRANCH\` branch, but have not yet been released.\n\n### Added\n\n### Changed\n\n### Fixed\n\n### Removed\n\n&|" CHANGELOG.md
123+
sed -i "s|\[unreleased\]:.*|[unreleased]: https://github.com/$REPOSITORY/compare/v$VERSION...HEAD\n[$VERSION]: https://github.com/$REPOSITORY/compare/$(git describe --tags --abbrev=0 @^)...v$VERSION|" CHANGELOG.md
124+
git add CHANGELOG.md
125+
git commit -m "chore(release): update CHANGELOG.md for version $VERSION"
126+
- name: "Commit and Push Changelog to ${{ github.ref_name }}"
127+
id: commit-main-branch
128+
shell: bash
129+
env:
130+
VERSION: ${{ inputs.version }}
131+
GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }}
132+
BRANCH: ${{ github.ref_name }}
133+
run: |
134+
git config user.name "NyuwBot"
135+
git config user.email "[email protected]"
136+
git push origin HEAD:$BRANCH -f
137+
- name: "Push Changelog to Version Branch"
138+
id: commit-version-branch
139+
shell: bash
140+
env:
141+
GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }}
142+
VERSION_BRANCH: ${{ needs.pre_config.outputs.branch_name }}
143+
run: |
144+
git config user.name "NyuwBot"
145+
git config user.email "[email protected]"
146+
git push origin HEAD:$VERSION_BRANCH -f
147+
- name: "Create Git Tag"
148+
id: create-git-tag
149+
shell: bash
150+
env:
151+
VERSION: ${{ inputs.version }}
152+
GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }}
153+
run: |
154+
git config user.name "NyuwBot"
155+
git config user.email "[email protected]"
156+
git tag v$VERSION -m "Release version $VERSION"
157+
git push origin v$VERSION -f
158+
- name: "Verify Version"
159+
id: python-version-verify
160+
shell: bash
161+
run: python -m setuptools_scm
162+
- name: "Build Package"
163+
id: python-version-build
164+
shell: bash
165+
run: |
166+
python3 -m build --sdist
167+
python3 -m build --wheel
168+
- name: "Create GitHub Release"
169+
uses: softprops/[email protected]
170+
id: gh-release
171+
with:
172+
tag_name: "v${{ inputs.version }}"
173+
name: "v${{ inputs.version }}"
174+
generate_release_notes: true
175+
draft: false
176+
prerelease: ${{ needs.pre_config.outputs.is_rc }}
177+
files: |
178+
dist/*.whl
179+
dist/*.tar.gz
180+
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
181+
make_latest: true
182+
repository: ${{ github.repository }}
183+
target_commitish: ${{ github.ref_name }}
184+
185+
- name: "Publish package distributions to PyPI"
186+
uses: pypa/[email protected]
187+
env:
188+
name: "pypi"
189+
url: "https://pypi.org/p/py-cord"
190+
with:
191+
password: ${{ secrets.PYPI_TOKEN }}
192+
user: __token__
193+
attestations: false
194+
verify-metadata: false
195+
100196

101197
- name: "Echo release url"
102-
run: echo "${{ steps.pycord-release.outputs.gh-release }}"
198+
run: echo "${{ steps.gh-release.outputs.url }}"
103199

104200
docs_release:
105201
runs-on: ubuntu-latest
106202
needs: [lib_release,pre_config]
107-
if: ${{ needs.pre_config.outputs.is_rc == 'false' || (needs.pre_config.outputs.is_rc == 'true' && endsWith(needs.pre_config.outputs.version, '.0-rc.1')) }}
203+
if: ${{ needs.pre_config.outputs.is_rc == 'false' || (needs.pre_config.outputs.is_rc == 'true' && endsWith(needs.pre_config.outputs.version, '0rc1')) }}
108204
environment: release
109205
steps:
110206
- name: "Sync Versions on Read the Docs"
@@ -117,7 +213,7 @@ jobs:
117213
run: |
118214
VERSION=${{ needs.pre_config.outputs.version }}
119215
MAJOR_MINOR_VERSION=$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')
120-
if [[ $VERSION == *-rc* ]]; then
216+
if [[ $VERSION == *rc* ]]; then
121217
DOCS_VERSION="v${MAJOR_MINOR_VERSION}.x"
122218
else
123219
DOCS_VERSION="v$VERSION"
@@ -132,22 +228,22 @@ jobs:
132228
133229
inform_discord:
134230
runs-on: ubuntu-latest
135-
needs: [lib_release,docs_release,close_milestone,pre_config]
231+
needs: [lib_release,docs_release,pre_config]
136232
environment: release
137233
steps:
138234
- name: "Notify Discord"
139235
run: |
140236
VERSION=${{ needs.pre_config.outputs.version }}
141237
MAJOR_MINOR_VERSION=$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')
142-
if [[ $VERSION == *-rc* ]]; then
238+
if [[ $VERSION == *rc* ]]; then
143239
DOCS_URL="<https://docs.pycord.dev/en/v${MAJOR_MINOR_VERSION}.x/changelog.html>"
144240
else
145241
DOCS_URL="<https://docs.pycord.dev/en/v$VERSION/changelog.html>"
146242
fi
147243
GITHUB_COMPARE_URL="<https://github.com/Pycord-Development/pycord/compare/${{ needs.pre_config.outputs.previous_tag }}...v$VERSION>"
148244
GITHUB_RELEASE_URL="<https://github.com/Pycord-Development/pycord/releases/tag/v$VERSION>"
149245
PYPI_RELEASE_URL="<https://pypi.org/project/py-cord/$VERSION/>"
150-
if [[ $VERSION == *-rc* ]]; then
246+
if [[ $VERSION == *rc* ]]; then
151247
ANNOUNCEMENT="## <:pycord:1063211537008955495> Pycord v${MAJOR_MINOR_VERSION} Release Candidate ($VERSION) is available!\n\n"
152248
ANNOUNCEMENT="${ANNOUNCEMENT}This is a pre-release (release candidate) for testing and feedback.\n\n"
153249
ANNOUNCEMENT="${ANNOUNCEMENT}You can view the changelog here: <$DOCS_URL>\n\n"
@@ -191,7 +287,7 @@ jobs:
191287
close_milestone:
192288
runs-on: ubuntu-latest
193289
needs: [determine_milestone_id,pre_config]
194-
if: ${{ !contains(needs.pre_config.outputs.version, '-') && endsWith(needs.pre_config.outputs.version, '.0') }}
290+
if: ${{ !contains(needs.pre_config.outputs.version, 'rc') && endsWith(needs.pre_config.outputs.version, '.0') }}
195291
environment: release
196292
env:
197293
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ possible (see our [Version Guarantees] for more info).
1010

1111
These changes are available on the `master` branch, but have not yet been released.
1212

13+
### Added
14+
15+
### Changed
16+
17+
### Fixed
18+
19+
### Removed
20+
21+
## [2.7.0rc1] - 2025-08-30
22+
1323
⚠️ **This version removes support for Python 3.8.** ⚠️
1424

1525
### Added
@@ -47,6 +57,15 @@ These changes are available on the `master` branch, but have not yet been releas
4757
([#2659](https://github.com/Pycord-Development/pycord/pull/2659))
4858
- Added `VoiceMessage` subclass of `File` to allow voice messages to be sent.
4959
([#2579](https://github.com/Pycord-Development/pycord/pull/2579))
60+
- Added the following soundboard-related features:
61+
- Manage guild soundboard sounds with `Guild.fetch_sounds()`, `Guild.create_sound()`,
62+
`SoundboardSound.edit()`, and `SoundboardSound.delete()`.
63+
- Access Discord default sounds with `Client.fetch_default_sounds()`.
64+
- Play sounds in voice channels with `VoiceChannel.send_soundboard_sound()`.
65+
- New `on_voice_channel_effect_send` event for sound and emoji effects.
66+
- Soundboard limits based on guild premium tier (8-48 slots) in
67+
`Guild.soundboard_limit`.
68+
([#2623](https://github.com/Pycord-Development/pycord/pull/2623))
5069
- Added new `Subscription` object and related methods/events.
5170
([#2564](https://github.com/Pycord-Development/pycord/pull/2564))
5271
- Added `Message.forward_to`, `Message.snapshots`, and other related attributes.
@@ -57,6 +76,8 @@ These changes are available on the `master` branch, but have not yet been releas
5776
([#2714](https://github.com/Pycord-Development/pycord/pull/2714))
5877
- Added the ability to pass a `datetime.time` object to `format_dt`.
5978
([#2747](https://github.com/Pycord-Development/pycord/pull/2747))
79+
- Added various missing channel parameters and allow `default_reaction_emoji` to be
80+
`None`. ([#2772](https://github.com/Pycord-Development/pycord/pull/2772))
6081
- Added support for type hinting slash command options with `typing.Annotated`.
6182
([#2782](https://github.com/Pycord-Development/pycord/pull/2782))
6283
- Added conversion to `Member` in `MentionableConverter`.
@@ -69,6 +90,8 @@ These changes are available on the `master` branch, but have not yet been releas
6990
([#2817](https://github.com/Pycord-Development/pycord/pull/2817))
7091
- Added role gradients support with `Role.colours` and the `RoleColours` class.
7192
([#2818](https://github.com/Pycord-Development/pycord/pull/2818))
93+
- Added `ThreadArchiveDuration` enum to improve clarity of thread archive durations.
94+
([#2826](https://github.com/Pycord-Development/pycord/pull/2826))
7295
- Added `Interaction.attachment_size_limit`.
7396
([#2854](https://github.com/Pycord-Development/pycord/pull/2854))
7497
- Added support for selects and text displays in modals.
@@ -77,6 +100,8 @@ These changes are available on the `master` branch, but have not yet been releas
77100
([#2883](https://github.com/Pycord-Development/pycord/pull/2883))
78101
- Added `discord.User.primary_guild` and the `PrimaryGuild` class.
79102
([#2876](https://github.com/Pycord-Development/pycord/pull/2876))
103+
- Added `get_component` to `Message`, `Section`, `Container` and `ActionRow`.
104+
([#2849](https://github.com/Pycord-Development/pycord/pull/2849))
80105

81106
### Fixed
82107

@@ -148,8 +173,15 @@ These changes are available on the `master` branch, but have not yet been releas
148173
([#2843](https://github.com/Pycord-Development/pycord/pull/2843))
149174
- Fixed `TypeError` when using `@option` with certain annotations and along with
150175
`channel_types`. ([#2835](https://github.com/Pycord-Development/pycord/pull/2835))
176+
- Fixed `TypeError` when using `Optional[...]` or `... | None` in command option type.
177+
([#2852](https://github.com/Pycord-Development/pycord/pull/2852))
178+
- Fixed type-hinting for `PermissionOverwrite.update`.
179+
([#2878](https://github.com/Pycord-Development/pycord/pull/2878))
151180
- Fixed `AttributeError` when accessing `AuditLogEntry.changes` more than once.
152181
([#2882])(https://github.com/Pycord-Development/pycord/pull/2882))
182+
- Fixed type hint for argument `start_time` and `end_time` of
183+
`Guild.create_scheduled_event`
184+
([#2879](https://github.com/Pycord-Development/pycord/pull/2879))
153185

154186
### Changed
155187

@@ -182,6 +214,8 @@ These changes are available on the `master` branch, but have not yet been releas
182214
([#2501](https://github.com/Pycord-Development/pycord/pull/2501))
183215
- Deprecated `Interaction.cached_channel` in favor of `Interaction.channel`.
184216
([#2658](https://github.com/Pycord-Development/pycord/pull/2658))
217+
- Deprecated `is_nsfw` for categories since it was never supported by the API.
218+
([#2772](https://github.com/Pycord-Development/pycord/pull/2772))
185219
- Deprecated `Messageable.pins()` returning a list of `Message`; it should be used as an
186220
iterator of `MessagePin` instead.
187221
([#2872](https://github.com/Pycord-Development/pycord/pull/2872))
@@ -1094,7 +1128,8 @@ These changes are available on the `master` branch, but have not yet been releas
10941128
- Fix py3.10 UnionType checks issue.
10951129
([#1240](https://github.com/Pycord-Development/pycord/pull/1240))
10961130

1097-
[unreleased]: https://github.com/Pycord-Development/pycord/compare/v2.6.1...HEAD
1131+
[unreleased]: https://github.com/Pycord-Development/pycord/compare/v2.7.0rc1...HEAD
1132+
[2.7.0rc1]: https://github.com/Pycord-Development/pycord/compare/v2.6.0...v2.7.0rc1
10981133
[2.6.1]: https://github.com/Pycord-Development/pycord/compare/v2.6.0...v2.6.1
10991134
[2.6.0]: https://github.com/Pycord-Development/pycord/compare/v2.5.0...v2.6.0
11001135
[2.5.0]: https://github.com/Pycord-Development/pycord/compare/v2.4.1...v2.5.0

discord/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
from .role import *
6666
from .scheduled_events import *
6767
from .shard import *
68+
from .soundboard import *
6869
from .stage_instance import *
6970
from .sticker import *
7071
from .team import *

discord/asset.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,18 @@ def _from_cover_image(cls, state, object_id: int, cover_image_hash: str) -> Asse
274274
animated=False,
275275
)
276276

277+
@classmethod
278+
def _from_collectible(
279+
cls, state: ConnectionState, asset: str, animated: bool = False
280+
) -> Asset:
281+
name = "static.png" if not animated else "asset.webm"
282+
return cls(
283+
state,
284+
url=f"{cls.BASE}/assets/collectibles/{asset}{name}",
285+
key=asset,
286+
animated=animated,
287+
)
288+
277289
@classmethod
278290
def _from_guild_image(cls, state, guild_id: int, image: str, path: str) -> Asset:
279291
animated = False
@@ -331,6 +343,14 @@ def _from_scheduled_event_image(
331343
animated=False,
332344
)
333345

346+
@classmethod
347+
def _from_soundboard_sound(cls, state, sound_id: int) -> Asset:
348+
return cls(
349+
state,
350+
url=f"{cls.BASE}/soundboard-sounds/{sound_id}",
351+
key=str(sound_id),
352+
)
353+
334354
def __str__(self) -> str:
335355
return self._url
336356

0 commit comments

Comments
 (0)