init code
This commit is contained in:
43
internal/services/tele/commands/chat.go
Normal file
43
internal/services/tele/commands/chat.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"github.com/rs/zerolog/log"
|
||||
"gopkg.in/telebot.v3"
|
||||
"me.thuanle/bbot/internal/configs/tele"
|
||||
"me.thuanle/bbot/internal/helper/binancex"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func OnChatHandler(context telebot.Context) error {
|
||||
text := strings.ToLower(context.Text())
|
||||
|
||||
switch {
|
||||
case text == "p":
|
||||
return OnGetTopPrices(context)
|
||||
case text == "f" || text == "fee":
|
||||
return OnGetTopFundingFee(context)
|
||||
case binancex.IsToken(text):
|
||||
return OnTokenInfo(context)
|
||||
default:
|
||||
//ignore it
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func OnStickerHandler(context telebot.Context) error {
|
||||
stickerId := context.Message().Sticker.UniqueID
|
||||
switch stickerId {
|
||||
case tele.StickerTop:
|
||||
return OnGetTopPrices(context)
|
||||
default:
|
||||
token, ok := tele.Sticker2TokenMap[stickerId]
|
||||
if !ok {
|
||||
log.Debug().
|
||||
Any("sticker", context.Message().Sticker).
|
||||
Msg("Sticker received")
|
||||
return nil
|
||||
}
|
||||
|
||||
return OnTokenInfoByToken(context, token)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user