Skip to content

Commit

Permalink
GoogleDrive: fix gdsearch input always true
Browse files Browse the repository at this point in the history
Change-Id: I9d8d96161ac3cdfec2345ec612f20674f087c9be
  • Loading branch information
adekmaulana committed Sep 2, 2021
1 parent da5402c commit 493c048
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bot/plugins/gdrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,11 +626,10 @@ async def cmd_gdsearch(self, ctx: command.Context) -> Optional[str]:
r"(q)=(\"(?:[^\"\\]|\\.)*\"|'(?:[^'\\]|\\.)*')"
)
matches = regex.finditer(ctx.msg.text)
if ctx.input and not matches:
return "__Invalid parameters of input.__"

await ctx.respond("Collecting...")

length = 0
options: MutableMapping[str, Any] = {}
for match in matches:
for index, option in enumerate(match.groups()):
Expand All @@ -643,8 +642,12 @@ async def cmd_gdsearch(self, ctx: command.Context) -> Optional[str]:
options[option] = match.removesuffix(
match[0]).removeprefix(match[0])

length += 1
break

if ctx.input and length == 0:
return "__Invalid parameters of input.__"

name = options.get("name")
parent = options.get("parent")
if parent:
Expand Down

0 comments on commit 493c048

Please sign in to comment.