(new): rich message support
Golang lint / lint (pull_request) Successful in 1m20s
Golang lint / lint (push) Successful in 4m8s

(fix): runtime reliability
(tests): regression coverage
(doc): v1.1 release notes
This commit is contained in:
2026-08-12 16:34:44 +03:00
parent 48ddf66540
commit f03a081ed6
83 changed files with 6122 additions and 1925 deletions
+16
View File
@@ -19,6 +19,12 @@ func (bot *Bot[T]) AddPlugins(plugin ...*Plugin[T]) *Bot[T] {
return bot
}
level := bot.GetLoggerLevel()
sceneOwners := make(map[string]string)
for _, registered := range bot.plugins {
for name := range registered.scenes {
sceneOwners[name] = registered.name
}
}
for _, p := range plugin {
if p == nil {
if bot.logger != nil {
@@ -27,6 +33,16 @@ func (bot *Bot[T]) AddPlugins(plugin ...*Plugin[T]) *Bot[T] {
continue
}
cloned := clonePlugin(p)
for name := range cloned.scenes {
if owner, duplicate := sceneOwners[name]; duplicate {
if bot.logger != nil {
bot.logger.Warnf("scene %q from plugin %q duplicates plugin %q; skipping", name, cloned.name, owner)
}
delete(cloned.scenes, name)
continue
}
sceneOwners[name] = cloned.name
}
if cloned.logger == nil {
cloned.logger = utils.CreateLogger(cloned.name, level, bot.logFormat, bot.logFormatter)
cloned.loggerOwned = true