Skip to content

Commit

Permalink
instantcmd: fix bug with non-view items
Browse files Browse the repository at this point in the history
  • Loading branch information
laggron42 committed Oct 30, 2023
1 parent 350fb45 commit 682d434
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions instantcmd/code_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ def get_code_from_str(content: str, env: Dict[str, Any]) -> T:


def find_matching_type(code: T) -> Type[CodeSnippet]:
if issubclass(code, discord.ui.View):
return ViewSnippet
try:
if issubclass(code, discord.ui.View):
return ViewSnippet
except TypeError: # code is not a class (probably instance)
pass
for source, dest in OBJECT_TYPES_MAPPING.items():
if isinstance(code, source):
return dest
Expand Down

0 comments on commit 682d434

Please sign in to comment.