Skip to content

Instantly share code, notes, and snippets.

@nesffer
Created November 3, 2016 03:40
Show Gist options
  • Select an option

  • Save nesffer/73f98bd1eda6ef36a23d37f975b68fff to your computer and use it in GitHub Desktop.

Select an option

Save nesffer/73f98bd1eda6ef36a23d37f975b68fff to your computer and use it in GitHub Desktop.

Revisions

  1. Nesffer created this gist Nov 3, 2016.
    9 changes: 9 additions & 0 deletions bot.ping.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    bot.onText(/^(ping|)[!]?$/i, (msg, match) => {
    var messageId = msg.message_id;
    var chatId = msg.chat.id;
    if (match[1].match(/ping/i)) {
    bot.sendMessage(chatId, 'Ping!', {reply_to_message_id: messageId});
    } else if (match[1].match(//)) {
    bot.sendMessage(chatId, '퐁!', {reply_to_message_id: messageId});
    }
    });