An alternative for got-and-reject in Nonebot
Project description
nonebot-plugin-waiter
该插件提供一个 got-and-reject 会话控制的替代方案,可自由控制超时时间
安装
pip install nonebot-plugin-waiter
使用
from nonebot import on_command
from nonebot.adapters import Event
from nonebot_plugin_waiter import waiter
test = on_command("test")
@test.handle()
async def _(event: Event):
await test.send("请输入数字")
@waiter(test)
async def check(event1: Event):
if event.get_session_id() == event1.get_session_id():
return event1.get_plaintext()
async for resp in check(timeout=60):
if resp is None:
await test.send("等待超时")
break
if not resp.isdigit():
await test.send("请输入数字")
continue
await test.send(f"你输入了{resp}")
break
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for nonebot_plugin_waiter-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8196bd8e4bd967e40aa068b119ec09e82333c79a6983095b8ff50617517cecb0 |
|
MD5 | 9222a5ba18581bc6eef9859d90b8cf17 |
|
BLAKE2b-256 | 3044f60eaef062f0e5bb6104320522c0792b82208f5ca98c57dc244da7c430d4 |
Close
Hashes for nonebot_plugin_waiter-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b02825b17da23a685fdb83c2a6702b8f1d3fed35f00e1d4914f6381a8a9c053a |
|
MD5 | 666f09cdce9e39a947053af098d899ad |
|
BLAKE2b-256 | 5fc60e9d39a3cb2a2db2af235d6de5a8eb083ef66a83341df39dfbecdef346d1 |