Skip to content

Commit 395ca7f

Browse files
committed
Merge branch 'master' into features/voice-receive
2 parents 3ba05a2 + 5c41bb0 commit 395ca7f

32 files changed

+642
-1055
lines changed

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: [ '3.10' ]
10+
python-version: [ 3.8 ]
1111
steps:
1212
- uses: actions/checkout@v2
1313
- name: Set up Python ${{ matrix.python-version }}
@@ -17,7 +17,7 @@ jobs:
1717
- name: Install dependencies
1818
run: |
1919
python -m pip install -U pip
20-
pip install -U sphinx sphinxcontrib-trio aiohttp sphinxcontrib-websupport myst-parser typing-extensions
20+
pip install -U sphinx sphinxcontrib-trio aiohttp sphinxcontrib-websupport myst-parser
2121
- name: Compile to html
2222
run: |
2323
cd docs

discord/__init__.py

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,57 +13,57 @@
1313
__author__ = 'Pycord Development'
1414
__license__ = 'MIT'
1515
__copyright__ = 'Copyright 2015-2021 Rapptz & Copyright 2021-present Pycord Development'
16-
__version__ = '2.0.0-rc.1'
16+
__version__ = '2.0.0b1'
1717

1818
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
1919

2020
import logging
2121
from typing import NamedTuple, Literal
2222

23-
from .client import *
24-
from .appinfo import *
25-
from .user import *
26-
from .emoji import *
27-
from .partial_emoji import *
23+
from . import utils, opus, abc, ui, sinks
2824
from .activity import *
29-
from .channel import *
30-
from .guild import *
31-
from .flags import *
32-
from .member import *
33-
from .message import *
25+
from .appinfo import *
3426
from .asset import *
27+
from .audit_logs import *
28+
from .bot import *
29+
from .channel import *
30+
from .client import *
31+
from .cog import Cog
32+
from .colour import *
33+
from .commands.__init__ import *
34+
from .components import *
35+
from .embeds import *
36+
from .emoji import *
37+
from .enums import *
3538
from .errors import *
36-
from .permissions import *
37-
from .role import *
3839
from .file import *
39-
from .colour import *
40+
from .flags import *
41+
from .guild import *
4042
from .integrations import *
43+
from .interactions import *
4144
from .invite import *
42-
from .template import *
43-
from .widget import *
44-
from .object import *
45-
from .reaction import *
46-
from . import utils, opus, abc, ui, sinks
47-
from .enums import *
48-
from .embeds import *
45+
from .member import *
4946
from .mentions import *
50-
from .shard import *
47+
from .message import *
48+
from .object import *
49+
from .partial_emoji import *
50+
from .permissions import *
5151
from .player import *
52-
from .webhook import *
53-
from .voice_client import *
54-
from .audit_logs import *
5552
from .raw_models import *
56-
from .team import *
57-
from .sticker import *
53+
from .reaction import *
54+
from .role import *
55+
from .scheduled_events import ScheduledEvent, ScheduledEventLocation
56+
from .shard import *
5857
from .stage_instance import *
59-
from .interactions import *
60-
from .components import *
58+
from .sticker import *
59+
from .team import *
60+
from .template import *
6161
from .threads import *
62-
from .bot import *
63-
from .commands.__init__ import *
64-
from .cog import Cog
62+
from .user import *
63+
from .voice_client import *
64+
from .webhook import *
6565
from .welcome_screen import *
66-
from .scheduled_events import ScheduledEvent, ScheduledEventLocation
66+
from .widget import *
6767

6868

6969
class VersionInfo(NamedTuple):
@@ -74,6 +74,6 @@ class VersionInfo(NamedTuple):
7474
serial: int
7575

7676

77-
version_info: VersionInfo = VersionInfo(major=2, minor=0, micro=0, releaselevel='candidate', serial=1)
77+
version_info: VersionInfo = VersionInfo(major=2, minor=0, micro=0, releaselevel='beta', serial=1)
7878

7979
logging.getLogger(__name__).addHandler(logging.NullHandler())

discord/asset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,11 @@ def __str__(self) -> str:
268268
def __len__(self) -> int:
269269
return len(self._url)
270270

271-
def __repr__(self) -> str:
271+
def __repr__(self):
272272
shorten = self._url.replace(self.BASE, '')
273273
return f'<Asset url={shorten!r}>'
274274

275-
def __eq__(self, other) -> bool:
275+
def __eq__(self, other):
276276
return isinstance(other, Asset) and self._url == other._url
277277

278278
def __hash__(self):

discord/bot.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
Type,
4141
TypeVar,
4242
Union,
43-
Type,
4443
)
4544

4645
from .client import Client
@@ -90,6 +89,10 @@ def __init__(self, *args, **kwargs) -> None:
9089
self._pending_application_commands = []
9190
self._application_commands = {}
9291

92+
@property
93+
def all_commands(self):
94+
return self._application_commands
95+
9396
@property
9497
def pending_application_commands(self):
9598
return self._pending_application_commands
@@ -150,7 +153,14 @@ def remove_application_command(
150153
The command that was removed. If the name is not valid then
151154
``None`` is returned instead.
152155
"""
153-
return self._application_commands.pop(command.id)
156+
if command.id is None:
157+
try:
158+
index = self._pending_application_commands.index(command)
159+
except ValueError:
160+
return None
161+
return self._pending_application_commands.pop(index)
162+
163+
return self._application_commands.pop(int(command.id), None)
154164

155165
@property
156166
def get_command(self):

discord/cog.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ def get_commands(self) -> List[ApplicationCommand]:
251251
This does not include subcommands.
252252
"""
253253
return [c for c in self.__cog_commands__ if isinstance(c, ApplicationCommand) and c.parent is None]
254+
254255
@property
255256
def qualified_name(self) -> str:
256257
""":class:`str`: Returns the cog's specified name, not the class name."""
@@ -611,11 +612,17 @@ def _remove_module_references(self, name: str) -> None:
611612
self.remove_cog(cogname)
612613

613614
# remove all the commands from the module
614-
for cmd in self.all_commands.copy().values():
615+
if self._supports_prefixed_commands:
616+
for cmd in self.prefixed_commands.copy().values():
617+
if cmd.module is not None and _is_submodule(name, cmd.module):
618+
# if isinstance(cmd, GroupMixin):
619+
# cmd.recursively_remove_all_commands()
620+
self.remove_command(cmd.name)
621+
for cmd in self._application_commands.copy().values():
615622
if cmd.module is not None and _is_submodule(name, cmd.module):
616623
# if isinstance(cmd, GroupMixin):
617624
# cmd.recursively_remove_all_commands()
618-
self.remove_command(cmd.name)
625+
self.remove_application_command(cmd)
619626

620627
# remove all the listeners from the module
621628
for event_list in self.extra_events.copy().values():

discord/commands/_types.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)