Skip to main content

基于Nonebot2的发病语录插件

Project description

NoneBotPluginLogo

NoneBotPluginText

NoneBot-Plugin-Random-Stereotypes

✨ 发病语录 ✨

python pdm-managed wakatime
Pydantic Version 1 Or 2 license pypi pypi download
NoneBot Registry Supported Adapters

📖 介绍

随机返回一条在互联网上收录一些有趣的发病语录(主要针对 VTB)
如果有需要补充的可以提交 issue 进行追加,侵删。

💿 安装

以下提到的方法 任选其一 即可

[推荐] 使用 nb-cli 安装 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-random-stereotypes
使用包管理器安装 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
pip
pip install nonebot-plugin-random-stereotypes
pdm
pdm add nonebot-plugin-random-stereotypes
poetry
poetry add nonebot-plugin-random-stereotypes
conda
conda install nonebot-plugin-random-stereotypes

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

[tool.nonebot]
plugins = [
    # ...
    "nonebot_plugin_random_stereotypes"
]

⚙️ 配置

在 nonebot2 项目的 .env 文件中添加下表中的必填配置

配置项 必填 默认值 说明
全局配置
SUPERUSERS [] 超级用户 ID 列表,本插件中超级用户无视冷却限制
冷却配置
STEREOTYPES_CD 1800 触发冷却后的冷却时间(秒)
STEREOTYPES_COUNT 3 STEREOTYPES_COUNT_TIME(单位秒)中触发超过 STEREOTYPES_COUNT 次则触发冷却
STEREOTYPES_COUNT_TIME 1800 如上
STEREOTYPES_PUNISH_COUNT 5 当在冷却中继续触发指令超过此次数将会重置冷却时间
STEREOTYPES_CD_KEY_TYPE user 冷却时间标识符,可选 user(只分用户冷却)或 session(分群与用户冷却)
消息配置
STEREOTYPES_SHOW_TRIGGER_USER_NAME True 是否在消息中展示触发的用户昵称
Meme 配置(详见下方)
STEREOTYPES_ENABLE_MEME True 是否启用 Meme 功能,启用后将会在有 At 对象时附带生成一张表情包图
STEREOTYPES_MEME_SOURCE auto Meme 数据源,可选 auto(自动选择)、embedapi
STEREOTYPES_MEMES ["kiss","bite","rub","little_angel"] 表情包列表
指令配置
STEREOTYPES_ALIASES ["发电", "发癫"] 附加指令前缀
STEREOTYPES_PRIORITY 100 Matcher 优先级
STEREOTYPES_BLOCK False 是否阻止事件向低优先级 Matcher 传递

Meme 配置相关

Meme 功能默认启用,但是当没有可用数据源或初始化时遇到问题将会自动禁用
当指令参数为 At 对象时才会触发此功能

数据源相关

当数据源为 auto 时,插件会尝试依次导入所有可用的数据源的依赖,当导入成功时则使用并停止遍历

各数据源需求依赖:

表情包列表配置(STEREOTYPES_MEMES

本配置项为以字符串或 MemeConfig 为元素的列表,当列表中某元素为字符串时其会自动转换为有默认配置的 MemeConfig

MemeConfig 包含以下字段:

  • name(必填): 表情名
  • target_first(默认 False):当需传入两张图片时,是否调换图片顺序使被 At 的用户在前
  • additional_images(默认 []):额外的图片路径列表,会附加在传入图片后
  • additional_texts(默认 []):额外传入的文字列表
  • additional_args(默认 {}):额外传入的参数字典

示例:

STEREOTYPES_MEMES='
[
  "little_angel",
  {
    "name": "call_110",
    "target_first": true
  },
  {
    "name": "addiction",
    "additional_texts": ["阿巴阿巴阿巴阿巴"]
  },
  {
    "name": "petpet",
    "additional_args": {
      "circle": true
    }
  }
]
'

🎉 使用

Example

📞 联系

Ikaros

QQ: 327209194
邮箱:327209194@qq.com

LgCookie

QQ:3076823485
Telegram:@lgc2333
吹水群:1105946125
邮箱:lgc2333@126.com

💰 赞助

LgCookie

赞助我

感谢大家的赞助!你们的赞助将是我继续创作的动力!

📝 更新日志

0.5.0

  • 重构适配 meme-generator-rs
  • 换用 nonebot-plugin-uninfo

0.4.0

  • 加入 meme 功能

0.3.0

  • 重构

0.2.1

  • 支持获取 At 对象的昵称作为发病对象

0.2.0

  • 添加命令冷却
  • 追加发病语录数据

0.1.0

  • 重构

0.0.2 ~ 0.0.3

  • 追加发病语录数据

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_random_stereotypes-0.5.0.tar.gz (110.4 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file nonebot_plugin_random_stereotypes-0.5.0.tar.gz.

File metadata

File hashes

Hashes for nonebot_plugin_random_stereotypes-0.5.0.tar.gz
Algorithm Hash digest
SHA256 642489b3d3bfb22f03192fe3bd9b8abd151f4f0cc6d43424090cfd63ba96faf2
MD5 522b4c4c85034e09d29ee750d6385940
BLAKE2b-256 cee4cbc37beb144705003e8920c08c963264cab4ac4e7359247857505d7b308b

See more details on using hashes here.

File details

Details for the file nonebot_plugin_random_stereotypes-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_random_stereotypes-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 42d02466207f9dce985d2b19eabc42abf490dc63f9c53df456d4caa0e14fdd5f
MD5 33ae2606185f94f651eb93cc291842a6
BLAKE2b-256 e4e493b1dab1865d47acef733e0be3b73caf9a4bdbe45253a1989bf9102fd04a

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