-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands-handler.js
61 lines (58 loc) · 1.59 KB
/
commands-handler.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
58
59
60
61
/* const { connectToDatabase } = require("./connect-to-database");
const { defaultKeyboard } = require("./keyboards");
const commandsHandlers = {
"/start": async (bot, chatID) => {
bot.telegram.sendMessage(chatID, "alright , there is my menu: ", {
reply_markup: {
keyboard: defaultKeyboard,
},
});
},
home: async (bot, chatID) => {
bot.telegram.sendMessage(chatID, "You already at home");
},
bye: async (bot, chatID) => {
bot.telegram.sendMessage(chatID, "**ok, bye\\-bye\\!**", {
parse_mode: "MarkdownV2",
reply_markup: {
remove_keyboard: true,
},
});
},
menu: async (bot, chatID) => {
bot.telegram.sendMessage(chatID, "alright , there is my menu: ", {
reply_markup: {
keyboard: defaultKeyboard,
},
});
},
help: async (bot, chatID) => {
bot.telegram.sendMessage(chatID, "||Of course I'll help you\\.||", {
parse_mode: "MarkdownV2",
});
},
button: async (bot, chatID) => {
bot.telegram.sendMessage(chatID, "||Of course I'll help you\\.||", {
reply_markup: {
inline_keyboard: [
[
{ text: "button-1", callback_data: "button1" },
{ text: "button-2", callback_data: "button2" },
],
],
},
});
},
};
const commandManager = async (command, bot, chatID, DBClient) => {
if (commandsHandlers.hasOwnProperty(message)) {
const command = message;
commandsHandlers[command](bot, chatID);
} else {
bot.telegram.sendMessage(chatID, "unknown command , sorry");
}
};
module.exports = {
commandsHandlers,
};
*/