Skip to content

Commit

Permalink
fix(info): auto converters in DM
Browse files Browse the repository at this point in the history
  • Loading branch information
ZRunner committed Jan 16, 2025
1 parent 1d8a81e commit 3a2c506
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/info/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"id",
]
QUERY_TYPES: tuple[str] = get_args(QueryTypesTyping)
DM_QUERY_TYPES: tuple[str] = ["emoji", "user", "invite", "id"]


class Info(commands.Cog):
Expand Down Expand Up @@ -105,10 +106,10 @@ async def info_main(self, interaction: discord.Interaction, *, query: app_comman

async def _guess_query_type(self, query: str, interaction: discord.Interaction):
"Guess the query type from the given query"
if query == "server":
if query == "server" and interaction.guild:
return "server", interaction.guild
ctx = await commands.Context.from_interaction(interaction)
for query_type in QUERY_TYPES:
for query_type in (QUERY_TYPES if interaction.guild else DM_QUERY_TYPES):
try:
result = await self._convert_query(query, query_type, ctx)
except commands.BadArgument:
Expand Down

0 comments on commit 3a2c506

Please sign in to comment.