mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-30 17:50:03 +00:00
Add docs for writing "usage" command
This commit is contained in:
16
docs/guide/code/awesome-bot-7/awesome/plugins/scheduler.py
Normal file
16
docs/guide/code/awesome-bot-7/awesome/plugins/scheduler.py
Normal file
@ -0,0 +1,16 @@
|
||||
from datetime import datetime
|
||||
|
||||
import nonebot
|
||||
import pytz
|
||||
from aiocqhttp.exceptions import Error as CQHttpError
|
||||
|
||||
|
||||
@nonebot.scheduler.scheduled_job('cron', hour='*')
|
||||
async def _():
|
||||
bot = nonebot.get_bot()
|
||||
now = datetime.now(pytz.timezone('Asia/Shanghai'))
|
||||
try:
|
||||
await bot.send_group_msg(group_id=672076603,
|
||||
message=f'现在{now.hour}点整啦!')
|
||||
except CQHttpError:
|
||||
pass
|
Reference in New Issue
Block a user