feature:加群提醒功能
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import mysql.connector.pooling
|
import mysql.connector.pooling
|
||||||
@@ -33,11 +34,14 @@ class GroupAdd:
|
|||||||
if self.gbm.get_group_permission(message.roomid, Feature.GROUP_ADD) == PermissionStatus.DISABLED:
|
if self.gbm.get_group_permission(message.roomid, Feature.GROUP_ADD) == PermissionStatus.DISABLED:
|
||||||
return
|
return
|
||||||
|
|
||||||
now_time = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
|
now_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||||
nick_name = self.all_contacts.get(message.sender, message.sender)
|
|
||||||
|
|
||||||
# 创建包含用户昵称、时间和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),
|
if match:
|
||||||
message.sender)
|
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