Skip to content

Commit 002d93e

Browse files
committed
1.0.1
1 parent 6b7b73a commit 002d93e

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
## 介绍
1313

14-
本项目是一个 Class Widgets 插件,用于接收来自 SecRandom 的抽选和抽奖结果通知。通过文件系统作为通信媒介,SecRandom 可以将抽选结果和抽奖结果发送到 Class Widgets 中显示。
14+
本项目是一个 Class Widgets 插件,用于接收来自 SecRandom 的抽选和抽奖结果通知。
1515

1616
### 特性
1717

main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def listen(self):
3737
if msg_type == "selection_result":
3838
# 处理抽选结果
3939
name = data.get("name", "未知")
40+
display_time = data.get("display_time", 3)
4041
time_str = data.get("time", "")
4142

4243
# 构建通知内容
@@ -51,12 +52,13 @@ def listen(self):
5152
subtitle=subtitle,
5253
content=content,
5354
icon=f'{self.plugin_dir}/assets/SecRandom.png',
54-
duration=3000
55+
duration=display_time * 1000
5556
)
5657

5758
elif msg_type == "reward_result":
5859
# 处理抽奖结果
5960
reward = data.get("reward", "未知奖品")
61+
display_time = data.get("display_time", 3)
6062
time_str = data.get("time", "")
6163

6264
# 构建通知内容
@@ -71,18 +73,19 @@ def listen(self):
7173
subtitle=subtitle,
7274
content=content,
7375
icon=f'{self.plugin_dir}/assets/SecRandom.png',
74-
duration=3000
76+
duration=display_time * 1000
7577
)
7678

7779
else:
7880
# 未知消息类型,尝试显示原始数据
81+
display_time = data.get("display_time", 3)
7982
self.method.send_notification(
8083
state=4,
8184
title="收到消息",
8285
subtitle="未知类型的消息",
8386
content=str(data),
8487
icon=f'{self.plugin_dir}/assets/SecRandom.png',
85-
duration=3000
88+
duration=display_time * 1000
8689
)
8790

8891
except Exception as e:

plugin.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "SecRandom CW联动",
3-
"description": "让SecRandom与Class-Widgets联动,解锁许多实用的功能。",
4-
"version": "1.0.0",
5-
"plugin_ver": 2,
2+
"name": "SecRandom-CW",
3+
"description": "SecRandom x Class-Widgets联动插件",
4+
"version": "1.0.1",
5+
"plugin_ver": 1,
66
"author": "SECTL",
77
"settings": false,
88

0 commit comments

Comments
 (0)