Last active
November 19, 2023 00:37
-
-
Save bpevs/7fbcf6790b10bd35e3561b746d4bd071 to your computer and use it in GitHub Desktop.
GIVE ME TEA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const weather_to_drink_temp_map = { | |
'0': "正常冰", | |
'1': "正常冰", | |
'2': "少冰", | |
'3': "少冰", | |
'71': "熱", | |
'73': "熱", | |
'75': "熱", | |
'77': "熱", | |
'95': "熱", | |
'96': "熱", | |
'99': "熱", | |
} | |
function 要冰(天氣) { | |
if (weather_to_drink_temp_map[天氣]) return weather_to_drink_temp_map[天氣]; | |
else return "溫"; | |
} | |
const BASE_URL = "https://api.open-meteo.com/v1/forecast?current_weather=true&" | |
Deno.serve(async (req) => { | |
const url = new URL(req.url); | |
const latitude = "latitude=25.0330" | |
const longitude = "longitude=121.5654" | |
const 天氣 = await (await fetch(BASE_URL + latitude + "&" + longitude)).json() | |
console.log(天氣) | |
let resp = "not found" | |
resp = 要冰(天氣); | |
return new Response(resp); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment