mirror of
				https://github.com/Rapptz/discord.py.git
				synced 2025-10-31 05:23:03 +00:00 
			
		
		
		
	Remove StoreChannel and any references to it
This commit is contained in:
		| @@ -46,7 +46,7 @@ from typing import ( | ||||
|  | ||||
| from .errors import AppCommandError, TransformerError | ||||
| from .models import AppCommandChannel, AppCommandThread, Choice | ||||
| from ..channel import StageChannel, StoreChannel, VoiceChannel, TextChannel, CategoryChannel | ||||
| from ..channel import StageChannel, VoiceChannel, TextChannel, CategoryChannel | ||||
| from ..enums import AppCommandOptionType, ChannelType | ||||
| from ..utils import MISSING, maybe_coroutine | ||||
| from ..user import User | ||||
| @@ -513,7 +513,6 @@ def channel_transformer(*channel_types: Type[Any], raw: Optional[bool] = False) | ||||
| CHANNEL_TO_TYPES: Dict[Any, List[ChannelType]] = { | ||||
|     AppCommandChannel: [ | ||||
|         ChannelType.stage_voice, | ||||
|         ChannelType.store, | ||||
|         ChannelType.voice, | ||||
|         ChannelType.text, | ||||
|         ChannelType.news, | ||||
| @@ -521,7 +520,6 @@ CHANNEL_TO_TYPES: Dict[Any, List[ChannelType]] = { | ||||
|     ], | ||||
|     AppCommandThread: [ChannelType.news_thread, ChannelType.private_thread, ChannelType.public_thread], | ||||
|     StageChannel: [ChannelType.stage_voice], | ||||
|     StoreChannel: [ChannelType.store], | ||||
|     VoiceChannel: [ChannelType.voice], | ||||
|     TextChannel: [ChannelType.text, ChannelType.news], | ||||
|     CategoryChannel: [ChannelType.category], | ||||
| @@ -538,7 +536,6 @@ BUILT_IN_TRANSFORMERS: Dict[Any, Type[Transformer]] = { | ||||
|     AppCommandChannel: channel_transformer(AppCommandChannel, raw=True), | ||||
|     AppCommandThread: channel_transformer(AppCommandThread, raw=True), | ||||
|     StageChannel: channel_transformer(StageChannel), | ||||
|     StoreChannel: channel_transformer(StoreChannel), | ||||
|     VoiceChannel: channel_transformer(VoiceChannel), | ||||
|     TextChannel: channel_transformer(TextChannel), | ||||
|     CategoryChannel: channel_transformer(CategoryChannel), | ||||
|   | ||||
| @@ -60,7 +60,6 @@ __all__ = ( | ||||
|     'StageChannel', | ||||
|     'DMChannel', | ||||
|     'CategoryChannel', | ||||
|     'StoreChannel', | ||||
|     'GroupChannel', | ||||
|     'PartialMessageable', | ||||
| ) | ||||
| @@ -83,7 +82,6 @@ if TYPE_CHECKING: | ||||
|         StageChannel as StageChannelPayload, | ||||
|         DMChannel as DMChannelPayload, | ||||
|         CategoryChannel as CategoryChannelPayload, | ||||
|         StoreChannel as StoreChannelPayload, | ||||
|         GroupDMChannel as GroupChannelPayload, | ||||
|     ) | ||||
|     from .types.snowflake import SnowflakeList | ||||
| @@ -1659,180 +1657,6 @@ class CategoryChannel(discord.abc.GuildChannel, Hashable): | ||||
|         return await self.guild.create_stage_channel(name, category=self, **options) | ||||
|  | ||||
|  | ||||
| class StoreChannel(discord.abc.GuildChannel, Hashable): | ||||
|     """Represents a Discord guild store channel. | ||||
|  | ||||
|     .. container:: operations | ||||
|  | ||||
|         .. describe:: x == y | ||||
|  | ||||
|             Checks if two channels are equal. | ||||
|  | ||||
|         .. describe:: x != y | ||||
|  | ||||
|             Checks if two channels are not equal. | ||||
|  | ||||
|         .. describe:: hash(x) | ||||
|  | ||||
|             Returns the channel's hash. | ||||
|  | ||||
|         .. describe:: str(x) | ||||
|  | ||||
|             Returns the channel's name. | ||||
|  | ||||
|     Attributes | ||||
|     ----------- | ||||
|     name: :class:`str` | ||||
|         The channel name. | ||||
|     guild: :class:`Guild` | ||||
|         The guild the channel belongs to. | ||||
|     id: :class:`int` | ||||
|         The channel ID. | ||||
|     category_id: :class:`int` | ||||
|         The category channel ID this channel belongs to. | ||||
|     position: :class:`int` | ||||
|         The position in the channel list. This is a number that starts at 0. e.g. the | ||||
|         top channel is position 0. | ||||
|     nsfw: :class:`bool` | ||||
|         If the channel is marked as "not safe for work". | ||||
|  | ||||
|         .. note:: | ||||
|  | ||||
|             To check if the channel or the guild of that channel are marked as NSFW, consider :meth:`is_nsfw` instead. | ||||
|     """ | ||||
|  | ||||
|     __slots__ = ( | ||||
|         'name', | ||||
|         'id', | ||||
|         'guild', | ||||
|         '_state', | ||||
|         'nsfw', | ||||
|         'category_id', | ||||
|         'position', | ||||
|         '_overwrites', | ||||
|     ) | ||||
|  | ||||
|     def __init__(self, *, state: ConnectionState, guild: Guild, data: StoreChannelPayload): | ||||
|         self._state: ConnectionState = state | ||||
|         self.id: int = int(data['id']) | ||||
|         self._update(guild, data) | ||||
|  | ||||
|     def __repr__(self) -> str: | ||||
|         return f'<StoreChannel id={self.id} name={self.name!r} position={self.position} nsfw={self.nsfw}>' | ||||
|  | ||||
|     def _update(self, guild: Guild, data: StoreChannelPayload) -> None: | ||||
|         self.guild: Guild = guild | ||||
|         self.name: str = data['name'] | ||||
|         self.category_id: Optional[int] = utils._get_as_snowflake(data, 'parent_id') | ||||
|         self.position: int = data['position'] | ||||
|         self.nsfw: bool = data.get('nsfw', False) | ||||
|         self._fill_overwrites(data) | ||||
|  | ||||
|     @property | ||||
|     def _sorting_bucket(self) -> int: | ||||
|         return ChannelType.text.value | ||||
|  | ||||
|     @property | ||||
|     def type(self) -> ChannelType: | ||||
|         """:class:`ChannelType`: The channel's Discord type.""" | ||||
|         return ChannelType.store | ||||
|  | ||||
|     @utils.copy_doc(discord.abc.GuildChannel.permissions_for) | ||||
|     def permissions_for(self, obj: Union[Member, Role], /) -> Permissions: | ||||
|         base = super().permissions_for(obj) | ||||
|  | ||||
|         # store channels do not have voice related permissions | ||||
|         denied = Permissions.voice() | ||||
|         base.value &= ~denied.value | ||||
|         return base | ||||
|  | ||||
|     def is_nsfw(self) -> bool: | ||||
|         """:class:`bool`: Checks if the channel is NSFW.""" | ||||
|         return self.nsfw | ||||
|  | ||||
|     @utils.copy_doc(discord.abc.GuildChannel.clone) | ||||
|     async def clone(self, *, name: Optional[str] = None, reason: Optional[str] = None) -> StoreChannel: | ||||
|         return await self._clone_impl({'nsfw': self.nsfw}, name=name, reason=reason) | ||||
|  | ||||
|     @overload | ||||
|     async def edit( | ||||
|         self, | ||||
|         *, | ||||
|         name: str = ..., | ||||
|         position: int = ..., | ||||
|         nsfw: bool = ..., | ||||
|         sync_permissions: bool = ..., | ||||
|         category: Optional[CategoryChannel] = ..., | ||||
|         reason: Optional[str] = ..., | ||||
|         overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ..., | ||||
|     ) -> Optional[StoreChannel]: | ||||
|         ... | ||||
|  | ||||
|     @overload | ||||
|     async def edit(self) -> Optional[StoreChannel]: | ||||
|         ... | ||||
|  | ||||
|     async def edit(self, *, reason: Optional[str] = None, **options: Any) -> Optional[StoreChannel]: | ||||
|         """|coro| | ||||
|  | ||||
|         Edits the channel. | ||||
|  | ||||
|         You must have the :attr:`~Permissions.manage_channels` permission to | ||||
|         use this. | ||||
|  | ||||
|         .. versionchanged:: 2.0 | ||||
|             Edits are no longer in-place, the newly edited channel is returned instead. | ||||
|  | ||||
|         .. versionchanged:: 2.0 | ||||
|             This function will now raise :exc:`TypeError` or | ||||
|             :exc:`ValueError` instead of ``InvalidArgument``. | ||||
|  | ||||
|         Parameters | ||||
|         ---------- | ||||
|         name: :class:`str` | ||||
|             The new channel name. | ||||
|         position: :class:`int` | ||||
|             The new channel's position. | ||||
|         nsfw: :class:`bool` | ||||
|             To mark the channel as NSFW or not. | ||||
|         sync_permissions: :class:`bool` | ||||
|             Whether to sync permissions with the channel's new or pre-existing | ||||
|             category. Defaults to ``False``. | ||||
|         category: Optional[:class:`CategoryChannel`] | ||||
|             The new category for this channel. Can be ``None`` to remove the | ||||
|             category. | ||||
|         reason: Optional[:class:`str`] | ||||
|             The reason for editing this channel. Shows up on the audit log. | ||||
|         overwrites: :class:`Mapping` | ||||
|             A :class:`Mapping` of target (either a role or a member) to | ||||
|             :class:`PermissionOverwrite` to apply to the channel. | ||||
|  | ||||
|             .. versionadded:: 1.3 | ||||
|  | ||||
|         Raises | ||||
|         ------ | ||||
|         ValueError | ||||
|             The new ``position`` is less than 0 or greater than the number of channels. | ||||
|         TypeError | ||||
|             The permission overwrite information is not in proper form. | ||||
|         Forbidden | ||||
|             You do not have permissions to edit the channel. | ||||
|         HTTPException | ||||
|             Editing the channel failed. | ||||
|  | ||||
|         Returns | ||||
|         -------- | ||||
|         Optional[:class:`.StoreChannel`] | ||||
|             The newly edited store channel. If the edit was only positional | ||||
|             then ``None`` is returned instead. | ||||
|         """ | ||||
|  | ||||
|         payload = await self._edit(options, reason=reason) | ||||
|         if payload is not None: | ||||
|             # the payload will always be the proper channel payload | ||||
|             return self.__class__(state=self._state, guild=self.guild, data=payload)  # type: ignore | ||||
|  | ||||
|  | ||||
| class DMChannel(discord.abc.Messageable, Hashable): | ||||
|     """Represents a Discord direct message channel. | ||||
|  | ||||
| @@ -2189,8 +2013,6 @@ def _guild_channel_factory(channel_type: int): | ||||
|         return CategoryChannel, value | ||||
|     elif value is ChannelType.news: | ||||
|         return TextChannel, value | ||||
|     elif value is ChannelType.store: | ||||
|         return StoreChannel, value | ||||
|     elif value is ChannelType.stage_voice: | ||||
|         return StageChannel, value | ||||
|     else: | ||||
|   | ||||
| @@ -191,7 +191,6 @@ class ChannelType(Enum): | ||||
|     group = 3 | ||||
|     category = 4 | ||||
|     news = 5 | ||||
|     store = 6 | ||||
|     news_thread = 10 | ||||
|     public_thread = 11 | ||||
|     private_thread = 12 | ||||
|   | ||||
| @@ -74,7 +74,6 @@ __all__ = ( | ||||
|     'PartialEmojiConverter', | ||||
|     'CategoryChannelConverter', | ||||
|     'IDConverter', | ||||
|     'StoreChannelConverter', | ||||
|     'ThreadConverter', | ||||
|     'GuildChannelConverter', | ||||
|     'GuildStickerConverter', | ||||
| @@ -563,25 +562,6 @@ class CategoryChannelConverter(IDConverter[discord.CategoryChannel]): | ||||
|         return GuildChannelConverter._resolve_channel(ctx, argument, 'categories', discord.CategoryChannel) | ||||
|  | ||||
|  | ||||
| class StoreChannelConverter(IDConverter[discord.StoreChannel]): | ||||
|     """Converts to a :class:`~discord.StoreChannel`. | ||||
|  | ||||
|     All lookups are via the local guild. If in a DM context, then the lookup | ||||
|     is done by the global cache. | ||||
|  | ||||
|     The lookup strategy is as follows (in order): | ||||
|  | ||||
|     1. Lookup by ID. | ||||
|     2. Lookup by mention. | ||||
|     3. Lookup by name. | ||||
|  | ||||
|     .. versionadded:: 1.7 | ||||
|     """ | ||||
|  | ||||
|     async def convert(self, ctx: Context[BotT], argument: str) -> discord.StoreChannel: | ||||
|         return GuildChannelConverter._resolve_channel(ctx, argument, 'channels', discord.StoreChannel) | ||||
|  | ||||
|  | ||||
| class ThreadConverter(IDConverter[discord.Thread]): | ||||
|     """Coverts to a :class:`~discord.Thread`. | ||||
|  | ||||
| @@ -1118,7 +1098,6 @@ CONVERTER_MAPPING: Dict[type, Any] = { | ||||
|     discord.Emoji: EmojiConverter, | ||||
|     discord.PartialEmoji: PartialEmojiConverter, | ||||
|     discord.CategoryChannel: CategoryChannelConverter, | ||||
|     discord.StoreChannel: StoreChannelConverter, | ||||
|     discord.Thread: ThreadConverter, | ||||
|     discord.abc.GuildChannel: GuildChannelConverter, | ||||
|     discord.GuildSticker: GuildStickerConverter, | ||||
|   | ||||
| @@ -109,7 +109,7 @@ if TYPE_CHECKING: | ||||
|     ) | ||||
|     from .types.voice import GuildVoiceState | ||||
|     from .permissions import Permissions | ||||
|     from .channel import VoiceChannel, StageChannel, TextChannel, CategoryChannel, StoreChannel | ||||
|     from .channel import VoiceChannel, StageChannel, TextChannel, CategoryChannel | ||||
|     from .template import Template | ||||
|     from .webhook import Webhook | ||||
|     from .state import ConnectionState | ||||
| @@ -120,7 +120,6 @@ if TYPE_CHECKING: | ||||
|         NewsChannel as NewsChannelPayload, | ||||
|         VoiceChannel as VoiceChannelPayload, | ||||
|         CategoryChannel as CategoryChannelPayload, | ||||
|         StoreChannel as StoreChannelPayload, | ||||
|         StageChannel as StageChannelPayload, | ||||
|     ) | ||||
|     from .types.integration import IntegrationType | ||||
| @@ -128,7 +127,7 @@ if TYPE_CHECKING: | ||||
|     from .types.widget import EditWidgetSettings | ||||
|  | ||||
|     VocalGuildChannel = Union[VoiceChannel, StageChannel] | ||||
|     GuildChannel = Union[VocalGuildChannel, TextChannel, CategoryChannel, StoreChannel] | ||||
|     GuildChannel = Union[VocalGuildChannel, TextChannel, CategoryChannel] | ||||
|     ByCategoryItem = Tuple[Optional[CategoryChannel], List[GuildChannel]] | ||||
|  | ||||
|  | ||||
| @@ -1115,17 +1114,6 @@ class Guild(Hashable): | ||||
|     ) -> Coroutine[Any, Any, NewsChannelPayload]: | ||||
|         ... | ||||
|  | ||||
|     @overload | ||||
|     def _create_channel( | ||||
|         self, | ||||
|         name: str, | ||||
|         channel_type: Literal[ChannelType.store], | ||||
|         overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ..., | ||||
|         category: Optional[Snowflake] = ..., | ||||
|         **options: Any, | ||||
|     ) -> Coroutine[Any, Any, StoreChannelPayload]: | ||||
|         ... | ||||
|  | ||||
|     @overload | ||||
|     def _create_channel( | ||||
|         self, | ||||
|   | ||||
| @@ -69,13 +69,11 @@ if TYPE_CHECKING: | ||||
|     from .ui.view import View | ||||
|     from .app_commands.models import Choice, ChoiceT | ||||
|     from .ui.modal import Modal | ||||
|     from .channel import VoiceChannel, StageChannel, TextChannel, CategoryChannel, StoreChannel, PartialMessageable | ||||
|     from .channel import VoiceChannel, StageChannel, TextChannel, CategoryChannel, PartialMessageable | ||||
|     from .threads import Thread | ||||
|     from .app_commands.commands import Command, ContextMenu | ||||
|  | ||||
|     InteractionChannel = Union[ | ||||
|         VoiceChannel, StageChannel, TextChannel, CategoryChannel, StoreChannel, Thread, PartialMessageable | ||||
|     ] | ||||
|     InteractionChannel = Union[VoiceChannel, StageChannel, TextChannel, CategoryChannel, Thread, PartialMessageable] | ||||
|  | ||||
| MISSING: Any = utils.MISSING | ||||
|  | ||||
|   | ||||
| @@ -93,10 +93,6 @@ class CategoryChannel(_BaseGuildChannel): | ||||
|     type: Literal[4] | ||||
|  | ||||
|  | ||||
| class StoreChannel(_BaseGuildChannel): | ||||
|     type: Literal[6] | ||||
|  | ||||
|  | ||||
| class _StageChannelOptional(TypedDict, total=False): | ||||
|     rtc_region: Optional[str] | ||||
|     topic: str | ||||
| @@ -129,7 +125,7 @@ class ThreadChannel(_BaseChannel, _ThreadChannelOptional): | ||||
|     thread_metadata: ThreadMetadata | ||||
|  | ||||
|  | ||||
| GuildChannel = Union[TextChannel, NewsChannel, VoiceChannel, CategoryChannel, StoreChannel, StageChannel, ThreadChannel] | ||||
| GuildChannel = Union[TextChannel, NewsChannel, VoiceChannel, CategoryChannel, StageChannel, ThreadChannel] | ||||
|  | ||||
|  | ||||
| class DMChannel(_BaseChannel): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user