每日一言
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import requests
import speaking
from clock import Alarm_add,Alarm_del
url = "https://v1.hitokoto.cn/?c=a&c=c&c=e&c=f&c=h&c=i&c=k"
def yiyan():
response = requests.get(url)
data = response.json()
# 检查响应状态码
if response.status_code == 200:
hitokoto = data["hitokoto"]
from_who = data["from_who"]
print("Hitokoto:", hitokoto)
else:
print("请求失败:", data["message"])
#speaking.speak(hitokoto,0)
return hitokoto
def open_yiyan():
#格言已开启
#speaking.play_audio("../file/aphorism/kaiqi.wav")
#开启定时器
Alarm_add("21:50:00", 4)
def close_yiyan():
#格言已开启
#speaking.play_audio("../file/aphorism/close.wav")
#开启定时器
Alarm_del("21:46:00", 4)
#yiyan()