nonebot-plugin-milock 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. nonebot_plugin_milock-0.1.0/.env.example +79 -0
  2. nonebot_plugin_milock-0.1.0/LICENSE +674 -0
  3. nonebot_plugin_milock-0.1.0/MANIFEST.in +7 -0
  4. nonebot_plugin_milock-0.1.0/PKG-INFO +309 -0
  5. nonebot_plugin_milock-0.1.0/README.md +275 -0
  6. nonebot_plugin_milock-0.1.0/nonebot_plugin_milock/__init__.py +378 -0
  7. nonebot_plugin_milock-0.1.0/nonebot_plugin_milock/client.py +212 -0
  8. nonebot_plugin_milock-0.1.0/nonebot_plugin_milock/config.py +173 -0
  9. nonebot_plugin_milock-0.1.0/nonebot_plugin_milock/flow.py +184 -0
  10. nonebot_plugin_milock-0.1.0/nonebot_plugin_milock/messages.py +293 -0
  11. nonebot_plugin_milock-0.1.0/nonebot_plugin_milock/report.py +111 -0
  12. nonebot_plugin_milock-0.1.0/nonebot_plugin_milock/schedule.py +140 -0
  13. nonebot_plugin_milock-0.1.0/nonebot_plugin_milock/service.py +274 -0
  14. nonebot_plugin_milock-0.1.0/nonebot_plugin_milock/store.py +557 -0
  15. nonebot_plugin_milock-0.1.0/nonebot_plugin_milock.egg-info/PKG-INFO +309 -0
  16. nonebot_plugin_milock-0.1.0/nonebot_plugin_milock.egg-info/SOURCES.txt +30 -0
  17. nonebot_plugin_milock-0.1.0/nonebot_plugin_milock.egg-info/dependency_links.txt +1 -0
  18. nonebot_plugin_milock-0.1.0/nonebot_plugin_milock.egg-info/requires.txt +6 -0
  19. nonebot_plugin_milock-0.1.0/nonebot_plugin_milock.egg-info/top_level.txt +1 -0
  20. nonebot_plugin_milock-0.1.0/pyproject.toml +88 -0
  21. nonebot_plugin_milock-0.1.0/setup.cfg +4 -0
  22. nonebot_plugin_milock-0.1.0/tests/_load_smoke.py +55 -0
  23. nonebot_plugin_milock-0.1.0/tests/conftest.py +185 -0
  24. nonebot_plugin_milock-0.1.0/tests/test_client.py +204 -0
  25. nonebot_plugin_milock-0.1.0/tests/test_config.py +104 -0
  26. nonebot_plugin_milock-0.1.0/tests/test_flow.py +366 -0
  27. nonebot_plugin_milock-0.1.0/tests/test_messages.py +27 -0
  28. nonebot_plugin_milock-0.1.0/tests/test_plugin_load.py +27 -0
  29. nonebot_plugin_milock-0.1.0/tests/test_report_channels.py +105 -0
  30. nonebot_plugin_milock-0.1.0/tests/test_schedule.py +86 -0
  31. nonebot_plugin_milock-0.1.0/tests/test_service.py +336 -0
  32. nonebot_plugin_milock-0.1.0/tests/test_store.py +135 -0
@@ -0,0 +1,79 @@
1
+ # nonebot-plugin-milock 示例配置
2
+ # 复制到 NoneBot 项目的 .env / .env.prod 中按需修改。
3
+
4
+ # --------------------------------------------------------------------------- #
5
+ # milock 服务
6
+ # --------------------------------------------------------------------------- #
7
+ MILOCK_API_BASE=http://192.168.139.50:8787
8
+ # 服务端未设置 MILOCK_API_KEYS 时留空
9
+ MILOCK_API_KEY=
10
+ # 设备 did(推荐):服务端自行取密钥、解包、出码
11
+ MILOCK_DID=
12
+ # 安全密码,配合 MILOCK_DID 使用
13
+ MILOCK_PINCODE=
14
+ # 或者直接给主密钥(十六进制,高级用法,注意保密)
15
+ MILOCK_SEED_HEX=
16
+ MILOCK_TIMEOUT=10
17
+
18
+ # --------------------------------------------------------------------------- #
19
+ # 出码参数
20
+ # --------------------------------------------------------------------------- #
21
+ # 留空则用服务端默认(30 分钟 / 8 位)
22
+ # MILOCK_INTERVAL_MINUTES=30
23
+ # MILOCK_DIGITS=8
24
+ # 每人每个窗口最多领几个密码
25
+ MILOCK_MAX_CODES_PER_WINDOW=1
26
+ # 窗口剩余秒数低于该值时,自动改用下一个窗口,避免刚发出就过期
27
+ MILOCK_MIN_REMAINING_SECONDS=60
28
+
29
+ # --------------------------------------------------------------------------- #
30
+ # 管理员与汇报
31
+ # --------------------------------------------------------------------------- #
32
+ # 额外管理员 QQ(NoneBot 的 SUPERUSERS 始终算管理员);JSON 数组或逗号分隔
33
+ MILOCK_ADMINS=[]
34
+ # 管理群:汇报目标,也是群内审核的唯一合法场所
35
+ MILOCK_ADMIN_GROUPS=[]
36
+
37
+ # 汇报渠道开关:单独控制推给谁(默认都开)
38
+ MILOCK_REPORT_TO_ADMINS=true
39
+ MILOCK_REPORT_TO_GROUPS=true
40
+ # 注意:这两个开关只管"汇报推送",不影响群内审核资格。
41
+ # 群内审核始终要求管理员 + 群号在 MILOCK_ADMIN_GROUPS 里。
42
+ # MILOCK_REPORT_TO_ADMINS=false 时必须配置 MILOCK_ADMIN_GROUPS,否则插件拒绝启动。
43
+
44
+ # 汇报给管理员私聊时是否带上密码明文(审计用)
45
+ MILOCK_REPORT_PASSWORD=true
46
+ # 汇报到管理群时是否也带明文(默认 false,避免整个群都看到密码)
47
+ MILOCK_REPORT_PASSWORD_IN_GROUPS=false
48
+
49
+ # --------------------------------------------------------------------------- #
50
+ # 审核与存储
51
+ # --------------------------------------------------------------------------- #
52
+ # 申请单等待审核的秒数,超时自动作废
53
+ MILOCK_APPROVAL_TIMEOUT=300
54
+ # 密码"占位"存活秒数:私聊投递失败后自动回收,避免浪费一个码
55
+ MILOCK_RESERVATION_TTL=90
56
+ # 后台清理任务间隔(秒)
57
+ MILOCK_SWEEP_INTERVAL=30
58
+ # SQLite 路径,建议写成绝对路径并指向挂载卷(相对路径是相对机器人进程的 CWD)
59
+ # 目录不存在会自动创建;权限请收紧
60
+ MILOCK_DB_PATH=data/milock.sqlite3
61
+
62
+ # --------------------------------------------------------------------------- #
63
+ # 交互
64
+ # --------------------------------------------------------------------------- #
65
+ # 用户申请密码的命令名:只写命令名,不要带前导斜杠(NoneBot 会自己补 "/")
66
+ # 默认 /密码;别名固定为:申请密码 / 取密码 / otp
67
+ MILOCK_COMMAND=密码
68
+ # 是否允许在聊天里直接说"申请密码"就触发(群里可能误触,默认关闭)
69
+ MILOCK_ALLOW_KEYWORD_TRIGGER=false
70
+
71
+ # --------------------------------------------------------------------------- #
72
+ # 指定时间取码(/密码 21:00)
73
+ # --------------------------------------------------------------------------- #
74
+ # 是否允许用户指定时间取码;关闭后 /密码 只接受"现在"
75
+ MILOCK_ALLOW_TIME_REQUEST=true
76
+ # 说明:锁的密码有效期是"本窗口 + 下一个窗口",默认 interval=30 时即 1 小时。
77
+ # /密码 21:00 -> 发 20:30 那个窗口的码,有效期 20:30-21:30
78
+ # 最多能提前多久取码(小时),防止有人索要很久以后的码
79
+ MILOCK_MAX_ADVANCE_HOURS=24