feature:新增群百科游戏,用于促进群活跃。加入了新的指令 可用:/start, /tasks, /list, /answer [任务ID] [答案], /addgroup, /rank

This commit is contained in:
liuwei
2025-02-21 16:32:51 +08:00
parent 84f8a88ba4
commit 08e71722e8
5 changed files with 404 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
import json
import logging
import re
import time
@@ -24,6 +24,7 @@ from base.func_xinghuo_web import XinghuoWeb
from base.func_claude import Claude
from configuration import Config
from constants import ChatType
from game_task.game_task_encyclopedia import game_process_message
from group_auto.group_auto_invite import get_first_group_id, process_command
from group_auto.group_member_change import GroupMemberChange
from robot_cmd.robot_command import GroupBotManager
@@ -147,8 +148,12 @@ class Robot(Job):
match = re.match(pattern, q)
# 所有人员都可以要求他撤回刚刚的信息
if q == '撤回':
self.revoke_messages(msg.roomid)
if msg.from_group() and q.startswith("/"):
# 因为内容中存在空格指令所以不能使用q
game_message = re.sub(r"@.*?[\u2005|\s]", "", msg.content)
resp = game_process_message(group_id=msg.roomid, player_id=msg.sender, message=game_message,
player_name=self.allContacts.get(msg.sender, msg.sender))
self.sendTextMsg(resp.get("message"), msg.roomid, msg.sender)
return True
if q == "#今日百度新闻":
self.newsBaiduReport((msg.roomid if msg.from_group() else msg.sender))