simmsb / calamity

A library for writing discord bots in haskell
https://hackage.haskell.org/package/calamity
MIT License
112 stars 14 forks source link

Check failure reason reporting #62

Closed csamak closed 1 year ago

csamak commented 1 year ago

When command checks fail, is there any way to surface the message from the Maybe Text?

Failures can of course be reported/logged from within the checks, but some e.g. debug logging would be convenient, especially when using requiresPure.

simmsb commented 1 year ago

If a check fails it rises as a CustomEvt (CtxCommandError <your chosen context>) event, then you can log it like here: https://github.com/simmsb/calamity/blob/master/bot/app/Main.hs#L180

csamak commented 1 year ago

Makes sense. I missed that, thanks!