Skip to content

akhater/Lupin

Repository files navigation

Who am I ?

Hey I am Lupin, an Open Source Telegram Python Chat Bot build to supercharge your LogSeq with great features like Interstitial Journaling | Flashcards | Brainmaps | PDF / Web Annotations | {TODO; DOING; LATER} | Bookmarks | Images upload and more

Getting Started

There are two methods to deploy Lupin. You can install it manaully or your can use Docker. Either method will require that you place information in a config.ini file.

Manually via Python and PIP:

Assuming you are already using LogSeq & are familar with Python.

Lupin requires Python version >= 3.x

  1. Clone me git clone https://github.com/akhater/Lupin
  2. Create a telegram bot
  3. Install Python Telegram Bot library using pip install python-telegram-bot or pip3 install python-telegram-bot
  4. Install PyGithub library using pip install pyGitHub or pip3 install pyGitHub
  5. Install the requests library using pip install requests or pip3 install requests
  6. Generate a Github token from https://github.com/settings/tokens
  7. Rename config.sample.ini to config.ini
  8. Change values in config.ini to fit your environment
  9. Run the bot using python main.py or python3 main.py

Docker

The container is based off the official python 3 images.

The only requirement is that you have Docker installed.

Before pulling the container please follow these steps:

  1. Create a telegram bot: https://core.telegram.org/bots#creating-a-new-bot
  2. Generate a Github personal token from https://github.com/settings/tokens
  3. Download config.sample.ini and save it asconfig.ini
  4. Change values in config.ini to fit your environment

Note: That if you do not change the time zone (TZ) your timestamp will reflect Eastern US Time (America/New_York). You can see a list of time zones here that way you can have the timestamp reflect a time zone of your choosing.

You can run an instance of Lupin where your config.ini is located by typing this in your terminal:

docker run -d \
--name lupin \
--mount type=bind,source=$(pwd)/config.ini,target=/app/config.ini \
-e TZ=America/New_York \
--restart unless-stopped \
digitalknk/lupin

You could also create a docker-compose.yaml file and copy/paste the text from below or download it from the repo, save it where your config.ini is located. You can then deploy Lupin by typing this in your terminal docker-compose up -d in the same directory.

version: "3.2"
services:
  lupin:
    container_name: lupin
    image: digitalknk/lupin
    volumes:
      - type: bind
        source: ./config.ini
        target: /app/config.ini
    environment:
      TZ: America/New_York
    restart: unless-stopped

When a new update to the container is released, you can update your pulled image by running one of these depending your deployment strategy where your config.ini is located:

If you used the docker run command:

docker stop lupin
docker rm lupin
docker run -d \
--name lupin \
--mount type=bind,source=$(pwd)/config.ini,target=/app/config.ini \
-e TZ=America/New_York \
--restart unless-stopped \
digitalknk/lupin

If a docker-compose.yaml is used:

docker-compose stop
docker-compose rm -f
docker-compose pull   
docker-compose up -d

Features

  • Privacy always - self hosted & open source
  • Security
    • Entries are only accepted from telegram BotAuthorizedIDs so not anyone can add entries to your journal
  • Fully customization with config.ini file
    • Rename it
    • Translate it (no hard coded messages)
    • much more
  • Send a thought (any text) and Lupin will make your Interstitial Journaling a breeze
    • Timestamp it: supporting both 12 and 24 hrs format
    • You can also turn off the timestamp all together if that's what you want
    • Enter it in your Github hosted Jounral
  • Send your TODO list (by including TODO in the text) and Lupin will convert it to a LogSeq TODO
    • TODO command is customizable
  • Send a link and Lupin automatically create a #bookmark entry in your Journal in the form of
    • 18:48 #bookmark title
    • #bookmark tag is customizable
  • Send a YouTube video link and Lupin will automatically embedded in your Journal in the form of
    • 18:52 {{Youtube link}}
  • Send /anno uri to import all your annotations from for the uri from Hypothesis
  • Support for both LogSeq regular Journal and custom Journal folder and/or file
  • Spaced Repetion: Spaced Repetition capabilities based on SuperMemo2 Algorithm
  • Calendar Generation: Auto generates PiotrSss calendar and puts them in the sidebar
  • Theme Switcher: Switch between multiple themes by calling /themes
  • Generate Mindmaps of your pages by called /getMM PageTitle
  • Support for AGE encryption and encrypted Graphs

Spaced Repetition

Supported format for flaschards is

## #flashcardtag
### Question 1
#### answer line 1
#### answer line 2
### Question 2
#### Answer 2

Flashcard tag is customizable Algorithm used is SuperMemo2 Triggers are /tsr import --> scan - import - update your flashcards /tsr x -> retrieve x flashcards from you pending pool /tsr -> retrieve the default number of cards set in your config .ini file Below entry in config.ini specifies you default number of flashcards

[TimeSpacedRepetion]
flashcardDailyGoal=10

Theme Switcher

Before being able to use this feature you need to name your various themes in the format ThemeName.custom.css and place them in the /logseq folder

Commands summary

Command Description
/start Just a greeting
/uptime returns Lupin Uptime
/ver returns Lupin running Version
/help help command (WIP)
/anno URL Import hypothesis annotations from URL
/importFC Imports your Flashcards into Lupin
/srs import alias of /importFC
/srs x starts a round of SRS for x flashcards
/getMM pageTitle Generates a dynamic MindMap for pageTitle
/pullNow Pulls all pages from your Git for fast access
/themes calls the theme changer
/encryptAll Encrypts all your pages with AGE keys
/decryptAll Decrypts all your pages back to clear text

Screenshots

Imported Hypothesis notes into LogSeq

Credits

License

MIT License