mirror of
https://github.com/tgdrive/teldrive.git
synced 2024-11-10 09:02:52 +08:00
cupdate
This commit is contained in:
parent
b3b4354e0a
commit
fd29819b0d
2 changed files with 3 additions and 1 deletions
|
@ -20,6 +20,8 @@ type Config struct {
|
|||
AllowedUsers []string `envconfig:"ALLOWED_USERS"`
|
||||
DatabaseUrl string `envconfig:"DATABASE_URL" required:"true"`
|
||||
RateLimit bool `envconfig:"RATE_LIMIT" default:"true"`
|
||||
RateBurst int `envconfig:"RATE_BURST" default:"5"`
|
||||
Rate int `envconfig:"RATE" default:"100"`
|
||||
TgClientDeviceModel string `envconfig:"TG_CLIENT_DEVICE_MODEL" required:"true"`
|
||||
TgClientSystemVersion string `envconfig:"TG_CLIENT_SYSTEM_VERSION" default:"Win32"`
|
||||
TgClientAppVersion string `envconfig:"TG_CLIENT_APP_VERSION" default:"2.1.9 K"`
|
||||
|
|
|
@ -108,7 +108,7 @@ func GetBotClient(clientName string) *telegram.Client {
|
|||
middlewares := []telegram.Middleware{floodwait.NewSimpleWaiter()}
|
||||
|
||||
if config.RateLimit {
|
||||
middlewares = append(middlewares, ratelimit.New(rate.Every(time.Millisecond*100), 5))
|
||||
middlewares = append(middlewares, ratelimit.New(rate.Every(time.Millisecond*time.Duration(config.Rate)), config.RateBurst))
|
||||
}
|
||||
|
||||
options := telegram.Options{
|
||||
|
|
Loading…
Reference in a new issue