mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-06 20:16:47 +00:00
Update
This commit is contained in:
15
plugins/weather.py
Normal file
15
plugins/weather.py
Normal file
@ -0,0 +1,15 @@
|
||||
import none
|
||||
from none.command import Session
|
||||
from none.helpers import send
|
||||
|
||||
|
||||
@none.on_command('weather', aliases=('天气',))
|
||||
async def weather(bot, session: Session):
|
||||
city = session.require_arg('city', prompt='你想知道哪个城市的天气呢?')
|
||||
await send(bot, session.ctx, f'你查询了{city}的天气')
|
||||
|
||||
|
||||
@weather.args_parser
|
||||
def _(session: Session):
|
||||
if session.current_key:
|
||||
session.args[session.current_key] = session.current_arg.strip()
|
Reference in New Issue
Block a user