-
Notifications
You must be signed in to change notification settings - Fork 1
/
Tambahan.js
50 lines (45 loc) · 1.27 KB
/
Tambahan.js
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
45
46
47
48
49
50
import "google-apps-script";
// membuat fungsi panggil hashtag saat reply pesan
function sendMsgReplyTag(msg, pesan) {
//inisiasi awal message id yang akan direply
let msg_id = msg.message_id;
//jika pesannya direply, message id nya diupdate
if (msg.reply_to_message) {
msg_id = msg.reply_to_message.message_id;
}
let data = {
chat_id: msg.chat.id,
text: pesan,
reply_to_message_id: msg_id,
};
let r = tg.request("sendMessage", data);
return r;
}
// membuat fungsi kirim keyboard
function sendMsgKeyboard(chatid, pesan, keyboard) {
let data = {
chat_id: chatid,
text: pesan,
parse_mode: "HTML",
reply_markup: {
resize_keyboard: true,
one_time_keyboard: true,
keyboard: keyboard,
},
};
let r = tg.request("sendMessage", data);
return r;
}
// fungsi untuk mengirim pesan dengan keyboard inline
function sendMsgKeyboardInline(chatid, pesan, keyboard) {
let data = {
chat_id: chatid,
text: pesan,
parse_mode: "HTML",
reply_markup: {
inline_keyboard: keyboard,
},
};
let r = tg.request("sendMessage", data);
return r;
}