Browse Source

Change type to be compatible with the overwrites property

pull/7297/head
PythonCoderAS 4 years ago
committed by GitHub
parent
commit
51b02f2568
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      discord/abc.py
  2. 32
      discord/channel.py

4
discord/abc.py

@ -475,7 +475,7 @@ class GuildChannel:
return PermissionOverwrite() return PermissionOverwrite()
@property @property
def overwrites(self) -> Mapping[Union[Role, Member], PermissionOverwrite]: def overwrites(self) -> Dict[Union[Role, Member], PermissionOverwrite]:
"""Returns all of the channel's overwrites. """Returns all of the channel's overwrites.
This is returned as a dictionary where the key contains the target which This is returned as a dictionary where the key contains the target which
@ -484,7 +484,7 @@ class GuildChannel:
Returns Returns
-------- --------
Mapping[Union[:class:`~discord.Role`, :class:`~discord.Member`], :class:`~discord.PermissionOverwrite`] Dict[Union[:class:`~discord.Role`, :class:`~discord.Member`], :class:`~discord.PermissionOverwrite`]
The channel's permission overwrites. The channel's permission overwrites.
""" """
ret = {} ret = {}

32
discord/channel.py

@ -26,7 +26,7 @@ from __future__ import annotations
import time import time
import asyncio import asyncio
from typing import Any, Callable, Dict, Iterable, List, Optional, TYPE_CHECKING, Tuple, Type, TypeVar, Union, overload from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, TYPE_CHECKING, Tuple, Type, TypeVar, Union, overload
import datetime import datetime
import discord.abc import discord.abc
@ -251,7 +251,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
category: Optional[CategoryChannel] = ..., category: Optional[CategoryChannel] = ...,
slowmode_delay: int = ..., slowmode_delay: int = ...,
type: ChannelType = ..., type: ChannelType = ...,
overwrites: Dict[Union[Role, Member, Snowflake], PermissionOverwrite] = ..., overwrites: Mapping[Union[Role, Member, Snowflake], PermissionOverwrite] = ...,
) -> None: ) -> None:
... ...
@ -298,8 +298,8 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
is only available to guilds that contain ``NEWS`` in :attr:`Guild.features`. is only available to guilds that contain ``NEWS`` in :attr:`Guild.features`.
reason: Optional[:class:`str`] reason: Optional[:class:`str`]
The reason for editing this channel. Shows up on the audit log. The reason for editing this channel. Shows up on the audit log.
overwrites: :class:`dict` overwrites: :class:`Mapping`
A :class:`dict` of target (either a role or a member) to A :class:`Mapping` of target (either a role or a member) to
:class:`PermissionOverwrite` to apply to the channel. :class:`PermissionOverwrite` to apply to the channel.
Raises Raises
@ -939,7 +939,7 @@ class VoiceChannel(VocalGuildChannel):
position: int = ..., position: int = ...,
sync_permissions: int = ..., sync_permissions: int = ...,
category: Optional[CategoryChannel] = ..., category: Optional[CategoryChannel] = ...,
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ..., overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
rtc_region: Optional[VoiceRegion] = ..., rtc_region: Optional[VoiceRegion] = ...,
video_quality_mode: VideoQualityMode = ..., video_quality_mode: VideoQualityMode = ...,
reason: Optional[str] = ..., reason: Optional[str] = ...,
@ -979,8 +979,8 @@ class VoiceChannel(VocalGuildChannel):
category. category.
reason: Optional[:class:`str`] reason: Optional[:class:`str`]
The reason for editing this channel. Shows up on the audit log. The reason for editing this channel. Shows up on the audit log.
overwrites: :class:`dict` overwrites: :class:`Mapping`
A :class:`dict` of target (either a role or a member) to A :class:`Mapping` of target (either a role or a member) to
:class:`PermissionOverwrite` to apply to the channel. :class:`PermissionOverwrite` to apply to the channel.
rtc_region: Optional[:class:`VoiceRegion`] rtc_region: Optional[:class:`VoiceRegion`]
The new region for the voice channel's voice communication. The new region for the voice channel's voice communication.
@ -1204,7 +1204,7 @@ class StageChannel(VocalGuildChannel):
position: int = ..., position: int = ...,
sync_permissions: int = ..., sync_permissions: int = ...,
category: Optional[CategoryChannel] = ..., category: Optional[CategoryChannel] = ...,
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ..., overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
rtc_region: Optional[VoiceRegion] = ..., rtc_region: Optional[VoiceRegion] = ...,
video_quality_mode: VideoQualityMode = ..., video_quality_mode: VideoQualityMode = ...,
reason: Optional[str] = ..., reason: Optional[str] = ...,
@ -1240,8 +1240,8 @@ class StageChannel(VocalGuildChannel):
category. category.
reason: Optional[:class:`str`] reason: Optional[:class:`str`]
The reason for editing this channel. Shows up on the audit log. The reason for editing this channel. Shows up on the audit log.
overwrites: :class:`dict` overwrites: :class:`Mapping`
A :class:`dict` of target (either a role or a member) to A :class:`Mapping` of target (either a role or a member) to
:class:`PermissionOverwrite` to apply to the channel. :class:`PermissionOverwrite` to apply to the channel.
rtc_region: Optional[:class:`VoiceRegion`] rtc_region: Optional[:class:`VoiceRegion`]
The new region for the stage channel's voice communication. The new region for the stage channel's voice communication.
@ -1348,7 +1348,7 @@ class CategoryChannel(discord.abc.GuildChannel, Hashable):
name: str = ..., name: str = ...,
position: int = ..., position: int = ...,
nsfw: bool = ..., nsfw: bool = ...,
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ..., overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
reason: Optional[str] = ..., reason: Optional[str] = ...,
) -> None: ) -> None:
... ...
@ -1378,8 +1378,8 @@ class CategoryChannel(discord.abc.GuildChannel, Hashable):
To mark the category as NSFW or not. To mark the category as NSFW or not.
reason: Optional[:class:`str`] reason: Optional[:class:`str`]
The reason for editing this category. Shows up on the audit log. The reason for editing this category. Shows up on the audit log.
overwrites: :class:`dict` overwrites: :class:`Mapping`
A :class:`dict` of target (either a role or a member) to A :class:`Mapping` of target (either a role or a member) to
:class:`PermissionOverwrite` to apply to the channel. :class:`PermissionOverwrite` to apply to the channel.
Raises Raises
@ -1581,7 +1581,7 @@ class StoreChannel(discord.abc.GuildChannel, Hashable):
sync_permissions: bool = ..., sync_permissions: bool = ...,
category: Optional[CategoryChannel], category: Optional[CategoryChannel],
reason: Optional[str], reason: Optional[str],
overwrites: Dict[Union[Role, Member], PermissionOverwrite], overwrites: Mapping[Union[Role, Member], PermissionOverwrite],
) -> None: ) -> None:
... ...
@ -1613,8 +1613,8 @@ class StoreChannel(discord.abc.GuildChannel, Hashable):
category. category.
reason: Optional[:class:`str`] reason: Optional[:class:`str`]
The reason for editing this channel. Shows up on the audit log. The reason for editing this channel. Shows up on the audit log.
overwrites: :class:`dict` overwrites: :class:`Mapping`
A :class:`dict` of target (either a role or a member) to A :class:`Mapping` of target (either a role or a member) to
:class:`PermissionOverwrite` to apply to the channel. :class:`PermissionOverwrite` to apply to the channel.
.. versionadded:: 1.3 .. versionadded:: 1.3

Loading…
Cancel
Save