mirror of
				https://github.com/LiteyukiStudio/LiteyukiBot.git
				synced 2025-11-04 13:26:25 +00:00 
			
		
		
		
	⚡ 使用webp背景图压缩资源包大小
This commit is contained in:
		@@ -2,9 +2,9 @@ import nonebot
 | 
			
		||||
from nonebot import on_message, require
 | 
			
		||||
from nonebot.plugin import PluginMetadata
 | 
			
		||||
 | 
			
		||||
from liteyuki.utils.base.data import Database, LiteModel
 | 
			
		||||
from liteyuki.utils.base.ly_typing import T_Bot, T_MessageEvent
 | 
			
		||||
from liteyuki.utils.message.message import MarkdownMessage as md
 | 
			
		||||
from liteyuki.internal.base.data import Database, LiteModel
 | 
			
		||||
from liteyuki.internal.base.ly_typing import T_Bot, T_MessageEvent
 | 
			
		||||
from liteyuki.internal.message.message import MarkdownMessage as md
 | 
			
		||||
 | 
			
		||||
require("nonebot_plugin_alconna")
 | 
			
		||||
from nonebot_plugin_alconna import on_alconna
 | 
			
		||||
@@ -64,7 +64,7 @@ async def _(result: Arparma):
 | 
			
		||||
            push1 = Push(
 | 
			
		||||
                source=Node(bot_id=source[0], session_type=source[1], session_id=source[2]),
 | 
			
		||||
                target=Node(bot_id=target[0], session_type=target[1], session_id=target[2]),
 | 
			
		||||
                inde=len(pushes_db.all(Push(), default=[]))
 | 
			
		||||
                inde=len(pushes_db.where_all(Push(), default=[]))
 | 
			
		||||
            )
 | 
			
		||||
            pushes_db.save(push1)
 | 
			
		||||
 | 
			
		||||
@@ -72,7 +72,7 @@ async def _(result: Arparma):
 | 
			
		||||
                push2 = Push(
 | 
			
		||||
                    source=Node(bot_id=target[0], session_type=target[1], session_id=target[2]),
 | 
			
		||||
                    target=Node(bot_id=source[0], session_type=source[1], session_id=source[2]),
 | 
			
		||||
                    inde=len(pushes_db.all(Push(), default=[]))
 | 
			
		||||
                    inde=len(pushes_db.where_all(Push(), default=[]))
 | 
			
		||||
                )
 | 
			
		||||
                pushes_db.save(push2)
 | 
			
		||||
            await add_push.finish("添加成功")
 | 
			
		||||
@@ -92,14 +92,14 @@ async def _(result: Arparma):
 | 
			
		||||
        await add_push.finish(
 | 
			
		||||
            "\n".join([f"{push.inde} {push.source.bot_id}.{push.source.session_type}.{push.source.session_id} -> "
 | 
			
		||||
                       f"{push.target.bot_id}.{push.target.session_type}.{push.target.session_id}" for i, push in
 | 
			
		||||
                       enumerate(pushes_db.all(Push(), default=[]))]))
 | 
			
		||||
                       enumerate(pushes_db.where_all(Push(), default=[]))]))
 | 
			
		||||
    else:
 | 
			
		||||
        await add_push.finish("参数错误")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@on_message(block=False).handle()
 | 
			
		||||
async def _(event: T_MessageEvent, bot: T_Bot):
 | 
			
		||||
    for push in pushes_db.all(Push(), default=[]):
 | 
			
		||||
    for push in pushes_db.where_all(Push(), default=[]):
 | 
			
		||||
        if str(push.source) == f"{bot.self_id}.{event.message_type}.{event.user_id if event.message_type == 'private' else event.group_id}":
 | 
			
		||||
            bot2 = nonebot.get_bot(push.target.bot_id)
 | 
			
		||||
            msg_formatted = ""
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user