From 49edc83660faae897ffaf20bb72b9ec1aa2826ee Mon Sep 17 00:00:00 2001 From: Katelyn Gigante Date: Tue, 6 Jun 2023 01:15:59 +1000 Subject: [PATCH 1/2] feat: Warn if people try to run d.py alongside interactions --- interactions/client/const.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/interactions/client/const.py b/interactions/client/const.py index 1d0ced829..0f30c8e70 100644 --- a/interactions/client/const.py +++ b/interactions/client/const.py @@ -283,3 +283,8 @@ def has_client_feature(feature: str) -> bool: raise RuntimeError( f"NON_RESUMABLE_WEBSOCKET_CLOSE_CODES contains codes that are not in RECOVERABLE_WEBSOCKET_CLOSE_CODES: {diff}" ) from e + +if "discord" in sys.modules: + get_logger().error( + "`import discord` import detected. Interactions.py is a completely separate library, and is not compatible with d.py models. Please see https://interactions-py.github.io/interactions.py/Guides/100%20Migration%20From%20D.py/ for how to fix your code." + ) From 938d6c2d91c35687b1325a9beb8e7c6a4322146f Mon Sep 17 00:00:00 2001 From: Katelyn Gigante Date: Tue, 6 Jun 2023 20:44:30 +1000 Subject: [PATCH 2/2] refactor: Move d.py check to __init__.py --- interactions/__init__.py | 5 +++++ interactions/client/const.py | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/interactions/__init__.py b/interactions/__init__.py index 4ad18cd3f..3be1785e8 100644 --- a/interactions/__init__.py +++ b/interactions/__init__.py @@ -1,3 +1,4 @@ +import sys from .client import ( __api_version__, __py_version__, @@ -680,6 +681,10 @@ "WebSocketOPCode", ) +if "discord" in sys.modules: + get_logger().error( + "`import discord` import detected. Interactions.py is a completely separate library, and is not compatible with d.py models. Please see https://interactions-py.github.io/interactions.py/Guides/100%20Migration%20From%20D.py/ for how to fix your code." + ) ######################################################################################################################## # Noteworthy Credits diff --git a/interactions/client/const.py b/interactions/client/const.py index 0f30c8e70..1d0ced829 100644 --- a/interactions/client/const.py +++ b/interactions/client/const.py @@ -283,8 +283,3 @@ def has_client_feature(feature: str) -> bool: raise RuntimeError( f"NON_RESUMABLE_WEBSOCKET_CLOSE_CODES contains codes that are not in RECOVERABLE_WEBSOCKET_CLOSE_CODES: {diff}" ) from e - -if "discord" in sys.modules: - get_logger().error( - "`import discord` import detected. Interactions.py is a completely separate library, and is not compatible with d.py models. Please see https://interactions-py.github.io/interactions.py/Guides/100%20Migration%20From%20D.py/ for how to fix your code." - )