mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-04-29 01:15:58 +00:00
Added bam + some other code fixes
This commit is contained in:
parent
c419a4e653
commit
4b9ed6d2c0
8
src/commands/bam.js
Normal file
8
src/commands/bam.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
module.exports = function(bot, msg) {
|
||||||
|
const chatId = msg.chat.id;
|
||||||
|
|
||||||
|
const message = `O usuario foi bamido com sucesso`;
|
||||||
|
|
||||||
|
bot.sendMessage(chatId, message, { parse_mode: 'Markdown' })
|
||||||
|
.catch(error => console.error('WARN: Message cannot be sent: ', error));
|
||||||
|
}
|
@ -3,9 +3,8 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const token = process.env.TGBOT_TOKEN;
|
const token = process.env.TGBOT_TOKEN;
|
||||||
const bot = new TelegramBot(token, { polling: true });
|
const bot = new TelegramBot(token, { polling: true });
|
||||||
|
|
||||||
const logMessage = require('./logger');
|
|
||||||
const { isBlocked } = require('./blocklist');
|
const { isBlocked } = require('./blocklist');
|
||||||
|
require('./logger');
|
||||||
|
|
||||||
const commandsPath = path.join(__dirname, 'commands');
|
const commandsPath = path.join(__dirname, 'commands');
|
||||||
const commandHandlers = {};
|
const commandHandlers = {};
|
||||||
@ -30,7 +29,7 @@ bot.on('message', (msg) => {
|
|||||||
commandHandlers[messageText](bot, msg);
|
commandHandlers[messageText](bot, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`INFO: User ${userName}, ${userId} sended a message with the content:
|
console.log(`INFO: User ${userName}, ${userId} sended a command or message with the content:
|
||||||
• ${messageText}\n`)
|
• ${messageText}\n`)
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -38,5 +37,4 @@ bot.on('polling_error', (error) => {
|
|||||||
console.error('WARN: Polling error:', error);
|
console.error('WARN: Polling error:', error);
|
||||||
});
|
});
|
||||||
|
|
||||||
const date = new Date().toString();
|
|
||||||
console.log(`INFO: Lynx started\n`);
|
console.log(`INFO: Lynx started\n`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user