mirror of
https://github.com/Zippland/Bubbles.git
synced 2026-01-19 01:21:15 +08:00
去掉周报月报功能
This commit is contained in:
@@ -166,7 +166,6 @@ GROUP_MODELS:
|
||||
# 功能开关
|
||||
news_report # 每日新闻推送
|
||||
weather_report # 每日天气推送
|
||||
report_reminder # 日报周报月报提醒
|
||||
image_generation # AI生图
|
||||
perplexity # perplexity
|
||||
```
|
||||
|
||||
@@ -79,9 +79,6 @@ MAX_HISTORY: 300 # 记录数据库的消息历史
|
||||
news:
|
||||
receivers: ["filehelper"] # 定时新闻接收人(roomid 或者 wxid)
|
||||
|
||||
report_reminder:
|
||||
receivers: [] # 定时日报周报月报提醒(roomid 或者 wxid)
|
||||
|
||||
# 消息发送速率限制:一分钟内最多发送6条消息
|
||||
send_rate_limit: 6
|
||||
|
||||
|
||||
@@ -34,8 +34,6 @@ class Config(object):
|
||||
self.WELCOME_MSG = yconfig["groups"].get("welcome_msg", "欢迎 {new_member} 加入群聊!")
|
||||
self.GROUP_MODELS = yconfig["groups"].get("models", {"default": 0, "mapping": []})
|
||||
self.NEWS = yconfig["news"]["receivers"]
|
||||
self.REPORT_REMINDERS = yconfig["report_reminder"]["receivers"]
|
||||
|
||||
self.CHATGPT = yconfig.get("chatgpt", {})
|
||||
self.DEEPSEEK = yconfig.get("deepseek", {})
|
||||
self.PERPLEXITY = yconfig.get("perplexity", {})
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
import calendar
|
||||
import datetime
|
||||
|
||||
from chinese_calendar import is_workday
|
||||
from robot import Robot
|
||||
|
||||
|
||||
class ReportReminder:
|
||||
|
||||
@staticmethod
|
||||
def remind(robot: Robot) -> None:
|
||||
|
||||
receivers = robot.config.REPORT_REMINDERS
|
||||
if not receivers:
|
||||
receivers = ["filehelper"]
|
||||
# 日报周报月报提醒
|
||||
for receiver in receivers:
|
||||
today = datetime.datetime.now().date()
|
||||
# 如果是非工作日
|
||||
if not is_workday(today):
|
||||
#robot.sendTextMsg("休息日快乐", receiver)
|
||||
pass
|
||||
# 如果是工作日
|
||||
if is_workday(today):
|
||||
robot.sendTextMsg("该发日报啦", receiver)
|
||||
# 如果是本周最后一个工作日
|
||||
if ReportReminder.last_work_day_of_week(today) == today:
|
||||
robot.sendTextMsg("该发周报啦", receiver)
|
||||
# 如果本日是本月最后一整周的最后一个工作日:
|
||||
if ReportReminder.last_work_friday_of_month(today) == today:
|
||||
robot.sendTextMsg("该发月报啦", receiver)
|
||||
|
||||
# 计算本月最后一个周的最后一个工作日
|
||||
@staticmethod
|
||||
def last_work_friday_of_month(d: datetime.date) -> datetime.date:
|
||||
days_in_month = calendar.monthrange(d.year, d.month)[1]
|
||||
weekday = calendar.weekday(d.year, d.month, days_in_month)
|
||||
if weekday == 4:
|
||||
last_friday_of_month = datetime.date(
|
||||
d.year, d.month, days_in_month)
|
||||
else:
|
||||
if weekday >= 5:
|
||||
last_friday_of_month = datetime.date(d.year, d.month, days_in_month) - \
|
||||
datetime.timedelta(days=(weekday - 4))
|
||||
else:
|
||||
last_friday_of_month = datetime.date(d.year, d.month, days_in_month) - \
|
||||
datetime.timedelta(days=(weekday + 3))
|
||||
while not is_workday(last_friday_of_month):
|
||||
last_friday_of_month = last_friday_of_month - datetime.timedelta(days=1)
|
||||
return last_friday_of_month
|
||||
|
||||
# 计算本周最后一个工作日
|
||||
@staticmethod
|
||||
def last_work_day_of_week(d: datetime.date) -> datetime.date:
|
||||
weekday = calendar.weekday(d.year, d.month, d.day)
|
||||
last_work_day_of_week = datetime.date(
|
||||
d.year, d.month, d.day) + datetime.timedelta(days=(6 - weekday))
|
||||
|
||||
while not is_workday(last_work_day_of_week):
|
||||
last_work_day_of_week = last_work_day_of_week - \
|
||||
datetime.timedelta(days=1)
|
||||
return last_work_day_of_week
|
||||
3
main.py
3
main.py
@@ -35,7 +35,6 @@ logging.getLogger("commands").setLevel(logging.WARNING)
|
||||
# 临时调试:为AI路由器设置更详细的日志级别
|
||||
logging.getLogger("commands.ai_router").setLevel(logging.INFO)
|
||||
|
||||
from function.func_report_reminder import ReportReminder
|
||||
from configuration import Config
|
||||
from constants import ChatType
|
||||
from robot import Robot, __version__
|
||||
@@ -76,8 +75,6 @@ def main(chat_type: int):
|
||||
# 每天 7:30 发送新闻
|
||||
robot.onEveryTime("07:30", robot.newsReport)
|
||||
|
||||
# 每天 16:30 提醒发日报周报月报
|
||||
robot.onEveryTime("17:00", ReportReminder.remind, robot=robot)
|
||||
|
||||
# 让机器人一直跑
|
||||
robot.keepRunningAndBlockProcess()
|
||||
|
||||
Reference in New Issue
Block a user