-
Notifications
You must be signed in to change notification settings - Fork 54
/
HandleStartCommand.js
57 lines (41 loc) · 1.16 KB
/
HandleStartCommand.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
51
52
53
54
55
56
57
function debugStart() {
debug();
}
function handleStartCommand(body, paras, origParas) {
var payload = {
"method": "sendMessage",
"chat_id": body.message.chat.id,
"text": "",
"parse_mode": "markdown",
"disable_web_page_preview": true,
};
if (isPrivate(body)) {
if (paras[1]) {
return handleStartToken(body, paras, origParas);
}
payload.text += "本机器人要加入群中才能工作";
payload.text += "\n";
var buttons = [];
var button1 = {
text: "添加本机器人到群中",
url: "https://telegram.me/" + Const.myName + "?startgroup=true"
};
buttons.push(button1);
var inlineKeyboardMarkup = generateInlineKeyboardMarkup(buttons, 3);
payload.reply_markup = inlineKeyboardMarkup;
return payload;
} else {
paras[0] = "/help";
return handleHelpCommand(body, paras, origParas);
}
}
function handleStartToken(body, paras, origParas) {
var share = getShareObject(body);
var payload = share.payload;
var chat = share.chat;
var token=paras[1];
origParas = token.split('_-_');
paras = token.toLowerCase().split('_-_');
payload.text += token;
return payload;
}