Skip to content

Commit c2db9a4

Browse files
authored
Merge branch 'master' into unittest
2 parents e59a535 + 4584bec commit c2db9a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1771
-328
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@
2020
- [ ] If code changes were made then they have been tested.
2121
- [ ] I have updated the documentation to reflect the changes.
2222
- [ ] If `type: ignore` comments were used, a comment is also left explaining why.
23+
- [ ] I have updated the changelog to include these changes.

.pre-commit-config.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repos:
88
- id: trailing-whitespace
99
- id: end-of-file-fixer
1010
- repo: https://github.com/PyCQA/autoflake
11-
rev: v2.0.0
11+
rev: v2.0.2
1212
hooks:
1313
- id: autoflake
1414
# args:
@@ -23,14 +23,13 @@ repos:
2323
- id: pyupgrade
2424
args: [--py38-plus]
2525
- repo: https://github.com/PyCQA/isort
26-
rev: 5.11.4
26+
rev: 5.12.0
2727
hooks:
2828
- id: isort
2929
- repo: https://github.com/psf/black
30-
rev: 22.12.0
30+
rev: 23.3.0
3131
hooks:
3232
- id: black
33-
# See https://github.com/psf/black/issues/2188#issuecomment-1289317647 for why we can't use the --preview flag.
3433
args: [--safe, --quiet]
3534
- repo: https://github.com/Pierre-Sassoulas/black-disable-checker
3635
rev: v1.1.3
@@ -77,7 +76,7 @@ repos:
7776
# - id: mypy
7877

7978
- repo: https://github.com/pre-commit/mirrors-prettier
80-
rev: v3.0.0-alpha.4
79+
rev: v3.0.0-alpha.6
8180
hooks:
8281
- id: prettier
8382
args: [--prose-wrap=always, --print-width=88]

CHANGELOG.md

Lines changed: 96 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,116 @@ These changes are available on the `master` branch, but have not yet been releas
1212

1313
### Added
1414

15+
- Added new events `on_bridge_command`, `on_bridge_command_completion`, and
16+
`on_bridge_command_error`.
17+
([#1916](https://github.com/Pycord-Development/pycord/pull/1916))
18+
- Added the `@client.once()` decorator, which serves as a one-time event listener.
19+
([#1940](https://github.com/Pycord-Development/pycord/pull/1940))
20+
- Added support for text-related features in `StageChannel`.
21+
([#1936](https://github.com/Pycord-Development/pycord/pull/1936))
22+
- Added support for one-time event listeners in `@client.listen()`.
23+
([#1957](https://github.com/Pycord-Development/pycord/pull/1957))
24+
- Added `current_page` argument to Paginator.update().
25+
([#1983](https://github.com/Pycord-Development/pycord/pull/1983))
26+
- Added new `application_auto_moderation_rule_create_badge` to `ApplicationFlags`.
27+
([#1992](https://github.com/Pycord-Development/pycord/pull/1992))
28+
29+
### Changed
30+
31+
- Changed file-upload size limit from 8 MB to 25 MB accordingly.
32+
([#2014](https://github.com/Pycord-Development/pycord/pull/2014))
33+
34+
### Removed
35+
36+
- Removed `@client.once()` in favour of `@client.listen(once=True)`.
37+
([#1957](https://github.com/Pycord-Development/pycord/pull/1957))
38+
39+
### Fixed
40+
41+
- Fixed `AttributeError` caused by
42+
[#1957](https://github.com/Pycord-Development/pycord/pull/1957) when using listeners
43+
in cogs. ([#1989](https://github.com/Pycord-Development/pycord/pull/1989))
44+
- Fixed `None` being handled incorrectly for avatar in `ClientUser.edit`.
45+
([#1994](https://github.com/Pycord-Development/pycord/pull/1994))
46+
- Fixed scheduled events breaking when changing the location from external to a channel.
47+
([#1998](https://github.com/Pycord-Development/pycord/pull/1998))
48+
- Fixed boolean converter breaking for bridge commands. Fix bridge command Options not
49+
working. ([#1999](https://github.com/Pycord-Development/pycord/pull/1999))
50+
- Fixed `TypeError` being raised when passing `name` argument to bridge groups.
51+
([#2000](https://github.com/Pycord-Development/pycord/pull/2000))
52+
53+
## [2.4.1] - 2023-03-20
54+
55+
### Changed
56+
57+
- Updated the values of the `Color.embed_background()` classmethod to correspond with
58+
new theme colors in the app.
59+
([#1931](https://github.com/Pycord-Development/pycord/pull/1931))
60+
61+
### Fixed
62+
63+
- Fixed the type-hinting of `SlashCommandGroup.walk_commands()` to reflect actual
64+
behavior. ([#1838](https://github.com/Pycord-Development/pycord/pull/1838))
65+
- Fixed the voice ip discovery due to the recent
66+
[announced change](https://discord.com/channels/613425648685547541/697138785317814292/1080623873629884486).
67+
([#1955](https://github.com/Pycord-Development/pycord/pull/1955))
68+
- Fixed `reason` being passed to wrong method in `guild.create_auto_moderation_rule`.
69+
([#1960](https://github.com/Pycord-Development/pycord/pull/1960))
70+
71+
## [2.4.0] - 2023-02-10
72+
73+
### Added
74+
1575
- Added new AutoMod trigger metadata properties `regex_patterns`, `allow_list`, and
1676
`mention_total_limit`; and added the `mention_spam` trigger type.
1777
([#1809](https://github.com/Pycord-Development/pycord/pull/1809))
1878
- Added missing `image` parameter to `Guild.create_scheduled_event()` method.
1979
([#1831](https://github.com/Pycord-Development/pycord/pull/1831))
20-
- Added new message types, `interaction_premium_upsell`, `stage_start`, `stage_end`,
21-
`stage_speaker`, `stage_raise_hand`, `stage_topic`, and
80+
- New `ApplicationRoleConnectionMetadata` class for application role connection
81+
metadata, along with the `fetch_role_connection_metadata_records` and
82+
`update_role_connection_metadata_records` methods in `Client`.
83+
([#1791](https://github.com/Pycord-Development/pycord/pull/1791))
84+
- Added new message types, `role_subscription_purchase`, `interaction_premium_upsell`,
85+
`stage_start`, `stage_end`, `stage_speaker`, `stage_raise_hand`, `stage_topic`, and
2286
`guild_application_premium_subscription`.
2387
([#1852](https://github.com/Pycord-Development/pycord/pull/1852))
2488
- Added new `EmbeddedActivity` values.
2589
([#1859](https://github.com/Pycord-Development/pycord/pull/1859))
90+
- Added new `suppress_notifications` to `MessageFlags`.
91+
([#1912](https://github.com/Pycord-Development/pycord/pull/1912))
92+
- Added GIF sticker format type to the `StickerFormatType` enum.
93+
([#1915](https://github.com/Pycord-Development/pycord/pull/1915))
94+
- Added new raw events: `raw_member_remove`, `raw_thread_update`, and
95+
`raw_thread_member_remove`.
96+
([#1880](https://github.com/Pycord-Development/pycord/pull/1880))
97+
- Improved support for setting channel types & added new channel types for
98+
`discord.Option`. ([#1883](https://github.com/Pycord-Development/pycord/pull/1883))
2699

27100
### Changed
28101

29102
- Changed `EmbeddedActivity` values to update accordingly with the new activities.
30103
([#1859](https://github.com/Pycord-Development/pycord/pull/1859))
104+
- Advanced version info is now stored as a dict in `version_info.advanced` instead of
105+
attributes on the `version_info` object.
106+
([#1920](https://github.com/Pycord-Development/pycord/pull/1920))
107+
- The `version_info.release_level` attribute has been reverted to its previous name,
108+
`releaselevel`. ([#1920](https://github.com/Pycord-Development/pycord/pull/1920))
31109

32110
### Fixed
33111

34-
- Fixed a bug in `Page.update_files` where file objects stored in memory were causing an
35-
`AttributeError`. ([#1869](https://github.com/Pycord-Development/pycord/pull/1869))
36-
37-
## [2.3.2] - 2022-12-03
38-
39-
### Fixed
40-
112+
- Fixed bugs in `Page.update_files` where file objects stored in memory were causing an
113+
`AttributeError`, and `io.BytesIO` files didn't send properly more than once.
114+
([#1869](https://github.com/Pycord-Development/pycord/pull/1869) &
115+
[#1881](https://github.com/Pycord-Development/pycord/pull/1881))
41116
- Fixed bridge groups missing the `parent` attribute.
42117
([#1823](https://github.com/Pycord-Development/pycord/pull/1823))
118+
- Fixed issues with creating auto moderation rules.
119+
([#1822](https://github.com/Pycord-Development/pycord/pull/1822))
120+
121+
## [2.3.3] - 2023-02-10
122+
123+
- Fixed an unhandled `KeyError` exception when receiving GIF stickers, causing crashes.
124+
([#1915](https://github.com/Pycord-Development/pycord/pull/1915))
43125

44126
## [2.3.2] - 2022-12-03
45127

@@ -99,6 +181,7 @@ These changes are available on the `master` branch, but have not yet been releas
99181
([#1678](https://github.com/Pycord-Development/pycord/pull/1678))
100182
- `get_application_command()` now supports retrieving subcommands and subcommand groups.
101183
([#1678](https://github.com/Pycord-Development/pycord/pull/1678))
184+
-
102185

103186
### Removed
104187

@@ -494,7 +577,10 @@ These changes are available on the `master` branch, but have not yet been releas
494577
- Fix py3.10 UnionType checks issue.
495578
([#1240](https://github.com/Pycord-Development/pycord/pull/1240))
496579

497-
[unreleased]: https://github.com/Pycord-Development/pycord/compare/v2.3.2...HEAD
580+
[unreleased]: https://github.com/Pycord-Development/pycord/compare/v2.4.1...HEAD
581+
[2.4.1]: https://github.com/Pycord-Development/pycord/compare/v2.4.0...v2.4.1
582+
[2.4.0]: https://github.com/Pycord-Development/pycord/compare/v2.3.3...v2.4.0
583+
[2.3.3]: https://github.com/Pycord-Development/pycord/compare/v2.3.2...v2.3.3
498584
[2.3.2]: https://github.com/Pycord-Development/pycord/compare/v2.3.1...v2.3.2
499585
[2.3.1]: https://github.com/Pycord-Development/pycord/compare/v2.3.0...v2.3.1
500586
[2.3.0]: https://github.com/Pycord-Development/pycord/compare/v2.2.2...v2.3.0

discord/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from . import abc, opus, sinks, ui, utils
2828
from .activity import *
2929
from .appinfo import *
30+
from .application_role_connection import *
3031
from .asset import *
3132
from .audit_logs import *
3233
from .automod import *

discord/_version.py

Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424
"""
2525
from __future__ import annotations
2626

27+
import datetime
2728
import re
2829
import warnings
29-
from datetime import date
3030
from importlib.metadata import PackageNotFoundError, version
3131

32+
from ._typed_dict import TypedDict
33+
3234
__all__ = ("__version__", "VersionInfo", "version_info")
3335

3436
from typing import Literal, NamedTuple
@@ -47,27 +49,63 @@
4749
# setuptools_scm is not installed
4850
__version__ = "0.0.0"
4951
warnings.warn(
50-
"Package is not installed, and setuptools_scm is not installed. "
51-
f"As a fallback, {__name__}.__version__ will be set to {__version__}",
52+
(
53+
"Package is not installed, and setuptools_scm is not installed. "
54+
f"As a fallback, {__name__}.__version__ will be set to {__version__}"
55+
),
5256
RuntimeWarning,
5357
stacklevel=2,
5458
)
5559

5660

61+
class AdvancedVersionInfo(TypedDict):
62+
serial: int
63+
build: int | None
64+
commit: str | None
65+
date: datetime.date | None
66+
67+
5768
class VersionInfo(NamedTuple):
5869
major: int
5970
minor: int
6071
micro: int
61-
release_level: Literal["alpha", "beta", "candidate", "final"]
62-
serial: int
63-
build: int | None = None
64-
commit: str | None = None
65-
date: date | None = None
72+
releaselevel: Literal["alpha", "beta", "candidate", "final"]
73+
74+
# We can't set instance attributes on a NamedTuple, so we have to use a
75+
# global variable to store the advanced version info.
76+
@property
77+
def advanced(self) -> AdvancedVersionInfo:
78+
return _advanced
79+
80+
@advanced.setter
81+
def advanced(self, value: object) -> None:
82+
global _advanced
83+
_advanced = value
84+
85+
@property
86+
@deprecated("releaselevel", "2.4")
87+
def release_level(self) -> Literal["alpha", "beta", "candidate", "final"]:
88+
return self.releaselevel
6689

6790
@property
68-
@deprecated("release_level", "2.3")
69-
def releaselevel(self) -> Literal["alpha", "beta", "candidate", "final"]:
70-
return self.release_level
91+
@deprecated('.advanced["serial"]', "2.4")
92+
def serial(self) -> int:
93+
return self.advanced["serial"]
94+
95+
@property
96+
@deprecated('.advanced["build"]', "2.4")
97+
def build(self) -> int | None:
98+
return self.advanced["build"]
99+
100+
@property
101+
@deprecated('.advanced["commit"]', "2.4")
102+
def commit(self) -> str | None:
103+
return self.advanced["commit"]
104+
105+
@property
106+
@deprecated('.advanced["date"]', "2.4")
107+
def date(self) -> datetime.date | None:
108+
return self.advanced["date"]
71109

72110

73111
version_regex = re.compile(
@@ -95,7 +133,7 @@ def releaselevel(self) -> Literal["alpha", "beta", "candidate", "final"]:
95133
raise RuntimeError("Invalid release level")
96134

97135
if (raw_date := raw_info["date"] or raw_info["date1"]) is not None:
98-
date_info = date(
136+
date_info = datetime.date(
99137
int(raw_date[:4]),
100138
int(raw_date[4:6]),
101139
int(raw_date[6:]),
@@ -107,7 +145,10 @@ def releaselevel(self) -> Literal["alpha", "beta", "candidate", "final"]:
107145
major=int(raw_info["major"] or 0) or None,
108146
minor=int(raw_info["minor"] or 0) or None,
109147
micro=int(raw_info["patch"] or 0) or None,
110-
release_level=level_info,
148+
releaselevel=level_info,
149+
)
150+
151+
_advanced = AdvancedVersionInfo(
111152
serial=raw_info["serial"],
112153
build=int(raw_info["build"] or 0) or None,
113154
commit=raw_info["commit"],

0 commit comments

Comments
 (0)