feature:1.点歌功能,2.签到功能
This commit is contained in:
@@ -47,37 +47,6 @@ class News(object):
|
||||
|
||||
return f"{fmt_time} {self.week[weekday_news]}\n{fmt_news}"
|
||||
|
||||
|
||||
def get_36kr_news(self):
|
||||
url = "https://orz.ai/dailynews/?platform=36kr"
|
||||
# 获取当前日期和英文星期名
|
||||
now = datetime.now()
|
||||
current_date = now.strftime("%Y年%m月%d日")
|
||||
english_weekdays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
|
||||
chinese_weekdays = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]
|
||||
|
||||
# 将英文星期名映射为中文
|
||||
current_weekday_index = now.weekday() # 获取当前是星期几(0代表星期一,6代表星期日)
|
||||
current_weekday_chinese = chinese_weekdays[current_weekday_index]
|
||||
|
||||
# 初始化一个空字符串来存储结果
|
||||
output = f"当前日期:{current_date} {current_weekday_chinese}\n\n"
|
||||
|
||||
response = requests.get(url)
|
||||
|
||||
if response.status_code == 200:
|
||||
post = response.json()
|
||||
str = post['data']
|
||||
# 遍历列表,并格式化每个字典的title, url,然后添加到output字符串中
|
||||
for index, article in enumerate(str, start=1):
|
||||
title = article['title']
|
||||
url = article['url']
|
||||
# 使用f-string格式化字符串,并添加到output中
|
||||
output += f"{index}. 标题: {title}\n URL: {url}\n"
|
||||
|
||||
# 输出最终的字符串(这里只是为了展示,实际上你可以根据需要处理这个字符串)
|
||||
return output
|
||||
|
||||
def get_baidu_news(self):
|
||||
url = "https://top.baidu.com/api/board?platform=wise&tab=realtime"
|
||||
# 获取当前日期和英文星期名
|
||||
|
||||
@@ -18,16 +18,16 @@ class ReportReminder:
|
||||
today = datetime.datetime.now().date()
|
||||
# 如果是非工作日
|
||||
if not is_workday(today):
|
||||
robot.sendTextMsg("休息日快乐", receiver)
|
||||
robot.send_text_msg("休息日快乐", receiver)
|
||||
# 如果是工作日
|
||||
if is_workday(today):
|
||||
robot.sendTextMsg("该发日报啦", receiver)
|
||||
robot.send_text_msg("该发日报啦", receiver)
|
||||
# 如果是本周最后一个工作日
|
||||
if ReportReminder.last_work_day_of_week(today) == today:
|
||||
robot.sendTextMsg("该发周报啦", receiver)
|
||||
robot.send_text_msg("该发周报啦", receiver)
|
||||
# 如果本日是本月最后一整周的最后一个工作日:
|
||||
if ReportReminder.last_work_friday_of_month(today) == today:
|
||||
robot.sendTextMsg("该发月报啦", receiver)
|
||||
robot.send_text_msg("该发月报啦", receiver)
|
||||
|
||||
# 计算本月最后一个周的最后一个工作日
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user