diff --git a/config.gen.py b/config.gen.py index 732d534..121b1b9 100644 --- a/config.gen.py +++ b/config.gen.py @@ -9,6 +9,9 @@ EXCLUSIVE_MODE = False # 配置私有模式群组id列表(不私有请忽略) 例如:[-1001324252532, -100112415423] EXCLUSIVE_LIST = [] +# 跳过定时词云的群组 +SKIP_SCHEDULE_GROUP = [] + # 主动触发命令仅管理员有效 False:否 True:是 RANK_COMMAND_MODE = True diff --git a/task.py b/task.py index 101e448..cfabc6b 100644 --- a/task.py +++ b/task.py @@ -8,7 +8,7 @@ import telegram import time import os import connector -from config import TOKEN, FRONT, CHANNEL +from config import TOKEN, FRONT, CHANNEL, SKIP_SCHEDULE_GROUP bot = telegram.Bot(token=TOKEN) @@ -29,7 +29,10 @@ def schedule_task(): for group in group_list: try: # 向任务队列中添加任务 - task_queue.put(group) + if int(group) not in SKIP_SCHEDULE_GROUP: + task_queue.put(group) + else: + print(f"已跳过群组 {group} 的定时任务执行。") except Exception as e: print("群组:{} | 词云数据分析生成失败,请查看报错信息".format(group)) print(e) @@ -132,7 +135,7 @@ def generate(group): # print(word + "\t" + flag) if flag in ["n", "nr", "nz", "PER", "f", "ns", "LOC", "s", "nt", "ORG", "nw"]: # 判断该词是否有效,不为空格 - if re.match(r"^\s+?$", word) is None: + if re.match(r"^\s+?$", word) is None and len(word) > 1: word_list.append(word) # print(word_list)