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
import { telegramSendMessage } from "https://esm.town/v/vtdocs/telegramSendMessage?v=5";
import process from "node:process";
import { telegramSendPhoto } from "https://esm.town/v/vtdocs/telegramSendPhoto?v=1";
import { telegramValTownBotSecrets } from "https://esm.town/v/stevekrouse/telegramValTownBotSecrets";
export let telegramValTownBot = async (secret, text, options?) => {
let chat = telegramValTownBotSecrets.find((c) =>
c.secret === secret
);
if (!chat)
throw new Error("@stevekrouse.telegramValTownBot: secret not found");
if (options?.photo) {
telegramSendPhoto(process.env.telegramBot, {
...options,
chat_id: chat.chatId,
});
}
else {
await telegramSendMessage(
process.env.telegramBot,
{
...options,
chat_id: chat.chatId,
text,
},
);
}
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023