diff --git a/discord/calls.py b/discord/calls.py index 4ff671601..6c3254e23 100644 --- a/discord/calls.py +++ b/discord/calls.py @@ -23,7 +23,7 @@ DEALINGS IN THE SOFTWARE. """ import datetime -from typing import List, Optional, TYPE_CHECKING +from typing import List, Optional, TYPE_CHECKING, Union from . import utils from .enums import VoiceRegion, try_enum @@ -313,3 +313,6 @@ class GroupCall(PrivateCall): @_running_only async def stop_ringing(self, *recipients) -> None: await self._state.http.stop_ringing(self._channel_id, *{r.id for r in recipients}) + + +Call = Union[PrivateCall, GroupCall] diff --git a/discord/guild_folder.py b/discord/guild_folder.py index 2031295b0..860b64b71 100644 --- a/discord/guild_folder.py +++ b/discord/guild_folder.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """ The MIT License (MIT) @@ -24,6 +22,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ +from __future__ import annotations + from typing import List, Optional, TYPE_CHECKING from .colour import Colour @@ -33,6 +33,8 @@ if TYPE_CHECKING: from .state import ConnectionState from .types.snowflake import Snowflake +__all__ = ('GuildFolder',) + class GuildFolder: __slots__ = ('_state', 'id', 'name', '_colour', 'guilds') diff --git a/discord/settings.py b/discord/settings.py index c9abdee4c..359a53eb1 100644 --- a/discord/settings.py +++ b/discord/settings.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """ The MIT License (MIT) @@ -24,6 +22,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ +from __future__ import annotations + from typing import Any, Dict, List, Optional, TYPE_CHECKING from .enums import FriendFlags, StickerAnimationOptions, Theme, UserContentFilter, try_enum @@ -33,8 +33,10 @@ if TYPE_CHECKING: from .guild import Guild from .state import ConnectionState +__all__ = ('UserSettings',) + -class Settings: +class UserSettings: """Represents the Discord client settings. Attributes diff --git a/discord/tracking.py b/discord/tracking.py index b60e33c52..2e0297093 100644 --- a/discord/tracking.py +++ b/discord/tracking.py @@ -31,9 +31,7 @@ from typing import Any, Dict, Optional from .types.snowflake import Snowflake -__all__ = ( - 'ContextProperties', -) +__all__ = ('ContextProperties',) class ContextProperties: # Thank you Discord-S.C.U.M diff --git a/discord/user.py b/discord/user.py index b1db6d003..0c9db2f9e 100644 --- a/discord/user.py +++ b/discord/user.py @@ -36,13 +36,13 @@ from .errors import ClientException, NotFound from .flags import PublicUserFlags from .object import Object from .relationship import Relationship -from .settings import Settings +from .settings import UserSettings from .utils import _bytes_to_base64_data, cached_slot_property, parse_time, snowflake_time, MISSING if TYPE_CHECKING: from datetime import datetime - from .call import Call + from .calls import PrivateCall from .channel import DMChannel from .guild import Guild from .member import VoiceState @@ -664,8 +664,8 @@ class ClientUser(BaseUser): return [r.user for r in self._state._relationships.values() if r.type is RelationshipType.blocked] @property - def settings(self) -> Optional[Settings]: - """Optional[:class:`Settings`]: Returns the user's settings.""" + def settings(self) -> Optional[UserSettings]: + """Optional[:class:`UserSettings`]: Returns the user's settings.""" return self._state.settings async def edit( @@ -810,7 +810,7 @@ class ClientUser(BaseUser): return ClientUser(state=self._state, data=data) - async def fetch_settings(self) -> Settings: + async def fetch_settings(self) -> UserSettings: """|coro| Retrieves your settings. @@ -826,13 +826,13 @@ class ClientUser(BaseUser): Returns -------- - :class:`Settings` + :class:`UserSettings` The current settings for your account. """ data = await self._state.http.get_settings() - return Settings(data=data, state=self._state) + return UserSettings(data=data, state=self._state) - async def edit_settings(self, **kwargs) -> Settings: # TODO: I really wish I didn't have to do this... + async def edit_settings(self, **kwargs) -> UserSettings: # TODO: I really wish I didn't have to do this... """|coro| Edits the client user's settings. @@ -910,7 +910,7 @@ class ClientUser(BaseUser): Returns ------- - :class:`.Settings` + :class:`.UserSettings` The client user's updated settings. """ payload = {} @@ -949,7 +949,7 @@ class ClientUser(BaseUser): state = self._state data = await state.http.edit_settings(**payload) - state.settings = settings = Settings(data=data, state=self._state) + state.settings = settings = UserSettings(data=data, state=self._state) return settings @@ -1030,7 +1030,7 @@ class User(BaseUser, discord.abc.Connectable, discord.abc.Messageable): return self._state._get_private_channel_by_user(self.id) @property - def call(self) -> Optional[Call]: + def call(self) -> Optional[PrivateCall]: return getattr(self.dm_channel, 'call', None) @property