From 3e5cd60cf73f4da7acb5ba002d5242824d6096e2 Mon Sep 17 00:00:00 2001 From: krau <71133316+krau@users.noreply.github.com> Date: Sat, 9 Nov 2024 09:43:56 +0800 Subject: [PATCH] refactor: update config and readme --- README.md | 11 +++++++++-- config.example.toml | 4 ++-- config/viper.go | 6 +----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d9cbcfc..d58ecff 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -我真的服了😇, 目前没有什么好的 telegram mtproto sdk, 因此这个项目在运行时会产生很多因上游依赖的 bug 的终止, 能跑就是赢. - # Save Any Bot 把 Telegram 的文件保存到各类存储端. @@ -35,3 +33,12 @@ api = "http://localhost:8081" ``` 参考: [telegram-bot-api-compose](https://github.com/krau/telegram-bot-api-compose) + +--- + +## Thanks + +- [gotd](https://github.com/gotd/td) +- [TG-FileStreamBot](https://github.com/EverythingSuckz/TG-FileStreamBot) +- [gotgproto](https://github.com/celestix/gotgproto) +- All the dependencies \ No newline at end of file diff --git a/config.example.toml b/config.example.toml index fa47527..28d2e57 100644 --- a/config.example.toml +++ b/config.example.toml @@ -1,5 +1,5 @@ -threads = 4 # 下载线程数 workers = 4 # 同时下载文件数 + [telegram] token = "" # Bot Token admins = [777000] # 你的 user_id @@ -10,7 +10,7 @@ api_hash = "0123456789abcdef0123456789abcdef" # Telegram API Hash level = "DEBUG" # 日志等级 [temp] -base_path = "cache/" # 临时目录, 请不要在此目录下存放任何其他文件 +base_path = "cache/" # 下载文件临时目录, 请不要在此目录下存放任何其他文件 cache_ttl = 30 # 临时文件保存时间, 单位: 秒 [db] diff --git a/config/viper.go b/config/viper.go index 93f0a22..48cef26 100644 --- a/config/viper.go +++ b/config/viper.go @@ -8,9 +8,7 @@ import ( ) type Config struct { - Threads int `toml:"threads" mapstructure:"threads"` - Workers int `toml:"workers" mapstructure:"workers"` - ChunkSize int32 `toml:"chunk_size" mapstructure:"chunk_size"` + Workers int `toml:"workers" mapstructure:"workers"` Temp tempConfig `toml:"temp" mapstructure:"temp"` Log logConfig `toml:"log" mapstructure:"log"` @@ -76,9 +74,7 @@ func Init() { viper.AddConfigPath(".") viper.SetConfigType("toml") - viper.SetDefault("threads", 3) viper.SetDefault("workers", 3) - viper.SetDefault("chunk_size", 1024*1024) viper.SetDefault("temp.base_path", "cache/") viper.SetDefault("temp.cache_ttl", 3600)