182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const telegramSendMessage = async (botToken: string, options: {
14 reply_markup?: any[];
15}) =>
16 fetchJSON(
17 `https://api.telegram.org/bot${botToken}/sendMessage`,
18 {
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
90 useEffect(() => {
91 setLoading(true);
92 fetch(`/weather?region=${region}`)
93 .then(response => response.json())
94 .then(data => {
97 })
98 .catch(error => {
99 console.error('Error fetching weather:', error);
100 setLoading(false);
101 });
131
132 if (loading) return <div>Loading weather...</div>;
133 if (!weather) return <div>Unable to fetch weather</div>;
134
135 return (
199 const selectedLocation = LOCATIONS[regionParam as keyof typeof LOCATIONS] || LOCATIONS.Moscow;
200
201 const weatherResponse = await fetch(
202 `https://api.open-meteo.com/v1/forecast?latitude=${selectedLocation.lat}&longitude=${selectedLocation.lon}¤t=temperature_2m,relative_humidity_2m,wind_speed_10m`
203 );
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
96
97 try {
98 const response = await fetch('https://api.openai.com/v1/chat/completions', {
99 method: 'POST',
100 headers: {