NoneBot 暗语
Project description
📖 介绍
NoneBot2 暗语消息支持
[!IMPORTANT] 收藏项目,你将从 GitHub 上无延迟地接收所有发布通知~⭐️
Star History
💿 安装
以下提到的方法任选 其一 即可
[推荐] 使用 nb-cli 安装
在 Bot 的根目录下打开命令行, 输入以下指令即可安装nb plugin install nonebot-plugin-argot
使用包管理器安装
pip install nonebot-plugin-argot
# or, use poetry
poetry add nonebot-plugin-argot
# or, use pdm
pdm add nonebot-plugin-argot
# or, use uv
uv add nonebot-plugin-argot
🎉 使用
添加暗语
# 无过期时间
await cmd.send(
"This is a text message. Reply /background to get background image.",
argot={
"name": "background",
"command": "background",
"content": "https://nonebot.dev/logo.png",
}
)
# 60s 后过期
await cmd.send(
"This is a text message. Reply /background to get background image.",
argot={
"name": "background",
"command": "background",
"content": "https://nonebot.dev/logo.png",
"expire": 60
}
)
# 手动调用 `add_argot` 方法
from nonebot_plugin_argot import add_argot, get_message_id
@on_command("cmd").handle()
async def _():
message = await cmd2.send("This is a text message. Reply /background to get background image.")
await add_argot(
message_id=get_message_id(message) or "",
name="background",
segment=Image(url="https://koishi.chat/logo.png"),
expired_at=timedelta(minutes=2),
)
# 使用 Alconna UniMessage
from nonebot_plugin_alconna import Command
from nonebot_plugin_alconna.uniseg import Text, Image, UniMessage
from nonebot_plugin_argot.extension import ArgotExtension, ArgotSendWrapper, current_send_wrapper
cmd1 = Command("cmd1").build(use_cmd_start=True)
cmd2 = Command("cmd2").build(use_cmd_start=True, extensions=[ArgotExtension()])
@cmd1.handle()
async def _():
path: Path = Path(__file__).parent / "image.png"
with current_send_wrapper.use(ArgotSendWrapper()):
await UniMessage(
[
Text("This is a text message. Reply /image to get image."),
Argot("image", [Text("image"), Image(path=path)]),
]
).send()
@cmd2.handle()
async def _():
path: Path = Path(__file__).parent / "image.png"
await UniMessage(
[
Text("This is a text message. Reply /image to get image."),
Argot("image", [Text("image"), Image(path=path)]),
]
).send()
获取暗语信息
- 使用设置的
command - 通过
get_argot函数 - 超管回复暗语消息
/argot [name]
📸 效果图
💖 鸣谢
KiramiBot:灵感来源KomoriDev/Starify:提供了引人注目的徽章
贡献者们
感谢这些大佬对本项目作出的贡献:
📄 许可证
本项目使用 MIT 许可证开源
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
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_argot-0.1.6.tar.gz.
File metadata
- Download URL: nonebot_plugin_argot-0.1.6.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8f0e3ef7e2e7fc1b5643c0b8ce9c0e94e94ac64d9361df35b235a1459b18b63
|
|
| MD5 |
5b2ccba0c0528d7c7bd018ee51c64451
|
|
| BLAKE2b-256 |
5f167e9a2a3a09c9e0f78b6cc30997a14ea20da5e5d6fd4adff2884f8afbe588
|
File details
Details for the file nonebot_plugin_argot-0.1.6-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_argot-0.1.6-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e74d0e23bee412f6b6a2e22f2258a556e4c2705816373a3ba71d45935416b30e
|
|
| MD5 |
8bc645d2b1b68601e0738421815da484
|
|
| BLAKE2b-256 |
a15355e954b7e93e90c3b5d0453c20a2a6aa0cf405229984958e4270001b4be0
|