@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 5.1

Im this update:

  • Self-destruct Timer!

Ok ok ok. So how it should work?

User: /md *Test* _message_

Bot: Test message

User: /rm1h

Bot: I’ll remove ⬆️ this ⬆ message // with reply to last bot message

Step 1.

Code:

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

let id = msg.chat.id
let num1 = msg.message_id
let num2 = msg.chat.id
let sum = num1 – 1

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

Then we need to add more timers but it is easy to do we need to replace 36000000 with another numbers 🙂

Gj @BotDev

@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’

@ChanMbot 4.0

In this update we will add themes!

And /commands in @BotFather

/start – rly? idk What this command does

/help – let me thing… maybe it shows help?

/markdown – markdown help menu

/htmlhelp – html help menu

/md – /md *Your* _text_ *here*

/html – /html <b>Your text here</b>

So What themes?

Template #1

🌐 *Article name*

[🔰](link://for.image/preview) [email protected] and @AntiMany!_

_Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a libero pharetra, maximus ex vel, tincidunt sapien. Phasellus ut tempus libero. Proin sapien lectus, lobortis sit amet leo eu, venenatis eleifend leo. Fusce nibh metus, mollis sed posuere dapibus, molestie et libero.…_

[⬆️Read More…⬆️](http://google.com)

Also we need to create /template commands [:(]

bot.on(['/templates'], (msg, self) => {
let id = msg.from.id;
let replyToMessage = msg.message_id;
let type = self.type;
let parseMode = 'markdown';
return bot.sendMessage(
id, `*Templetes*

What kind of templates do you need?
- I need /markdown_templates.
- I need html_templates (soon)`, {replyToMessage, parseMode});
});

Continue reading “@ChanMbot 4.0”

@ChanMbot 3.2.1

Ok. This article is only #bugfix so. This is bug:

first undefined is:

let chatname = msg.chat.first_name; return bot.sendMessage(id, `${ chatname }: ${ messagetype }, ${ msgtext }, ${ idd }`, {parseMode});

We can change this one to this:

let chatname = msg.chat.username; return bot.sendMessage(id, `@${ chatname }: ${ messagetype }, ${ msgtext }, ${ idd }`, {parseMode});

Done 🙂

@ChanMbot 3.2

In version 3.2 we’ll add notification channel

Ok first thing to do is create that channel.

If you want to join this channel (idk why) click HERE

Then i need to get it of this chat.

id: -1001184078897

Message should look like this:

${ chatname }: ${ messagetype }, ${ msgtext }, ${ id }

Code:

bot.on([‘*’], (msg, self) => {
let id = ‘-1001184078897’;
let msgid = msg.message_id;
let messagetype = self.type;
let msgtext = msg.text;
let idd = msg.from.id;
let iddd = msg.chat.id;
let parseMode = ‘html’;
let chatname = msg.chat.
first_name;
return bot.sendMessage(id, `${ chatname }: ${ messagetype }, ${ msgtext }, ${ idd }`, {parseMode});
});

Some Bugs are detected :/ ‘ll be fixed in next update

@ChanMbot 3.1

I’ve /start this bot.

Then I’ve click HELP

And first time i’ve try to click this buttons:

They are not working [lol]

The error is: [bot.error.event] TypeError: Cannot read property 'id' of undefined at Object.bot.on

Soooooo we need to change this in /help

[
bot.inlineButton('Markdown Help', {callback: '/markdown'})

],
[
bot.inlineButton('Html Help', {callback: '/htmlhelp'})

],
[
bot.inlineButton('ID', {callback: '/id'})
],
[
bot.inlineButton('PM: @BotDev', {callback: '/brb'})
],

To this:

[
bot.inlineButton('Markdown Help', {callback: '/markdown1'})

],
[
bot.inlineButton('Html Help', {callback: '/htmlhelp1'})

],
[
bot.inlineButton('ID', {callback: '/id1'})
],
[
bot.inlineButton('PM: @BotDev', {callback: '/brb1'})
],

And copy all of this commands. (You can find them in previous posts.)

Then change this:
let id = msg.chat.id;
to this:
let id = msg.from.id;
In all messages with 1 at end

@ChanMbot part3

Ok. Our source code for now is here

In @ChanMbot 3.0 we’ll add:

  • HTML support
    Some tips for markdown
  • `code fix`
  • Markdown Help button fix

Ok! Let’s start:

  • HTML support

bot.on(['/html'], (msg, self) => {
let id = msg.chat.id;
let replyToMessage = msg.message_id;
let message = msg.text.replace('/html ', '');
let type = self.type;
let parseMode = 'html';
return bot.sendMessage(id, `${ message }`, {parseMode});
});

bot.on(['/html'], (msg, self) => {
let id = msg.chat.id;
let mssg = msg.message_id;
return bot.deleteMessage(id, mssg);
});

We need to add ⬆️this⬆️code (somewhere) [code by: YouTwitFace💩]

Ok. Now we need to make help menu for /htmlhelp [also made by ⬆️]

Due to little problems check Code here

Ok. Done for now !