Emil
Emil
DDeno
Created by Emil on 6/9/2024 in #help
Deno.cron scheduled to run once daily executes 6 times daily
Moved this to Val Town and am using their cron functionality for scheduling. Would love to move it back to Deno Deploy eventually if the issue can be resolved.
6 replies
DDeno
Created by Emil on 6/9/2024 in #help
Deno.cron scheduled to run once daily executes 6 times daily
Any help would be greatly appreciated!
6 replies
DDeno
Created by Emil on 6/9/2024 in #help
Deno.cron scheduled to run once daily executes 6 times daily
No description
6 replies
DDeno
Created by Emil on 6/9/2024 in #help
Deno.cron scheduled to run once daily executes 6 times daily
await Deno.cron("send-name-day", "0 5 * * *", () => {
const nameDays = [ ... ];
const date = new Date();
const month = date.getMonth() + 1;
const day = date.getDate();
const nameDay = nameDays[month - 1][day - 1];

const path = `https://api.telegram.org/bot${Deno.env.get("TOKEN")}/sendMessage`;
const resp = fetch(path, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
chat_id: XXXXXXXXXX,
text: `${day}/${month}: ${nameDay}`,
}),
});
console.log(resp.json());
});
await Deno.cron("send-name-day", "0 5 * * *", () => {
const nameDays = [ ... ];
const date = new Date();
const month = date.getMonth() + 1;
const day = date.getDate();
const nameDay = nameDays[month - 1][day - 1];

const path = `https://api.telegram.org/bot${Deno.env.get("TOKEN")}/sendMessage`;
const resp = fetch(path, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
chat_id: XXXXXXXXXX,
text: `${day}/${month}: ${nameDay}`,
}),
});
console.log(resp.json());
});
6 replies