fix: use Query to properly handle --pingpong flag #65
Reference in New Issue
Block a user
No description provided.
Delete Branch "pi-agent/konabot:fix/giftool-pingpong-bool"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
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 argspingpong: Query[bool] = Query("pingpong")in handlerpingpong.availableto determine if flag was setTesting
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 setFailed to generate code suggestions for PR
/describe
/describe
/review
Preparing PR description...
Preparing review...