forked from bot/app
14 lines
4.4 KiB
JavaScript
14 lines
4.4 KiB
JavaScript
import{_ as n,o as t,c as s,d as a}from"./app-CLi4lRj1.js";const e={},p=a(`<h3 id="func-run-plugins" tabindex="-1"><a class="header-anchor" href="#func-run-plugins"><span><em>func</em> <code>run_plugins()</code></span></a></h3><p><strong>说明</strong>: 运行插件,无需手动初始化bot</p><p><strong>参数</strong>:</p><blockquote><ul><li>module_path: 插件路径,参考<code>liteyuki.load_plugin</code>的函数签名</li></ul></blockquote><details><summary><b>源代码</b></summary><div class="language-python line-numbers-mode" data-ext="py" data-title="py"><pre class="language-python"><code><span class="token keyword">def</span> <span class="token function">run_plugins</span><span class="token punctuation">(</span><span class="token operator">*</span>module_path<span class="token punctuation">:</span> <span class="token builtin">str</span> <span class="token operator">|</span> Path<span class="token punctuation">)</span><span class="token punctuation">:</span>
|
||
<span class="token triple-quoted-string string">"""
|
||
运行插件,无需手动初始化bot
|
||
Args:
|
||
module_path: 插件路径,参考\`liteyuki.load_plugin\`的函数签名
|
||
"""</span>
|
||
cfg <span class="token operator">=</span> load_config_in_default<span class="token punctuation">(</span><span class="token punctuation">)</span>
|
||
plugins <span class="token operator">=</span> cfg<span class="token punctuation">.</span>get<span class="token punctuation">(</span><span class="token string">'liteyuki.plugins'</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span>
|
||
plugins<span class="token punctuation">.</span>extend<span class="token punctuation">(</span>module_path<span class="token punctuation">)</span>
|
||
cfg<span class="token punctuation">[</span><span class="token string">'liteyuki.plugins'</span><span class="token punctuation">]</span> <span class="token operator">=</span> plugins
|
||
bot <span class="token operator">=</span> LiteyukiBot<span class="token punctuation">(</span><span class="token operator">**</span>cfg<span class="token punctuation">)</span>
|
||
bot<span class="token punctuation">.</span>run<span class="token punctuation">(</span><span class="token punctuation">)</span>
|
||
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details>`,5),i=[p];function o(l,u){return t(),s("div",null,i)}const r=n(e,[["render",o],["__file","plugin.html.vue"]]),d=JSON.parse('{"path":"/api/dev/plugin.html","title":"liteyuki.dev.plugin","lang":"zh-CN","frontmatter":{"title":"liteyuki.dev.plugin","description":"func run_plugins() 说明: 运行插件,无需手动初始化bot 参数: module_path: 插件路径,参考liteyuki.load_plugin的函数签名 源代码","head":[["link",{"rel":"alternate","hreflang":"en-us","href":"https://vuepress-theme-hope-docs-demo.netlify.app/en/api/dev/plugin.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/api/dev/plugin.html"}],["meta",{"property":"og:site_name","content":"LiteyukiBot 轻雪机器人"}],["meta",{"property":"og:title","content":"liteyuki.dev.plugin"}],["meta",{"property":"og:description","content":"func run_plugins() 说明: 运行插件,无需手动初始化bot 参数: module_path: 插件路径,参考liteyuki.load_plugin的函数签名 源代码"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:locale:alternate","content":"en-US"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"liteyuki.dev.plugin\\",\\"image\\":[\\"\\"],\\"dateModified\\":null,\\"author\\":[]}"]]},"headers":[{"level":3,"title":"func run_plugins()","slug":"func-run-plugins","link":"#func-run-plugins","children":[]}],"git":{"createdTime":null,"updatedTime":null,"contributors":[]},"readingTime":{"minutes":0.29,"words":88},"filePathRelative":"api/dev/plugin.md","autoDesc":true}');export{r as comp,d as data};
|