feature:加群提醒功能
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import logging
|
||||
import re
|
||||
from datetime import datetime
|
||||
|
||||
import mysql.connector.pooling
|
||||
@@ -33,11 +34,14 @@ class GroupAdd:
|
||||
if self.gbm.get_group_permission(message.roomid, Feature.GROUP_ADD) == PermissionStatus.DISABLED:
|
||||
return
|
||||
|
||||
now_time = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
|
||||
nick_name = self.all_contacts.get(message.sender, message.sender)
|
||||
now_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
||||
# 创建包含用户昵称、时间和Emoji表情的字符串
|
||||
welcome_message = f"🎉 欢迎用户 {message.content} \n👋 🕒 {now_time} 🕒 !😊"
|
||||
# 使用正则表达式提取双引号中的内容
|
||||
match = re.search(r'"(.*?)"', message.content)
|
||||
|
||||
self.wcf.send_text(welcome_message, (message.roomid if message.from_group() else message.sender),
|
||||
message.sender)
|
||||
if match:
|
||||
nickname = match.group(1)
|
||||
welcome_message = f"🎉 欢迎 【{nickname}】 加入群聊\n👋 🕒 {now_time} 🕒 !😊"
|
||||
self.wcf.send_text(welcome_message, message.roomid)
|
||||
else:
|
||||
print("未找到昵称信息!")
|
||||
|
||||
Reference in New Issue
Block a user