Skip to content

Latest commit

 

History

History
93 lines (70 loc) · 2.48 KB

README.md

File metadata and controls

93 lines (70 loc) · 2.48 KB

An advanced Telegram music bot with a variety of singers developed with the node-telegram-bot-api library

⚠️ Music bot is not yet deployed on the server, it will be deployed soon


What capabilities does this robot have?

  • User's favorite music list
  • Adding a reader to the list of favorites by the user
  • Invite friends to the bot
  • Add comments to music and see other people's comments
  • Robot music management panel by the manager
  • Send music to friends
  • Get biographies of singers
  • Music request if the desired music is not found
  • Online music search
  • Etc ....

What libraries are used in this robot?


Databases used in this robot:

How to install node-telegram-bot-api library

npm i -g node-telegram-bot-api

How node-telegram-bot-api works

let telegrambot = require("node-telegram-bot-api");
// You need to get the bot token from botfather in Telegram
let token = "Your bot token";

let bot = new telegrambot(token, { poling: true });

bot.onText(/\/start/ , (msg) => {
  let chatId = msg.chat.id
  bot.sendMessage(chatId , "welcome to bot")
})

bot.on("message", (msg) => {
  let chatId = msg.chat.id;

  let replyMarkup = {
    inline_keyboard: [
      [
        { text: "click To button 1", callback_data: "click 1" },
        { text: "click To button 2", callback_data: "click 2" },
      ],
    ],
  };

  if (msg.text == "list") {
    bot.sendMessage(chatId,`Hello ${msg.from.first_name} welcome to bot`, {reply_markup: replyMarkup});
  }

});

bot.on("callback_query", (msg) => {
  let data = msg.data;
  let chatId = msg.from.id;
  if (data == "click 1") {
    bot.sendMessage(chatId, "Option 1 was clicked");
  } else if (data == "click 2") {
    bot.sendMessage(chatId, "Option 2 was clicked");
  }
});

output