(new): v1.2 release
Golang lint / lint (push) Successful in 11m32s

This commit is contained in:
2026-08-19 14:58:25 +03:00
parent f03a081ed6
commit 29b208eeec
79 changed files with 7301 additions and 2060 deletions
+36 -3
View File
@@ -115,6 +115,7 @@ type Bot[T AppData] struct {
l10n *L10n // Localization manager
draftProvider *DraftProvider // Draft message builder
observer Observer // Optional event observer for instrumentation
observerAsync *observerDispatcher
appData T // Injected application data
hasAppData bool
@@ -264,20 +265,50 @@ func NewBot[T any](opts *BotOpts) (*Bot[T], error) {
return bot, nil
}
// SetLogger replaces the main bot logger.
// SetLogger replaces the main bot logger before runtime starts.
func (bot *Bot[T]) SetLogger(l *sneklog.Logger) *Bot[T] {
if !bot.configMutable("SetLogger") {
return bot
}
if l == nil {
if bot.logger != nil {
bot.logger.Warnln("SetLogger called with nil logger; nothing changed")
}
return bot
}
bot.addTokenReplacer(l)
bot.logger = l
return bot
}
// SetRequestLogger replaces the request-level logger.
// SetRequestLogger replaces the request-level logger before runtime starts.
func (bot *Bot[T]) SetRequestLogger(l *sneklog.Logger) *Bot[T] {
if !bot.configMutable("SetRequestLogger") {
return bot
}
if l == nil {
if bot.logger != nil {
bot.logger.Warnln("SetRequestLogger called with nil logger; nothing changed")
}
return bot
}
bot.addTokenReplacer(l)
bot.requestLogger = l
return bot
}
// SetWebhookLogger replaces the webhook logger.
// SetWebhookLogger replaces the webhook logger before runtime starts.
func (bot *Bot[T]) SetWebhookLogger(l *sneklog.Logger) *Bot[T] {
if !bot.configMutable("SetWebhookLogger") {
return bot
}
if l == nil {
if bot.logger != nil {
bot.logger.Warnln("SetWebhookLogger called with nil logger; nothing changed")
}
return bot
}
bot.addTokenReplacer(l)
bot.webhookLogger = l
return bot
}
@@ -291,6 +322,7 @@ func (bot *Bot[T]) GetUploader() *tgapi.Uploader { return bot.uploader }
// Close gracefully shuts down bot-owned resources.
//
// Close shuts down, in order:
// - The asynchronous observer dispatcher, after draining queued events
// - Registered plugins via Plugin.Close
// - Webhook logger (if initialized)
// - Uploader (waits for pending uploads)
@@ -314,6 +346,7 @@ func (bot *Bot[T]) Close() error {
}
e = append(e, err)
}
bot.stopObserverDispatcher()
for _, p := range bot.plugins {
if err := p.Close(); err != nil {