File tree Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 4
4
"fmt"
5
5
"github.com/bots-go-framework/bots-fw-store/botsfwmodels"
6
6
"slices"
7
+ "strconv"
7
8
)
8
9
9
10
// TgChatRecord holds base properties of Telegram chat TgChatData
@@ -87,16 +88,23 @@ func (data *TgChatBaseData) SetAppUserID(appUserID string) {
87
88
88
89
// SetBotUserID sets bot user int ID
89
90
func (data * TgChatBaseData ) SetBotUserID (id interface {}) {
90
- switch id := id .(type ) {
91
+ var botUserID string
92
+ switch typedID := id .(type ) {
91
93
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 )
95
99
default :
96
100
panic (fmt .Sprintf ("Expected string or int, got: %T=%v" , id , id ))
97
101
}
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 }
100
108
}
101
109
}
102
110
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ toolchain go1.23.0
7
7
// replace github.com/bots-go-framework/bots-fw-store => ../bots-fw-store
8
8
9
9
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
11
11
github.com/strongo/strongoapp v0.20.0
12
12
)
13
13
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ github.com/bots-go-framework/bots-fw-store v0.4.0 h1:5gQNsMNJ2rni3uGvXt7TeG+V7LF
6
6
github.com/bots-go-framework/bots-fw-store v0.4.0 /go.mod h1:T2yX1QodQ9A1nep/aIAL/czt9adqMyIBVTGOAdNVPAI =
7
7
github.com/bots-go-framework/bots-fw-store v0.5.0 h1:RY/EdRB3dq7fgzMDw9H8Qr0K6dKgX33Les26NOiBTDU =
8
8
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 =
9
11
github.com/davecgh/go-spew v1.1.0 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
10
12
github.com/pmezard/go-difflib v1.0.0 /go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4 =
11
13
github.com/stretchr/objx v0.1.0 /go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME =
You can’t perform that action at this time.
0 commit comments