Skip to content

indrasaputra/tetesan-hujan

Repository files navigation

Tetesan Hujan

Go Report Card Workflow codecov Maintainability Quality Gate Status Go Reference

Description

Tetesan Hujan is a bot to connect Telegram with Raindrop. Its main purpose is currently to save a bookmark for my own purpose.

Owner

Indra Saputra

Usage

Send exactly two strings separated by a space to @tetesan_hujan_bot in Telegram. The first string represents the link and the second represents the collection/category in which the link will be saved in Raindrop.io.

For example, the link is https://queue.acm.org/detail.cfm?id=3197520 and collection is learning. Then, the message in Telegram will be: Tetesan Hujan Example

Caveat

To use this bot, make sure you have the access to use the bot (it is set by TELEGRAM_OWNER_ID environment variable). Since the original purpose is my own usage only, the @tetesan_hujan_bot is only available for me. If you want to use the bot, please follow the Development and Deployment sections.

The bot is heavily depends on Raindrop API. Thus, any latency will be depends on Raindrop API latency.

Development

  • Install Go

    This project uses version 1.19. Follow Golang installation guideline.

  • Create your Telegram bot

    Read https://telegram.org/blog/bot-revolution.

    Follow https://core.telegram.org/bots for developer guide.

  • Create Raindrop.io account

    Get the Raindrop's token in settings.

    Follow https://developer.raindrop.io/ for more guidance.

  • Clone the project (use one of the two methods below)

    Use SSH

    $ git@github.com:indrasaputra/tetesan-hujan.git
    

    Use HTTP

    $ https://github.com/indrasaputra/tetesan-hujan.git
    
  • Go to project folder

    Usually, it would be

    $ cd go/src/github.com/indrasaputra/tetesan-hujan
    
  • Fill in the environment variables

    Copy the sample env file.

    $ cp env.sample .env
    

    Then, fill the values according to your setting in .env file.

  • Download the dependencies

    $ make dep-download
    

    or run this command if you don't have make installed in your local.

    $ go mod download 
    
  • Run the application

    $ go run cmd/bot/main.go
    
  • Expose your localhost to the internet

    Usually, I use https://ngrok.com/

    $ ngrok http $PORT
    
  • Send some messages to your bot in Telegram.

Deployment

Currently, this project is deployed in Fly. The deployment process definiton is stated and ruled in fly.toml and run automatically using Github Actions.

Releases

No releases published

Packages

No packages published