├── .dockerignore ├── .domain ├── .github ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── resource_publish_en.yml │ ├── resource_publish_zh.yml │ └── 问题反馈.md ├── dependabot.yml └── workflows │ ├── build-image.yml │ ├── deploy-docs-liteyukicloud.yml │ ├── issue_handler.yml │ ├── pre-commit.yml │ └── pypi-publish.yml ├── .gitignore ├── .pre-commit-config.yaml ├── Dockerfile ├── LICENSE ├── README.md ├── config └── default.yml ├── docker-compose.yml ├── docker └── sources.list ├── docs ├── .vitepress │ ├── config │ │ ├── common.ts │ │ ├── en.ts │ │ ├── index.ts │ │ ├── utils.ts │ │ └── zh.ts │ └── theme │ │ ├── index.ts │ │ └── liteyuki.scss ├── components │ ├── ContributorBar.vue │ ├── Dash.vue │ ├── Geo.vue │ ├── Home.vue │ ├── PluginItemCard.vue │ ├── PluginStore.vue │ ├── ResItemCard.vue │ ├── ResPubWindow.vue │ ├── ResStore.vue │ ├── StatsBar.vue │ ├── Tabs.vue │ ├── ToggleSwitch.vue │ ├── TryLiteyukiWindow.vue │ └── scripts │ │ ├── const.ts │ │ ├── i18n.ts │ │ └── statsApi.ts ├── en │ ├── deploy │ │ ├── config.md │ │ ├── fandq.md │ │ └── install.md │ ├── dev │ │ ├── best_practices.md │ │ ├── comm.md │ │ ├── guide.md │ │ ├── lyfunc.md │ │ ├── plugin.md │ │ └── resource.md │ ├── index.md │ ├── store │ │ ├── plugin.md │ │ └── resource.md │ └── usage │ │ ├── agreement.md │ │ ├── basic.md │ │ └── extra.md ├── package.json ├── pnpm-lock.yaml ├── public │ ├── favicon.ico │ ├── plugins.json │ └── resources.json ├── tsconfig.json └── zh │ ├── deploy │ ├── adapter.md │ ├── config.md │ ├── fandq.md │ └── install.md │ ├── dev │ ├── best_practices.md │ ├── comm.md │ ├── guide.md │ ├── lyfunc.md │ ├── plugin.md │ └── resource.md │ ├── index.md │ ├── store │ ├── plugin.md │ └── resource.md │ └── usage │ ├── agreement.md │ ├── basic.md │ └── extra.md ├── liteyuki ├── EN.LICENSE ├── LICENSE ├── __init__.py ├── bot │ ├── __init__.py │ └── lifespan.py ├── comm │ ├── __init__.py │ ├── channel.py │ ├── event.py │ └── storage.py ├── config.py ├── core │ ├── __init__.py │ └── manager.py ├── dev │ ├── __init__.py │ ├── observer.py │ └── plugin.py ├── exception.py ├── log.py ├── plugin │ ├── __init__.py │ ├── load.py │ ├── manager.py │ └── model.py ├── plugins │ ├── __init__.py │ ├── liteecho.py │ └── plugin_loader │ │ └── __init__.py ├── py.typed ├── session │ ├── __init__.py │ ├── event.py │ ├── matcher.py │ ├── message │ │ └── segments.py │ ├── models.py │ ├── on.py │ └── rule.py └── utils.py ├── liteyuki_flow ├── __init__.py ├── __main__.py ├── const.py ├── markdown_parser.py ├── plugin_handler.py ├── requirements.txt ├── resource_handler.py ├── ts.md └── typ.py ├── main.py ├── py.typed ├── pyproject.toml ├── requirements.txt ├── scripts └── install-deps.sh ├── src ├── liteyuki_plugins │ ├── hello_liteyuki.py │ ├── lifespan_monitor.py │ ├── melobot │ │ └── __init__.py │ ├── nonebot │ │ ├── __init__.py │ │ ├── dev_reloader.py │ │ ├── nb_utils │ │ │ ├── adapter_manager │ │ │ │ ├── __init__.py │ │ │ │ ├── onebot.py │ │ │ │ └── satori.py │ │ │ └── driver_manager │ │ │ │ ├── __init__.py │ │ │ │ ├── auto_set_env.py │ │ │ │ └── defines.py │ │ ├── nonebot_plugins │ │ │ ├── liteyuki_mctools │ │ │ │ └── __init__.py │ │ │ ├── liteyuki_pacman │ │ │ │ ├── __init__.py │ │ │ │ ├── common.py │ │ │ │ ├── npm.py │ │ │ │ └── rpm.py │ │ │ ├── liteyuki_smart_reply │ │ │ │ ├── __init__.py │ │ │ │ ├── matchers.py │ │ │ │ ├── monitors.py │ │ │ │ └── utils.py │ │ │ ├── liteyuki_statistics │ │ │ │ ├── __init__.py │ │ │ │ ├── common.py │ │ │ │ ├── data_source.py │ │ │ │ ├── stat_matchers.py │ │ │ │ ├── stat_monitors.py │ │ │ │ ├── stat_restful_api.py │ │ │ │ └── word_cloud │ │ │ │ │ ├── LICENSE │ │ │ │ │ └── data_source.py │ │ │ ├── liteyuki_status │ │ │ │ ├── __init__.py │ │ │ │ ├── api.py │ │ │ │ ├── counter_for_satori.py │ │ │ │ └── status.py │ │ │ ├── liteyuki_user │ │ │ │ ├── __init__.py │ │ │ │ ├── const.py │ │ │ │ ├── input_handle.py │ │ │ │ └── profile_manager.py │ │ │ ├── liteyuki_weather │ │ │ │ ├── __init__.py │ │ │ │ ├── qw_api.py │ │ │ │ ├── qw_models.py │ │ │ │ └── qweather.py │ │ │ ├── packmanv2 │ │ │ │ ├── __init__.py │ │ │ │ ├── handle.py │ │ │ │ ├── npm │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── data_source.py │ │ │ │ └── rpm │ │ │ │ │ └── __init__.py │ │ │ ├── to_liteyuki.py │ │ │ └── webdash │ │ │ │ ├── __init__.py │ │ │ │ ├── common.py │ │ │ │ ├── main.py │ │ │ │ └── restful_api.py │ │ └── np_main │ │ │ ├── __init__.py │ │ │ ├── api.py │ │ │ ├── core.py │ │ │ ├── loader.py │ │ │ └── uitls.py │ ├── process_manager │ │ └── __init__.py │ ├── register_service.py │ ├── resource_loader │ │ └── __init__.py │ └── scheduled_tasks │ │ ├── __init__.py │ │ └── divided_by_lifespan │ │ ├── __init__.py │ │ └── after_start.py ├── resources │ ├── htmlrender │ │ ├── LICENSE │ │ ├── metadata.yml │ │ └── templates │ │ │ ├── github-markdown-light.css │ │ │ ├── katex │ │ │ ├── katex.min.b64_fonts.css │ │ │ ├── katex.min.js │ │ │ └── mathtex-script-type.min.js │ │ │ ├── markdown.html │ │ │ ├── pygments-default.css │ │ │ ├── text.css │ │ │ └── text.html │ ├── liteyuki_crt │ │ ├── lang │ │ │ ├── en.lang │ │ │ └── zh-CN.lang │ │ ├── metadata.yml │ │ └── templates │ │ │ ├── crt_route.html │ │ │ ├── css │ │ │ └── crt_route.css │ │ │ └── js │ │ │ └── crt_route.js │ ├── liteyuki_statistics │ │ ├── lang │ │ │ ├── en-US.lang │ │ │ ├── fr-FR.lang │ │ │ ├── ru-RU.lang │ │ │ └── zh-CN.lang │ │ ├── metadata.yml │ │ └── templates │ │ │ ├── css │ │ │ ├── stat_msg.css │ │ │ └── stat_rank.css │ │ │ ├── js │ │ │ ├── stat_msg.js │ │ │ └── stat_rank.js │ │ │ ├── stat_msg.html │ │ │ └── stat_rank.html │ ├── liteyuki_weather │ │ ├── lang │ │ │ ├── en.lang │ │ │ ├── ja.lang │ │ │ └── zh-CN.lang │ │ ├── metadata.yml │ │ └── templates │ │ │ ├── css │ │ │ └── weather_now.css │ │ │ ├── img │ │ │ ├── ad_default │ │ │ │ └── ad_default.png │ │ │ ├── qw_icon │ │ │ │ ├── 100.png │ │ │ │ ├── 101.png │ │ │ │ ├── 102.png │ │ │ │ ├── 103.png │ │ │ │ ├── 104.png │ │ │ │ ├── 150.png │ │ │ │ ├── 151.png │ │ │ │ ├── 152.png │ │ │ │ ├── 153.png │ │ │ │ ├── 154.png │ │ │ │ ├── 300.png │ │ │ │ ├── 301.png │ │ │ │ ├── 302.png │ │ │ │ ├── 303.png │ │ │ │ ├── 304.png │ │ │ │ ├── 305.png │ │ │ │ ├── 306.png │ │ │ │ ├── 307.png │ │ │ │ ├── 308.png │ │ │ │ ├── 309.png │ │ │ │ ├── 310.png │ │ │ │ ├── 311.png │ │ │ │ ├── 312.png │ │ │ │ ├── 313.png │ │ │ │ ├── 314.png │ │ │ │ ├── 315.png │ │ │ │ ├── 316.png │ │ │ │ ├── 317.png │ │ │ │ ├── 318.png │ │ │ │ ├── 350.png │ │ │ │ ├── 351.png │ │ │ │ ├── 399.png │ │ │ │ ├── 400.png │ │ │ │ ├── 401.png │ │ │ │ ├── 402.png │ │ │ │ ├── 403.png │ │ │ │ ├── 404.png │ │ │ │ ├── 405.png │ │ │ │ ├── 406.png │ │ │ │ ├── 407.png │ │ │ │ ├── 408.png │ │ │ │ ├── 409.png │ │ │ │ ├── 410.png │ │ │ │ ├── 456.png │ │ │ │ ├── 457.png │ │ │ │ ├── 499.png │ │ │ │ ├── 500.png │ │ │ │ ├── 501.png │ │ │ │ ├── 502.png │ │ │ │ ├── 503.png │ │ │ │ ├── 504.png │ │ │ │ ├── 507.png │ │ │ │ ├── 508.png │ │ │ │ ├── 509.png │ │ │ │ ├── 510.png │ │ │ │ ├── 511.png │ │ │ │ ├── 512.png │ │ │ │ ├── 513.png │ │ │ │ ├── 514.png │ │ │ │ ├── 515.png │ │ │ │ ├── 800.png │ │ │ │ ├── 801.png │ │ │ │ ├── 802.png │ │ │ │ ├── 803.png │ │ │ │ ├── 804.png │ │ │ │ ├── 805.png │ │ │ │ ├── 806.png │ │ │ │ ├── 807.png │ │ │ │ ├── 900.png │ │ │ │ ├── 901.png │ │ │ │ └── 999.png │ │ │ └── svg │ │ │ │ ├── cloud.svg │ │ │ │ ├── feelsLike.svg │ │ │ │ ├── humidity.svg │ │ │ │ ├── precip.svg │ │ │ │ ├── pressure.svg │ │ │ │ ├── sunrise.svg │ │ │ │ ├── sunset.svg │ │ │ │ ├── vis.svg │ │ │ │ ├── windDirect.svg │ │ │ │ └── windVelocity.svg │ │ │ ├── js │ │ │ └── weather_now.js │ │ │ └── weather_now.html │ ├── liteyuki_words │ │ ├── metadata.yml │ │ └── word_bank │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ └── data.json │ ├── vanilla_language │ │ ├── lang │ │ │ ├── de.lang │ │ │ ├── en.lang │ │ │ ├── es.lang │ │ │ ├── fr.lang │ │ │ ├── ja.lang │ │ │ ├── ko.lang │ │ │ ├── ru.lang │ │ │ ├── zh-CN.lang │ │ │ ├── zh-HK.lang │ │ │ ├── zh-Kawaii.lang │ │ │ ├── zh-MS.lang │ │ │ └── zh-WY.lang │ │ └── metadata.yml │ └── vanilla_resource │ │ ├── functions │ │ ├── func.md │ │ ├── hello.lyfunction │ │ └── poke.lyfunction │ │ ├── metadata.yml │ │ ├── templates │ │ ├── chromium_error.png │ │ ├── css │ │ │ ├── card.css │ │ │ ├── fonts.css │ │ │ ├── status.css │ │ │ └── style.css │ │ ├── favicon.ico │ │ ├── fonts │ │ │ ├── MapleMono │ │ │ │ ├── MapleMono-Bold.woff2 │ │ │ │ ├── MapleMono-BoldItalic.woff2 │ │ │ │ ├── MapleMono-Italic.woff2 │ │ │ │ ├── MapleMono-Light.woff2 │ │ │ │ ├── MapleMono-LightItalic.woff2 │ │ │ │ └── MapleMono-Regular.woff2 │ │ │ └── MiSans │ │ │ │ ├── MiSans-Bold.woff2 │ │ │ │ ├── MiSans-Heavy.woff2 │ │ │ │ ├── MiSans-Light.woff2 │ │ │ │ ├── MiSans-Normal.woff2 │ │ │ │ └── MiSans-Semibold.woff2 │ │ ├── img │ │ │ ├── 2023-08-05_20.06.51.png │ │ │ ├── bg1.webp │ │ │ ├── bg2.webp │ │ │ ├── bg3.webp │ │ │ ├── bg4.webp │ │ │ ├── bg5.webp │ │ │ ├── bg6.webp │ │ │ ├── bg7.webp │ │ │ └── liteyuki.png │ │ ├── js │ │ │ ├── card.js │ │ │ ├── motto.js │ │ │ ├── status.js │ │ │ └── style.js │ │ ├── static │ │ │ └── motto.txt │ │ ├── stats.html │ │ ├── status.html │ │ ├── status_mem.html │ │ └── svg │ │ │ └── lylogo-full.svg │ │ └── unsorted │ │ └── plugins.json └── utils │ ├── __init__.py │ ├── base │ ├── __init__.py │ ├── config.py │ ├── data.py │ ├── data_manager.py │ ├── language.py │ ├── log.py │ ├── ly_function.py │ ├── ly_typing.py │ ├── permission.py │ ├── resource.py │ └── word_bank.py │ ├── canvas │ └── __init__.py │ ├── event │ ├── __init__.py │ └── get_info.py │ ├── extension │ ├── __init__.py │ └── lib_loader.py │ ├── external │ ├── __init__.py │ └── logo.py │ ├── io │ ├── __init__.py │ ├── file.py │ └── net.py │ ├── message │ ├── __init__.py │ ├── html_tool.py │ ├── markdown.py │ ├── message.py │ ├── string_tool.py │ ├── tools.py │ └── union.py │ ├── nb │ └── __init__.py │ └── satori_utils │ ├── __init__.py │ ├── count_friends.py │ ├── count_groups.py │ └── user_info.py ├── tests ├── test_config_load.py ├── test_core.py ├── test_ipc.py ├── test_logger.py ├── test_lyapi.py └── test_lyfunc.py └── todo.md /.dockerignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteyukiStudio/LiteyukiBot/1ae45808fd3021c0920771802627acd85a2edea1/.dockerignore -------------------------------------------------------------------------------- /.domain: -------------------------------------------------------------------------------- 1 | bot.liteyuki.icu 2 | docs.app.bot.pages.git.liteyuki.icu 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/resource_publish_en.yml: -------------------------------------------------------------------------------- 1 | name: Publish Resource 2 | title: "Resource: {name}" 3 | description: Publish the resource to the LiteyukiBot official store 4 | labels: [ "Resource" ] 5 | body: 6 | - type: input 7 | id: name 8 | attributes: 9 | label: Name 10 | description: The readable name of the resource pack 11 | placeholder: e.g. Cute UI Resource Pack 12 | validations: 13 | required: true 14 | 15 | - type: input 16 | id: description 17 | attributes: 18 | label: Description 19 | description: A brief description of the resource 20 | placeholder: e.g. Makes the rendering card style more beautiful 21 | validations: 22 | required: true 23 | 24 | - type: input 25 | id: author 26 | attributes: 27 | label: Author 28 | description: The GitHub username of the author 29 | placeholder: e.g. snowykami 30 | validations: 31 | required: true 32 | 33 | - type: input 34 | id: link 35 | attributes: 36 | label: Link 37 | description: Direct download link of the resource pack 38 | placeholder: e.g. https://aaa.com/r.zip 39 | validations: 40 | required: true 41 | 42 | - type: input 43 | id: homepage 44 | attributes: 45 | label: Homepage 46 | description: Homepage of the resource pack 47 | placeholder: e.g. https://github.com/user/repo 48 | validations: 49 | required: false 50 | 51 | - type: input 52 | id: tags 53 | attributes: 54 | label: Tags 55 | description: Tags 56 | placeholder: 'e.g. [{"label": "Tag Name", "color": "#ea5252"}]' 57 | value: '[ { "label": "Text", "color": "#a2d8f4" } ]' 58 | validations: 59 | required: false 60 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/resource_publish_zh.yml: -------------------------------------------------------------------------------- 1 | name: 发布资源 2 | title: "Resource: {name}" 3 | description: 发布资源到轻雪机器人官方商店 4 | labels: [ "Resource" ] 5 | body: 6 | - type: input 7 | id: name 8 | attributes: 9 | label: 名称 10 | description: 资源包的可读名称 11 | placeholder: e.g. 可爱UI资源包 12 | validations: 13 | required: true 14 | 15 | - type: input 16 | id: description 17 | attributes: 18 | label: 描述 19 | description: 资源的简短描述 20 | placeholder: e.g. 使渲染卡片的样式更美观 21 | validations: 22 | required: true 23 | 24 | - type: input 25 | id: author 26 | attributes: 27 | label: 作者 28 | description: 作者的github用户名 29 | placeholder: e.g. snowykami 30 | validations: 31 | required: true 32 | 33 | - type: input 34 | id: link 35 | attributes: 36 | label: 下载链接 37 | description: 资源包直接下载链接 38 | placeholder: e.g. https://aaa.com/r.zip 39 | validations: 40 | required: true 41 | 42 | - type: input 43 | id: homepage 44 | attributes: 45 | label: 主页 46 | description: 资源包主页 47 | placeholder: e.g. https://github.com/user/repo 48 | validations: 49 | required: false 50 | 51 | - type: input 52 | id: tags 53 | attributes: 54 | label: 标签 55 | description: 标签 56 | placeholder: 'e.g. [{"label": "标签名", "color": "#ea5252"}]' 57 | value: '[ { "label": "标签名", "color": "#a2d8f4" } ]' 58 | validations: 59 | required: false 60 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/问题反馈.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 问题反馈 3 | about: 反馈你在使用轻雪中遇到的问题 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | # 问题反馈 11 | 12 | ## **请确保** 13 | 14 | - 已认真阅读[文档]("https://bot.liteyuki.icu"),该问题不是文档提及的或你自己操作不当造成的 15 | - 你的问题是在最新版本的代码上测试的 16 | - 请勿重复提交相同或类似的issue 17 | 18 | 19 | ## **描述问题** 20 | 21 | 请在此简单描述问题 22 | 23 | 24 | 25 | ## **如何复现** 26 | 27 | 请阐述一下如何重现这个问题 28 | ### 预期 29 | 30 | 描述你期望发生的事情 31 | 32 | ### 实际 33 | 34 | 描述实际发生的事情 35 | 36 | 37 | 38 | ## **日志或截图** 39 | ``` 40 | 日志内容 41 | ``` 42 | 43 | 44 | ## **设备信息** 45 | - **系统**: [例如 Ubuntu 22.04] 46 | - **CPU**: [例如 Intel i7-7700K] 47 | - **内存**: [例如 16GB] 48 | - **Python**: [例如CPython 3.10.7] 49 | 50 | 51 | **补充内容** 52 | 53 | 可选,推荐提供`pip freeze`的输出,以及其他相关信息,以及你的建议 54 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | -------------------------------------------------------------------------------- /.github/workflows/build-image.yml: -------------------------------------------------------------------------------- 1 | 2 | name: Docker Image Build 3 | 4 | on: 5 | push: 6 | branches: [main] 7 | 8 | workflow_dispatch: 9 | 10 | permissions: 11 | contents: write 12 | 13 | concurrency: 14 | group: docker-build 15 | cancel-in-progress: false 16 | 17 | jobs: 18 | build: 19 | runs-on: ubuntu-latest 20 | 21 | steps: 22 | - name: Checkout code 23 | uses: actions/checkout@v4 24 | 25 | - name: Set up Docker Buildx 26 | uses: docker/setup-buildx-action@v2 27 | 28 | - name: Log in to GitHub Container Registry 29 | uses: docker/login-action@v2 30 | with: 31 | registry: ghcr.io 32 | username: ${{ secrets.GHCR_USERNAME }} 33 | password: ${{ secrets.GHCR_PASSWORD }} 34 | 35 | - name: Build and push Docker image 36 | uses: docker/build-push-action@v6 37 | with: 38 | context: . 39 | push: true 40 | tags: ghcr.io/liteyukistudio/liteyukibot:latest 41 | 42 | - name: Log out from GitHub Container Registry 43 | run: docker logout ghcr.io 44 | -------------------------------------------------------------------------------- /.github/workflows/deploy-docs-liteyukicloud.yml: -------------------------------------------------------------------------------- 1 | name: Deploy VitePress site to Liteyuki PaaS 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | workflow_dispatch: 7 | permissions: 8 | contents: write 9 | statuses: write 10 | 11 | concurrency: 12 | group: pages 13 | cancel-in-progress: false 14 | 15 | env: 16 | MELI_SITE: "800a7c09-dd9c-4ba7-a43f-af9bc69808c4" 17 | 18 | jobs: 19 | # 构建工作 20 | build: 21 | runs-on: ubuntu-latest 22 | steps: 23 | - name: Checkout 24 | uses: actions/checkout@v4 25 | with: 26 | fetch-depth: 0 # 如果未启用 lastUpdated,则不需要 27 | - name: Setup Python 28 | uses: actions/setup-python@v2 29 | with: 30 | python-version: "3.11" 31 | 32 | - name: Setup API markdown 33 | run: |- 34 | python -m pip install litedoc 35 | litedoc liteyuki -o docs/zh/dev/api -l zh-Hans -cd class -fd func -md func -vd var -bu https://github.com/LiteyukiStudio/LiteyukiBot/tree/main/liteyuki/ 36 | litedoc liteyuki -o docs/en/dev/api -l en -cd class -fd func -md func -vd var -bu https://github.com/LiteyukiStudio/LiteyukiBot/tree/main/liteyuki/ 37 | 38 | - name: 安装 pnpm 39 | uses: pnpm/action-setup@v2 40 | with: 41 | run_install: true 42 | version: 8 43 | 44 | - name: 设置 Node.js 45 | run: |- 46 | cd docs 47 | pnpm install 48 | 49 | - name: 构建文档 50 | env: 51 | NODE_OPTIONS: --max_old_space_size=8192 52 | run: |- 53 | cd docs 54 | pnpm run docs:build 55 | > .vitepress/dist/.nojekyll 56 | 57 | - name: "发布" 58 | run: | 59 | npx -p "@getmeli/cli" meli upload docs/.vitepress/dist \ 60 | --url "https://dash.apage.dev" \ 61 | --site "$MELI_SITE" \ 62 | --token "$MELI_TOKEN" \ 63 | --release "$GITHUB_SHA" 64 | env: 65 | MELI_TOKEN: ${{ secrets.MELI_TOKEN }} 66 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 67 | -------------------------------------------------------------------------------- /.github/workflows/issue_handler.yml: -------------------------------------------------------------------------------- 1 | name: Issue Handler 2 | 3 | on: 4 | issues: 5 | types: [ opened, edited, closed ] 6 | 7 | concurrency: 8 | group: issue_handler 9 | cancel-in-progress: false 10 | 11 | jobs: 12 | check-issue: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout code 16 | uses: actions/checkout@v2 17 | 18 | - name: Check issue title 19 | id: check_title 20 | run: | 21 | ISSUE_TITLE="${{ github.event.issue.title }}" 22 | if [[ "$ISSUE_TITLE" == Plugin:* || "$ISSUE_TITLE" == Resource:* ]]; then 23 | echo "Title starts with Plugin: or Resource:." 24 | echo "::set-output name=title_match::true" 25 | else 26 | echo "Title does not start with Plugin: or Resource:." 27 | echo "::set-output name=title_match::false" 28 | fi 29 | 30 | - name: Set up Python 31 | uses: actions/setup-python@v2 32 | if: steps.check_title.outputs.title_match == 'true' 33 | with: 34 | python-version: '3.12' 35 | 36 | - name: Install dependencies 37 | if: steps.check_title.outputs.title_match == 'true' 38 | run: | 39 | echo "Installing dependencies." 40 | pip install -r liteyuki_flow/requirements.txt 41 | 42 | - name: Run Plugin/Resource issue handler 43 | if: steps.check_title.outputs.title_match == 'true' 44 | run: | 45 | echo "Running Plugin/Resource issue handler." 46 | python -m liteyuki_flow --handle 47 | env: 48 | GITHUB_TOKEN: ${{ secrets.TOKEN }} 49 | ISSUE_NUMBER: ${{ github.event.issue.number }} 50 | REPOSITORY: ${{ github.repository }} 51 | ACT_TYPE: ${{ github.event.action }} -------------------------------------------------------------------------------- /.github/workflows/pre-commit.yml: -------------------------------------------------------------------------------- 1 | name: Pre-commit checks 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | pre-commit: 7 | runs-on: ubuntu-latest 8 | strategy: 9 | matrix: 10 | python-version: ['3.10', '3.11', '3.12', '3.13'] # 添加你想要测试的 Python 版本 11 | 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v3 15 | 16 | - name: Set up Python 17 | uses: actions/setup-python@v3 18 | with: 19 | python-version: ${{ matrix.python-version }} # 使用矩阵中的 Python 版本 20 | 21 | - name: Install dependencies 22 | run: | 23 | python -m pip install pdm 24 | python -m pip install pre-commit 25 | pdm config python.use_venv false 26 | pdm install --no-lock 27 | pre-commit install 28 | 29 | - name: Run pre-commit 30 | run: pre-commit run --all-files 31 | -------------------------------------------------------------------------------- /.github/workflows/pypi-publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v*' 7 | 8 | jobs: 9 | pypi-publish: 10 | name: upload release to PyPI 11 | runs-on: ubuntu-latest 12 | permissions: 13 | contents: read 14 | id-token: write 15 | steps: 16 | - uses: actions/checkout@v3 17 | 18 | - uses: pdm-project/setup-pdm@v3 19 | 20 | - name: Publish package distributions to PyPI 21 | run: pdm publish 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .venv/ 2 | .idea/ 3 | .vscode/ 4 | .cache/ 5 | 6 | venv/ 7 | 8 | node_modules/ 9 | data/ 10 | db/ 11 | /resources/ 12 | __pycache__/ 13 | *.pyc 14 | *.pyo 15 | *.pyd 16 | *.pyw 17 | /plugins/ 18 | 19 | #config 20 | /config/ 21 | !config/default.yml 22 | _config.yml 23 | config.yml 24 | config.example.yml 25 | 26 | # vuepress 27 | 28 | # mupy 29 | mypy.ini 30 | 31 | # nuitka 32 | compile.bat 33 | src/resources/templates/latest-debug.html 34 | main.build/ 35 | main.dist/ 36 | main.exe 37 | main.cmd 38 | docs/.vuepress/.cache/ 39 | docs/.vuepress/.temp/ 40 | docs/.vuepress/dist/ 41 | prompt.txt 42 | 43 | # js 44 | **/echarts.js 45 | .env 46 | 47 | 48 | # pdm 49 | .pdm-python 50 | .pdm-build 51 | dist 52 | 53 | doc 54 | 55 | mkdoc2.py 56 | result.json 57 | 58 | # litedoc 59 | docs/zh/dev/api 60 | docs/en/dev/api 61 | mkdoc.bat 62 | 63 | # vitepress 64 | docs/.vitepress/dist/ 65 | docs/.vitepress/cache 66 | docs/.vitepress/.temp 67 | 68 | # python toolchain 69 | .mypy_cache/ 70 | .pytest_cache/ 71 | 72 | # pdm 73 | __pypackages__/ 74 | pdm.lock -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | fail_fast: true 2 | repos: 3 | - repo: https://github.com/psf/black 4 | rev: 24.4.2 5 | hooks: 6 | - id: black 7 | args: [--config=./pyproject.toml] 8 | 9 | - repo: https://github.com/timothycrosley/isort 10 | rev: 5.13.2 11 | hooks: 12 | - id: isort 13 | args: ["--profile", "black"] 14 | 15 | - repo: https://github.com/pre-commit/mirrors-mypy 16 | rev: v1.13.0 17 | hooks: 18 | - id: mypy 19 | 20 | - repo: https://github.com/pre-commit/pre-commit-hooks 21 | rev: v4.0.1 22 | hooks: 23 | - id: trailing-whitespace 24 | - id: end-of-file-fixer 25 | - id: check-yaml 26 | - id: check-added-large-files 27 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/library/python:3.10-slim-bullseye 2 | 3 | ENV TZ Asia/Shanghai 4 | 5 | RUN apt-get update && apt-get install -y git 6 | 7 | WORKDIR /liteyukibot 8 | 9 | COPY . /liteyukibot 10 | 11 | RUN pip install --no-cache-dir -r requirements.txt 12 | 13 | RUN apt-get install -y libnss3 libnspr4 libdbus-1-3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libatspi2.0-0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libxkbcommon0 libasound2 libpango-1.0-0 libcairo2 14 | 15 | EXPOSE 20216 16 | 17 | CMD ["python", "main.py"] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | LSO license 2 | LiteyukiStudio Opensource license 3 | 4 | --- 5 | 6 | 版权所有 © 2024 Snowykami 7 | 8 | --- 9 | 10 | 免费向任何获得副本的人或组织授予以相同许可为基础的权利 11 | 12 | 包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件的副本 13 | 14 | 本软件及相关文档文件(以下简称"本软件")在相同方式许可为基础, 以开源的形式发布于互联网抑或其他媒体介质平台 15 | 16 | 任何人都有权利获取副本并以上述方式获取许可传播和/或使用 17 | 18 | 但获取副本时仍需注意: 19 | 20 | - 上述版权声明和本许可声明应包含在本软件的副本中 21 | - 使用本软件及其副本时仍需保持与原有形式相同 22 | 23 | - 在使用时仍需将本软件的副本以相同许可公开表现: 24 | - 不得未经原作者允许将本软件的副本以非原许可的形式对外盈利 25 | 26 | --- 27 | 28 | 该软件按"原样"之副本提供,不提供任何形式的任意保证,明示或暗示: 29 | 包括但不限于适销性保证, 适用于特定目的非侵权 30 | 31 | 在任何情况下, 作者或版权所有者对任何非因作者或版权所有者使用该软件造成的索赔、损害或其他责任, 无论是在合同诉讼、侵权行为还是其他诉讼中都不具有责任, 作者及其版权所有者有权利驳回使用者因个人原因造成的任何损失之赔付 32 | -------------------------------------------------------------------------------- /config/default.yml: -------------------------------------------------------------------------------- 1 | nonebot: 2 | host: 0.0.0.0 3 | port: 20216 4 | command_start: ["", "/"] 5 | nickname: [ "liteyuki" ] 6 | default_language: zh 7 | driver: ~fastapi+~httpx+~websockets 8 | alconna_use_command_start: true 9 | gotify_token: "empty token" 10 | 11 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | 3 | services: 4 | app: 5 | image: git.liteyuki.icu/bot/app:latest 6 | ports: 7 | - "20216:20216" 8 | environment: 9 | - TZ=Asia/Chongqing 10 | volumes: 11 | - .:/liteyukibot 12 | command: [ "python", "main.py" ] 13 | -------------------------------------------------------------------------------- /docker/sources.list: -------------------------------------------------------------------------------- 1 | deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free 2 | # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free 3 | deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free 4 | # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free 5 | 6 | deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free 7 | # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free 8 | 9 | deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free 10 | # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free -------------------------------------------------------------------------------- /docs/.vitepress/config/en.ts: -------------------------------------------------------------------------------- 1 | import {defineConfig} from 'vitepress' 2 | import {ThemeConfig} from "./utils"; 3 | 4 | export const en = defineConfig({ 5 | lang: "en-US", 6 | title: "LiteyukiBot", 7 | description: "A high-performance, easy-to-use chatbot framework and application", 8 | themeConfig: { 9 | nav: [ 10 | {text: 'Deploy', link: '/en/deploy/install'}, 11 | {text: 'Usage', link: '/en/usage/basic'}, 12 | {text: 'Extension', link: '/en/store/resource'}, 13 | {text: 'Develop', link: '/en/dev/guide'}, 14 | ], 15 | docFooter: { 16 | prev: 'Prev Page', 17 | next: 'Next Page' 18 | }, 19 | editLink: ThemeConfig.getEditLink( 20 | 'Edit this page on GitHub', 21 | ), 22 | footer: { 23 | message: 'Page is deployed at Liteyuki Meli and accelerated by Liteyukiflare
Documentation built with VitePress | API references generated by litedoc', 24 | copyright: ThemeConfig.copyright 25 | }, 26 | outline: ThemeConfig.getOutLine("Page Content"), 27 | 28 | langMenuLabel: 'Language', 29 | returnToTopLabel: 'Back to top', 30 | sidebarMenuLabel: 'Menu', 31 | darkModeSwitchLabel: 'Theme', 32 | lightModeSwitchTitle: 'Light Mode', 33 | darkModeSwitchTitle: 'Dark Mode', 34 | }, 35 | }) -------------------------------------------------------------------------------- /docs/.vitepress/config/index.ts: -------------------------------------------------------------------------------- 1 | import {defineConfig} from "vitepress"; 2 | 3 | import {common} from './common' 4 | export default defineConfig({ 5 | ...common, 6 | }) -------------------------------------------------------------------------------- /docs/.vitepress/config/utils.ts: -------------------------------------------------------------------------------- 1 | // 本模块储存一些工具函数和引用 2 | 3 | /** 4 | * GetEditLink Options 5 | * @param text Edit link text 6 | */ 7 | export const ThemeConfig = { 8 | getEditLink: (editPageText: string): { pattern: (params: { filePath: string; }) => string; text: string; } => { 9 | return { 10 | pattern: ({filePath}: { filePath: string; }): string => { 11 | // 匹配 /dev/api或 /{lang}/dev/api 12 | const regex = /^[^\/]+\/dev\/api/; 13 | console.log(filePath); 14 | if (regex.test(filePath)) { 15 | // remove {lang}/api prefix 16 | filePath = filePath.replace(regex, '') 17 | .replace('index.md', '__init__.py') 18 | .replace('.md', '.py'); 19 | // 若文件名(不含扩展)和上级文件夹相同,返回文件夹/__init__.py 20 | if (filePath.split('/').pop().split('.')[0] === filePath.split('/').slice(-2, -1)[0]) { 21 | filePath = filePath.split('/').slice(0, -1).join('/') + '/__init__.py'; 22 | } 23 | return `https://github.com/LiteyukiStudio/LiteyukiBot/tree/main/liteyuki${filePath}`; 24 | } else { 25 | return `https://github.com/LiteyukiStudio/LiteyukiBot/tree/main/docs/${filePath}`; 26 | } 27 | }, 28 | text: editPageText 29 | }; 30 | }, 31 | 32 | getOutLine: (label: string): { label: string; level: [number, number]; } => { 33 | return { 34 | label: label, 35 | level: [2, 6] 36 | }; 37 | }, 38 | 39 | copyright: 'Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved' 40 | } 41 | -------------------------------------------------------------------------------- /docs/.vitepress/config/zh.ts: -------------------------------------------------------------------------------- 1 | import {defineConfig} from 'vitepress' 2 | import {ThemeConfig} from "./utils"; 3 | 4 | export const zh = defineConfig({ 5 | lang: "zh-Hans", 6 | title: "轻雪机器人", 7 | description: "一个综合性的机器人应用及管理框架", 8 | themeConfig: { 9 | nav: [ 10 | {text: '部署', link: '/deploy/install'}, 11 | {text: '使用', link: '/usage/basic'}, 12 | {text: '扩展', link: '/store/resource'}, 13 | {text: '开发', link: '/dev/guide'}, 14 | ], 15 | docFooter: { 16 | prev: '上一页', 17 | next: '下一页' 18 | }, 19 | editLink: ThemeConfig.getEditLink( 20 | '在 GitHub 上编辑此页', 21 | ), 22 | footer: { 23 | message: '网站部署在 Liteyuki MeliLiteyukiflare 提供加速服务
文档由 VitePress 构建 | API引用由 litedoc 生成', 24 | copyright: ThemeConfig.copyright 25 | }, 26 | outline: ThemeConfig.getOutLine("页面内容"), 27 | 28 | langMenuLabel: '语言', 29 | returnToTopLabel: '返回顶部', 30 | sidebarMenuLabel: '菜单', 31 | darkModeSwitchLabel: '主题', 32 | lightModeSwitchTitle: '轻色模式', 33 | darkModeSwitchTitle: '深色模式', 34 | }, 35 | }) -------------------------------------------------------------------------------- /docs/.vitepress/theme/index.ts: -------------------------------------------------------------------------------- 1 | import DefaultTheme from 'vitepress/theme' 2 | import './liteyuki.scss' 3 | 4 | import StatsBar from '../../components/StatsBar.vue' 5 | import PluginStore from '../../components/PluginStore.vue' 6 | import ResStore from '../../components/ResStore.vue' 7 | 8 | 9 | 10 | export default { 11 | extends: DefaultTheme, 12 | enhanceApp({ app }) { 13 | app.component('StatsBar', StatsBar); 14 | app.component('PluginStore', PluginStore); 15 | app.component('ResStore', ResStore); 16 | }, 17 | Layout: StatsBar 18 | } -------------------------------------------------------------------------------- /docs/components/ContributorBar.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 19 | 20 | -------------------------------------------------------------------------------- /docs/components/Dash.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 35 | 36 | -------------------------------------------------------------------------------- /docs/components/Geo.vue: -------------------------------------------------------------------------------- 1 | 4 | 14 | 15 | -------------------------------------------------------------------------------- /docs/components/Home.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /docs/components/ResItemCard.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 29 | 30 | -------------------------------------------------------------------------------- /docs/components/ResPubWindow.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 16 | 17 | -------------------------------------------------------------------------------- /docs/components/Tabs.vue: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteyukiStudio/LiteyukiBot/1ae45808fd3021c0920771802627acd85a2edea1/docs/components/Tabs.vue -------------------------------------------------------------------------------- /docs/components/ToggleSwitch.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 21 | 22 | -------------------------------------------------------------------------------- /docs/components/TryLiteyukiWindow.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /docs/components/scripts/const.ts: -------------------------------------------------------------------------------- 1 | export const platformBaseURL = "https://github.com/" 2 | export const repoPath = "LiteyukiStudio/LiteyukiBot" 3 | 4 | export const repoURL = `${platformBaseURL}${repoPath}` -------------------------------------------------------------------------------- /docs/en/deploy/fandq.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: FAQ 3 | order: 3 4 | --- 5 | # FAQ 6 | 7 | ## **Frequently Asked Questions** 8 | 9 | - There are too many python interpreters on my computer, how do I know which one to use? 10 | - You can specify which python interpreter to use by using the full path to the python executable, for example, `/path/to/python main.py` 11 | - Use virtual environments to avoid conflicts between different python interpreters 12 | 13 | - Update Liteyuki failed, error `InvalidGitRepositoryError` 14 | - Please install `Git` correctly and deploy Liteyuki using cloning instead of direct download 15 | 16 | - How to log in to chat platforms? 17 | - Some plugins provide the ability to log in to specific platforms, for example, using the NoneBot plugin to log in to supported adapter platforms 18 | 19 | - `Playwright` installation failed 20 | - Enter `playwright install` to install the browser 21 | 22 | - Some plugins report errors after installation and cannot be started 23 | - Please refer to the plugin documentation first, confirm that the necessary configuration items of the plugin are intact, 24 | and if the problem persists, please contact the plugin author or start Liteyuki in safe mode `safe_mode: true`. 25 | In safe mode, you can use `npm uninstall` to uninstall problematic plugins 26 | 27 | ## Other questions 28 | 29 | - Join chat group[775840726](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=SzmDYbfR6jY94o9KFNon7AwelRyI6M_u&authKey=ygeBdEmdFNyCWuNR4w0M1M8%2B5oDg7k%2FDfN0tzBkYcnbB%2FGHNnlVEnCIGbdftsnn7&noverify=0&group_code=775840726) 30 | - If you don't have a QQ account, you can [submit an issue on GitHub](https://github.com/LiteyukiStudio/LiteyukiBot/issues/new?assignees=&labels=&projects=&template=%E9%97%AE%E9%A2%98%E5%8F%8D%E9%A6%88.md&title=) 31 | -------------------------------------------------------------------------------- /docs/en/deploy/install.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Install 3 | order: 1 4 | --- 5 | # Install 6 | 7 | ## **Normal Installation** 8 | 9 | 1. Install [`Git`](https://git-scm.com/download/) and [`Python3.10+`](https://www.python.org/downloads/release/python-31010/) Environment. 10 | 11 | ```bash 12 | # Clone Repo 13 | git clone https://github.com/LiteyukiStudio/LiteyukiBot --depth=1 14 | 15 | # Change directory 16 | cd LiteyukiBot 17 | 18 | # Create virtual environment 19 | python -m venv venv 20 | 21 | # Activate virtual environment 22 | .\venv\Scripts\activate # Windows 23 | source venv/bin/activate # Linux 24 | 25 | # Install dependencies 26 | pip install -r requirements.txt 27 | 28 | # Run Liteyuki 29 | python main.py 30 | ``` 31 | 32 | > [!tip] 33 | > It is recommended to use a virtual environment to run Liteyuki to avoid dependency conflicts. 34 | > You can use `python -m venv .venv` to create a virtual environment, and then use `.venv\Scripts\activate` to activate the virtual environment 35 | > (use `source .venv/bin/activate` to activate on Linux). 36 | 37 | 38 | ## **Run with Docker** 39 | 40 | ```bash 41 | docker pull ghcr.io/liteyukistudio/liteyukibot:latest # Nightly build 42 | ``` 43 | 44 | > [!tip] 45 | > If you are using Windows, please use the absolute project directory `/path/to/LiteyukiBot` instead of `$(pwd)`
46 | > If you have modified the port number, please replace `20216:20216` with your port number 47 | 48 | 49 | ## **Device Requirements** 50 | - Windows system version minimum `Windows10+`/`Windows Server 2019+` 51 | - Linux system requires Python3.10+, recommended `Ubuntu 20.04+` 52 | - CPU: at least `1vCPU` 53 | - Memory: Bot without other plugins will occupy `300~500MB`, including `chromium` and `node` processes, other plugins depend on specific plugins, recommended `1GB` or more 54 | - Disk: at least `1GB` of space 55 | 56 | > [!warning] 57 | > If there are multiple environments on the device, please use `path/to/python -m pip install -r requirements.txt` to install dependencies, `path/to/python` is the path to your Python executable 58 | 59 | > [!warning] 60 | > Liteyuki's update function depends on Git. If you do not have Git installed and run the source code directly, you will not be able to use the update function 61 | 62 | #### For other questions, please refer to [FAQ](./fandq) -------------------------------------------------------------------------------- /docs/en/dev/best_practices.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Best Practices 3 | order: 10 4 | --- 5 | 6 | # Best Practices 7 | 8 | ## Bot applications 9 | - [LiteyukiBot](https://github.com/LiteyukiStudio/LiteyukiBot): Liteyuki Official Bot 10 | - [LiteyukiBot-TriM](https://github.com/TriM-Organization/LiteyukiBot-TriM): TriM Official Custom Liteyuki Bot 11 | - [Liteyuki Marsho](https://git.liteyuki.icu/LiteyukiStudio/marsho-alpha): A cute cat girl bot based on Liteyuki and the github model 12 | 13 | ## plugins 14 | - [liteyukibot-plugin-nonebot](https://github.com/LiteyukiStudio/liteyukibot-plugin-nonebot): Liteyuki Bot NoneBot plugin, allowing Liteyuki to support NoneBot 15 | - [nonebot-plugin-liteyukibot](https://github.com/LiteyukiStudio/nonebot-plugin-liteyukibot): NoneBot plugin, allowing NoneBot to support Liteyuki 16 | 17 | ## Others 18 | - [liteyuki starmap](https://starmap.liteyuki.icu): Liteyuki official star map, showing all instances of Liteyuki and their location distribution 19 | - [TRSS_Liteyuki](https://timerainstarsky.github.io/TRSS_Liteyuki/): LiteyukiBot management script 20 | - [litedoc](https://github.com/LiteyukiStudio/litedoc): Liteyuki API documentation generator 21 | - liteyukibot-api (closed source): Liteyuki Bot stat interface -------------------------------------------------------------------------------- /docs/en/dev/lyfunc.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Liteyuki Function 3 | order: 2 4 | --- 5 | 6 | # **轻雪函数** 7 | 8 | 轻雪函数 Liteyuki Function 是轻雪的一个功能,它允许你在轻雪中运行一些自定义的由数据驱动的命令,类似于Minecraft的mcfunction,属于资源包的一部分,但需单独起篇幅. 9 | 10 | ### **函数文件** 11 | 12 | 函数文件放在资源包的`functions`目录下,文件名以`.mcfunction` `.lyfunction` `.lyf`结尾,例如`test.mcfunction`,文件内容为一系列的命令,每行一个命令,支持单行注释`#`(编辑时的语法高亮可采取`shell`格式),例如: 13 | 14 | ```shell 15 | # 在发信器输出"hello world" 16 | cmd echo hello world 17 | 18 | # 如果你想同时输出多行内容可以尝试换行符(Python格式) 19 | cmd echo hello world\nLiteyuki bot 20 | ``` 21 | 22 | 也支持句末注释,例如: 23 | ```shell 24 | cmd echo hello world # 输出"hello world" 25 | ``` 26 | 27 | ### **命令文档** 28 | 29 | ```shell 30 | var [var2=value2] ... # 定义变量 31 | cmd # 在设备上执行命令 32 | api [var=value...] # 调用Bot API 33 | function # 调用函数,可递归 34 | sleep