An advanced Telegram music bot with a variety of singers developed with the node-telegram-bot-api library
- 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 ....
npm i -g node-telegram-bot-api
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");
}
});