refactor: update config and readme

This commit is contained in:
krau
2024-11-09 09:43:56 +08:00
parent 0297fdce71
commit 3e5cd60cf7
3 changed files with 12 additions and 9 deletions

View File

@@ -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

View File

@@ -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]

View File

@@ -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)