fix: guard nil logger in prefix check

This commit is contained in:
2026-03-27 16:06:24 +03:00
parent 4f8d583b03
commit 3ad9e48d71
+3 -1
View File
@@ -270,7 +270,9 @@ func (bot *Bot[T]) prepareUpdateCtx(u *tgapi.Update, ctx *MsgContext) {
func (bot *Bot[T]) checkPrefixes(text string) (string, bool) { func (bot *Bot[T]) checkPrefixes(text string) (string, bool) {
for _, prefix := range bot.prefixes { for _, prefix := range bot.prefixes {
if prefix == "" { if prefix == "" {
bot.logger.Warnln("empty prefix is not allowed") if bot.logger != nil {
bot.logger.Warnln("empty prefix is not allowed")
}
continue continue
} }
if strings.HasPrefix(text, prefix) { if strings.HasPrefix(text, prefix) {