Recently I have been trying to write a simple bot in Hy with Discord.py. In Discord.py we can write a command like this to turn the last argument into a full string that includes spaces:
@commands.command(description="", help="")
async def say(self, ctx, level, *, remains):
...
But if I write this in Hy as:
#@((commands.command :description "" :help "")
(defn/a say [self ctx level * remains]
...))
It will complain about missing required argument "text." What's even weirder is that the sample code in the defn
part on Hy's official website:
(defn compare [a b * keyfn [reverse False]]
(setv result (keyfn a b))
(if (not reverse)
result
(- result)))
doesn't even work under hy --spy
. Did I use it wrong or there's a correct way to handle this?
(defn compare…)
works for me. Sounds like the version of Hy you're running doesn't match the version of the documentation you're reading.