Skip to content

fix: 修复数据库记录不存在的报错 & feat: '-r' “替换”参数与'-p'“标点”参数#2

Open
R1Yue wants to merge 2 commits into
BlockG-ws:masterfrom
R1Yue:master
Open

fix: 修复数据库记录不存在的报错 & feat: '-r' “替换”参数与'-p'“标点”参数#2
R1Yue wants to merge 2 commits into
BlockG-ws:masterfrom
R1Yue:master

Conversation

@R1Yue
Copy link
Copy Markdown

@R1Yue R1Yue commented May 28, 2026

#1 fix
feat: 两个参数 -r & -p 分别可以替换actions回复中的“了”和标点

预期行为:

# 输入 verb 变化 标点 输出
1 /踢 "踢了" "!" 张三 踢了 自己!
2 /踢 -r "踢" "!" 张三 踢 自己!
3 /踢 -r 死 "踢死" "!" 张三 踢死 自己!
4 /踢 -p "踢了" "" 张三 踢了 自己
5 /踢 -p ? "踢了" "?" 张三 踢了 自己?
6 /踢 -r -p "踢" "" 张三 踢 自己
7 /踢 -r 死 -p "踢死" "" 张三 踢死 自己
8 /踢 -r 死 -p ? "踢死" "?" 张三 踢死 自己?
# 输入 verb 变化 content 标点 输出
9 /踢 一脚 "踢了" "一脚" "!" 张三 踢了 李四 一脚!
10 /踢 一脚 -r "踢" "一脚" "!" 张三 踢 李四 一脚!
11 /踢 一脚 -r 死 "踢死" "一脚" "!" 张三 踢死 李四 一脚!
12 /踢 一脚 -p "踢了" "一脚" "" 张三 踢了 李四 一脚
13 /踢 一脚 -p ? "踢了" "一脚" "?" 张三 踢了 李四 一脚?
14 /踢 一脚 -r -p "踢" "一脚" "" 张三 踢 李四 一脚
15 /踢 一脚 -r 死 -p "踢死" "一脚" "" 张三 踢死 李四 一脚
16 /踢 一脚 -r 死 -p ? "踢死" "一脚" "?" 张三 踢死 李四 一脚?

vibe coding产物,如果很差请狠狠批评!
一次force push是因为origin改变
本人测试无不符合预期行为。

@R1Yue R1Yue marked this pull request as draft May 28, 2026 06:08
@R1Yue R1Yue marked this pull request as ready for review May 28, 2026 06:14
Copy link
Copy Markdown
Contributor

@GrassBlock1 GrassBlock1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢提交 Pull Request!

虽然人工代码检查已经通过,但由于本项目并没有设置测试机制,请确保在本地进行足够的测试。

@R1Yue R1Yue force-pushed the master branch 2 times, most recently from 7892742 to 12fcdd3 Compare May 28, 2026 07:09
@R1Yue R1Yue marked this pull request as draft May 28, 2026 07:18
@R1Yue R1Yue force-pushed the master branch 4 times, most recently from d58115f to 69badba Compare May 28, 2026 07:58
@R1Yue R1Yue changed the title fix: 修复数据库记录不存在的报错 & feat: '-r' “替换”参数 fix: 修复数据库记录不存在的报错 & feat: '-r' “替换”参数与'-p'“标点”参数 May 28, 2026
- Fix Stats.get_or_create to handle missing records
- Add -r (replace suffix) parameter to /actions and \reverse_actions
- Add -p (replace punctuation) parameter to /actions and \reverse_actions
@R1Yue
Copy link
Copy Markdown
Author

R1Yue commented May 28, 2026

抱歉没有标准操作新commit而是重复修改commit了!
新增一个'-p'参数,用于删除/替换末尾标点。

@R1Yue R1Yue marked this pull request as ready for review May 28, 2026 08:26
@R1Yue
Copy link
Copy Markdown
Author

R1Yue commented May 29, 2026

目前经测与预期行为相符,无异常行为。

@R1Yue R1Yue force-pushed the master branch 2 times, most recently from 9894a2e to 8d4f474 Compare May 29, 2026 01:59
@R1Yue
Copy link
Copy Markdown
Author

R1Yue commented May 29, 2026

新提交了一个commit,针对向匿名用户回复时报错AttributeError: 'NoneType' object has no attribute 'from_user'
但发现若匿名用户进行反向动作时,由于API不会反回Update,bot无法进行回复。我认为无法/难以解决。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants