Skip to main content

词库插件

Project description

NoneBotPluginLogo

NoneBotPluginText

nonebot-plugin-ciku

✨ NoneBot 插件描述 ✨

这是一个 onebot.v11的词库插件

📖 介绍

词库插件方面:

面向小白的词库插件,目的是减少编写代码的时间和难度 特点:语言精简 无需重启nb和reload即可实 现功能热重载 缺点:目前仅能实现一些简单的逻辑运行,但随着更新肯定会慢慢削减

支持导入自定义规则

💿 安装

使用 nb-cli 安装 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot_plugin_ciku
使用包管理器安装 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
pip
pip install nonebot_plugin_ciku

打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分追加写入

plugins = ["nonebot_plugin_ciku"]

⚙️ 说明

词库文件(dicpro.ck)和自定义拓展文件夹都会在初次使用时自动创建

项目还在持续优化,目前只能就行指令完全匹配,暂时不支持正则语法

变量大全 目前支持的变量:
变量 说明
%QQ% 用户id
%群号% 群号
$读 路径 键 默认值$ 读文件
$写 路径 键 值$ 写文件
±at QQ号± 艾特用户
±img 路径/链接± 发送图片
±reply 0± 回复指令消息
@%a%['data'] 比如你前面写了a:{'data':1},那么为1

🎉 使用

词库格式

测试
路径:/词库项目/qrbot/src/plugins/词库v2/
name:['123']
a:$读 %路径%send.txt a 0$
b:$读 %路径%send.txt b 0$
c:$读 %路径%send.txt c 123$
d:±img bug.png±
$写 %路径%send.txt c 哈哈哈$
±reply 0±
%a%《隔断》%b%%c%\n±at %QQ%±\n456789
±img https://homdgcat.wiki/images/emote/Yunli/1.png±
%d%
如果:1 > 2
$读 %路径%send.txt c wdnmd$
如果:%a% == %a%
变量测试成功@%name%[0]
如果尾
如果尾
如果:%a% == %a%
缩进测试成功



测试json
name:['123']
data:{'a':'123','b':'456'}
@%name%[0]\n
@%data%['b']

hello
hi

自定义拓展

在机器人项目目录下找到《自定义拓展》文件夹 创建py文件,这里是示例

# example.py

from nonebot import require

require("nonebot_plugin_ciku")

from nonebot_plugin_ciku.ciku.parser_rules import ParseRule

class EmojiRule(ParseRule):
    """示例第三方规则:替换表情符号"""
    
    def match(self, line, event, tab_time) -> bool:
        return re.search(r'#\w+#', line) is not None
    
    def process(self, line, event, tab_time) -> str:
        line = line.replace('#smile#', '😊')
        line = line.replace('#angry#', '😠')
        return f'{line}', tab_time

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nonebot_plugin_ciku-0.1.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nonebot_plugin_ciku-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_ciku-0.1.0.tar.gz.

File metadata

  • Download URL: nonebot_plugin_ciku-0.1.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for nonebot_plugin_ciku-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6afde17c7f4da4bae3c1a7df1ab83ac0af5bd11bb4ace71c3549925ba6b663a0
MD5 cbb12435c102843468a906dae9d24b53
BLAKE2b-256 7c51674c04cfe3bebffb261ee919b4ac57fb510b63c0c47ac5930c63bc41d944

See more details on using hashes here.

File details

Details for the file nonebot_plugin_ciku-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_ciku-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d6469ab046d30c4897a942aee46bbdf56706b2da0d4ad5874416ddbf167096f
MD5 d6e9a1b40e877c4d858336445d5bd991
BLAKE2b-256 a215d6ae788c85cf513afbcb7fcea6837f381c90deae25e604a5883e8d293261

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page