nonebot2/demo/__init__.py

23 lines
557 B
Python
Raw Normal View History

2018-08-15 15:43:33 +00:00
from os import path
2018-07-04 08:21:01 +00:00
2018-12-27 12:23:45 +00:00
import nonebot
2018-08-15 15:43:33 +00:00
from demo import config
2018-12-27 12:23:45 +00:00
nonebot.init(config)
2018-08-26 02:05:42 +00:00
2018-12-27 12:23:45 +00:00
@nonebot.scheduler.scheduled_job('interval', seconds=20)
2018-08-26 02:05:42 +00:00
async def cb():
2018-12-27 12:23:45 +00:00
bot_ = nonebot.get_bot()
2018-08-26 02:05:42 +00:00
try:
2018-08-26 03:30:22 +00:00
await bot_.send_private_msg(user_id=1002647525, message='')
2018-08-26 02:05:42 +00:00
except Exception as e:
2018-12-27 12:23:45 +00:00
nonebot.logger.exception(e)
2018-08-26 02:05:42 +00:00
2018-07-04 08:21:01 +00:00
if __name__ == '__main__':
2018-12-27 12:23:45 +00:00
nonebot.load_builtin_plugins()
nonebot.load_plugins(path.join(path.dirname(__file__), 'plugins'),
'demo.plugins')
nonebot.run(host=config.HOST, port=config.PORT)