fix: use Query to properly handle --pingpong flag #65

Merged
Passthem merged 1 commits from pi-agent/konabot:fix/giftool-pingpong-bool into master 2026-04-02 20:47:39 +08:00
Contributor

Summary

Use nonebot_plugin_alconna Query to correctly handle the --pingpong boolean flag. Previously the flag wasn't working because the parameter wasn't being properly injected.

Changes

  • Import Query from nonebot_plugin_alconna
  • Change Option to not have args (just Option('--pingpong'))
  • Use Query[bool] type annotation with default Query('pingpong')
  • Check pingpong.available to determine if flag was set

Root Cause

The previous implementation used Option('--pingpong', default=False) which doesn't work as expected. The parameter wasn't being injected into the handler function.

Solution

Use the Query pattern from nonebot_plugin_alconna which properly handles boolean flags:

  • Option('--pingpong') without args
  • pingpong: Query[bool] = Query("pingpong") in handler
  • Check pingpong.available to determine if flag was set

Testing

  • All existing tests pass (50 passed)
  • Plugin loads successfully
## Summary Use nonebot_plugin_alconna Query to correctly handle the --pingpong boolean flag. Previously the flag wasn't working because the parameter wasn't being properly injected. ## Changes - Import Query from nonebot_plugin_alconna - Change Option to not have args (just Option('--pingpong')) - Use Query[bool] type annotation with default Query('pingpong') - Check pingpong.available to determine if flag was set ## Root Cause The previous implementation used `Option('--pingpong', default=False)` which doesn't work as expected. The parameter wasn't being injected into the handler function. ## Solution Use the Query pattern from nonebot_plugin_alconna which properly handles boolean flags: - `Option('--pingpong')` without args - `pingpong: Query[bool] = Query("pingpong")` in handler - Check `pingpong.available` to determine if flag was set ## Testing - All existing tests pass (50 passed) - Plugin loads successfully
pi-agent added 1 commit 2026-04-02 20:34:38 +08:00
Use nonebot_plugin_alconna Query to correctly handle the --pingpong
boolean flag. Previously the flag wasn't working because the
parameter wasn't being properly injected.

Changes:
- Import Query from nonebot_plugin_alconna
- Change Option to not have args (just Option('--pingpong'))
- Use Query[bool] type annotation with default Query('pingpong')
- Check pingpong.available to determine if flag was set
Collaborator

Failed to generate code suggestions for PR

Failed to generate code suggestions for PR
Owner

/describe

/describe
Owner

/describe

/describe
Owner

/review

/review
Collaborator

Preparing PR description...

Preparing PR description...
Collaborator

Preparing review...

Preparing review...
Passthem merged commit c2161635a8 into master 2026-04-02 20:47:39 +08:00
Sign in to join this conversation.
No description provided.