@ChanMBot 6.1

In this update we will add /md and /html to inline!

bot.on('inlineQuery', msg => {
  let query = msg.query;
  let answers = bot.answerList(msg.id);

  if (query.startsWith('/html ')) {
    query = query.replace('/html ', '');
    answers.addArticle({
      id: 'html',
      title: 'HTML',
      description: `${query}`,
      message_text: `${query}`,
      parse_mode: 'html',
      disable_web_page_preview: true
    });
  } else if (query.startsWith('/md')) {
    answers.addArticle({
      id: 'markdown',
      title: 'Markdown',
      description: `${query}`,
      message_text: `${query}`,
      parse_mode: 'markdown',
      disable_web_page_preview: true
    });
  }

  return bot.answerQuery(answers);
});

@ChanMBot 5.2

Here I am with another update!

In this update we will add a way to get the id of other users

if you check the events section on the telebot github repository you can see forward

so we do it like this:

bot.on(['forward'], (msg) => {
  let id = msg.chat.id;
  let replyToMessage = msg.message_id;
  let parseMode = 'markdown';
  let ff = msg.forward_from;

  return bot.sendMessage(id, `From First Name: \`${ff.first_name}\`
From Last Name: \`${ff.last_name}\`
From Username: \`${ff.username}\`
From ID: \`${ff.id}\``, {parseMode, replyToMessage});
  }
});

and every time you forward a message from any user it will return a message with the first name, last name, username and id!

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

In this update we will add a /feedback command and a /send to reply.

First we will add /feedback:

bot.on(['/feedback'], (msg) => {
 let id = msg.from.id;
 let replyToMessage = msg.message_id;
 let replyMarkup = 'reply';

return bot.sendMessage(id, `Please send your feedback`, {replyToMessage, ask: 'feedback', replyMarkup});
});

bot.on(['ask.feedback'], (msg) => {
 let id = msg.from.id;
 let replyToMessage = msg.message_id;
 let parseMode = 'markdown';

if (msg.text == '/cancel') {
 return bot.sendMessage(id, "I've canceled that!", {replyToMessage});
 } else {
 return bot.sendMessage(id, `Thanks for the feedback`, {replyToMessage}), bot.sendMessage(YOUR_ID, `[${msg.from.username}](tg://user?id=${id}) (\`${id}\`):\n\n${msg.text}`, {parseMode});
 } 
});

and replace YOUR_ID with your id.

 

Next we will add /send:

let send, send_message;

bot.on(['/send'], (msg) => {
 let id = msg.from.id;
 let replyToMessage = msg.message_id;

if (id === YOUR_ID && msg.text == '/cancel') {
 return bot.sendMessage(id, "I've canceled that");
 } else if (id === YOUR_ID && msg.text != '/cancel') {
 return bot.sendMessage(msg.from.id, `Who would you like to send a message to?`, {replyToMessage, ask: 'send_id'});
 }
});

bot.on(['ask.send_id'], (msg) => {
 let id = msg.from.id;
 let replyToMessage = msg.message_id;

if (id === YOUR_ID && msg.text == '/cancel') {
 return bot.sendMessage(id, "I've canceled that");
 } else if (id === YOUR_ID && msg.text != '/cancel') {
 return bot.sendMessage(id, `What would you like to send?`, {replyToMessage, ask: 'send_msg'}).then(() => send = `${msg.text}`).then(() => console.log(send));
 }
});

bot.on(['ask.send_msg'], (msg) => {
 let id = msg.from.id;
 let replyToMessage = msg.message_id;

if (id === YOUR_ID && msg.text == '/cancel') {
 return bot.sendMessage(id, "I've canceled that");
 } else if (id === YOUR_ID && msg.text != '/cancel') {
 return bot.sendMessage(id, `What would you like to send?`, {replyToMessage}).then(() => send_message = `${msg.text}`).then(() => console.log(send_message)).then(() => bot.sendMessage(send, `Message from the admin:\n\n${send_message}`));
 }
});

and again replace YOUR_ID with your id.

@ChanM 4.3

In part 2 we added /id but we need to fix the problem if the user doesnt have a username.

So we do it like this:

bot.on(['/id'], (msg, self) => {
  let id = msg.chat.id;
  let replyToMessage = msg.message_id;
  let username = msg.chat.username;
  let type = self.type;
  let parseMode = 'markdown';

  if (username != 'undefined') {
    return bot.sendMessage(id, `Chat ID: \`${id}\`
Message ID: \`${replyToMessage}\`
username: @${username}
t.me link: t.me/${username}
telegram link: [${msg.from.first_name}](tg://user?id=${ id })`, {replyToMessage, parseMode});
  } else {
    return bot.sendMessage(id, `Chat ID: \`${ id }\`
Message ID: \`${replyToMessage}\`
telegram link: [${msg.from.first_name}](tg://user?id=${ id })`, {replyToMessage, parseMode});
  }
});

@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