mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2024-11-28 16:24:51 +08:00
feat: 愚人节快乐
This commit is contained in:
parent
e58e853445
commit
55ea08cf11
@ -7,17 +7,16 @@ bgImage:
|
|||||||
bgImageDark:
|
bgImageDark:
|
||||||
bgImageStyle:
|
bgImageStyle:
|
||||||
background-attachment: fixed
|
background-attachment: fixed
|
||||||
heroText: HeavyyukiBot666 # LiteyukiBot 6
|
heroText: LiteyukiBot 6
|
||||||
tagline: 重雪机器人,一个以笨重和复杂为设计理念基于Koishi114514的OneBotv1919810标准聊天机器人,可用于雪地清扫,使用Typethon编写
|
tagline: 轻雪机器人,一个以轻量和简洁为设计理念基于Nonebot2的OneBot标准聊天机器人
|
||||||
#tagline: 轻雪机器人,一个以轻量和简洁为设计理念基于Nonebot2的OneBot标准聊天机器人
|
|
||||||
|
|
||||||
actions:
|
actions:
|
||||||
- text: 快速结束 # 快速开始
|
- text: 快速开始
|
||||||
icon: lightbulb
|
icon: lightbulb
|
||||||
link: ./deployment/install.html
|
link: ./deployment/install.html
|
||||||
type: primary
|
type: primary
|
||||||
|
|
||||||
- text: 奇怪的册子 # 使用手册
|
- text: 使用手册
|
||||||
icon: book
|
icon: book
|
||||||
link: ./usage/basic_command.html
|
link: ./usage/basic_command.html
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ actions:
|
|||||||
|
|
||||||
highlights:
|
highlights:
|
||||||
|
|
||||||
- header: 简洁至下 # 简洁至上
|
- header: 简洁至上
|
||||||
image: /assets/image/layout.svg
|
image: /assets/image/layout.svg
|
||||||
bgImage: https://theme-hope-assets.vuejs.press/bg/2-light.svg
|
bgImage: https://theme-hope-assets.vuejs.press/bg/2-light.svg
|
||||||
bgImageDark: https://theme-hope-assets.vuejs.press/bg/2-dark.svg
|
bgImageDark: https://theme-hope-assets.vuejs.press/bg/2-dark.svg
|
||||||
@ -37,70 +36,70 @@ highlights:
|
|||||||
background-repeat: repeat
|
background-repeat: repeat
|
||||||
background-size: initial
|
background-size: initial
|
||||||
features:
|
features:
|
||||||
- title: 基于Koishi.js233
|
- title: 基于Nonebot2
|
||||||
icon: robot
|
icon: robot
|
||||||
details: 拥有良好的生态支持
|
details: 拥有良好的生态支持
|
||||||
link: https://nonebot.dev/
|
link: https://nonebot.dev/
|
||||||
|
|
||||||
- title: 盲目插件管理
|
- title: 可视化插件管理
|
||||||
icon: plug
|
icon: plug
|
||||||
details: 基于nbshi使用<code>npmx和pip</code>,让你无法安装/卸载插件
|
details: 使用<code>npm</code>,无需命令行操作即可安装/卸载插件
|
||||||
|
|
||||||
- title: 点击无法交互
|
- title: 点击交互
|
||||||
icon: mouse-pointer
|
icon: mouse-pointer
|
||||||
details: 老的的点击交互模式,必须手打指令
|
details: 新的点击交互模式,拒绝手打指令
|
||||||
|
|
||||||
- title: 猪蹄支持
|
- title: 主题支持
|
||||||
icon: paint-brush
|
icon: paint-brush
|
||||||
details: 支持多种主题,可自定义资源包,满足你的审美需求
|
details: 支持多种主题,可自定义资源包,满足你的审美需求
|
||||||
|
|
||||||
- title: 非国际化
|
- title: 国际化
|
||||||
icon: globe
|
icon: globe
|
||||||
details: 支持多种语言,包括i18n部分语言和自行扩展的语言代码
|
details: 支持多种语言,包括i18n部分语言和自行扩展的语言代码
|
||||||
link: https://baike.baidu.com/item/i18n/6771940
|
link: https://baike.baidu.com/item/i18n/6771940
|
||||||
|
|
||||||
- title: 超难配置
|
- title: 简易配置
|
||||||
icon: cog
|
icon: cog
|
||||||
details: 无需过多配置,开箱即用
|
details: 无需过多配置,开箱即用
|
||||||
link: https://bot.liteyuki.icu/deployment/config.html
|
link: https://bot.liteyuki.icu/deployment/config.html
|
||||||
|
|
||||||
- title: 高占用
|
- title: 低占用
|
||||||
icon: memory
|
icon: memory
|
||||||
details: 使用更多的意义不明的依赖和资源
|
details: 使用更少的依赖和资源
|
||||||
|
|
||||||
- title: 一个Bot标准
|
- title: OneBot标准
|
||||||
icon: link
|
icon: link
|
||||||
details: 支持OneBotv11/12标准的四种通信协议
|
details: 支持OneBotv11/12标准的四种通信协议
|
||||||
link: https://onebot.dev/
|
link: https://onebot.dev/
|
||||||
|
|
||||||
- title: Alconna
|
- title: Alconna
|
||||||
icon: link
|
icon: link
|
||||||
details: 使用Alconna实现低效命令解析
|
details: 使用Alconna实现高效命令解析
|
||||||
link: https://github.com/nonebot/plugin-alconna
|
link: https://github.com/nonebot/plugin-alconna
|
||||||
|
|
||||||
- title: 不准更新
|
- title: 便捷更新
|
||||||
icon: cloud-download
|
icon: cloud-download
|
||||||
details: 要更新自己下新版本去
|
details: 聊天窗口命令更新,无需手动下载
|
||||||
|
|
||||||
- title: 服务支持
|
- title: 服务支持
|
||||||
icon: server
|
icon: server
|
||||||
details: 内置轻雪API,但随时可能跑路
|
details: 内置轻雪API,可自动收集错误,提供图床服务
|
||||||
|
|
||||||
- title: 闭源
|
- title: 开源
|
||||||
icon: code
|
icon: code
|
||||||
details: 要源代码自己逆向去
|
details: 项目遵循MIT协议开源,欢迎各位的贡献
|
||||||
|
|
||||||
- header: 快速部署
|
- header: 快速部署
|
||||||
image: /assets/image/box.svg
|
image: /assets/image/box.svg
|
||||||
bgImage: https://theme-hope-assets.vuejs.press/bg/3-light.svg
|
bgImage: https://theme-hope-assets.vuejs.press/bg/3-light.svg
|
||||||
bgImageDark: https://theme-hope-assets.vuejs.press/bg/3-dark.svg
|
bgImageDark: https://theme-hope-assets.vuejs.press/bg/3-dark.svg
|
||||||
highlights:
|
highlights:
|
||||||
- title: 安装 Git 和 node.js+
|
- title: 安装 Git 和 Python3.10+
|
||||||
- title: 使用 <code>git clone https://github.com/snowykami/LiteyukiBot</code> 以克隆项目至本地。
|
- title: 使用 <code>git clone https://github.com/snowykami/LiteyukiBot</code> 以克隆项目至本地。
|
||||||
details: 如果无法连接到GitHub,可以使用 <code>git clone https://gitee.com/snowykami/LiteyukiBot</code>。
|
details: 如果无法连接到GitHub,可以使用 <code>git clone https://gitee.com/snowykami/LiteyukiBot</code>。
|
||||||
- title: 使用 <code>cd LiteyukiBot</code> 切换到项目目录。
|
- title: 使用 <code>cd LiteyukiBot</code> 切换到项目目录。
|
||||||
- title: 使用 <code>npm install -r requirements.txt</code> 安装项目依赖。
|
- title: 使用 <code>pip install -r requirements.txt</code> 安装项目依赖。
|
||||||
details: 如果你有多个 node.js 环境,请使用 <code>pythonx -m npm install -r requirements.txt</code>。
|
details: 如果你有多个 Python 环境,请使用 <code>pythonx -m pip install -r requirements.txt</code>。
|
||||||
- title: 使用 <code>node main.py</code> 启动项目。
|
- title: 使用 <code>python main.py</code> 启动项目。
|
||||||
copyright: © 2021-2024 SnowyKami All Rights Reserved
|
copyright: © 2021-2024 SnowyKami All Rights Reserved
|
||||||
---
|
---
|
@ -7,16 +7,17 @@ bgImage:
|
|||||||
bgImageDark:
|
bgImageDark:
|
||||||
bgImageStyle:
|
bgImageStyle:
|
||||||
background-attachment: fixed
|
background-attachment: fixed
|
||||||
heroText: LiteyukiBot 6
|
heroText: HeavyyukiBot666 # LiteyukiBot 6
|
||||||
tagline: 轻雪机器人,一个以轻量和简洁为设计理念基于Nonebot2的OneBot标准聊天机器人
|
tagline: 重雪机器人,一个以笨重和复杂为设计理念基于Koishi114514的OneBotv1919810标准聊天机器人,可用于雪地清扫,使用Typethon编写
|
||||||
|
#tagline: 轻雪机器人,一个以轻量和简洁为设计理念基于Nonebot2的OneBot标准聊天机器人
|
||||||
|
|
||||||
actions:
|
actions:
|
||||||
- text: 快速开始
|
- text: 快速结束 # 快速开始
|
||||||
icon: lightbulb
|
icon: lightbulb
|
||||||
link: ./deployment/install.html
|
link: ./deployment/install.html
|
||||||
type: primary
|
type: primary
|
||||||
|
|
||||||
- text: 使用手册
|
- text: 奇怪的册子 # 使用手册
|
||||||
icon: book
|
icon: book
|
||||||
link: ./usage/basic_command.html
|
link: ./usage/basic_command.html
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ actions:
|
|||||||
|
|
||||||
highlights:
|
highlights:
|
||||||
|
|
||||||
- header: 简洁至上
|
- header: 简洁至下 # 简洁至上
|
||||||
image: /assets/image/layout.svg
|
image: /assets/image/layout.svg
|
||||||
bgImage: https://theme-hope-assets.vuejs.press/bg/2-light.svg
|
bgImage: https://theme-hope-assets.vuejs.press/bg/2-light.svg
|
||||||
bgImageDark: https://theme-hope-assets.vuejs.press/bg/2-dark.svg
|
bgImageDark: https://theme-hope-assets.vuejs.press/bg/2-dark.svg
|
||||||
@ -36,70 +37,70 @@ highlights:
|
|||||||
background-repeat: repeat
|
background-repeat: repeat
|
||||||
background-size: initial
|
background-size: initial
|
||||||
features:
|
features:
|
||||||
- title: 基于Nonebot2
|
- title: 基于Koishi.js233
|
||||||
icon: robot
|
icon: robot
|
||||||
details: 拥有良好的生态支持
|
details: 拥有良好的生态支持
|
||||||
link: https://nonebot.dev/
|
link: https://nonebot.dev/
|
||||||
|
|
||||||
- title: 可视化插件管理
|
- title: 盲目插件管理
|
||||||
icon: plug
|
icon: plug
|
||||||
details: 使用<code>npm</code>,无需命令行操作即可安装/卸载插件
|
details: 基于nbshi使用<code>npmx和pip</code>,让你无法安装/卸载插件
|
||||||
|
|
||||||
- title: 点击交互
|
- title: 点击无法交互
|
||||||
icon: mouse-pointer
|
icon: mouse-pointer
|
||||||
details: 新的点击交互模式,拒绝手打指令
|
details: 老的的点击交互模式,必须手打指令
|
||||||
|
|
||||||
- title: 主题支持
|
- title: 猪蹄支持
|
||||||
icon: paint-brush
|
icon: paint-brush
|
||||||
details: 支持多种主题,可自定义资源包,满足你的审美需求
|
details: 支持多种主题,可自定义资源包,满足你的审美需求
|
||||||
|
|
||||||
- title: 国际化
|
- title: 非国际化
|
||||||
icon: globe
|
icon: globe
|
||||||
details: 支持多种语言,包括i18n部分语言和自行扩展的语言代码
|
details: 支持多种语言,包括i18n部分语言和自行扩展的语言代码
|
||||||
link: https://baike.baidu.com/item/i18n/6771940
|
link: https://baike.baidu.com/item/i18n/6771940
|
||||||
|
|
||||||
- title: 简易配置
|
- title: 超难配置
|
||||||
icon: cog
|
icon: cog
|
||||||
details: 无需过多配置,开箱即用
|
details: 无需过多配置,开箱即用
|
||||||
link: https://bot.liteyuki.icu/deployment/config.html
|
link: https://bot.liteyuki.icu/deployment/config.html
|
||||||
|
|
||||||
- title: 低占用
|
- title: 高占用
|
||||||
icon: memory
|
icon: memory
|
||||||
details: 使用更少的依赖和资源
|
details: 使用更多的意义不明的依赖和资源
|
||||||
|
|
||||||
- title: OneBot标准
|
- title: 一个Bot标准
|
||||||
icon: link
|
icon: link
|
||||||
details: 支持OneBotv11/12标准的四种通信协议
|
details: 支持OneBotv11/12标准的四种通信协议
|
||||||
link: https://onebot.dev/
|
link: https://onebot.dev/
|
||||||
|
|
||||||
- title: Alconna
|
- title: Alconna
|
||||||
icon: link
|
icon: link
|
||||||
details: 使用Alconna实现高效命令解析
|
details: 使用Alconna实现低效命令解析
|
||||||
link: https://github.com/nonebot/plugin-alconna
|
link: https://github.com/nonebot/plugin-alconna
|
||||||
|
|
||||||
- title: 便捷更新
|
- title: 不准更新
|
||||||
icon: cloud-download
|
icon: cloud-download
|
||||||
details: 聊天窗口命令更新,无需手动下载
|
details: 要更新自己下新版本去
|
||||||
|
|
||||||
- title: 服务支持
|
- title: 服务支持
|
||||||
icon: server
|
icon: server
|
||||||
details: 内置轻雪API,可自动收集错误,提供图床服务
|
details: 内置轻雪API,但随时可能跑路
|
||||||
|
|
||||||
- title: 开源
|
- title: 闭源
|
||||||
icon: code
|
icon: code
|
||||||
details: 项目遵循MIT协议开源,欢迎各位的贡献
|
details: 要源代码自己逆向去
|
||||||
|
|
||||||
- header: 快速部署
|
- header: 快速部署
|
||||||
image: /assets/image/box.svg
|
image: /assets/image/box.svg
|
||||||
bgImage: https://theme-hope-assets.vuejs.press/bg/3-light.svg
|
bgImage: https://theme-hope-assets.vuejs.press/bg/3-light.svg
|
||||||
bgImageDark: https://theme-hope-assets.vuejs.press/bg/3-dark.svg
|
bgImageDark: https://theme-hope-assets.vuejs.press/bg/3-dark.svg
|
||||||
highlights:
|
highlights:
|
||||||
- title: 安装 Git 和 Python3.10+
|
- title: 安装 Git 和 node.js+
|
||||||
- title: 使用 <code>git clone https://github.com/snowykami/LiteyukiBot</code> 以克隆项目至本地。
|
- title: 使用 <code>git clone https://github.com/snowykami/LiteyukiBot</code> 以克隆项目至本地。
|
||||||
details: 如果无法连接到GitHub,可以使用 <code>git clone https://gitee.com/snowykami/LiteyukiBot</code>。
|
details: 如果无法连接到GitHub,可以使用 <code>git clone https://gitee.com/snowykami/LiteyukiBot</code>。
|
||||||
- title: 使用 <code>cd LiteyukiBot</code> 切换到项目目录。
|
- title: 使用 <code>cd LiteyukiBot</code> 切换到项目目录。
|
||||||
- title: 使用 <code>pip install -r requirements.txt</code> 安装项目依赖。
|
- title: 使用 <code>npm install -r requirements.txt</code> 安装项目依赖。
|
||||||
details: 如果你有多个 Python 环境,请使用 <code>pythonx -m pip install -r requirements.txt</code>。
|
details: 如果你有多个 node.js 环境,请使用 <code>pythonx -m npm install -r requirements.txt</code>。
|
||||||
- title: 使用 <code>python main.py</code> 启动项目。
|
- title: 使用 <code>node main.py</code> 启动项目。
|
||||||
copyright: © 2021-2024 SnowyKami All Rights Reserved
|
copyright: © 2021-2024 SnowyKami All Rights Reserved
|
||||||
---
|
---
|
@ -17,7 +17,7 @@ category: 使用手册
|
|||||||
[S]liteyuki # 查看轻雪信息
|
[S]liteyuki # 查看轻雪信息
|
||||||
[S]config set <key> value # 添加配置项,若存在则会覆盖,输入值会被执行,以便于转换为正确的值,"10"和10是不一样的
|
[S]config set <key> value # 添加配置项,若存在则会覆盖,输入值会被执行,以便于转换为正确的值,"10"和10是不一样的
|
||||||
[S]config get [key] # 查询配置项,不带key返回配置项列表,推荐私聊使用
|
[S]config get [key] # 查询配置项,不带key返回配置项列表,推荐私聊使用
|
||||||
[S]switch-image-mode # 切换图片模式,在普通图片和Markdown图片之间切换,后者更大但有失败的可能
|
[S]switch-image-mode # 切换图片模式,该功能需要commit:44477b9及以后的Lagrange.OneBot版本,在普通图片和Markdown图片之间切换,后者更大但有失败的可能
|
||||||
# 上述两个命令修改的配置项在数据库中保存,但是优先级低于配置文件,如果配置文件中存在相同的配置项,将会使用配置文件中的配置
|
# 上述两个命令修改的配置项在数据库中保存,但是优先级低于配置文件,如果配置文件中存在相同的配置项,将会使用配置文件中的配置
|
||||||
------
|
------
|
||||||
别名: reload-liteyuki 重启轻雪, update-liteyuki 更新轻雪, config 配置, set 设置, get 查询
|
别名: reload-liteyuki 重启轻雪, update-liteyuki 更新轻雪, config 配置, set 设置, get 查询
|
||||||
|
@ -22,7 +22,7 @@ from nonebot_plugin_alconna import on_alconna, Alconna, Args, Subcommand, Arparm
|
|||||||
|
|
||||||
driver = get_driver()
|
driver = get_driver()
|
||||||
|
|
||||||
markdown_image = False
|
markdown_image = common_db.first(StoredConfig(), default=StoredConfig()).config.get("markdown_image", False)
|
||||||
|
|
||||||
cmd_liteyuki = on_alconna(
|
cmd_liteyuki = on_alconna(
|
||||||
Alconna(
|
Alconna(
|
||||||
@ -156,7 +156,7 @@ async def _(bot: T_Bot, event: T_MessageEvent):
|
|||||||
|
|
||||||
@Bot.on_calling_api
|
@Bot.on_calling_api
|
||||||
async def test_for_md_image(bot: T_Bot, api: str, data: dict):
|
async def test_for_md_image(bot: T_Bot, api: str, data: dict):
|
||||||
if api in ["send_msg", "send_private_msg", "send_group_msg"] and markdown_image:
|
if api in ["send_msg", "send_private_msg", "send_group_msg"] and markdown_image and data.get("user_id") != bot.self_id:
|
||||||
if api == "send_msg" and data.get("message_type") == "private" or api == "send_private_msg":
|
if api == "send_msg" and data.get("message_type") == "private" or api == "send_private_msg":
|
||||||
session_type = "private"
|
session_type = "private"
|
||||||
session_id = data.get("user_id")
|
session_id = data.get("user_id")
|
||||||
|
@ -114,15 +114,31 @@ class Markdown:
|
|||||||
dict: response data
|
dict: response data
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
print("\n\n\n发送图片\n\n\n")
|
||||||
if isinstance(image, str):
|
if isinstance(image, str):
|
||||||
async with aiofiles.open(image, "rb") as f:
|
async with aiofiles.open(image, "rb") as f:
|
||||||
image = await f.read()
|
image = await f.read()
|
||||||
|
# 1.轻雪图床方案
|
||||||
image_url = await liteyuki_api.upload_image(image)
|
image_url = await liteyuki_api.upload_image(image)
|
||||||
image_size = Image.open(io.BytesIO(image)).size
|
image_size = Image.open(io.BytesIO(image)).size
|
||||||
image_md = Markdown.image(image_url, image_size)
|
image_md = Markdown.image(image_url, image_size)
|
||||||
return await Markdown.send_md(image_md, bot, message_type=message_type, session_id=session_id, event=event, **kwargs)
|
return await Markdown.send_md(image_md, bot, message_type=message_type, session_id=session_id, event=event, **kwargs)
|
||||||
|
|
||||||
|
# 2.此方案等林文轩修好后再用QQ图床,再嵌入markdown发送
|
||||||
|
# image_message_id = (await bot.send_private_msg(
|
||||||
|
# user_id=bot.self_id,
|
||||||
|
# message=[
|
||||||
|
# v11.MessageSegment.image(file=image)
|
||||||
|
# ]
|
||||||
|
# ))["message_id"]
|
||||||
|
# await asyncio.sleep(3)
|
||||||
|
# await bot.delete_msg(message_id=image_message_id)
|
||||||
|
# image_message = await bot.get_msg(message_id=image_message_id)
|
||||||
|
# image_url = (await bot.get_msg(message_id=image_message_id))["message"][0]["data"]["url"]
|
||||||
|
# image_size = Image.open(io.BytesIO(image)).size
|
||||||
|
# image_md = Markdown.image(image_url, image_size)
|
||||||
|
# return await Markdown.send_md(image_md, bot, message_type=message_type, session_id=session_id, event=event, **kwargs)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def get_image_url(image: bytes | str, bot: T_Bot) -> str:
|
async def get_image_url(image: bytes | str, bot: T_Bot) -> str:
|
||||||
"""把图片上传到图床,返回链接
|
"""把图片上传到图床,返回链接
|
||||||
|
Loading…
Reference in New Issue
Block a user