This system reminds us of our favorite screenshots in Google Drive every day. It picks image files up from Google Drive and notifies the shared links to your Slack channel.
classDiagram
class Executor {
-DriveAdapter driveAdapter
-MessageAdapter slackAdapter
+relearn() Promise~RelearnResult~
}
class DriveAdapter {
<<interface>>
+getTargetPaths() Promise~string[]~
+getAssetLinks(fileIds: string[]) Promise~string[]~
+evacuateRelearnedFiles(fileIds: string[]) Promise~DriveOperationResult~
+reviveSharedFiles() Promise~DriveOperationResult~
}
class MessageAdapter {
<<interface>>
+send(message: string) Promise~void~
}
class GoogleDriveAdapter {
+getTargetPaths() Promise~string[]~
+getAssetLinks(fileIds: string[]) Promise~string[]~
+evacuateRelearnedFiles(fileIds: string[]) Promise~DriveOperationResult~
+reviveSharedFiles() Promise~DriveOperationResult~
}
class SlackAdapter {
+send(message: string) Promise~void~
}
class RelearnResult {
<<union>>
}
class DriveOperationResult {
+succeeded string[]
+failed DriveOperationFailure[]
}
class DriveOperationFailure {
+id string
+reason string
}
Executor --> DriveAdapter
Executor --> MessageAdapter
GoogleDriveAdapter ..|> DriveAdapter
SlackAdapter ..|> MessageAdapter
RelearnResult --> DriveOperationResult
DriveOperationResult --> DriveOperationFailure
RelearnResult is a discriminated union keyed by the kind property. It captures either the outcome of sending reminders again or restoring evacuated files. DriveOperationResult returns arrays of successful and failed Google Drive operations so downstream logging and retry logic can consume the details.
When I find some good tweets or posts etc.. I take a screenshot and upload it to my Google Drive, but I never check it again...
This system reminds us of the screenshots randomly every day, and we can relearn them.
- The system picks random image files from your specified Google Drive folder
- Generates shared links for the selected files
- Sends the links to your Slack channel
- Moves the shared files to a temporary folder to avoid duplicate notifications
- When there are no more files to share, it revives all files from the temporary folder for the next cycle
- Create your Google Cloud project and enable Google Drive API
- Create a service account and download the credentials JSON file
- Share your target Google Drive folder with the service account email
- Get your folder ID from the folder URL
- Create your Slack app from the slack api page
- Get your webhook url
- Please fork this repository and set required environment variables in the Actions secrets
- See
.env.template GOOGLE_DRIVE_CREDENTIALS: JSON string of your service account credentialsGOOGLE_DRIVE_FOLDER_ID: Your target Google Drive folder IDSLACK_WEBHOOK_URL: Your Slack webhook URL
- See
- Develop
npm run dev
- Watch code changes
npm run dev:watch
- Lint
npm run lint
- Format
npm run format