2024-08-19 23:51:06 +08:00
|
|
|
|
import{_ as e,o as n,c as s,e as f}from"./app-Dk7jq3Nw.js";const t={},o=f(`<h3 id="def-run-funcs-funcs-list-lifespan-func-process-lifespan-func-none" tabindex="-1"><a class="header-anchor" href="#def-run-funcs-funcs-list-lifespan-func-process-lifespan-func-none"><span><em><strong>def</strong></em> <code>run_funcs(funcs: list[LIFESPAN_FUNC | PROCESS_LIFESPAN_FUNC]) -> None</code></span></a></h3><p>运行函数</p><p>Args:</p><pre><code>funcs:
|
2024-08-19 10:23:10 +08:00
|
|
|
|
</code></pre><p>Returns:</p><h3 id="class-lifespan" tabindex="-1"><a class="header-anchor" href="#class-lifespan"><span><em><strong>class</strong></em> <code>Lifespan</code></span></a></h3><h3 id="def-init-self-none" tabindex="-1"><a class="header-anchor" href="#def-init-self-none"><span> <em><strong>def</strong></em> <code>__init__(self) -> None</code></span></a></h3><p> 轻雪生命周期管理,启动、停止、重启</p><h3 id="staticmethod" tabindex="-1"><a class="header-anchor" href="#staticmethod"><span> <em><strong>@staticmethod</strong></em></span></a></h3><h3 id="def-run-funcs-funcs-list-lifespan-func-process-lifespan-func-none-1" tabindex="-1"><a class="header-anchor" href="#def-run-funcs-funcs-list-lifespan-func-process-lifespan-func-none-1"><span> <em><strong>def</strong></em> <code>run_funcs(funcs: list[LIFESPAN_FUNC | PROCESS_LIFESPAN_FUNC]) -> None</code></span></a></h3><p> 运行函数</p><p>Args:</p><pre><code>funcs:
|
|
|
|
|
</code></pre><p>Returns:</p><h3 id="def-on-before-start-self-func-lifespan-func-lifespan-func" tabindex="-1"><a class="header-anchor" href="#def-on-before-start-self-func-lifespan-func-lifespan-func"><span> <em><strong>def</strong></em> <code>on_before_start(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC</code></span></a></h3><p> 注册启动时的函数</p><p>Args:</p><pre><code>func:
|
|
|
|
|
</code></pre><p>Returns:</p><pre><code>LIFESPAN_FUNC:
|
|
|
|
|
</code></pre><h3 id="def-on-after-start-self-func-lifespan-func-lifespan-func" tabindex="-1"><a class="header-anchor" href="#def-on-after-start-self-func-lifespan-func-lifespan-func"><span> <em><strong>def</strong></em> <code>on_after_start(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC</code></span></a></h3><p> 注册启动时的函数</p><p>Args:</p><pre><code>func:
|
|
|
|
|
</code></pre><p>Returns:</p><pre><code>LIFESPAN_FUNC:
|
|
|
|
|
</code></pre><h3 id="def-on-before-process-shutdown-self-func-lifespan-func-lifespan-func" tabindex="-1"><a class="header-anchor" href="#def-on-before-process-shutdown-self-func-lifespan-func-lifespan-func"><span> <em><strong>def</strong></em> <code>on_before_process_shutdown(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC</code></span></a></h3><p> 注册停止前的函数</p><p>Args:</p><pre><code>func:
|
|
|
|
|
</code></pre><p>Returns:</p><pre><code>LIFESPAN_FUNC:
|
|
|
|
|
</code></pre><h3 id="def-on-after-shutdown-self-func-lifespan-func-lifespan-func" tabindex="-1"><a class="header-anchor" href="#def-on-after-shutdown-self-func-lifespan-func-lifespan-func"><span> <em><strong>def</strong></em> <code>on_after_shutdown(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC</code></span></a></h3><p> 注册停止后的函数</p><p>Args:</p><pre><code>func:
|
|
|
|
|
</code></pre><p>Returns:</p><pre><code>LIFESPAN_FUNC:
|
|
|
|
|
</code></pre><h3 id="def-on-before-process-restart-self-func-lifespan-func-lifespan-func" tabindex="-1"><a class="header-anchor" href="#def-on-before-process-restart-self-func-lifespan-func-lifespan-func"><span> <em><strong>def</strong></em> <code>on_before_process_restart(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC</code></span></a></h3><p> 注册重启时的函数</p><p>Args:</p><pre><code>func:
|
|
|
|
|
</code></pre><p>Returns:</p><pre><code>LIFESPAN_FUNC:
|
|
|
|
|
</code></pre><h3 id="def-on-after-restart-self-func-lifespan-func-lifespan-func" tabindex="-1"><a class="header-anchor" href="#def-on-after-restart-self-func-lifespan-func-lifespan-func"><span> <em><strong>def</strong></em> <code>on_after_restart(self, func: LIFESPAN_FUNC) -> LIFESPAN_FUNC</code></span></a></h3><p> 注册重启后的函数</p><p>Args:</p><pre><code>func:
|
|
|
|
|
</code></pre><p>Returns:</p><pre><code>LIFESPAN_FUNC:
|
|
|
|
|
</code></pre><h3 id="def-on-after-nonebot-init-self-func-any-none" tabindex="-1"><a class="header-anchor" href="#def-on-after-nonebot-init-self-func-any-none"><span> <em><strong>def</strong></em> <code>on_after_nonebot_init(self, func: Any) -> None</code></span></a></h3><p> 注册 NoneBot 初始化后的函数</p><p>Args:</p><pre><code>func:
|
2024-08-19 23:51:06 +08:00
|
|
|
|
</code></pre><p>Returns:</p><h3 id="def-before-start-self-none" tabindex="-1"><a class="header-anchor" href="#def-before-start-self-none"><span> <em><strong>def</strong></em> <code>before_start(self) -> None</code></span></a></h3><p> 启动前</p><p>Returns:</p><h3 id="def-after-start-self-none" tabindex="-1"><a class="header-anchor" href="#def-after-start-self-none"><span> <em><strong>def</strong></em> <code>after_start(self) -> None</code></span></a></h3><p> 启动后</p><p>Returns:</p><h3 id="def-before-process-shutdown-self-none" tabindex="-1"><a class="header-anchor" href="#def-before-process-shutdown-self-none"><span> <em><strong>def</strong></em> <code>before_process_shutdown(self) -> None</code></span></a></h3><p> 停止前</p><p>Returns:</p><h3 id="def-after-shutdown-self-none" tabindex="-1"><a class="header-anchor" href="#def-after-shutdown-self-none"><span> <em><strong>def</strong></em> <code>after_shutdown(self) -> None</code></span></a></h3><p> 停止后</p><p>Returns:</p><h3 id="def-before-process-restart-self-none" tabindex="-1"><a class="header-anchor" href="#def-before-process-restart-self-none"><span> <em><strong>def</strong></em> <code>before_process_restart(self) -> None</code></span></a></h3><p> 重启前</p><p>Returns:</p><h3 id="def-after-restart-self-none" tabindex="-1"><a class="header-anchor" href="#def-after-restart-self-none"><span> <em><strong>def</strong></em> <code>after_restart(self) -> None</code></span></a></h3><p> 重启后</p><p>Returns:</p><h3 id="var-tasks" tabindex="-1"><a class="header-anchor" href="#var-tasks"><span><em><strong>var</strong></em> <code>tasks = []</code></span></a></h3><h3 id="var-loop-asyncio-get-event-loop" tabindex="-1"><a class="header-anchor" href="#var-loop-asyncio-get-event-loop"><span><em><strong>var</strong></em> <code>loop = asyncio.get_event_loop()</code></span></a></h3><h3 id="var-loop-asyncio-new-event-loop" tabindex="-1"><a class="header-anchor" href="#var-loop-asyncio-new-event-loop"><span><em><strong>var</strong></em> <code>loop = asyncio.new_event_loop()</code></span></a></h3>`,76),a=[o];function r(l,c){return n(),s("div",null,a)}const d=e(t,[["render",r],["__file","lifespan.html.vue"]]),i=JSON.parse('{"path":"/dev/api/bot/lifespan.html","title":"liteyuki.bot.lifespan","lang":"zh-CN","frontmatter":{"title":"liteyuki.bot.lifespan","order":1,"icon":"laptop-code","category":"API","description":"def run_funcs(funcs: list[LIFESPAN_FUNC | PROCESS_LIFESPAN_FUNC]) -> None 运行函数 Args: Returns: class Lifespan def __init__(self) -> None 轻雪生命周期管理,启动、停止、重启 @staticmethod def run_f...","head":[["link",{"rel":"alternate","hreflang":"en-us","href":"https://vuepress-theme-hope-docs-demo.netlify.app/en/dev/api/bot/lifespan.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/dev/api/bot/lifespan.html"}],["meta",{"property":"og:site_name","content":"LiteyukiBot 轻雪机器人"}],["meta",{"property":"og:title","content":"liteyuki.bot.lifespan"}],["meta",{"property":"og:description","content":"def run_funcs(funcs: list[LIFESPAN_FUNC | PROCESS_LIFESPAN_FUNC]) -> None 运行函数 Args: Returns: class Lifespan def __init__(self) -> None 轻雪生命周期管理,启动、停止、重启 @staticmethod def run_f..."}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:locale:alternate","content":"en-US"}],["meta",{"property":"og:updated_time","content":"2024-08-19T02:22:24.000Z"}],["meta",{"property":"article:modified_time","content":"2024-08-19T02:22:24.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"liteyuki.bot.lifespan\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-08-19T02:22:24.000Z\\",\\"author\\":[]}"]]},"headers":[{"level":3,"title":"def run_funcs(funcs: list[LIFESPAN_FUNC | PROCESS_LIFESPAN_FUNC]) -> None","slug":"def-run-funcs-funcs-list-lifespan-func-process-lifes
|