让你的代码被群友看光光!
Project description
📖 介绍
这是一个让你的代码被群友看光光的 NoneBot2 插件!🔍
当你想要展示某个指令的源码实现时,只需要使用 /see 命令,插件会自动找到对应的处理器并将其源码以精美的代码图片形式展示出来。非常适合:
- 代码学习和交流
- 调试和问题排查
- 向群友炫耀你的代码(雾)
- 满足赛博露阴癖
💿 安装
使用 nb-cli 安装
在 NoneBot2 项目的根目录下打开命令行,输入以下指令即可安装:
nb plugin install nonebot-plugin-exhibitionism
使用包管理器安装
pip install nonebot-plugin-exhibitionism
使用 uv 安装
uv add nonebot-plugin-exhibitionism
然后在 NoneBot2 项目的 pyproject.toml 文件中的 [tool.nonebot] 部分添加:
plugins = ["nonebot_plugin_exhibitionism"]
🎉 使用
指令表
| 指令 | 权限 | 需要@ | 范围 | 说明 |
|---|---|---|---|---|
/see [目标指令] |
所有人 | 否 | 群聊/私聊 | 查看指定指令的源码 |
效果预览
发送指令:
/see /帮助
插件会:
- 自动匹配到对应的处理器
- 获取处理器的源码
- 使用 Pygments 进行语法高亮
- 生成精美的代码图片并发送
⚙️ 配置
本插件无需额外配置,安装即可使用。
配置项
- 代码风格:使用
one-dark主题 - 字体大小:22px
- 包含行号显示
- 自动背景色处理
🔧 工作原理
- 命令解析:支持通过 Alconna 和传统 Matcher 两种方式匹配指令
- 处理器查找:模仿 Nonebot 事件处理流程,找到匹配的目标
- 源码提取:使用
inspect模块获取处理器函数的源码 - 代码渲染:使用 Pygments 进行语法高亮,生成高质量代码图片
- 图片发送:将生成的图片通过 UniMessage 发送到群聊
🤝 贡献
欢迎提交 issue 和 pull request!
📄 许可证
本项目采用 AGPL-3 许可证。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nonebot_plugin_exhibitionism-0.1.1.tar.gz.
File metadata
- Download URL: nonebot_plugin_exhibitionism-0.1.1.tar.gz
- Upload date:
- Size: 15.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef65ac7305dc08781a5d1460093755220cd41e04f627d0b1cc6863f76df03595
|
|
| MD5 |
53732e1e1caa0b851d5ed09fe0503c11
|
|
| BLAKE2b-256 |
5b99d144ef16334c220f00d0f1a562908f6f4eae6ce6df3854ff99be45e0d1dc
|
File details
Details for the file nonebot_plugin_exhibitionism-0.1.1-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_exhibitionism-0.1.1-py3-none-any.whl
- Upload date:
- Size: 15.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49f1b4bc89ffc98881037a86f94cd4915acec1f030230c0acd54b590edf96e13
|
|
| MD5 |
76bd7d66c041b9775e77ee083540deb9
|
|
| BLAKE2b-256 |
b0a1d3697bb197561fad73cc76a3dc327427234095a1c89fb2681f96135d78c6
|