From ecb1a98dbcad1dc2e1a1082d884189e1ac56f703 Mon Sep 17 00:00:00 2001 From: Known Black Hat <65008967+KnownBlackHat@users.noreply.github.com> Date: Tue, 9 May 2023 21:27:22 -0400 Subject: [PATCH 01/14] fix(enum): remove Party Type enum (#1023) Signed-off-by: Known Black Hat <65008967+KnownBlackHat@users.noreply.github.com> --- disnake/enums.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/disnake/enums.py b/disnake/enums.py index 7937c1d1e9..307fb58fca 100644 --- a/disnake/enums.py +++ b/disnake/enums.py @@ -52,7 +52,6 @@ "OptionType", "ApplicationCommandType", "ApplicationCommandPermissionType", - "PartyType", "GuildScheduledEventEntityType", "GuildScheduledEventStatus", "GuildScheduledEventPrivacyLevel", @@ -252,23 +251,6 @@ class MessageType(Enum): stage_topic = 31 guild_application_premium_subscription = 32 - -class PartyType(Enum): - poker = 755827207812677713 - betrayal = 773336526917861400 - fishing = 814288819477020702 - chess = 832012774040141894 - letter_tile = 879863686565621790 - word_snack = 879863976006127627 - doodle_crew = 878067389634314250 - checkers = 832013003968348200 - spellcast = 852509694341283871 - watch_together = 880218394199220334 - sketch_heads = 902271654783242291 - ocho = 832025144389533716 - gartic_phone = 1007373802981822582 - - class SpeakingState(Enum): none = 0 voice = 1 << 0 @@ -281,7 +263,6 @@ def __str__(self) -> str: def __int__(self) -> int: return self.value - class VerificationLevel(Enum, comparable=True): none = 0 low = 1 From 59156b746a316563dc426fdd2a8fa70f4c02c3be Mon Sep 17 00:00:00 2001 From: Known_Black_Hat Date: Tue, 9 May 2023 21:44:53 -0400 Subject: [PATCH 02/14] fix: import and dependecies --- disnake/abc.py | 11 ++------ disnake/enums.py | 2 ++ docs/api/voice.rst | 62 ---------------------------------------------- 3 files changed, 4 insertions(+), 71 deletions(-) diff --git a/disnake/abc.py b/disnake/abc.py index 567189e9b9..f71ea86309 100644 --- a/disnake/abc.py +++ b/disnake/abc.py @@ -25,14 +25,7 @@ from . import utils from .context_managers import Typing -from .enums import ( - ChannelType, - PartyType, - ThreadLayout, - ThreadSortOrder, - VideoQualityMode, - try_enum_to_int, -) +from .enums import ChannelType, ThreadLayout, ThreadSortOrder, VideoQualityMode, try_enum_to_int from .errors import ClientException from .file import File from .flags import ChannelFlags, MessageFlags @@ -1226,7 +1219,7 @@ async def create_invite( unique: bool = True, target_type: Optional[InviteTarget] = None, target_user: Optional[User] = None, - target_application: Optional[PartyType] = None, + target_application=None, guild_scheduled_event: Optional[GuildScheduledEvent] = None, ) -> Invite: """|coro| diff --git a/disnake/enums.py b/disnake/enums.py index 307fb58fca..e66150cde3 100644 --- a/disnake/enums.py +++ b/disnake/enums.py @@ -251,6 +251,7 @@ class MessageType(Enum): stage_topic = 31 guild_application_premium_subscription = 32 + class SpeakingState(Enum): none = 0 voice = 1 << 0 @@ -263,6 +264,7 @@ def __str__(self) -> str: def __int__(self) -> int: return self.value + class VerificationLevel(Enum, comparable=True): none = 0 low = 1 diff --git a/docs/api/voice.rst b/docs/api/voice.rst index 457473a926..8bce2c3b88 100644 --- a/docs/api/voice.rst +++ b/docs/api/voice.rst @@ -102,68 +102,6 @@ VoiceRegion :members: -Enumerations ------------- - -PartyType -~~~~~~~~~ - -.. class:: PartyType - - Represents the type of a voice channel activity/application. - - .. attribute:: poker - - The "Poker Night" activity. - .. attribute:: betrayal - - The "Betrayal.io" activity. - .. attribute:: fishing - - The "Fishington.io" activity. - .. attribute:: chess - - The "Chess In The Park" activity. - .. attribute:: letter_tile - - The "Letter Tile" activity. - .. attribute:: word_snack - - The "Word Snacks" activity. - .. attribute:: doodle_crew - - The "Doodle Crew" activity. - .. attribute:: checkers - - The "Checkers In The Park" activity. - - .. versionadded:: 2.3 - .. attribute:: spellcast - - The "SpellCast" activity. - - .. versionadded:: 2.3 - .. attribute:: watch_together - - The "Watch Together" activity, a Youtube application. - - .. versionadded:: 2.3 - .. attribute:: sketch_heads - - The "Sketch Heads" activity. - - .. versionadded:: 2.4 - .. attribute:: ocho - - The "Ocho" activity. - - .. versionadded:: 2.4 - .. attribute:: gartic_phone - - The "Gartic Phone" activity. - - .. versionadded:: 2.9 - Events ------ From b0a369d45f073d56fb6f2559b6e6bcc81690d151 Mon Sep 17 00:00:00 2001 From: Known_Black_Hat Date: Tue, 9 May 2023 21:56:49 -0400 Subject: [PATCH 03/14] docs(PartyType): remove traces --- disnake/abc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disnake/abc.py b/disnake/abc.py index f71ea86309..639f4d9d61 100644 --- a/disnake/abc.py +++ b/disnake/abc.py @@ -1255,7 +1255,7 @@ async def create_invite( .. versionadded:: 2.0 - target_application: Optional[:class:`.PartyType`] + target_application: The ID of the embedded application for the invite, required if `target_type` is `TargetType.embedded_application`. .. versionadded:: 2.0 From 67f8ccd222cc6de540daaa201ecaf3e91789509c Mon Sep 17 00:00:00 2001 From: Known_Black_Hat Date: Tue, 9 May 2023 23:43:56 -0400 Subject: [PATCH 04/14] Revert "docs(PartyType): remove traces" This reverts commit b0a369d45f073d56fb6f2559b6e6bcc81690d151. --- disnake/abc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disnake/abc.py b/disnake/abc.py index 639f4d9d61..f71ea86309 100644 --- a/disnake/abc.py +++ b/disnake/abc.py @@ -1255,7 +1255,7 @@ async def create_invite( .. versionadded:: 2.0 - target_application: + target_application: Optional[:class:`.PartyType`] The ID of the embedded application for the invite, required if `target_type` is `TargetType.embedded_application`. .. versionadded:: 2.0 From 2ce9d5bcff3b6b7838222f21766f119a2c8a5da7 Mon Sep 17 00:00:00 2001 From: Known_Black_Hat Date: Tue, 9 May 2023 23:44:16 -0400 Subject: [PATCH 05/14] Revert "fix: import and dependecies" This reverts commit 59156b746a316563dc426fdd2a8fa70f4c02c3be. --- disnake/abc.py | 11 ++++++-- disnake/enums.py | 2 -- docs/api/voice.rst | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 4 deletions(-) diff --git a/disnake/abc.py b/disnake/abc.py index f71ea86309..567189e9b9 100644 --- a/disnake/abc.py +++ b/disnake/abc.py @@ -25,7 +25,14 @@ from . import utils from .context_managers import Typing -from .enums import ChannelType, ThreadLayout, ThreadSortOrder, VideoQualityMode, try_enum_to_int +from .enums import ( + ChannelType, + PartyType, + ThreadLayout, + ThreadSortOrder, + VideoQualityMode, + try_enum_to_int, +) from .errors import ClientException from .file import File from .flags import ChannelFlags, MessageFlags @@ -1219,7 +1226,7 @@ async def create_invite( unique: bool = True, target_type: Optional[InviteTarget] = None, target_user: Optional[User] = None, - target_application=None, + target_application: Optional[PartyType] = None, guild_scheduled_event: Optional[GuildScheduledEvent] = None, ) -> Invite: """|coro| diff --git a/disnake/enums.py b/disnake/enums.py index e66150cde3..307fb58fca 100644 --- a/disnake/enums.py +++ b/disnake/enums.py @@ -251,7 +251,6 @@ class MessageType(Enum): stage_topic = 31 guild_application_premium_subscription = 32 - class SpeakingState(Enum): none = 0 voice = 1 << 0 @@ -264,7 +263,6 @@ def __str__(self) -> str: def __int__(self) -> int: return self.value - class VerificationLevel(Enum, comparable=True): none = 0 low = 1 diff --git a/docs/api/voice.rst b/docs/api/voice.rst index 8bce2c3b88..457473a926 100644 --- a/docs/api/voice.rst +++ b/docs/api/voice.rst @@ -102,6 +102,68 @@ VoiceRegion :members: +Enumerations +------------ + +PartyType +~~~~~~~~~ + +.. class:: PartyType + + Represents the type of a voice channel activity/application. + + .. attribute:: poker + + The "Poker Night" activity. + .. attribute:: betrayal + + The "Betrayal.io" activity. + .. attribute:: fishing + + The "Fishington.io" activity. + .. attribute:: chess + + The "Chess In The Park" activity. + .. attribute:: letter_tile + + The "Letter Tile" activity. + .. attribute:: word_snack + + The "Word Snacks" activity. + .. attribute:: doodle_crew + + The "Doodle Crew" activity. + .. attribute:: checkers + + The "Checkers In The Park" activity. + + .. versionadded:: 2.3 + .. attribute:: spellcast + + The "SpellCast" activity. + + .. versionadded:: 2.3 + .. attribute:: watch_together + + The "Watch Together" activity, a Youtube application. + + .. versionadded:: 2.3 + .. attribute:: sketch_heads + + The "Sketch Heads" activity. + + .. versionadded:: 2.4 + .. attribute:: ocho + + The "Ocho" activity. + + .. versionadded:: 2.4 + .. attribute:: gartic_phone + + The "Gartic Phone" activity. + + .. versionadded:: 2.9 + Events ------ From 939c29ada497f87ed854940d543d9cf23b8c093f Mon Sep 17 00:00:00 2001 From: Known_Black_Hat Date: Tue, 9 May 2023 23:44:36 -0400 Subject: [PATCH 06/14] Revert "fix(enum): remove Party Type enum (#1023)" This reverts commit ecb1a98dbcad1dc2e1a1082d884189e1ac56f703. --- disnake/enums.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/disnake/enums.py b/disnake/enums.py index 307fb58fca..7937c1d1e9 100644 --- a/disnake/enums.py +++ b/disnake/enums.py @@ -52,6 +52,7 @@ "OptionType", "ApplicationCommandType", "ApplicationCommandPermissionType", + "PartyType", "GuildScheduledEventEntityType", "GuildScheduledEventStatus", "GuildScheduledEventPrivacyLevel", @@ -251,6 +252,23 @@ class MessageType(Enum): stage_topic = 31 guild_application_premium_subscription = 32 + +class PartyType(Enum): + poker = 755827207812677713 + betrayal = 773336526917861400 + fishing = 814288819477020702 + chess = 832012774040141894 + letter_tile = 879863686565621790 + word_snack = 879863976006127627 + doodle_crew = 878067389634314250 + checkers = 832013003968348200 + spellcast = 852509694341283871 + watch_together = 880218394199220334 + sketch_heads = 902271654783242291 + ocho = 832025144389533716 + gartic_phone = 1007373802981822582 + + class SpeakingState(Enum): none = 0 voice = 1 << 0 @@ -263,6 +281,7 @@ def __str__(self) -> str: def __int__(self) -> int: return self.value + class VerificationLevel(Enum, comparable=True): none = 0 low = 1 From c93aec36a57470435f89452587f9b178840eff4e Mon Sep 17 00:00:00 2001 From: Known_Black_Hat Date: Wed, 10 May 2023 02:58:50 -0400 Subject: [PATCH 07/14] fix: deprecate warning added --- disnake/abc.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/disnake/abc.py b/disnake/abc.py index 567189e9b9..e9ca37ca41 100644 --- a/disnake/abc.py +++ b/disnake/abc.py @@ -1287,6 +1287,11 @@ async def create_invite( :class:`.Invite` The newly created invite. """ + if isinstance(target_application, PartyType): + utils.warn_deprecated( + "target_application parameter is deprecated and will be removed in future version", + stacklevel=2, + ) data = await self._state.http.create_invite( self.id, reason=reason, From 13eb1a705a8f19fb25c2b6eb7b28654e24dca55d Mon Sep 17 00:00:00 2001 From: Known Black Hat <65008967+KnownBlackHat@users.noreply.github.com> Date: Thu, 11 May 2023 10:13:30 -0400 Subject: [PATCH 08/14] chore: add changelog Signed-off-by: Known Black Hat <65008967+KnownBlackHat@users.noreply.github.com> --- changelog/1035.deprecate.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/1035.deprecate.rst diff --git a/changelog/1035.deprecate.rst b/changelog/1035.deprecate.rst new file mode 100644 index 0000000000..ea8de60e33 --- /dev/null +++ b/changelog/1035.deprecate.rst @@ -0,0 +1 @@ +:attr:`enum.PartyType` is obsolete, it is now enabled Discord-wide. From d6db29d2074788ba0d90ee66868965cb710f5531 Mon Sep 17 00:00:00 2001 From: Known Black Hat <65008967+KnownBlackHat@users.noreply.github.com> Date: Thu, 11 May 2023 11:45:17 -0400 Subject: [PATCH 09/14] refactor(changelog): add description Signed-off-by: Known Black Hat <65008967+KnownBlackHat@users.noreply.github.com> --- changelog/1035.deprecate.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/changelog/1035.deprecate.rst b/changelog/1035.deprecate.rst index ea8de60e33..1937bf6d02 100644 --- a/changelog/1035.deprecate.rst +++ b/changelog/1035.deprecate.rst @@ -1 +1,6 @@ -:attr:`enum.PartyType` is obsolete, it is now enabled Discord-wide. +:attr:`enum.PartyType` is obsolete. + +The PartyType enum contains IDs of voice activities, which aren't documented in any official capacity. New activities get added/removed constantly, so keeping up with maintaining that list is rather difficult. + +Since the introduction of this enum, activities have been released officially. +If anything, providing activities should really be more of a bot's responsibility, not the library's, so we should consider deprecating and removing this enum. From c41cfc681e062456190049106c6b24c19525f4a7 Mon Sep 17 00:00:00 2001 From: Known Black Hat <65008967+KnownBlackHat@users.noreply.github.com> Date: Mon, 15 May 2023 12:41:50 -0400 Subject: [PATCH 10/14] Update changelog/1035.deprecate.rst Co-authored-by: shiftinv <8530778+shiftinv@users.noreply.github.com> Signed-off-by: Known Black Hat <65008967+KnownBlackHat@users.noreply.github.com> --- changelog/1035.deprecate.rst | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/changelog/1035.deprecate.rst b/changelog/1035.deprecate.rst index 1937bf6d02..210816ff91 100644 --- a/changelog/1035.deprecate.rst +++ b/changelog/1035.deprecate.rst @@ -1,6 +1 @@ -:attr:`enum.PartyType` is obsolete. - -The PartyType enum contains IDs of voice activities, which aren't documented in any official capacity. New activities get added/removed constantly, so keeping up with maintaining that list is rather difficult. - -Since the introduction of this enum, activities have been released officially. -If anything, providing activities should really be more of a bot's responsibility, not the library's, so we should consider deprecating and removing this enum. +The :class:`PartyType` enum is deprecated, as voice activity IDs are not officially documented and the enum regularly becomes outdated. From 6d76b8069aa9e0ab79ab5daa0e7f7b85914dd7eb Mon Sep 17 00:00:00 2001 From: Known Black Hat <65008967+KnownBlackHat@users.noreply.github.com> Date: Mon, 15 May 2023 12:46:21 -0400 Subject: [PATCH 11/14] Update abc.py Signed-off-by: Known Black Hat <65008967+KnownBlackHat@users.noreply.github.com> --- disnake/abc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disnake/abc.py b/disnake/abc.py index e9ca37ca41..26c9b92ac2 100644 --- a/disnake/abc.py +++ b/disnake/abc.py @@ -1289,7 +1289,7 @@ async def create_invite( """ if isinstance(target_application, PartyType): utils.warn_deprecated( - "target_application parameter is deprecated and will be removed in future version", + "PartyType is deprecated and will be removed in future version", stacklevel=2, ) data = await self._state.http.create_invite( From febc1d9fa3ee849637e647a068b888374f035b06 Mon Sep 17 00:00:00 2001 From: Known Black Hat <65008967+KnownBlackHat@users.noreply.github.com> Date: Mon, 15 May 2023 13:02:48 -0400 Subject: [PATCH 12/14] Update 1035.deprecate.rst Signed-off-by: Known Black Hat <65008967+KnownBlackHat@users.noreply.github.com> --- changelog/1035.deprecate.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/1035.deprecate.rst b/changelog/1035.deprecate.rst index 210816ff91..45b25acb94 100644 --- a/changelog/1035.deprecate.rst +++ b/changelog/1035.deprecate.rst @@ -1 +1 @@ -The :class:`PartyType` enum is deprecated, as voice activity IDs are not officially documented and the enum regularly becomes outdated. +The :class:`PartyType`:deprecated::2.9 enum is deprecated, as voice activity IDs are not officially documented and the enum regularly becomes outdated. From 0a2a4527fc6ebd970aa548bdf6b9f20e9e7ee6dd Mon Sep 17 00:00:00 2001 From: Known Black Hat <65008967+KnownBlackHat@users.noreply.github.com> Date: Wed, 17 May 2023 12:29:29 -0400 Subject: [PATCH 13/14] Update 1035.deprecate.rst Signed-off-by: Known Black Hat <65008967+KnownBlackHat@users.noreply.github.com> --- changelog/1035.deprecate.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/1035.deprecate.rst b/changelog/1035.deprecate.rst index 45b25acb94..210816ff91 100644 --- a/changelog/1035.deprecate.rst +++ b/changelog/1035.deprecate.rst @@ -1 +1 @@ -The :class:`PartyType`:deprecated::2.9 enum is deprecated, as voice activity IDs are not officially documented and the enum regularly becomes outdated. +The :class:`PartyType` enum is deprecated, as voice activity IDs are not officially documented and the enum regularly becomes outdated. From e58fce826bbb4d03813023879c956ee78533e313 Mon Sep 17 00:00:00 2001 From: Known_Black_Hat Date: Wed, 24 May 2023 15:21:54 -0400 Subject: [PATCH 14/14] refactor: deprecate party type enum --- disnake/abc.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/disnake/abc.py b/disnake/abc.py index b659213cd8..2f9eaedc9f 100644 --- a/disnake/abc.py +++ b/disnake/abc.py @@ -38,6 +38,7 @@ from .flags import ChannelFlags, MessageFlags from .invite import Invite from .mentions import AllowedMentions +from .object import Object from .partial_emoji import PartialEmoji from .permissions import PermissionOverwrite, Permissions from .role import Role @@ -1227,7 +1228,7 @@ async def create_invite( unique: bool = True, target_type: Optional[InviteTarget] = None, target_user: Optional[User] = None, - target_application: Optional[PartyType] = None, + target_application: Optional[Union[Snowflake, PartyType]] = None, guild_scheduled_event: Optional[GuildScheduledEvent] = None, ) -> Invite: """|coro| @@ -1263,11 +1264,14 @@ async def create_invite( .. versionadded:: 2.0 - target_application: Optional[:class:`.PartyType`] + target_application: Optional[:class:`.Snowflake`] The ID of the embedded application for the invite, required if `target_type` is `TargetType.embedded_application`. .. versionadded:: 2.0 + .. versionchanged:: 2.9 + ``PartyType`` is deprecated, and :class:`.Snowflake` should be used instead. + guild_scheduled_event: Optional[:class:`.GuildScheduledEvent`] The guild scheduled event to include with the invite. @@ -1293,6 +1297,7 @@ async def create_invite( "PartyType is deprecated and will be removed in future version", stacklevel=2, ) + target_application = Object(target_application.value) data = await self._state.http.create_invite( self.id, reason=reason, @@ -1302,7 +1307,7 @@ async def create_invite( unique=unique, target_type=try_enum_to_int(target_type), target_user_id=target_user.id if target_user else None, - target_application_id=try_enum_to_int(target_application), + target_application_id=target_application.id if target_application else None, ) invite = Invite.from_incomplete(data=data, state=self._state) invite.guild_scheduled_event = guild_scheduled_event