-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.js
More file actions
49 lines (41 loc) · 1.31 KB
/
bot.js
File metadata and controls
49 lines (41 loc) · 1.31 KB
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
const TelegramBot = require('node-telegram-bot-api');
// replace the value below with the Telegram token you receive from @BotFather
const token = '6801831511:AAFrnpNUI-exTl2Em4P0GMjLM-MeFcPlAZ8';
const webAppUrl = 'https://ecopayci.netlify.app/';
const webAppUrlOrder = 'https://ecopayci.netlify.app/order';
const webAppUrlPayment = 'https://ecopayci.netlify.app/paymentForm';
// Create a bot that uses 'polling' to fetch new updates
const bot = new TelegramBot(token, {polling: true});
// Listen for any kind of message. There are different kinds of
// messages.
bot.on('message', async (msg) => {
const chatId = msg.chat.id;
const text = msg.text;
if(text === '/start') {
await bot.sendMessage(chatId, 'Hello <3 :) ', {
reply_markup: {
keyboard: [
[{text: 'Welcome Chekete !', web_app: {url:webAppUrl}}]
]
}
})
}
if(text === '/orders' && text === '/carts') {
await bot.sendMessage(chatId, 'Carts <3 :) ', {
reply_markup: {
keyboard: [
[{text: 'Your Order !', web_app: {url:webAppUrlOrder}}]
]
}
})
}
if(text === '/pay'){
await bot.sendMessage(chatId, 'payment <3 :) ', {
reply_markup: {
keyboard: [
[{text: 'Got To Pay !', web_app: {url:webAppUrlPayment}}]
]
}
})
}
});