Last active
September 7, 2021 01:43
-
-
Save otnansirk/1f7f5e8e6d74e4232300191e9e9d8464 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doPost(e) { | |
var token = "873868937:AAFEeWnw-nebX6KFwHLKspDlZHPehwYcsbo"; | |
var stringJson = e.postData.getDataAsString(); | |
var updates = JSON.parse(stringJson); | |
var chatId = updates.message.chat.id; | |
var messageId = updates.message.message_id; | |
if(isContainNewMember(updates)){ | |
var text = "Hi, <b>"+updates.message.new_chat_member.first_name+"</b>. Selamat Datang di <b>"+updates.message.chat.title+"</b>. Silahkan memperkenalkan diri dulu ya 🥰🤗. Baca juga aturan groupnya"; | |
var url = "https://api.telegram.org/bot"+token+"/sendMessage"; | |
var button = { | |
inline_keyboard: [ | |
[ | |
{text:'Aturan',url:'https://t.me/c/1248613825/91'}, | |
{text:'Etika',url:'https://t.me/c/1248613825/94'} | |
] | |
] | |
}; | |
var request = { | |
"method" : "post", | |
"payload" : { | |
"chat_id" : encodeURIComponent(chatId), | |
"text" : text, | |
"parse_mode" : "HTML", | |
"reply_to_message_id" : messageId, | |
"reply_markup" : JSON.stringify(button) | |
} | |
} | |
var reply = UrlFetchApp.fetch(url, request) | |
} | |
} | |
function isContainNewMember(updates){ | |
if(updates.message.new_chat_member == null){ | |
return false; | |
}else{ | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment