Skip to content

Commit

Permalink
change it back to original
Browse files Browse the repository at this point in the history
  • Loading branch information
deniganda committed Sep 20, 2024
1 parent 4c9c0e9 commit 8b2713d
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 153 deletions.
16 changes: 1 addition & 15 deletions E-Purchasing.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const axios = require('axios');
const { google } = require('googleapis');
const TelegramBot = require('node-telegram-bot-api');

// Parse the JSON key from the environment variable
const keyJson = JSON.parse(process.env.GOOGLE_SHEET_KEY_JSON);
Expand All @@ -20,11 +19,6 @@ const spreadsheetId = process.env.SPREADSHEET_ID; // Use environment variable fo
const clearRange = 'E-Purchasing!A:AK'; // Range to clear
const updateRange = 'E-Purchasing!A1'; // Range to update

// Telegram Bot setup
const botToken = process.env.TELEGRAM_BOT_TOKEN; // Telegram bot token
const chatId = process.env.TELEGRAM_CHAT_ID; // Telegram chat ID where messages will be sent
const bot = new TelegramBot(botToken, { polling: false }); // Set polling to false as we are just sending messages

async function fetchData() {
try {
// Fetch data from the URL
Expand Down Expand Up @@ -63,17 +57,9 @@ async function fetchData() {
});

console.log('Data successfully written to Google Sheets', result.data);

// Send success message to Telegram
const successMessage = `✅ Data E-Purchasing successfully written to Google Sheets. Updated rows: ${rows.length}`;
await bot.sendMessage(chatId, successMessage);
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);

// Send error message to Telegram
const errorMessage = `❌ Error: ${error.response ? error.response.data : error.message}`;
await bot.sendMessage(chatId, errorMessage);
}
}

fetchData();
fetchData();
16 changes: 1 addition & 15 deletions InstansiSatker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const axios = require('axios');
const { google } = require('googleapis');
const TelegramBot = require('node-telegram-bot-api');

// Parse the JSON key from the environment variable
const keyJson = JSON.parse(process.env.GOOGLE_SHEET_KEY_JSON);
Expand All @@ -20,11 +19,6 @@ const spreadsheetId = process.env.SPREADSHEET_ID; // Use environment variable fo
const clearRange = 'Satker!A:AK'; // Range to clear
const updateRange = 'Satker!A1'; // Range to update

// Telegram Bot setup
const botToken = process.env.TELEGRAM_BOT_TOKEN; // Telegram bot token
const chatId = process.env.TELEGRAM_CHAT_ID; // Telegram chat ID where messages will be sent
const bot = new TelegramBot(botToken, { polling: false }); // Set polling to false as we are just sending messages

async function fetchData() {
try {
// Fetch data from the URL
Expand Down Expand Up @@ -63,17 +57,9 @@ async function fetchData() {
});

console.log('Data successfully written to Google Sheets', result.data);

// Send success message to Telegram
const successMessage = `✅ Data Penyedia_Terumumkan successfully written to Google Sheets. Updated rows: ${rows.length}`;
await bot.sendMessage(chatId, successMessage);
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);

// Send error message to Telegram
const errorMessage = `❌ Error: ${error.response ? error.response.data : error.message}`;
await bot.sendMessage(chatId, errorMessage);
}
}

fetchData();
fetchData();
16 changes: 1 addition & 15 deletions NonTender_Selesai.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const axios = require('axios');
const { google } = require('googleapis');
const TelegramBot = require('node-telegram-bot-api');

// Parse the JSON key from the environment variable
const keyJson = JSON.parse(process.env.GOOGLE_SHEET_KEY_JSON);
Expand All @@ -20,11 +19,6 @@ const spreadsheetId = process.env.SPREADSHEET_ID; // Use environment variable fo
const clearRange = 'NonTender!A:ZZ'; // Range to clear
const updateRange = 'NonTender!A1'; // Range to update

// Telegram Bot setup
const botToken = process.env.TELEGRAM_BOT_TOKEN; // Telegram bot token
const chatId = process.env.TELEGRAM_CHAT_ID; // Telegram chat ID where messages will be sent
const bot = new TelegramBot(botToken, { polling: false }); // Set polling to false as we are just sending messages

async function fetchData() {
try {
// Fetch data from the URL
Expand Down Expand Up @@ -63,17 +57,9 @@ async function fetchData() {
});

console.log('Data successfully written to Google Sheets', result.data);

// Send success message to Telegram
const successMessage = `✅ Data NonTender_Selesai successfully written to Google Sheets. Updated rows: ${rows.length}`;
await bot.sendMessage(chatId, successMessage);
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);

// Send error message to Telegram
const errorMessage = `❌ Error: ${error.response ? error.response.data : error.message}`;
await bot.sendMessage(chatId, errorMessage);
}
}

fetchData();
fetchData();
17 changes: 1 addition & 16 deletions Pencatatan_NonTender.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const axios = require('axios');
const { google } = require('googleapis');
const TelegramBot = require('node-telegram-bot-api');

// Parse the JSON key from the environment variable
const keyJson = JSON.parse(process.env.GOOGLE_SHEET_KEY_JSON);
Expand All @@ -20,11 +19,6 @@ const spreadsheetId = process.env.SPREADSHEET_ID; // Use environment variable fo
const clearRange = 'Pen NonTender!A:ZZ'; // Range to clear
const updateRange = 'Pen Nontender!A1'; // Range to update

// Telegram Bot setup
const botToken = process.env.TELEGRAM_BOT_TOKEN; // Telegram bot token
const chatId = process.env.TELEGRAM_CHAT_ID; // Telegram chat ID where messages will be sent
const bot = new TelegramBot(botToken, { polling: false }); // Set polling to false as we are just sending messages

async function fetchData() {
try {
// Fetch data from the URL
Expand Down Expand Up @@ -63,18 +57,9 @@ async function fetchData() {
});

console.log('Data successfully written to Google Sheets', result.data);

// Send success message to Telegram
const successMessage = `✅ Data Pencatatan_NonTender successfully written to Google Sheets. Updated rows: ${rows.length}`;
await bot.sendMessage(chatId, successMessage);
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);

// Send error message to Telegram
const errorMessage = `❌ Error: ${error.response ? error.response.data : error.message}`;
await bot.sendMessage(chatId, errorMessage);
}
}

fetchData();

fetchData();
16 changes: 1 addition & 15 deletions Pencatatan_Swakelola.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const axios = require('axios');
const { google } = require('googleapis');
const TelegramBot = require('node-telegram-bot-api');

// Parse the JSON key from the environment variable
const keyJson = JSON.parse(process.env.GOOGLE_SHEET_KEY_JSON);
Expand All @@ -20,11 +19,6 @@ const spreadsheetId = process.env.SPREADSHEET_ID; // Use environment variable fo
const clearRange = 'Pen Swakelola!A:ZZ'; // Range to clear
const updateRange = 'Pen Swakelola!A1'; // Range to update

// Telegram Bot setup
const botToken = process.env.TELEGRAM_BOT_TOKEN; // Telegram bot token
const chatId = process.env.TELEGRAM_CHAT_ID; // Telegram chat ID where messages will be sent
const bot = new TelegramBot(botToken, { polling: false }); // Set polling to false as we are just sending messages

async function fetchData() {
try {
// Fetch data from the URL
Expand Down Expand Up @@ -63,17 +57,9 @@ async function fetchData() {
});

console.log('Data successfully written to Google Sheets', result.data);

// Send success message to Telegram
const successMessage = `✅ Data Pencatatatn_Swakelola successfully written to Google Sheets. Updated rows: ${rows.length}`;
await bot.sendMessage(chatId, successMessage);
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);

// Send error message to Telegram
const errorMessage = `❌ Error: ${error.response ? error.response.data : error.message}`;
await bot.sendMessage(chatId, errorMessage);
}
}

fetchData();
fetchData();
16 changes: 1 addition & 15 deletions Penyedia_Terumumkan.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const axios = require('axios');
const { google } = require('googleapis');
const TelegramBot = require('node-telegram-bot-api');

// Parse the JSON key from the environment variable
const keyJson = JSON.parse(process.env.GOOGLE_SHEET_KEY_JSON);
Expand All @@ -20,11 +19,6 @@ const spreadsheetId = process.env.SPREADSHEET_ID; // Use environment variable fo
const clearRange = 'Penyedia!A:ZZ'; // Range to clear
const updateRange = 'Penyedia!A1'; // Range to update

// Telegram Bot setup
const botToken = process.env.TELEGRAM_BOT_TOKEN; // Telegram bot token
const chatId = process.env.TELEGRAM_CHAT_ID; // Telegram chat ID where messages will be sent
const bot = new TelegramBot(botToken, { polling: false }); // Set polling to false as we are just sending messages

async function fetchData() {
try {
// Fetch data from the URL
Expand Down Expand Up @@ -63,17 +57,9 @@ async function fetchData() {
});

console.log('Data successfully written to Google Sheets', result.data);

// Send success message to Telegram
const successMessage = `✅ Data Penyedia_Terumumkan successfully written to Google Sheets. Updated rows: ${rows.length}`;
await bot.sendMessage(chatId, successMessage);
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);

// Send error message to Telegram
const errorMessage = `❌ Error: ${error.response ? error.response.data : error.message}`;
await bot.sendMessage(chatId, errorMessage);
}
}

fetchData();
fetchData();
16 changes: 1 addition & 15 deletions Swakelola_Terumumkan.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const axios = require('axios');
const { google } = require('googleapis');
const TelegramBot = require('node-telegram-bot-api');

// Parse the JSON key from the environment variable
const keyJson = JSON.parse(process.env.GOOGLE_SHEET_KEY_JSON);
Expand All @@ -20,11 +19,6 @@ const spreadsheetId = process.env.SPREADSHEET_ID; // Use environment variable fo
const clearRange = 'Swakelola!A:ZZ'; // Range to clear
const updateRange = 'Swakelola!A1'; // Range to update

// Telegram Bot setup
const botToken = process.env.TELEGRAM_BOT_TOKEN; // Telegram bot token
const chatId = process.env.TELEGRAM_CHAT_ID; // Telegram chat ID where messages will be sent
const bot = new TelegramBot(botToken, { polling: false }); // Set polling to false as we are just sending messages

async function fetchData() {
try {
// Fetch data from the URL
Expand Down Expand Up @@ -63,17 +57,9 @@ async function fetchData() {
});

console.log('Data successfully written to Google Sheets', result.data);

// Send success message to Telegram
const successMessage = `✅ Data Swakelola_Terumumkan successfully written to Google Sheets. Updated rows: ${rows.length}`;
await bot.sendMessage(chatId, successMessage);
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);

// Send error message to Telegram
const errorMessage = `❌ Error: ${error.response ? error.response.data : error.message}`;
await bot.sendMessage(chatId, errorMessage);
}
}

fetchData();
fetchData();
16 changes: 1 addition & 15 deletions Tender_Selesai.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const axios = require('axios');
const { google } = require('googleapis');
const TelegramBot = require('node-telegram-bot-api');

// Parse the JSON key from the environment variable
const keyJson = JSON.parse(process.env.GOOGLE_SHEET_KEY_JSON);
Expand All @@ -20,11 +19,6 @@ const spreadsheetId = process.env.SPREADSHEET_ID; // Use environment variable fo
const clearRange = 'Tender!A:ZZ'; // Range to clear
const updateRange = 'Tender!A1'; // Range to update

// Telegram Bot setup
const botToken = process.env.TELEGRAM_BOT_TOKEN; // Telegram bot token
const chatId = process.env.TELEGRAM_CHAT_ID; // Telegram chat ID where messages will be sent
const bot = new TelegramBot(botToken, { polling: false }); // Set polling to false as we are just sending messages

async function fetchData() {
try {
// Fetch data from the URL
Expand Down Expand Up @@ -63,17 +57,9 @@ async function fetchData() {
});

console.log('Data successfully written to Google Sheets', result.data);

// Send success message to Telegram
const successMessage = `✅ Data Tender_Selesai successfully written to Google Sheets. Updated rows: ${rows.length}`;
await bot.sendMessage(chatId, successMessage);
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);

// Send error message to Telegram
const errorMessage = `❌ Error: ${error.response ? error.response.data : error.message}`;
await bot.sendMessage(chatId, errorMessage);
}
}

fetchData();
fetchData();
15 changes: 0 additions & 15 deletions Tender_Selesai_Nilai.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const axios = require('axios');
const { google } = require('googleapis');
const TelegramBot = require('node-telegram-bot-api');

// Parse the JSON key from the environment variable
const keyJson = JSON.parse(process.env.GOOGLE_SHEET_KEY_JSON);

Expand All @@ -20,11 +18,6 @@ const spreadsheetId = process.env.SPREADSHEET_ID; // Use environment variable fo
const clearRange = 'TenderNilai!A:Z'; // Range to clear
const updateRange = 'TenderNilai!A:Z'; // Range to update

// Telegram Bot setup
const botToken = process.env.TELEGRAM_BOT_TOKEN; // Telegram bot token
const chatId = process.env.TELEGRAM_CHAT_ID; // Telegram chat ID where messages will be sent
const bot = new TelegramBot(botToken, { polling: false }); // Set polling to false as we are just sending messages

async function fetchData() {
try {
// Fetch data from the URL
Expand Down Expand Up @@ -63,16 +56,8 @@ async function fetchData() {
});

console.log('Data successfully written to Google Sheets', result.data);

// Send success message to Telegram
const successMessage = `✅ Data Tender_Selesai_Nilai successfully written to Google Sheets. Updated rows: ${rows.length}`;
await bot.sendMessage(chatId, successMessage);
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);

// Send error message to Telegram
const errorMessage = `❌ Error: ${error.response ? error.response.data : error.message}`;
await bot.sendMessage(chatId, errorMessage);
}
}

Expand Down
5 changes: 2 additions & 3 deletions Tender_Selesai_Pengumuman.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ const auth = new google.auth.GoogleAuth({
const sheets = google.sheets({ version: 'v4', auth });

// URL to fetch data from
const url = process.env.API_URL_TSP
; // Use environment variable for URL
const url = process.env.API_URL_TSP; // Use environment variable for URL

// Define the spreadsheet ID and range
const spreadsheetId = process.env.SPREADSHEET_ID; // Use environment variable for Spreadsheet ID
Expand Down Expand Up @@ -63,4 +62,4 @@ async function fetchData() {
}
}

fetchData();
fetchData();
Loading

0 comments on commit 8b2713d

Please sign in to comment.