Skip to content

Commit def1e1a

Browse files
authored
Merge branch 'master' into unittest
2 parents 96ef126 + aa6c405 commit def1e1a

File tree

12 files changed

+56
-14
lines changed

12 files changed

+56
-14
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ ci:
33

44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: v4.3.0
6+
rev: v4.4.0
77
hooks:
88
- id: trailing-whitespace
99
- id: end-of-file-fixer
1010
- repo: https://github.com/PyCQA/autoflake
11-
rev: v1.7.7
11+
rev: v2.0.0
1212
hooks:
1313
- id: autoflake
1414
# args:

CHANGELOG.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ 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+
_No changes yet_
14+
15+
## [2.3.1] - 2022-11-27
16+
17+
### Fixed
18+
19+
- Fixed `AttributeError` relating to the new `bridge_commands` attribute on
20+
`ext.bridge.Bot`. ([#1802](https://github.com/Pycord-Development/pycord/pull/1802))
21+
22+
## [2.3.0] - 2022-11-23
23+
1324
### Added
1425

1526
- New brief Attribute to BridgeSlashCommand.
@@ -28,6 +39,8 @@ These changes are available on the `master` branch, but have not yet been releas
2839
([#1636](https://github.com/Pycord-Development/pycord/pull/1636))
2940
- Added `bridge_commands` attribute to `ext.bridge.Bot` for access to bridge command
3041
objects. ([#1787](https://github.com/Pycord-Development/pycord/pull/1787))
42+
- Updated `Guild.features` to include new and previously missing features.
43+
([#1788](https://github.com/Pycord-Development/pycord/pull/1788))
3144

3245
### Fixed
3346

@@ -441,7 +454,9 @@ These changes are available on the `master` branch, but have not yet been releas
441454
- Fix py3.10 UnionType checks issue.
442455
([#1240](https://github.com/Pycord-Development/pycord/pull/1240))
443456

444-
[unreleased]: https://github.com/Pycord-Development/pycord/compare/v2.2.2...HEAD
457+
[unreleased]: https://github.com/Pycord-Development/pycord/compare/v2.3.1...HEAD
458+
[2.3.1]: https://github.com/Pycord-Development/pycord/compare/v2.3.0...v2.3.1
459+
[2.3.0]: https://github.com/Pycord-Development/pycord/compare/v2.2.2...v2.3.0
445460
[2.2.2]: https://github.com/Pycord-Development/pycord/compare/v2.2.1...v2.2.2
446461
[2.2.1]: https://github.com/Pycord-Development/pycord/compare/v2.2.0...v2.2.1
447462
[2.2.0]: https://github.com/Pycord-Development/pycord/compare/v2.1.3...v2.2.0

discord/cog.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ def __new__(cls: type[CogMeta], *args: Any, **kwargs: Any) -> CogMeta:
199199

200200
commands[f"ext_{elem}"] = value.ext_variant
201201
commands[f"app_{elem}"] = value.slash_variant
202+
commands[elem] = value
202203
for cmd in getattr(value, "subcommands", []):
203204
commands[
204205
f"ext_{cmd.ext_variant.qualified_name}"
@@ -229,9 +230,13 @@ def __new__(cls: type[CogMeta], *args: Any, **kwargs: Any) -> CogMeta:
229230

230231
# Either update the command with the cog provided defaults or copy it.
231232
# r.e type ignore, type-checker complains about overriding a ClassVar
232-
new_cls.__cog_commands__ = tuple(c._update_copy(cmd_attrs) for c in new_cls.__cog_commands__) # type: ignore
233+
new_cls.__cog_commands__ = tuple(c._update_copy(cmd_attrs) if not hasattr(c, "add_to") else c for c in new_cls.__cog_commands__) # type: ignore
233234

234-
name_filter = lambda c: "app" if isinstance(c, ApplicationCommand) else "ext"
235+
name_filter = (
236+
lambda c: "app"
237+
if isinstance(c, ApplicationCommand)
238+
else ("bridge" if not hasattr(c, "add_to") else "ext")
239+
)
235240

236241
lookup = {
237242
f"{name_filter(cmd)}_{cmd.qualified_name}": cmd
@@ -247,7 +252,9 @@ def __new__(cls: type[CogMeta], *args: Any, **kwargs: Any) -> CogMeta:
247252
):
248253
command.guild_ids = new_cls.__cog_guild_ids__
249254

250-
if not isinstance(command, SlashCommandGroup):
255+
if not isinstance(command, SlashCommandGroup) and not hasattr(
256+
command, "add_to"
257+
):
251258
# ignore bridge commands
252259
cmd = getattr(new_cls, command.callback.__name__, None)
253260
if hasattr(cmd, "add_to"):
@@ -534,6 +541,10 @@ def _inject(self: CogT, bot) -> CogT:
534541
# we've added so far for some form of atomic loading.
535542

536543
for index, command in enumerate(self.__cog_commands__):
544+
if hasattr(command, "add_to"):
545+
bot._bridge_commands.append(command)
546+
continue
547+
537548
command._set_cog(self)
538549

539550
if isinstance(command, ApplicationCommand):

discord/ext/bridge/bot.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class BotBase(ABC):
4444
def bridge_commands(self) -> list[BridgeCommand | BridgeCommandGroup]:
4545
"""Returns all of the bot's bridge commands."""
4646

47-
if cmds := getattr(self, "_bridge_commands", []):
47+
if not (cmds := getattr(self, "_bridge_commands", None)):
4848
self._bridge_commands = cmds = []
4949

5050
return cmds
@@ -73,6 +73,10 @@ def add_bridge_command(self, command: BridgeCommand):
7373
"""
7474
# Ignore the type hinting error here. All subclasses of BotBase pass the type checks.
7575
command.add_to(self) # type: ignore
76+
77+
if getattr(self, "_bridge_commands", None) is None:
78+
self._bridge_commands = []
79+
7680
self._bridge_commands.append(command)
7781

7882
def bridge_command(self, **kwargs):

discord/ext/bridge/core.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ def description_localizations(self) -> dict[str, str]:
191191
def description_localizations(self, value):
192192
self.slash_variant.description_localizations = value
193193

194+
@property
195+
def qualified_name(self) -> str:
196+
return self.slash_variant.qualified_name
197+
194198
def add_to(self, bot: ExtBot) -> None:
195199
"""Adds the command to a bot. This method is inherited by :class:`.BridgeCommandGroup`.
196200

discord/guild.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,17 +208,20 @@ class Guild(Hashable):
208208
209209
- ``ANIMATED_BANNER``: Guild can upload an animated banner.
210210
- ``ANIMATED_ICON``: Guild can upload an animated icon.
211+
- ``APPLICATION_COMMAND_PERMISSIONS_V2``: Guild is using the old command permissions behavior.
211212
- ``AUTO_MODERATION``: Guild has enabled the auto moderation system.
212213
- ``BANNER``: Guild can upload and use a banner. (i.e. :attr:`.banner`)
213214
- ``CHANNEL_BANNER``: Guild can upload and use a channel banners.
214215
- ``COMMERCE``: Guild can sell things using store channels, which have now been removed.
215216
- ``COMMUNITY``: Guild is a community server.
217+
- ``DEVELOPER_SUPPORT_SERVER``: Guild has been set as a support server on the App Directory.
216218
- ``DISCOVERABLE``: Guild shows up in Server Discovery.
219+
- ``FEATURABLE``: Guild can be featured in the Server Directory.
217220
- ``HAS_DIRECTORY_ENTRY``: Unknown.
218221
- ``HUB``: Hubs contain a directory channel that let you find school-related, student-run servers for your school or university.
219222
- ``INTERNAL_EMPLOYEE_ONLY``: Indicates that only users with the staff badge can join the guild.
220-
- ``INVITE_SPLASH``: Guild's invite page can have a special splash.
221223
- ``INVITES_DISABLED``: Guild Invites are disabled.
224+
- ``INVITE_SPLASH``: Guild's invite page can have a special splash.
222225
- ``LINKED_TO_HUB``: 'Guild is linked to a hub.
223226
- ``MEMBER_PROFILES``: Unknown.
224227
- ``MEMBER_VERIFICATION_GATE_ENABLED``: Guild has Membership Screening enabled.
@@ -233,8 +236,10 @@ class Guild(Hashable):
233236
- ``ROLE_ICONS``: Guild can set an image or emoji as a role icon.
234237
- ``ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE``: Role subscriptions are available for purchasing.
235238
- ``ROLE_SUBSCRIPTIONS_ENABLED``: Guild is able to view and manage role subscriptions.
239+
- ``SEVEN_DAY_THREAD_ARCHIVE``: Users can set the thread archive time to 7 days.
236240
- ``TEXT_IN_VOICE_ENABLED``: Guild has a chat button inside voice channels that opens a dedicated text channel in a sidebar similar to thread view.
237241
- ``THREADS_ENABLED_TESTING``: Used by bot developers to test their bots with threads in guilds with 5 or fewer members and a bot. Also gives the premium thread features.
242+
- ``THREE_DAY_THREAD_ARCHIVE``: Users can set the thread archive time to 3 days.
238243
- ``TICKETED_EVENTS_ENABLED``: Guild has enabled ticketed events.
239244
- ``VANITY_URL``: Guild can have a vanity invite URL (e.g. discord.gg/discord-api).
240245
- ``VERIFIED``: Guild is a verified server.

discord/types/guild.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,19 @@ class UnavailableGuild(TypedDict):
5959
GuildFeature = Literal[
6060
"ANIMATED_BANNER",
6161
"ANIMATED_ICON",
62+
"APPLICATION_COMMAND_PERMISSIONS_V2",
6263
"AUTO_MODERATION",
6364
"BANNER",
65+
"CHANNEL_BANNER",
6466
"COMMERCE",
6567
"COMMUNITY",
68+
"DEVELOPER_SUPPORT_SERVER",
6669
"DISCOVERABLE",
6770
"FEATURABLE",
6871
"HAS_DIRECTORY_ENTRY",
6972
"HUB",
73+
"INTERNAL_EMPLOYEE_ONLY",
74+
"INVITES_DISABLED",
7075
"INVITE_SPLASH",
7176
"LINKED_TO_HUB",
7277
"MEMBER_PROFILES",

docs/api/enums.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ of :class:`enum.Enum`.
5151

5252
.. attribute:: attachment
5353

54-
An attachment. Currently in beta.
54+
An attachment.
5555

5656
.. class:: ChannelType
5757

docs/faq.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ Frequently Asked Questions
99
This is a list of Frequently Asked Questions regarding using ``Pycord`` and its extension modules. Feel free to suggest a
1010
new question or submit one via pull requests.
1111

12-
.. contents:: Questions
13-
:local:
1412

1513
Coroutines
1614
----------

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dynamic = ["version", "dependencies", "optional-dependencies"]
3434

3535
[project.urls]
3636
Homepage = "https://pycord.dev"
37-
Changelog = "https://github.com/Pycord-Development/pycord/blob/master/CHANGELOG.md"
37+
Changelog = "https://docs.pycord.dev/en/master/changelog.html"
3838
Source = "https://github.com/Pycord-Development/pycord"
3939
Documentation = "https://docs.pycord.dev"
4040
Tracker = "https://github.com/Pycord-Development/pycord/issues"

0 commit comments

Comments
 (0)