@ChanMbot 6.0.0 – Markdown boostup? BitCoin price!!!

Bitcoin price is falling down and going up again… How to check this price??? If you like JSON you can check it here: https://blockchain.info/ticker . But maybe you don’t like JSON and you are crypto currency channel owner?

IN THIS UPDATE!!!!!!

you can check BTC price using ((btc)) in any message! How to do this? Look:

At top of our code we need to add:

var request = require('request');
var btcpurl = "https://blockchain.info/ticker"

And we need to type:

$ npm install

Then we need to find /md command.

After this:

We need to add let btcPrice;

After this we need to add:

request.get(btcpurl,
function(error, response, body) {
usdPrice = JSON.parse(body).USD[“15m”];

Then we need to replace ((btc)) with usdPrice

:

let message = msg.text.replace(‘((btc))’ usdPrice)
let message1 = message.replace(‘/md ‘, ”);

Ok..

Bug found . (again..)

So:

Move this: request.get(btcpurl,
function(error, response, body) {
usdPrice = JSON.parse(body).USD[“15m”];

At top we need to add:

var usdPrice;

And remove let usdPrice; from /md.

Done! Debug in 6.0.1

@ChanMbot 4.2

In this update:

Self-destruct timer!!!

First thing to do is: HOW TO DO THIS!!!

Ok. Maybe command /rm1h *message* _text_ *here*

Ok… So code:

bot.on([‘/rm1h’], function(msg) {

let id = msg.chat.id
let num1 = msg.message_id
let num2 = msg.chat.id
let sum = num1 + 2

return bot.sendMessage(msg.chat.id, “I’ll delete this message in 1hour”).then(() => {
setTimeout(() => bot.
deleteMessage(id, sum).catch(console.log), 36000000);
});
});

And /md commands should also answer this command add Just this:

‘/md’,’rm1h’

How to create Telegram bot??? part #1

How to create telegram bot?

Before creating bot dowload: node.js from NodeJs.org download version 8.7.0 or higher
Then:

1. Download this repostory https://github.com/MrCyjaneK/telebot/

2. Unzip, open cmd and type:
npm install

3. Create new folder for example Project
4. Open Project and create new file for example MyBot.js
5. Paste this to MyBot.js

CODE:

const TeleBot = require('../');
const bot = new TeleBot('YOUR:BOT_TOKEN');

// On every text message
bot.on('text', msg => {
let id = msg.from.id;
let text = msg.text;
return bot.sendMessage(id, `You said: ${ text }`);
});

bot.connect();

6. Replace YOUR:BOT_TOKEN with your bot token.
6. Open CMD then open folder your bot source (Project) code and type:
node MyBot.js
7. Open your bot and be happy!

Contact me in Telegram: @BotDev