Skip to content

Commit

Permalink
Merge pull request #50 from Sevenyine/dev1
Browse files Browse the repository at this point in the history
让用户可以取消信息跟踪式扔漂流瓶
  • Loading branch information
LambdaYH committed Sep 1, 2023
2 parents fe44c6b + 809ce46 commit 470ce36
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nonebot_plugin_bottle/.DS_Store
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- 使用 `nb plugin install nonebot_plugin_bottle`
* 指令 (前应带指令前缀)
-
- `扔漂流瓶` [文本/图片]
- `扔漂流瓶` [文本/图片]`扔漂流瓶` 后一条消息跟漂流瓶内容
- `寄漂流瓶` [文本/图片] (同`扔漂流瓶`,防止指令冲突用)
- `捡漂流瓶`
- `评论漂流瓶` [漂流瓶编号] [文本]
Expand All @@ -22,17 +22,17 @@
- `漂流瓶详情` [漂流瓶编号]
* 功能须知
- 所有用户:
- `扔漂流瓶`指令无字数限制,如需要可在代码中修改,**单扔一张图片也应加上指令后的空格**
- `扔漂流瓶`指令无字数限制,如需要可在代码中修改。若只说了扔漂流瓶,则插件将会监听用户的下一条消息。
- `捡漂流瓶`若捡到的漂流瓶存在回复,则会显示最近三条(默认),使用`查看漂流瓶`查看所有回复
- `查看漂流瓶`为保证随机性,无评论时不展示漂流瓶内容,可在代码中修改。漂流瓶的发送者可以通过本指令查看内容,无论有无评论。
- `评论漂流瓶`若机器人有被回复人好友,会发送被回复通知
- `评论漂流瓶`评论内容将通过该瓶子扔出的方式告诉扔出瓶子的人
- `举报漂流瓶`五次(默认)后将自动删除,举报成功后会私聊SUPERUSER漂流瓶详情内容
- `删除漂流瓶`漂流瓶发送者可以删除自己扔出的漂流瓶。二次确认会触发删除操作的指令为:`是/Y/Yes/y/yes`其他的均取消操作
- `删除漂流瓶`漂流瓶发送者可以删除自己扔出的漂流瓶。二次确认会触发删除操作的指令为:`是/Y/Yes/y/yes`其他的均直接取消操作
- SUPERUSER:
- `删除漂流瓶`可以删除任何一个漂流瓶
- `清空漂流瓶`无确认过程,使用需谨慎
- `删除漂流瓶`可以删除指定漂流瓶
- `清空漂流瓶`顾名思义,使用需谨慎
- `恢复漂流瓶`可以恢复被删除的漂流瓶
- `删除漂流瓶评论`是删除该发送者在该瓶的所有评论
- `删除漂流瓶评论`可删除该发送者在该瓶的所有评论
- `漂流瓶详情`将会发送漂流瓶发送者的QQ号和群号,所有回复人的QQ号
- `漂流瓶黑名单``举报`选项是指`举报漂流瓶`的使用权限
- `漂流瓶数据库`存放在`data/bottle/data.json`
Expand Down Expand Up @@ -133,4 +133,4 @@
![image](https://user-images.githubusercontent.com/97968466/191049794-1b409436-fd70-43d9-8dcb-3575e82fd69b.png)
![image](https://user-images.githubusercontent.com/97968466/213113862-e6c7568b-8686-4e97-8f83-7354ff1cb704.png)
![image](https://user-images.githubusercontent.com/97968466/191052704-1b5ec89d-7a49-40d6-a5d9-b0a0171c730e.png)
![image](https://user-images.githubusercontent.com/97968466/191049649-2e8d8555-f285-470f-9f7b-f5a0994341ee.png)
![image](https://user-images.githubusercontent.com/97968466/191049649-2e8d8555-f285-470f-9f7b-f5a0994341ee.png)
9 changes: 8 additions & 1 deletion nonebot_plugin_bottle/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import random
import asyncio

from nonebot.typing import T_State
from nonebot.matcher import Matcher
from nonebot import require, on_command
from nonebot.permission import SUPERUSER
Expand Down Expand Up @@ -114,6 +115,7 @@ async def verify(matcher: Matcher, event: GroupMessageEvent) -> None:

# 信息初始化
proceed = set(["是", "Y", "Yes", "y", "yes"])
cancel = set(["取消", "cancel"])


@listb.handle()
Expand Down Expand Up @@ -182,17 +184,22 @@ async def _(
await verify(matcher=matcher, event=event)
if args:
matcher.set_arg("content", args)
matcher.set_arg("__has_content__", True)


@throw.got("content", prompt="想说些什么话呢?")
@throw.got("content", prompt="在漂流瓶中要写下什么呢?(输入“取消”来取消扔漂流瓶操作。)")
async def _(
bot: Bot,
state: T_State,
event: GroupMessageEvent,
args: Message = Arg("content"),
session: AsyncSession = Depends(get_session),
):
message_text = args.extract_plain_text().strip()

if "__has_content__" not in state and message_text in cancel:
await throw.finish("已取消扔漂流瓶操作。")

audit = await text_audit(text=message_text)
if not audit == "pass":
if audit == "Error":
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nonebot_plugin_bottle"
version = "1.0.1.4"
version = "1.0.1.5"
description = "Bottle post plugin in Nonebot"
authors = ["Todysheep <[email protected]>"]
license = "GNU GPLv3"
Expand Down

0 comments on commit 470ce36

Please sign in to comment.