1
0
forked from bot/app
LiteyukiBot/assets/dev_lyfunc.html-CXCL0xJf.js

25 lines
9.7 KiB
JavaScript
Raw Normal View History

import{_ as t,r as o,o as i,c as l,b as n,d as e,a as s,e as c}from"./app-C3RRYNHH.js";const p={},r=c(`<h2 id="轻雪函数" tabindex="-1"><a class="header-anchor" href="#轻雪函数"><span><strong>轻雪函数</strong></span></a></h2><p>轻雪函数 Liteyuki Function 是轻雪的一个功能它允许你在轻雪中运行一些自定义的由数据驱动的命令类似于Minecraft的mcfunction属于资源包的一部分但需单独起篇幅.</p><h3 id="函数文件" tabindex="-1"><a class="header-anchor" href="#函数文件"><span><strong>函数文件</strong></span></a></h3><p>函数文件放在资源包的<code>functions</code>目录下,文件名以<code>.mcfunction</code> <code>.lyfunction</code> <code>.lyf</code>结尾,例如<code>test.mcfunction</code>,文件内容为一系列的命令,每行一个命令,支持单行注释<code>#</code>(编辑时的语法高亮可采取<code>shell</code>格式),例如:</p><div class="language-bash line-numbers-mode" data-ext="sh" data-title="sh"><pre class="language-bash"><code><span class="token comment"># 在发信器输出&quot;hello world&quot;</span>
cmd <span class="token builtin class-name">echo</span> hello world
<span class="token comment"># 如果你想同时输出多行内容可以尝试换行符(Python格式)</span>
cmd <span class="token builtin class-name">echo</span> hello world<span class="token punctuation">\\</span>nLiteyuki bot
</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></div><p></p><div class="language-bash line-numbers-mode" data-ext="sh" data-title="sh"><pre class="language-bash"><code>cmd <span class="token builtin class-name">echo</span> hello world <span class="token comment"># &quot;hello world&quot;</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h3 id="" tabindex="-1"><a class="header-anchor" href="#"><span><strong></strong></span></a></h3><div class="language-bash line-numbers-mode" data-ext="sh" data-title="sh"><pre class="language-bash"><code>var <span class="token operator">&lt;</span>var1<span class="token operator">=</span>value<span class="token operator"><span class="token file-descriptor important">1</span>&gt;</span> <span class="token punctuation">[</span>var2<span class="token operator">=</span>value2<span class="token punctuation">]</span> <span class="token punctuation">..</span>. <span class="token comment"># </span>
cmd <span class="token operator">&lt;</span>command<span class="token operator">&gt;</span> <span class="token comment"># </span>
api <span class="token operator">&lt;</span>api_name<span class="token operator">&gt;</span> <span class="token punctuation">[</span>var<span class="token operator">=</span>value<span class="token punctuation">..</span>.<span class="token punctuation">]</span> <span class="token comment"># Bot API</span>
<span class="token keyword">function</span> <span class="token operator">&lt;</span>func_name<span class="token operator">&gt;</span> <span class="token comment"># </span>
<span class="token function">sleep</span> <span class="token operator">&lt;</span>time<span class="token operator">&gt;</span> <span class="token comment"># s</span>
<span class="token function">nohup</span> <span class="token operator">&lt;</span>command<span class="token operator">&gt;</span> <span class="token comment"># 使task</span>
end <span class="token comment"># 结束函数关键字包括子task</span>
await <span class="token comment"># 等待所有异步任务结束若函数中启动了其他task需要在最后调用否则task对象会被销毁</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></div><h4 id="" tabindex="-1"><a class="header-anchor" href="#"><span><strong></strong></span></a></h4><div class="language-bash line-numbers-mode" data-ext="sh" data-title="sh"><pre class="language-bash"><code><span class="token comment"># </span>
<span class="token comment"># 使用 /function poke user_id=123456 执行</span>
<span class="token comment"># 每隔0.2s戳两次无限戳会触发最大递归深度限制</span>
<span class="token comment"># 若要戳20s后停止则需要删除await添加sleep 20和end</span>
api friend_poke <span class="token assign-left variable">user_id</span><span class="token operator">=</span>user_id
api friend_poke <span class="token assign-left variable">user_id</span><span class="token operator">=</span>user_id
<span class="token function">sleep</span> <span class="token number">0.2</span>
<span class="token function">nohup</span> <span class="token keyword">function</span> poke
await
</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></div><h3 id="api" tabindex="-1"><a class="header-anchor" href="#api"><span><strong>API</strong></span></a></h3><p>onebotv11apiAdapter api.</p>`,13),d={href:"https://283375.github.io/onebot_v11_vitepress/api/index.html",target:"_blank",rel:"noopener noreferrer"},u=n("h3",{id:"",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#"},[n("span",null,[n("strong",null,"")])])],-1),m=n("p",null,'LiteyukiBot, lyfunction"线".',-1),h=n("p",null,[n("code",null,"await"),e(" function")],-1),v=n("div",{class:"hint-container warning"},[n("p",{class:"hint-container-title"},"Warning"),n("p",null,"functiontaskawaittask")],-1),k={class:"hint-container tip"},f=n("p",{class:"hint-container-title"},"Tips",-1),g={href:"https://github.com/LiteyukiStudio/lyfunctionTextmate",target:"_blank",rel:"noopener noreferrer"};function b(_,y){const a=o("ExternalLinkIcon");return i(),l("div",null,[r,n("p",null,[n("a",d,[e("Onebot v11 API"),s(a)])]),u,m,h,v,n("div",k,[f,n("p",null,[e("使VS Code"),n("a",g,[e("Liteyuki Function"),s(a)]),e("")])])])}const w=t(p,[["render",b],["__file","dev_lyfunc.html.vue"]]),L=JSON.parse('{"path":"/en/dev/dev_lyfunc.html","title":"Liteyuki Function","lang":"en-US","frontmatter":{"title":"Liteyuki Function","icon":"code","order":2,"category":"development","description":" Liteyuki Function Minecraftmcfunction. functions.mcfunction .lyfunction .lyftest.mc...","head":[["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://vuepress-theme-hope-docs-demo.netlify.app/dev/dev_lyfunc.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/en/dev/dev_lyfunc.html"}],["meta",{"property":"og:site_name","content":"LiteyukiBot"}],["meta",{"property":"og:title","content":"Liteyuki Function"}],["meta",{"property":"og:description","content":" Liteyuki Function Minecraftmcfunction. functions.mcfunction .lyfunction .lyftest.mc..."}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"en-US"}],["meta",{"property":"og:locale:alternate","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-08-16T18:24:25.000Z"}],["meta",{"property":"article:modified_time","content":"2024-08-16T18:24:25.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"Liteyuki Function\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-08-16T18:24:25.000Z\\",\\"author\\":[]}"]]},"headers":[{"level":2,"title":"","slug":"","link":"#","children":[{"level":3,"title":"","slug":"","link":"#","children":[]},{"level":3,"title":"","slug":"","link":"