Skip to content

Commit 038d5a2

Browse files
committed
feat(server): 添加时钟表情映射器和聊天室维护通知功能
- 新增 ClockEmojiMapper 工具类,根据时间生成对应的时钟表情代码 - 在 Server.java 中添加 LocalTime 时间处理支持 - 整合 ChatRoomBot 聊天机器人功能模块 - 优化导入语句,使用通配符导入工具类 - 添加维护模式开始时的机器人消息通知 - 添加维护完成时的机器人消息通知,包含启动时间和编译版本信息
1 parent 50f4063 commit 038d5a2

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/main/java/org/b3log/symphony/Server.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,14 @@ public static void main(final String[] args) throws Exception {
314314
String staticResourceVersion = Symphonys.get("staticResourceVersion");
315315
STARTUP_STR = "<li>Rhythm 启动时间:" + startupTime + "</li><li>Rhythm 编译版本:" + staticResourceVersion + "</li>";
316316

317-
ChatRoomBot.sendBotMsg("#### 维护完毕:sparkles:\n社区已结束维护,可以开始聊天啦 :smile:\nRhythm 启动时间 " + ClockEmojiMapper.getClockEmojiCode(LocalTime.now()) + " " + startupTime + "\nRhythm 编译版本 :dart: " + staticResourceVersion);
317+
Thread.startVirtualThread(() -> {
318+
try {
319+
Thread.sleep(5000);
320+
} catch (InterruptedException e) {
321+
throw new RuntimeException(e);
322+
}
323+
ChatRoomBot.sendBotMsg("#### 维护完毕:sparkles:\n社区已结束维护,可以开始聊天啦 :smile:\nRhythm 启动时间 " + ClockEmojiMapper.getClockEmojiCode(LocalTime.now()) + " " + startupTime + "\nRhythm 编译版本 :dart: " + staticResourceVersion);
324+
});
318325

319326
System.out.println(">>> Quick boot mode requirements is ready!");
320327

src/main/java/org/b3log/symphony/util/ClockEmojiMapper.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Rhythm - A modern community (forum/BBS/SNS/blog) platform written in Java.
3+
* Modified version from Symphony, Thanks Symphony :)
4+
* Copyright (C) 2012-present, b3log.org
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Affero General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Affero General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Affero General Public License
17+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
18+
*/
119
package org.b3log.symphony.util;
220

321
import java.time.LocalTime;

0 commit comments

Comments
 (0)