-
Notifications
You must be signed in to change notification settings - Fork 1
/
telegram_bot.gs
83 lines (74 loc) · 3.6 KB
/
telegram_bot.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//自动回复
function doPost(e) {
var update = JSON.parse(e.postData.contents);
// Make sure this is update is a type message
if (update.hasOwnProperty('message')) {
var msg = update.message;
var chatId = msg.chat.id;
// Make sure the update is a command.
if (msg.hasOwnProperty('entities') && msg.entities[0].type == 'bot_command') {
// If the user sends the /quote command
if (msg.text == '/start') {
var payload = {
'method': 'sendMessage',
'chat_id': String(chatId),
'text': '\
Welcome To Follo Community!\n\n\
Kindly refer to the Pinned Message, our new activity!!!!🔥🔥\n\n\
🎉 Follo 🎉 is a Decentralized Location Big Data Platform.\n\n\
🎈 With Blockchain Technology, Follo devoted to realizing the confirmation of Data Right, Privacy Protection and Data Transaction.\n\n\
👉 Follo aims to build a Decentralized Ecosystem based on the Quantifiable Data from individuals, cars and in the future, IoT included.\n\n\
🙋♀️ We dedicate ourselves to protecting your privacy!\n\n\
Follo Official Website: www.follo.one\n\
Follo White paper: http://www.follo.one/FolloEN.pdf\n\
Follo Twitter: https://twitter.com/Follo_official\n\
Follo Medium: https://medium.com/@folloofficial\n',
//'parse_mode': 'HTML'
}
var data = {
"method": "post",
"payload": payload
}
}
if (msg.text == '/1') {
var payload = {
'method': 'sendMessage',
'chat_id': String(chatId),
'text': 'Follo Official Website: www.follo.one',
//'parse_mode': 'HTML'
}
var data = {
"method": "post",
"payload": payload
}
}
// Replace with your token
var API_TOKEN = '886146248:AAEFF5CmTra9boB0Z_Hm7NQmqLB_dOwcO0c';
UrlFetchApp.fetch('https://api.telegram.org/bot' + API_TOKEN + '/', data);
}
}
}
//在群内定时发送消息
function AutoSendMessage() {
var payload = {
'method': 'sendMessage',
'chat_id': '-1001201977744',
'text': '\
Welcome To Follo Community!\n\n\
Kindly refer to the Pinned Message, our new activity!!!!🔥🔥\n\n\
🎉 Follo 🎉 is a Decentralized Location Big Data Platform.\n\n\
🎈 With Blockchain Technology, Follo devoted to realizing the confirmation of Data Right, Privacy Protection and Data Transaction.\n\n\
👉 Follo aims to build a Decentralized Ecosystem based on the Quantifiable Data from individuals, cars and in the future, IoT included.\n\n\
🙋♀️ We dedicate ourselves to protecting your privacy!\n\n\
Follo Official Website: www.follo.one\n\
Follo White paper: http://www.follo.one/FolloEN.pdf\n\
Follo Twitter: https://twitter.com/Follo_official\n\
Follo Medium: https://medium.com/@folloofficial\n',
}
var data = {
"method": "post",
"payload": payload
}
var API_TOKEN = '886146248:AAEFF5CmTra9boB0Z_Hm7NQmqLB_dOwcO0c';
UrlFetchApp.fetch('https://api.telegram.org/bot' + API_TOKEN + '/', data);
}