feature:1.点歌功能,2.签到功能

This commit is contained in:
liuwei
2025-03-05 09:01:08 +08:00
parent 5ed4c94094
commit 9937115ad3
14 changed files with 524 additions and 200 deletions

View File

@@ -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"
# 获取当前日期和英文星期名