给9-群百科答题游戏加上权限,防止浪费资源
This commit is contained in:
8
robot.py
8
robot.py
@@ -158,6 +158,10 @@ class Robot(Job):
|
|||||||
|
|
||||||
# 所有人员都可以要求他撤回刚刚的信息
|
# 所有人员都可以要求他撤回刚刚的信息
|
||||||
if msg.from_group() and q.startswith("/"):
|
if msg.from_group() and q.startswith("/"):
|
||||||
|
# 进行权限判断 加入权限,防止tokens浪费
|
||||||
|
if self.gbm.get_group_permission(msg.roomid, Feature.TASK_GAME) == PermissionStatus.DISABLED:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
# 因为内容中存在空格指令,所以不能使用q
|
# 因为内容中存在空格指令,所以不能使用q
|
||||||
game_message = re.sub(r"@.*?[\u2005|\s]", "", msg.content)
|
game_message = re.sub(r"@.*?[\u2005|\s]", "", msg.content)
|
||||||
@@ -268,6 +272,10 @@ class Robot(Job):
|
|||||||
# 兼容不@ 直接/触发指令,回答问题。
|
# 兼容不@ 直接/触发指令,回答问题。
|
||||||
try:
|
try:
|
||||||
if msg.content.startswith("/"):
|
if msg.content.startswith("/"):
|
||||||
|
# 进行权限判断 加入权限,防止tokens浪费
|
||||||
|
if self.gbm.get_group_permission(msg.roomid, Feature.TASK_GAME) == PermissionStatus.DISABLED:
|
||||||
|
return
|
||||||
|
else:
|
||||||
# 因为内容中存在空格指令,所以不能使用
|
# 因为内容中存在空格指令,所以不能使用
|
||||||
self.LOG.info(f"msg.content:{msg.content}\n game_message: {msg.content}")
|
self.LOG.info(f"msg.content:{msg.content}\n game_message: {msg.content}")
|
||||||
resp = game_process_message(group_id=msg.roomid, player_id=msg.sender, message=msg.content,
|
resp = game_process_message(group_id=msg.roomid, player_id=msg.sender, message=msg.content,
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class Feature(Enum):
|
|||||||
PDF_CAPABILITY = 6, "sehuatang PDF能力"
|
PDF_CAPABILITY = 6, "sehuatang PDF能力"
|
||||||
EPIC = 7, "EPIC自动播报" # 新增的功能
|
EPIC = 7, "EPIC自动播报" # 新增的功能
|
||||||
PIC = 8, "图来能力"
|
PIC = 8, "图来能力"
|
||||||
|
TASK_GAME = 9, "百科答题游戏"
|
||||||
|
|
||||||
def __new__(cls, value, description):
|
def __new__(cls, value, description):
|
||||||
obj = object.__new__(cls)
|
obj = object.__new__(cls)
|
||||||
|
|||||||
Reference in New Issue
Block a user