app/assets/plugin.html-CeT36pIe.js

14 lines
5.5 KiB
JavaScript
Raw Permalink Normal View History

import{_ as n,o as t,c as e,e as a}from"./app-BvUYPzLF.js";const s={},i=a(`<h1 id="liteyuki-dev-plugin" tabindex="-1"><a class="header-anchor" href="#liteyuki-dev-plugin"><span>liteyuki.dev.plugin</span></a></h1><p><strong>说明</strong>: Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved</p><p>@Time : 2024/8/18 上午5:04 @Author : snowykami @Email : snowykami@outlook.com @File : plugin.py @Software: PyCharm</p><h3 id="def-run-plugins-module-path-str-path" tabindex="-1"><a class="header-anchor" href="#def-run-plugins-module-path-str-path"><span><em><strong>def</strong></em> <code>run_plugins(*module_path: str | Path)</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> 或 <a href="https://github.com/LiteyukiStudio/LiteyukiBot/tree/main/liteyuki/dev/plugin.py#L17" target="_blank">在GitHub上查看</a></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">&quot;&quot;&quot;
运行插件无需手动初始化bot
Args:
module_path: 插件路径参考\`liteyuki.load_plugin\`的函数签名
&quot;&quot;&quot;</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">&#39;liteyuki.plugins&#39;</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">&#39;liteyuki.plugins&#39;</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>`,8),o=[i];function p(l,u){return t(),e("div",null,o)}const r=n(s,[["render",p],["__file","plugin.html.vue"]]),d=JSON.parse('{"path":"/dev/api/dev/plugin.html","title":"liteyuki.dev.plugin","lang":"zh-CN","frontmatter":{"title":"liteyuki.dev.plugin","lastUpdated":false,"description":"liteyuki.dev.plugin : Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved @Time : 2024/8/18 5:04 @Author : snowykami @Email : snowykami@outlook.com @File : plugin.py...","head":[["link",{"rel":"alternate","hreflang":"en-us","href":"https://vuepress-theme-hope-docs-demo.netlify.app/en/dev/api/dev/plugin.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/dev/api/dev/plugin.html"}],["meta",{"property":"og:site_name","content":"LiteyukiBot "}],["meta",{"property":"og:title","content":"liteyuki.dev.plugin"}],["meta",{"property":"og:description","content":"liteyuki.dev.plugin : Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved @Time : 2024/8/18 5:04 @Author : snowykami @Email : snowykami@outlook.com @File : plugin.py..."}],["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-29T06:19:39.000Z"}],["meta",{"property":"article:modified_time","content":"2024-08-29T06:19:39.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"liteyuki.dev.plugin\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-08-29T06:19:39.000Z\\",\\"author\\":[]}"]]},"headers":[{"level":3,"title":"def run_plugins(*module_path: str | Path)","slug":"def-run-plugins-module-path-str-path","link":"#def-run-plugins-module-path-str-path","children":[]}],"git":{"createdTime":1724031826000,"updatedTime":1724912379000,"contributors":[{"name":"snowy","email":"snowykami@outlook.com","commits":5}]},"readingTime":{"minutes":0.44,"words":132},"filePathRelative":"dev/api/dev/plugin.md","localizedDate":"2024819","autoDesc":true}');export{r as comp,d as data};