Skip to content

Commit 6fd89cd

Browse files
committed
fix(deps): latest bots-fw-store - removal of BotUserID
1 parent 0f0b725 commit 6fd89cd

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

botsfwtgmodels/chat_base.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"github.com/bots-go-framework/bots-fw-store/botsfwmodels"
66
"slices"
7+
"strconv"
78
)
89

910
// TgChatRecord holds base properties of Telegram chat TgChatData
@@ -87,16 +88,23 @@ func (data *TgChatBaseData) SetAppUserID(appUserID string) {
8788

8889
// SetBotUserID sets bot user int ID
8990
func (data *TgChatBaseData) SetBotUserID(id interface{}) {
90-
switch id := id.(type) {
91+
var botUserID string
92+
switch typedID := id.(type) {
9193
case string:
92-
data.BotUserID = id
93-
case int, int64:
94-
data.BotUserID = fmt.Sprintf("%d", id)
94+
botUserID = typedID
95+
case int:
96+
botUserID = strconv.Itoa(typedID)
97+
case int64:
98+
botUserID = strconv.FormatInt(typedID, 10)
9599
default:
96100
panic(fmt.Sprintf("Expected string or int, got: %T=%v", id, id))
97101
}
98-
if data.IsGroup && !slices.Contains(data.BotUserIDs, data.BotUserID) {
99-
data.BotUserIDs = append(data.BotUserIDs, data.BotUserID)
102+
if data.IsGroup {
103+
if !slices.Contains(data.BotUserIDs, botUserID) {
104+
data.BotUserIDs = append(data.BotUserIDs, botUserID)
105+
}
106+
} else {
107+
data.BotUserIDs = []string{botUserID}
100108
}
101109
}
102110

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ toolchain go1.23.0
77
//replace github.com/bots-go-framework/bots-fw-store => ../bots-fw-store
88

99
require (
10-
github.com/bots-go-framework/bots-fw-store v0.5.0
10+
github.com/bots-go-framework/bots-fw-store v0.6.0
1111
github.com/strongo/strongoapp v0.20.0
1212
)
1313

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ github.com/bots-go-framework/bots-fw-store v0.4.0 h1:5gQNsMNJ2rni3uGvXt7TeG+V7LF
66
github.com/bots-go-framework/bots-fw-store v0.4.0/go.mod h1:T2yX1QodQ9A1nep/aIAL/czt9adqMyIBVTGOAdNVPAI=
77
github.com/bots-go-framework/bots-fw-store v0.5.0 h1:RY/EdRB3dq7fgzMDw9H8Qr0K6dKgX33Les26NOiBTDU=
88
github.com/bots-go-framework/bots-fw-store v0.5.0/go.mod h1:T2yX1QodQ9A1nep/aIAL/czt9adqMyIBVTGOAdNVPAI=
9+
github.com/bots-go-framework/bots-fw-store v0.6.0 h1:CFjbq3XfBp6GX6RAXIp0tXxDsY7ilo6zZ55M9jRTnW4=
10+
github.com/bots-go-framework/bots-fw-store v0.6.0/go.mod h1:T2yX1QodQ9A1nep/aIAL/czt9adqMyIBVTGOAdNVPAI=
911
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1012
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1113
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

0 commit comments

Comments
 (0)