Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Придумать, как архивировать конфиги бота #11

Open
dmitry-weirdo opened this issue May 3, 2023 · 1 comment

Comments

@dmitry-weirdo
Copy link
Owner

dmitry-weirdo commented May 3, 2023

  • Сейчас ситуация с совместным редактированием потенциально хрупкая.
  • Идея: Дать возможность загрузить конфиг бота в JSON как файл, специальной командой
  • Как-то нужно периодически архивировать конфиги, чтобы иметь какую-никакую возможность бэкапа.
@LidiaLel
Copy link

LidiaLel commented Feb 9, 2024

Как вариант: добавить Apps Script в самой гугл-таблице с настройками + настроить раз в месяц автоматическое копирование файла в отдельную директорию. (Для желающих можно написать скрипт для копии отдельного листа и сохранять им на гугл-диск).

Код скрипта:

function makeCopyAll() {

    // generates the timestamp and stores in variable formattedDate as year-month-date hour-minute-second
    var formattedDate = Utilities.formatDate(new Date(), "GMT", "dd-MM-yyyy' 'HH:mm:ss");
    
    // gets the name of the original file and appends the word "copy" followed by the timestamp stored in formattedDate
    var name = SpreadsheetApp.getActiveSpreadsheet().getName() + " Copy " + formattedDate;
    
    // gets the destination folder by their ID. REPLACE with your folder's ID that you can get by opening the folder in Google Drive and checking the URL in the browser's address bar
    // **!!!указать ID гугл-диска, куда копировать архивы**
    var destination = DriveApp.getFolderById("11Js1x98dfZgdOiuIFDyzIvTx2JIInRi0");  
      
    // gets the current Google Sheet file
    var  file = DriveApp.getFileById(SpreadsheetApp.getActiveSpreadsheet().getId())
    
    // makes a copy of "file" with "name" at the "destination"
    var fileNew = file.makeCopy(name, destination);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants