[pull] origin from krau:main#7
Conversation
Reviewer's GuideThis PR upgrades dependencies, integrates full i18n support, enhances configuration for language and userbot settings, implements a Telegram userbot fallback client for robust file retrieval, refines dispatcher handler registration, and updates logging formatting. Sequence Diagram for File Fetching with Userbot FallbacksequenceDiagram
participant FileRequester as "File Requester\n(e.g., Bot Handler, Task Processor)"
participant BotClient as "gotgproto.Client (Bot)"
participant UserClient as "gotgproto.Client (User)"
participant TelegramAPI
FileRequester->>BotClient: Request FileFromMessage(chatID, messageID)
BotClient->>TelegramAPI: Get file metadata/download
alt Fetch Successful with BotClient
TelegramAPI-->>BotClient: File data/stream
BotClient-->>FileRequester: file, err=nil
else Fetch Failed with BotClient (e.g., peer not found, restricted)
TelegramAPI-->>BotClient: Error
BotClient-->>FileRequester: nil, errorDetails
opt UserClient Enabled AND Error is recoverable by UserClient
FileRequester->>UserClient: Request FileFromMessage(chatID, messageID)
UserClient->>TelegramAPI: Get file metadata/download
alt Fetch Successful with UserClient
TelegramAPI-->>UserClient: File data/stream
UserClient-->>FileRequester: file, err=nil
else Fetch Failed with UserClient
TelegramAPI-->>UserClient: Error
UserClient-->>FileRequester: nil, finalError
end
end
end
Sequence Diagram for Userbot Login ProcesssequenceDiagram
actor Admin as "Admin/Operator"
participant UserClientApp as "SaveAny-Bot (userclient)"
participant TerminalAuth as "termialAuthConversator"
participant GotgprotoLib as "gotgproto Library"
participant TelegramAPI
UserClientApp->>GotgprotoLib: Login(appID, appHash, session, termialAuthConversator)
GotgprotoLib->>TerminalAuth: AskPhoneNumber()
TerminalAuth->>Admin: "Your Phone Number"
Admin-->>TerminalAuth: Enters phone number
TerminalAuth-->>GotgprotoLib: phone number
GotgprotoLib->>TelegramAPI: Send code request (auth.sendCode)
TelegramAPI-->>GotgprotoLib: Code sent
GotgprotoLib->>TerminalAuth: AskCode()
TerminalAuth->>Admin: "Your Code"
Admin-->>TerminalAuth: Enters code
TerminalAuth-->>GotgprotoLib: code
GotgprotoLib->>TelegramAPI: Sign in (auth.signIn with code)
alt 2FA Enabled
TelegramAPI-->>GotgprotoLib: SessionPasswordNeeded
GotgprotoLib->>TerminalAuth: AskPassword()
TerminalAuth->>Admin: "Your 2FA Password"
Admin-->>TerminalAuth: Enters password
TerminalAuth-->>GotgprotoLib: password
GotgprotoLib->>TelegramAPI: Check password (auth.checkPassword)
TelegramAPI-->>GotgprotoLib: Auth result (User)
else No 2FA / Code sufficient
TelegramAPI-->>GotgprotoLib: Auth result (User)
end
GotgprotoLib-->>UserClientApp: Client instance (UC)
UserClientApp->>Admin: "User client logged in as [Name]"
Class Diagram for Configuration Structure ChangesclassDiagram
direction LR
class Config {
+Lang: string "new"
+Workers: int
+Retry: int
+NoCleanCache: bool
+Threads: int
+Stream: bool
+AsPublicCopyMediaBot: bool
+Log: logConfig
+DB: dbConfig
+Telegram: telegramConfig
+Temp: tempConfig
+Storages: []storage.StorageConfig
}
class telegramConfig {
+Token: string
+AppID: int
+AppHash: string
+Timeout: int
+Proxy: proxyConfig
+FloodRetry: int
+RpcRetry: int
+Userbot: userbotConfig "new"
}
class userbotConfig {
+Enable: bool "new"
+Session: string "new"
}
Config "1" *-- "1" telegramConfig : contains
telegramConfig "1" *-- "1" userbotConfig : contains
Class Diagram for DAO and Core Type ChangesclassDiagram
direction LR
class ReceivedFile {
+gorm.Model
+ChatID: int64
+MessageID: int
+ReplyMessageID: int
+ReplyChatID: int64
+FileName: string
+IsTelegraph: bool
+TelegraphURL: string
+UseUserClient: bool "new"
}
class Task {
+Ctx: context.Context
+Cancel: context.CancelFunc
+Error: error
+UseUserClient: bool "new"
+Status: TaskStatus
+StorageName: string
+StoragePath: string
+StartTime: time.Time
+FileDBID: uint
+File: *File
+FileMessageID: int
+FileChatID: int64
+CallbackMessageID: int
+UserID: int64
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Vulnerable Libraries (2)
More info on how to fix Vulnerable Libraries in Go. 👉 Go to the dashboard for detailed results. 📥 Happy? Share your feedback with us. |
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.1)
Can you help keep this open source service alive? 💖 Please sponsor : )
Summary by Sourcery
Enable multilingual support and Telegram userbot fallback mechanism, update dependencies, and enhance logging, configuration, and message handling
New Features:
Enhancements:
Build:
Chores: