tombol - Keyboard

tombol - Keyboard

BaonK
idLOGbot
// penyederhanaan variable
 var msg = update.message;
var text = msg.text;
 var chats = msg.chat.id;
// jika ada pesan berupa text
  if (msg.text) {
// hanya akses by japri bot
   if (msg.chat.type == 'private') {
@bawelbot


// start dengan tombol / keyboard inline
    if ( /\/play/i.exec(msg.text) ){
     let pesan = "<b>Let's pLAY</b>❗️"
     pesan +="\n\n⌨️ <b>Hide keyboard</b> \nuntuk menghilangkan tombol";
     let keyboard = [
      ['🎲 Dadu', 'Basket 🏀'],
      ['🎯 Dart', 'Sepak ⚽️'],
      ['⌨️ Hide keyboard']
     ]
     return sendMsgKeyboard(chats, pesan, keyboard);
    }


// 🎲 Dice - 🏀 Ball - 🎯 Dart - ⚽️ Soccer

    if ( /^🎲 Dadu/i.exec(msg.text) ){
     return tg.request("sendDice", {chat_id: chats} );
    }

    if ( /^Basket 🏀/i.exec(msg.text) ){
     return tg.request("sendDice", {chat_id: chats, emoji: "🏀"} );
    }

    if ( /^🎯 Dart/i.exec(msg.text) ){
     return tg.request("sendDice", {chat_id: chats, emoji: "🎯"} );
    }

    if ( /^Sepak ⚽️/i.exec(msg.text) ){
     return tg.request("sendDice", {chat_id: chats, emoji: "⚽️"} );
    }

    if (/^⌨️ Hide keyboard/i.exec(msg.text) ){
     return removeKeyboard(chats, "❓<i>baCk to /play</i>");
    }

// akhir dari japri bot
   }


// membuat fungsi kirim keyboard
function sendMsgKeyboard(chatid, pesan, keyboard) {
  let data = {
        chat_id : chatid,
        text: pesan,
        parse_mode : 'HTML',
        reply_markup: {
            resize_keyboard: true,
            one_time_keyboard: true,
            keyboard: keyboard
        }
      }
 let r = tg.request('sendMessage', data);
 return r;  
}


// fungsi remove keyboard
function removeKeyboard(chatid, pesan) {
 let data = {
  chat_id: chatid,
  text: pesan,
  parse_mode: 'html',
  reply_markup: {
   remove_keyboard: true
   }
 }
  let r = tg.request('sendMessage', data);
  return r;
}



bermula dari sebuah peradaban | @idLOGbot @bawelbot

Report Page