From 827bfb108dbb417167c2b105da2f6de7574bab62 Mon Sep 17 00:00:00 2001 From: LightningTipBot <88730856+LightningTipBot@users.noreply.github.com> Date: Mon, 23 Aug 2021 20:46:57 +0200 Subject: [PATCH] hotfix new user creation (#17) --- tip.go | 2 +- users.go | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tip.go b/tip.go index 54600bfc..cfd1c368 100644 --- a/tip.go +++ b/tip.go @@ -83,7 +83,7 @@ func (bot *TipBot) tipHandler(m *tb.Message) { if !bot.UserHasWallet(to) { log.Infof("[/tip] User %s has no wallet.", toUserStr) - err = bot.CreateWalletForUser(to) + err = bot.CreateWalletForTelegramUser(to) if err != nil { errmsg := fmt.Errorf("[/tip] Error: Could not create wallet for %s", toUserStr) log.Errorln(errmsg) diff --git a/users.go b/users.go index 45fca096..9a616c99 100644 --- a/users.go +++ b/users.go @@ -5,6 +5,7 @@ import ( "fmt" "strings" + "github.com/LightningTipBot/LightningTipBot/internal/lnbits" log "github.com/sirupsen/logrus" tb "gopkg.in/tucnak/telebot.v2" @@ -94,13 +95,13 @@ func (bot *TipBot) GetUserBalance(user *tb.User) (amount int, err error) { return } -func (bot *TipBot) CreateWalletForUser(tbUser *tb.User) error { - user, err := GetUser(tbUser, *bot) +func (bot *TipBot) CreateWalletForTelegramUser(tbUser *tb.User) error { + user := &lnbits.User{Telegram: tbUser} userStr := GetUserStr(tbUser) - log.Printf("[CreateWalletForUser] Creating wallet for user %s ... ", userStr) - err = bot.createWallet(user) + log.Printf("[CreateWalletForTelegramUser] Creating wallet for user %s ... ", userStr) + err := bot.createWallet(user) if err != nil { - errmsg := fmt.Sprintf("[CreateWalletForUser] Error: Could not create wallet for user %s", userStr) + errmsg := fmt.Sprintf("[CreateWalletForTelegramUser] Error: Could not create wallet for user %s", userStr) log.Errorln(errmsg) return err } @@ -108,7 +109,7 @@ func (bot *TipBot) CreateWalletForUser(tbUser *tb.User) error { if tx.Error != nil { return tx.Error } - log.Printf("[CreateWalletForUser] Wallet created for user %s. ", userStr) + log.Printf("[CreateWalletForTelegramUser] Wallet created for user %s. ", userStr) return nil }