lightningtipbot/internal/telegram/state.go
gohumble 4e812f7897
add errors to handler (#273)
* add errors to handler

* add errors to handlers

* shop fixes (#274)

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>

* better log (#275)

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>

* add errors to map

* more errors

* rename NoWalletError

* fix one panic (#276)

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>

* add invalid type error

* Shop panic attempt 2 (#277)

* less log

* fix shop first view

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>

* make errors private

* add errors to handler

* add errors to handlers

* add errors to map

* more errors

* rename NoWalletError

* add invalid type error

* make errors private

* patch

* return handlers

* add noPrivateChat

* add invalid amount err

Co-authored-by: LightningTipBot <88730856+LightningTipBot@users.noreply.github.com>
Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2022-01-09 21:39:09 +01:00

25 lines
1,010 B
Go

package telegram
import (
"context"
"github.com/LightningTipBot/LightningTipBot/internal/lnbits"
tb "gopkg.in/lightningtipbot/telebot.v2"
)
type StateCallbackMessage map[lnbits.UserStateKey]func(ctx context.Context, m *tb.Message) (context.Context, error)
var stateCallbackMessage StateCallbackMessage
func initializeStateCallbackMessage(bot *TipBot) {
stateCallbackMessage = StateCallbackMessage{
lnbits.UserStateLNURLEnterAmount: bot.enterAmountHandler,
lnbits.UserEnterAmount: bot.enterAmountHandler,
lnbits.UserEnterUser: bot.enterUserHandler,
lnbits.UserEnterShopTitle: bot.enterShopTitleHandler,
lnbits.UserStateShopItemSendPhoto: bot.addShopItemPhoto,
lnbits.UserStateShopItemSendPrice: bot.enterShopItemPriceHandler,
lnbits.UserStateShopItemSendTitle: bot.enterShopItemTitleHandler,
lnbits.UserStateShopItemSendItemFile: bot.addItemFileHandler,
lnbits.UserEnterShopsDescription: bot.enterShopsDescriptionHandler,
}
}