micro-bot | : robot : Zero-configuration Telegram bot runner | Bot library
kandi X-RAY | micro-bot Summary
kandi X-RAY | micro-bot Summary
:robot: Zero-configuration Telegram bot runner
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of micro-bot
micro-bot Key Features
micro-bot Examples and Code Snippets
Community Discussions
Trending Discussions on micro-bot
QUESTION
const { Composer } = require('micro-bot');
const bot = new Composer;
const Telegram = require('telegraf/telegram')
const http = require('http');
const express = require('express');
const bodyParser = require('body-parser');
const telegram = new Telegram(process.env.BOT_TOKEN);
const app = express();
app.use(bodyParser.urlencoded({ extended: true }));
app.post('/sms', (req, res) => {
console.log('sms received')
telegram.sendMessage(process.env.CHANNEL_ID, req.body.Body)
res.send(req.body.Body);
});
http.createServer(app).listen(3000, () => {
console.log(`Express server listening on port 3000`);
});
module.exports = bot;
...ANSWER
Answered 2020-Oct-11 at 03:17I found a solution to my problem. I had a procfile that had my micro bot listen on the env port, thats why when I made the webserver listen to the same port at the same time it threw an error saying that the port is already in use.
QUESTION
I am currently developing several Telegram bots but I want to keep all of them in the same git repository. The issue is that on the other hand, I want to run them as separate processes.
Since I'm using the Telegraf framework, to run a bot it goes such as: micro-bot src/bot-one/bot.js
The problem comes when doing this with PM2. I've been able to run one of the bots with the npm start
script like this:
ANSWER
Answered 2017-Sep-19 at 20:56Try this:
pm2 start npm -- run littleAppleBot --
pm2 start npm -- run weatherWarnBot --
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install micro-bot
process.env.BOT_TOKEN - Bot token
process.env.BOT_DOMAIN - Webhook domain
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page