From ce758a2231679bf66218c6d752220b5a457a5470 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Thu, 8 Oct 2020 21:36:57 +0800 Subject: [PATCH] :memo: add nonebot quick import doc --- docs/api/nonebot.md | 49 +++++++++++++++++++++++++++++++++++++++++++++ nonebot/__init__.py | 22 ++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/docs/api/nonebot.md b/docs/api/nonebot.md index 3c278a5c..7c89c882 100644 --- a/docs/api/nonebot.md +++ b/docs/api/nonebot.md @@ -5,6 +5,55 @@ sidebarDepth: 0 # NoneBot 模块 +## 快捷导入 + +为方便使用,`nonebot` 模块从子模块导入了部分内容 + + +* `on_message` => `nonebot.plugin.on_message` + + +* `on_notice` => `nonebot.plugin.on_notice` + + +* `on_request` => `nonebot.plugin.on_request` + + +* `on_metaevent` => `nonebot.plugin.on_metaevent` + + +* `on_startswith` => `nonebot.plugin.on_startswith` + + +* `on_endswith` => `nonebot.plugin.on_endswith` + + +* `on_command` => `nonebot.plugin.on_command` + + +* `on_regex` => `nonebot.plugin.on_regex` + + +* `on_regex` => `nonebot.plugin.on_regex` + + +* `on_regex` => `nonebot.plugin.on_regex` + + +* `CommandGroup` => `nonebot.plugin.CommandGroup` + + +* `load_plugin` => `nonebot.plugin.load_plugin` + + +* `load_plugins` => `nonebot.plugin.load_plugins` + + +* `load_builtin_plugins` => `nonebot.plugin.load_builtin_plugins` + + +* `get_loaded_plugins` => `nonebot.plugin.get_loaded_plugins` + ## `get_driver()` diff --git a/nonebot/__init__.py b/nonebot/__init__.py index 213b63d2..cbf14115 100644 --- a/nonebot/__init__.py +++ b/nonebot/__init__.py @@ -1,5 +1,27 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +""" +快捷导入 +======== + +为方便使用,``nonebot`` 模块从子模块导入了部分内容 + +- ``on_message`` => ``nonebot.plugin.on_message`` +- ``on_notice`` => ``nonebot.plugin.on_notice`` +- ``on_request`` => ``nonebot.plugin.on_request`` +- ``on_metaevent`` => ``nonebot.plugin.on_metaevent`` +- ``on_startswith`` => ``nonebot.plugin.on_startswith`` +- ``on_endswith`` => ``nonebot.plugin.on_endswith`` +- ``on_command`` => ``nonebot.plugin.on_command`` +- ``on_regex`` => ``nonebot.plugin.on_regex`` +- ``on_regex`` => ``nonebot.plugin.on_regex`` +- ``on_regex`` => ``nonebot.plugin.on_regex`` +- ``CommandGroup`` => ``nonebot.plugin.CommandGroup`` +- ``load_plugin`` => ``nonebot.plugin.load_plugin`` +- ``load_plugins`` => ``nonebot.plugin.load_plugins`` +- ``load_builtin_plugins`` => ``nonebot.plugin.load_builtin_plugins`` +- ``get_loaded_plugins`` => ``nonebot.plugin.get_loaded_plugins`` +""" import importlib from nonebot.typing import Bot, Dict, Type, Union, Driver, Optional, NoReturn