-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCode.gs
44 lines (39 loc) · 989 Bytes
/
Code.gs
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
38
39
40
41
42
43
44
const subscribe = "t.me/<channel_name>";
const SHOW = "🗓️ Показати графік";
const NEXT = "⏱️ Наступне відключення";
function doPost(e) {
let content = JSON.parse(e.postData.contents);
let payload = {
chat_id: content.message.chat.id,
parse_mode: "markdown",
reply_markup: {
inline_keyboard: [[{
text: "📨 Підписатися",
url: subscribe,
}]]
}
}
switch (content.message.text) {
case "/start":
payload.text = "Вітаю! 👋";
payload.reply_markup = {
keyboard: [
[NEXT],
[SHOW],
],
is_persistent: true,
resize_keyboard: true,
}
sendMessage(payload);
break;
case SHOW:
payload.text = getSchedule();
sendMessage(payload);
break;
case NEXT:
payload.text = getNextShutdown();
sendMessage(payload);
break;
}
return HtmlService.createHtmlOutput();
}