Skip to content

Commit 5a6b2fd

Browse files
committed
✨ 青龙可选是否推送流量包明细
- 新增 `TELECOM_FLUX_PACKAGE` 环境变量,用于控制是否推送流量包明细 - 说明文档明确密码应为6位数字
1 parent 0bbb5dc commit 5a6b2fd

2 files changed

Lines changed: 14 additions & 13 deletions

File tree

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525
ql repo https://github.com/Cp0204/ChinaTelecomMonitor.git "telecom_monitor" "" "telecom_class|notify"
2626
```
2727

28-
| 环境变量 | 示例 | 备注 |
29-
| -------------- | --------------------- | ------------------------------ |
30-
| `TELECOM_USER` | `18912345678password` | 手机号密码直接拼接,会自动截取 |
28+
| 环境变量 | 示例 | 备注 |
29+
| ---------------------- | --------------------- | ----------------------------------------------- |
30+
| `TELECOM_USER` | `18912345678password` | 手机号密码直接拼接,密码应为6位数字,会自动截取 |
31+
| `TELECOM_FLUX_PACKAGE` | `true` (默认) | 推送流量包明细,`false` 则只推送基本信息 |
3132

3233
### Docker API 服务
3334

telecom_monitor.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,22 +176,22 @@ def auto_login():
176176
if summary["specialTotal"] > 0
177177
else ""
178178
)
179-
# 添加通知
180-
add_notify(
181-
f"""
179+
180+
# 基本信息
181+
notify_str = f"""
182182
📱 手机:{summary['phonenum']}
183183
💰 余额:{round(summary['balance']/100,2)}
184-
📞 通话:{summary['voiceUsage']}{f" / {summary['voiceTotal']}" if summary['voiceTotal']>0 else ""} min
184+
📞 通话:{summary['voiceUsage']}{f' / {summary['voiceTotal']}' if summary['voiceTotal']>0 else ''} min
185185
🌐 总流量
186-
- 通用:{common_str}{f"{chr(10)} - 专用:{special_str}" if special_str else ""}
186+
- 通用:{common_str}{f'{chr(10)} - 专用:{special_str}' if special_str else ''}"""
187187

188-
【流量包明细】
188+
# 流量包明细
189+
if os.environ.get("TELECOM_FLUX_PACKAGE", "true").lower() != "false":
190+
notify_str += f"\n\n【流量包明细】\n\n{flux_package_str.strip()}"
189191

190-
{flux_package_str.strip()}
192+
notify_str += f"\n\n查询时间:{summary['createTime']}"
191193

192-
查询时间:{summary['createTime']}
193-
""".strip()
194-
)
194+
add_notify(notify_str.strip())
195195

196196
# 通知
197197
if NOTIFYS:

0 commit comments

Comments
 (0)