Skip to content

Commit

Permalink
refactor: update config and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
krau committed Nov 9, 2024
1 parent 0297fdc commit 3e5cd60
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
我真的服了😇, 目前没有什么好的 telegram mtproto sdk, 因此这个项目在运行时会产生很多因上游依赖的 bug 的终止, 能跑就是赢.

# Save Any Bot

把 Telegram 的文件保存到各类存储端.
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions config.example.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
threads = 4 # 下载线程数
workers = 4 # 同时下载文件数

[telegram]
token = "" # Bot Token
admins = [777000] # 你的 user_id
Expand All @@ -10,7 +10,7 @@ api_hash = "0123456789abcdef0123456789abcdef" # Telegram API Hash
level = "DEBUG" # 日志等级

[temp]
base_path = "cache/" # 临时目录, 请不要在此目录下存放任何其他文件
base_path = "cache/" # 下载文件临时目录, 请不要在此目录下存放任何其他文件
cache_ttl = 30 # 临时文件保存时间, 单位: 秒

[db]
Expand Down
6 changes: 1 addition & 5 deletions config/viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3e5cd60

Please sign in to comment.