Skip to main content

(可能是)更好的一言插件!

Project description

一言+

(可能是)更好的一言插件!

一个基于 NoneBot2 的一言(Hitokoto)插件,用于获取来自 Hitokoto.cn 的一句话。

插件名:nonebot-plugin-hitokoto-plus

特性

  • ✅ 句子类型自定义
  • ✅ 频率限制和黑白名单支持
  • ✅ 收藏功能

安装

通过 nb-cli 安装(推荐)

nb plugin install nonebot-plugin-hitokoto-plus

通过 pip 安装

pip install nonebot-plugin-hitokoto-plus

使用方法

[!WARNING] 此处示例中的"/"为 nb 默认的命令开始标志,若您设置了另外的标志,则请使用您设置的标志作为命令的开头

基础命令

/一言          # 随机获取一条一言
/一言 [类型]   # 获取指定类型的一言

(参数允许字母/中文,即/一言 a/一言 动画均为正确命令,具体参照参数说明一节)

收藏功能

/一言收藏           # 收藏上一次获取的一言
/一言收藏列表       # 查看收藏列表
/一言收藏列表 -p 2  # 查看收藏列表 第2页
/一言查看收藏 1     # 查看序号为1的收藏详情
/一言删除收藏 1     # 删除序号为1的收藏

帮助命令

/一言帮助           # 获取插件总帮助
/一言帮助 基础      # 获取基础命令帮助
/一言帮助 收藏      # 获取收藏功能帮助
/一言帮助 类型      # 获取支持的一言类型列表

[!NOTE] 获取句子后,系统会提示在指定时间内可以使用收藏命令将该句子收藏。超过这个时间后将无法收藏,需要重新获取句子。

参数说明

字母 中文
a 动画
b 漫画
c 游戏
d 文学
e 原创
f 网络
g 其他
h 影视
i 诗词
j 网易云
k 哲学
l 抖机灵

配置项

在 NoneBot2 全局配置文件中(通常是 .env.env.prod 文件)添加以下配置:

[!IMPORTANT] 所有配置项都需要加上 HITP_ 前缀,例如 HITP_API_URL="https://v1.hitokoto.cn"。下表中的名称已包含此前缀。

[!WARNING] 指定的API地址必须支持与一言开发者中心提供的请求参数和句子类型调用(返回格式化的JSON文本)

一言开发者中心提供的可选API地址如下:

地址 协议 方法 QPS 限制 线路
v1.hitokoto.cn HTTPS Any 2 全球
international.v1.hitokoto.cn HTTPS Any 20(含缓存*) 海外
配置项 类型 必填 默认值 说明 示例
HITP_API_URL str https://v1.hitokoto.cn 一言API地址
HITP_DEFAULT_TYPE str None 默认一言类型,为空则随机 a
HITP_CD int 3 调用冷却时间(秒)
HITP_COOLDOWN_CLEANUP_INTERVAL int 360 冷却记录清理间隔(秒)
HITP_USER_RETENTION_TIME int 720 用户记录保留时间(秒)
HITP_FAVORITE_LIST_LIMIT int 10 收藏列表每页显示数量
HITP_FAVORITE_TIMEOUT int 30 收藏提示超时时间(秒)
HITP_USE_WHITELIST bool False 权限控制模式,True为白名单,False为黑名单
HITP_USER_LIST list [] 用户ID列表,格式为"platform:user_id" ["onebot11:12345678", "kook:87654321"]
HITP_GROUP_LIST list [] 群组ID列表,格式为"platform:group_id" ["onebot11:87654321", "kook:12345678"]

[!NOTE] 适配器名称 参考:

适配器名称 平台/协议
onebot11 OneBot V11
onebot12 OneBot V12
console Console
kook KOOK (开黑啦)
telegram Telegram
feishu 飞书
discord Discord
qq QQ (官方)
satori Satori
dodo DoDo
kritor Kritor
mirai Mirai
mail Mail
wxmp 微信公众号

注意事项

  • 该插件代码基本由AI完成,如有更好的改进建议欢迎提交pr
  • 目前仅使用了Onebot适配器+Napcat,在Windows/Linux系统下测试通过,如有兼容性问题/其他适配器的运行情况欢迎提交issue
  • 尝试进行了跨平台兼容,但运行情况未知

更新日志

0.3.1、0.3.2

优化

0.3.0

完全重构

旧版日志

0.2.4

修复一些已知问题,重写部分组件

[!IMPORTANT] 自0.2.4版本起,依赖与配置项均发生改变,请注意查看

0.2.3

添加对跨平台用户的区分

0.2.2

修复导入,移除不必要依赖

0.2.1

修复配置项相关问题

0.2.0

插件首次发布

0.1.0

暂无

致谢

以及所有相关项目❤

许可证

MIT

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_hitokoto_plus-0.3.2.4.tar.gz (17.0 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_hitokoto_plus-0.3.2.4-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_hitokoto_plus-0.3.2.4.tar.gz.

File metadata

File hashes

Hashes for nonebot_plugin_hitokoto_plus-0.3.2.4.tar.gz
Algorithm Hash digest
SHA256 cdbbfbf0ed555a9a2484c86cbeccb17163ff593c8f6482f28fac4b7d1e4e4c47
MD5 6ba8f13f1a584912b60035231e63518a
BLAKE2b-256 2c2a3e0d9d3eb78c48f034f1ac2a2f01eaa55dff4fc73e8b93ac0c8e3d8052e5

See more details on using hashes here.

File details

Details for the file nonebot_plugin_hitokoto_plus-0.3.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_hitokoto_plus-0.3.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5889e0410256cdb410e6878fae12fcec8cc494f8aebed009ee3203893a3fd60b
MD5 c1a7c2c7ef4f6fad0f2a475d291cd107
BLAKE2b-256 1afda1ca395065d11e20d659bf1cdf5cd7a170349150abe916925480673aefba

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