Telegram Connect With Google SpreadSheet
Telegram Connect With Google SpreadSheet
getScriptProperties();
function tulis(dataInput) {
var sheet = SpreadsheetApp.openById(sheetID).getSheetByName(sheetName);
lRow = sheet.getLastRow();
sheet.appendRow(dataInput);
Logger.log(lRow);
}
function breakData(update) {
var ret = errorMessage;
var msg = update.message;
var str= msg.text;
var match = str.match(validasiData);
tulis(simpan);
}
return ret;
}
function tanggalConverter(UNIX_timestamp){
var a = new Date(UNIX_timestamp * 1000);
var months = ['01','02','03','04','05','06','07','08','09','10','11','12'];
var year = a.getFullYear();
var month = months[a.getMonth()];
var date = a.getDate();
var tanggal = date + '/' + month + '/' + year;
return tanggal;
}
function jamConverter(UNIX_timestamp){
var a = new Date(UNIX_timestamp * 1000);
var hour = a.getHours();
var min = a.getMinutes();
var sec = a.getSeconds();
var jam = hour + ':' + min + ':' + sec;
return jam;
}
function escapeHtml(text){
var map = {
'&' : '&',
'<' : '<',
'>' : '>',
'"' : '"',
"'" : ''',
};
function doGet(e) {
return HtmlService.createHtmlOutput("Hey there! Send POST request instead!");
}
function doPost(e) {
if(e.postData.type == "application/json") {
bus.on(validasiData, function () {
var rtext = breakData(update);
this.replyToSender(rtext);
});
bot.register(bus);
if (update) {
bot.process();
}
}
}
function setWebhook() {
var bot = new Bot(token, {});
var result = bot.request('setWebhook', {
url: webAppURL
});
Logger.log(ScriptApp.getService().getUrl());
Logger.log(result);
}
Bot.prototype.process = function () {
for (var i in this.handlers) {
var event = this.handlers[i];
var result = event.condition(this);
if (result) {
return event.handle(this);
}
}
}
if (response.getResponseCode() == 200) {
return JSON.parse(response.getContentText());
}
return false;
}
function CommandBus() {
this.commands = [];
}