quick commit
This commit is contained in:
parent
59ceb75937
commit
71a69c5f9b
11
.vscode/launch.json
vendored
11
.vscode/launch.json
vendored
@ -7,11 +7,20 @@
|
|||||||
{
|
{
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Launch Program",
|
"name": "App",
|
||||||
"skipFiles": [
|
"skipFiles": [
|
||||||
"<node_internals>/**"
|
"<node_internals>/**"
|
||||||
],
|
],
|
||||||
"program": "${workspaceFolder}\\app.js",
|
"program": "${workspaceFolder}\\app.js",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Test",
|
||||||
|
"skipFiles": [
|
||||||
|
"<node_internals>/**"
|
||||||
|
],
|
||||||
|
"program": "${workspaceFolder}\\test.js",
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
16
app.js
16
app.js
@ -11,14 +11,14 @@ const fs = require('fs');
|
|||||||
const logger = require('perfect-logger');
|
const logger = require('perfect-logger');
|
||||||
const TelegramBot = require('node-telegram-bot-api');
|
const TelegramBot = require('node-telegram-bot-api');
|
||||||
|
|
||||||
const bot_chat = require('./data/bot/chat')
|
const bot_chat = require('./data/bot/functions/chat')
|
||||||
const bot_welcome = require('./data/bot/welcomeMesage')
|
const bot_welcome = require('./data/bot/functions/welcomeMesage')
|
||||||
const bot_questions = require('./data/bot/questions')
|
const bot_questions = require('./data/bot/functions/questions')
|
||||||
const bot_football = require('./data/bot/requests/football')
|
const bot_football = require('./data/bot/functions/requests/football')
|
||||||
const bot_joke = require('./data/bot/requests/joke')
|
const bot_joke = require('./data/bot/functions/requests/joke')
|
||||||
const bot_faq_subscription = require('./data/bot/faq/subscriptions')
|
const bot_faq_subscription = require('./data/bot/functions/faq/subscriptions')
|
||||||
const bot_subStatus = require('./data/bot/requests/updateSubStatus')
|
const bot_subStatus = require('./data/bot/functions/requests/updateSubStatus')
|
||||||
const bot_faq_whatAppToUse = require('./data/bot/faq/whatAppToUse')
|
const bot_faq_whatAppToUse = require('./data/bot/functions/faq/whatAppToUse')
|
||||||
|
|
||||||
const token = process.env.BOT_TOKEN;
|
const token = process.env.BOT_TOKEN;
|
||||||
const name = process.env.BOT_NAME;
|
const name = process.env.BOT_NAME;
|
||||||
|
17
data/bot/lib/common.js
Normal file
17
data/bot/lib/common.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
module.exports = {
|
||||||
|
help: (bot, msg, logger) => {
|
||||||
|
bot.on('message', (msg) => {
|
||||||
|
const updatesGroup = "/sub_status";
|
||||||
|
const checkName = updatesGroup + name
|
||||||
|
if (msg.text && msg.text.toString() === checkName) {
|
||||||
|
// logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Got the updates group info");
|
||||||
|
bot.sendMessage(msg.chat.id, "The updates groups can be found here")
|
||||||
|
.then(() => {
|
||||||
|
return bot.sendMessage(msg.chat.id, "https://t.me/joinchat/AAAAAFDxZ2rzgAW5acahxA").then(() => {
|
||||||
|
return bot.sendMessage(msg.chat.id, "Please join for BBLBTV updates")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
20
test.js
Normal file
20
test.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
require('dotenv').config();
|
||||||
|
const TelegramBot = require('node-telegram-bot-api');
|
||||||
|
const token = process.env.BOT_TOKEN;
|
||||||
|
|
||||||
|
const bot = new TelegramBot(token, { polling: true });
|
||||||
|
|
||||||
|
function t(msg, input) {
|
||||||
|
bot.sendMessage(msg.chat.id, input)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bot.on('message', (msg) => {
|
||||||
|
if (msg.text && msg.text.toString().includes("/sub_status")) {
|
||||||
|
t(msg, "/sub_status")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (msg.text && msg.text.toString().includes("/test")) {
|
||||||
|
t(msg, "/test")
|
||||||
|
}
|
||||||
|
})
|
Loading…
x
Reference in New Issue
Block a user