From 8339f29cacd8daf52823c0d239cb4297563d607d Mon Sep 17 00:00:00 2001 From: Sondra <125593620+sondevra@users.noreply.github.com> Date: Sat, 13 Jul 2024 11:19:55 -0400 Subject: [PATCH 1/2] fix: command lookup error when scope is cached Fixed lookup to use .get() on the dictionary to prevent large log of error in the circumstance of a cache command showing on a changed scope Signed-off-by: Sondra <125593620+sondevra@users.noreply.github.com> --- interactions/models/internal/context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interactions/models/internal/context.py b/interactions/models/internal/context.py index 19a3f992a..99e97e567 100644 --- a/interactions/models/internal/context.py +++ b/interactions/models/internal/context.py @@ -346,7 +346,7 @@ def author_permissions(self) -> Permissions: @property def command(self) -> InteractionCommand: - return self.client._interaction_lookup[self._command_name] + return self.client._interaction_lookup.get(self._command_name) @property def expires_at(self) -> Timestamp: From ae91e8b1eb9d013a64c0610e9f232fff1e26917d Mon Sep 17 00:00:00 2001 From: Sondra <125593620+sondevra@users.noreply.github.com> Date: Thu, 18 Jul 2024 18:57:37 -0400 Subject: [PATCH 2/2] Update context.py Signed-off-by: Sondra <125593620+sondevra@users.noreply.github.com> --- interactions/models/internal/context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interactions/models/internal/context.py b/interactions/models/internal/context.py index 99e97e567..7eac000be 100644 --- a/interactions/models/internal/context.py +++ b/interactions/models/internal/context.py @@ -345,7 +345,7 @@ def author_permissions(self) -> Permissions: return Permissions(0) @property - def command(self) -> InteractionCommand: + def command(self) -> typing.Optional[InteractionCommand]: return self.client._interaction_lookup.get(self._command_name) @property