mirror of
https://github.com/ChuckNorrison/LightningTipBot.git
synced 2026-08-18 13:08:52 +02:00
shop stuck fix (#284)
Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
This commit is contained in:
parent
95a22401b2
commit
7c95daabfd
1 changed files with 4 additions and 1 deletions
|
|
@ -429,9 +429,12 @@ func (bot *TipBot) displayShopItem(ctx context.Context, m *tb.Message, shop *Sho
|
|||
return nil
|
||||
}
|
||||
// failsafe: if the page is out of bounds, reset it
|
||||
if shopView.Page >= len(shop.Items) {
|
||||
if len(shop.Items) > 0 && shopView.Page >= len(shop.Items) {
|
||||
shopView.Page = len(shop.Items) - 1
|
||||
} else if len(shop.Items) == 0 {
|
||||
shopView.Page = 0
|
||||
}
|
||||
|
||||
log.Debugf("[displayShopItem] shop: %s page: %d", shop.ID, shopView.Page)
|
||||
if len(shop.Items) == 0 {
|
||||
no_items_message := "There are no items in this shop yet."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue