mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2024-11-14 14:57:25 +08:00
feat: 添加了对指令前缀的支持
This commit is contained in:
parent
76359ba83e
commit
2ad2bb4182
@ -15,7 +15,7 @@ tag:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# 生成文件的配置项
|
# 生成文件的配置项
|
||||||
command_start: [ "/", " " ] # 指令前缀
|
command_start: [ "/", "" ] # 指令前缀,若没有"",请开启alconna_use_command_start
|
||||||
host: 127.0.0.1 # 监听地址,默认为本机,若要对外开放请填写0.0.0.0或者你的公网IP
|
host: 127.0.0.1 # 监听地址,默认为本机,若要对外开放请填写0.0.0.0或者你的公网IP
|
||||||
port: 20216 # 绑定端口
|
port: 20216 # 绑定端口
|
||||||
nickname: [ "liteyuki" ] # 机器人昵称
|
nickname: [ "liteyuki" ] # 机器人昵称
|
||||||
@ -35,6 +35,8 @@ fake_device_info: # 统计卡片显示的虚假设备信息,用于保护隐私
|
|||||||
frequency: 3600 # CPU主频:MHz
|
frequency: 3600 # CPU主频:MHz
|
||||||
mem:
|
mem:
|
||||||
total: 32768000000 # 内存总数:字节
|
total: 32768000000 # 内存总数:字节
|
||||||
|
alconna_use_command_start: false # alconna是否使用默认指令前缀,默认false
|
||||||
|
alconna_auto_completion: false # alconna是否自动补全指令,默认false,建议开启
|
||||||
|
|
||||||
# 其他Nonebot插件的配置项
|
# 其他Nonebot插件的配置项
|
||||||
custom_config_1: "custom_value1"
|
custom_config_1: "custom_value1"
|
||||||
|
BIN
liteyuki/bin/libhello.dll
Normal file
BIN
liteyuki/bin/libhello.dll
Normal file
Binary file not shown.
@ -1,6 +1,5 @@
|
|||||||
from nonebot.plugin import PluginMetadata
|
from nonebot.plugin import PluginMetadata
|
||||||
|
|
||||||
from liteyuki.utils.data_manager import *
|
|
||||||
from liteyuki.utils.language import get_default_lang
|
from liteyuki.utils.language import get_default_lang
|
||||||
from .core import *
|
from .core import *
|
||||||
from .loader import *
|
from .loader import *
|
||||||
|
@ -1,20 +1,17 @@
|
|||||||
import json
|
import platform
|
||||||
import random
|
|
||||||
|
|
||||||
|
import nonebot
|
||||||
import psutil
|
import psutil
|
||||||
import requests
|
from cpuinfo import get_cpu_info
|
||||||
from PIL import Image
|
from nonebot import on_command
|
||||||
from nonebot.adapters.onebot.v11 import MessageSegment
|
from nonebot.adapters.onebot.v11 import MessageSegment
|
||||||
from nonebot.permission import SUPERUSER
|
from nonebot.permission import SUPERUSER
|
||||||
from liteyuki.utils.htmlrender import template_to_pic, html_to_pic
|
|
||||||
from liteyuki.utils.language import get_user_lang
|
|
||||||
from liteyuki.utils.liteyuki_api import liteyuki_api
|
|
||||||
from liteyuki.utils.ly_typing import T_Bot, T_MessageEvent
|
|
||||||
from liteyuki.utils.message import Markdown as md
|
|
||||||
from liteyuki.utils.resource import get_path
|
|
||||||
from nonebot import on_command
|
|
||||||
from cpuinfo import get_cpu_info
|
|
||||||
|
|
||||||
|
from liteyuki.utils import __NAME__, __VERSION__
|
||||||
|
from liteyuki.utils.htmlrender import template_to_pic
|
||||||
|
from liteyuki.utils.language import get_user_lang
|
||||||
|
from liteyuki.utils.ly_typing import T_Bot, T_MessageEvent
|
||||||
|
from liteyuki.utils.resource import get_path
|
||||||
from liteyuki.utils.tools import convert_size
|
from liteyuki.utils.tools import convert_size
|
||||||
|
|
||||||
stats = on_command("stats", aliases={"状态"}, priority=5, permission=SUPERUSER)
|
stats = on_command("stats", aliases={"状态"}, priority=5, permission=SUPERUSER)
|
||||||
@ -100,8 +97,10 @@ async def _(bot: T_Bot, event: T_MessageEvent):
|
|||||||
protocol_names.get(version_info.get("protocol_name"), "Linux"), version_info.get("app_name"), version_info.get("app_version"),
|
protocol_names.get(version_info.get("protocol_name"), "Linux"), version_info.get("app_name"), version_info.get("app_version"),
|
||||||
f"{ulang.get('liteyuki.stats.groups')} {groups}", f"{ulang.get('liteyuki.stats.friends')} {friends}",
|
f"{ulang.get('liteyuki.stats.groups')} {groups}", f"{ulang.get('liteyuki.stats.friends')} {friends}",
|
||||||
f"{ulang.get('liteyuki.stats.sent')} {statistics.get('message_sent', 0)}",
|
f"{ulang.get('liteyuki.stats.sent')} {statistics.get('message_sent', 0)}",
|
||||||
f"{ulang.get('liteyuki.stats.received')} {statistics.get('message_received', 0)}" \
|
f"{ulang.get('liteyuki.stats.received')} {statistics.get('message_received', 0)}",
|
||||||
],
|
f"{platform.python_implementation()} {platform.python_version()}",
|
||||||
|
f"Nonebot {nonebot.__version__}", f"{__NAME__} {__VERSION__}"
|
||||||
|
],
|
||||||
"CPU_TAGS" : [
|
"CPU_TAGS" : [
|
||||||
f"{brand} {cpu_info.get('arch', 'Unknown')}",
|
f"{brand} {cpu_info.get('arch', 'Unknown')}",
|
||||||
f"{fake_device_info.get('cpu', {}).get('cores', psutil.cpu_count(logical=False))}C "
|
f"{fake_device_info.get('cpu', {}).get('cores', psutil.cpu_count(logical=False))}C "
|
||||||
|
@ -9,9 +9,12 @@ import nonebot
|
|||||||
from nonebot.adapters.onebot import v11, v12
|
from nonebot.adapters.onebot import v11, v12
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from . import load_from_yaml
|
||||||
from .liteyuki_api import liteyuki_api
|
from .liteyuki_api import liteyuki_api
|
||||||
from .ly_typing import T_Bot, T_MessageEvent
|
from .ly_typing import T_Bot, T_MessageEvent
|
||||||
|
|
||||||
|
config = load_from_yaml("config.yml")
|
||||||
|
|
||||||
|
|
||||||
class Markdown:
|
class Markdown:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -143,6 +146,8 @@ class Markdown:
|
|||||||
markdown格式的可点击回调按钮
|
markdown格式的可点击回调按钮
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
if "" not in config.get("command_start", ["/"]):
|
||||||
|
cmd = f"{config['command_start'][0]}{cmd}"
|
||||||
return f"[{name}](mqqapi://aio/inlinecmd?command={quote(cmd)}&reply={str(reply).lower()}&enter={str(enter).lower()})"
|
return f"[{name}](mqqapi://aio/inlinecmd?command={quote(cmd)}&reply={str(reply).lower()}&enter={str(enter).lower()})"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user