Categorygithub.com/simba-fs/telegrary
repositorypackage
0.1.18
Repository: https://github.com/simba-fs/telegrary.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

en doc

Telegrary

Telegrary = Telegram + diary

Telegrary 是一個 Telegram 機器人,讓你可以在 Telegram 上管理日記。同時 Telegrary 提供了一個 CLI 界面,讓你可以在終端機管理日記。

Installation

go install github.com/simba-fs/telegrary@latest

Dependency

  • git
  • go 1.17+ (I beleve 1.16 also work, but I develop it with go1.17)

CLI Usage

Telegram Bot

把你的 Telegram bot token 放在 ~/.config/telegrary.toml./telegrary.toml,並設定 secret(hashed),像下面這樣:

token = "dafjskdsajflkdsajflkdsjflkjdsalkf"
secret = "fdshafjdafhjdjasnmalfjsdjkf"

然後執行命令 telegrary bot

Bot Commands

CommandDescription
/helpprint help text
/read [[[year], month], day]read diary
/write [[[year], month], day] <content>write diary
/treelist all notes in tree form

現在 /write 還不支援 MD 語法,因為機器人還讀不到原始的文字,MD 語法會被 TG 吃掉,解決中......

終端機寫日記

命令 telegrary [[[year] month] day] 會用你喜歡的編輯器 ($EDITOR) 打開日記,內容會存在目錄 ~/.local/share/telegrary 下面。你可以在 telegrary.toml 中加入 root = path/to/directory 改變預設目錄。

Git

Telegrary 使用 Git 對日記進行版本管理,在編輯、Bot 命令結束後都會自動執行 git addgit commit,如果設定檔中有設定 git_repo 的話就會執行 git push

Config

用命令 telegrary config 可以開啟最近的設定檔(在路徑列表中優先序第一且存在的檔案,但是這檔案沒寫的設定可能會由其他設定檔提供)
以下是有支援的設定

FieldTypeDescription
tokenstringTelegram Bot Token, Optional
rootstringwhere notes stored, default = ~/.lcoal/telegrary
gitstringpath to git exec, default = git
git_signboolif you want to use gpg sign when commit, default = true
git_repostringpath to remote git repository

路徑列表:~/.config/telegrary.toml./telegrary.toml

Hash

在 bot 中使用密語驗證使用者身份,為了避免明碼除存密語,因此先經過 hash,你可以用指令 telegrary hash <secret> 來產生 hash 過的密語

未來版本規劃

  • v0.1 - 最初版本,基本功能
    • auto update and build info
    • auto pull in bot
  • v0.2 - 筆記加密
  • v0.3 - 網頁界面、API
  • v0.4 - 多人共用伺服器