mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
use bot token prefix as the redis store namespace
This commit is contained in:
parent
f16cde3b26
commit
6b760c72b7
|
@ -2,6 +2,7 @@ package telegramnotifier
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
tb "gopkg.in/tucnak/telebot.v2"
|
||||
|
@ -36,7 +37,9 @@ func New(bot *tb.Bot, authToken string, options ...NotifyOption) *Notifier {
|
|||
o(notifier)
|
||||
}
|
||||
|
||||
store := notifier.redis.NewStore("bbgo", "telegram")
|
||||
// use token prefix as the redis namespace
|
||||
tt := strings.Split(bot.Token, ":")
|
||||
store := notifier.redis.NewStore("bbgo", "telegram", tt[0])
|
||||
if err := store.Load(notifier.chatUser) ; err == nil {
|
||||
bot.Send(notifier.chatUser, fmt.Sprintf("Hi %s, I'm back", notifier.chatUser.Username))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user