this is why i hate git and all this version control sytems so much....
This commit is contained in:
parent
1ff570d6c4
commit
5cfa0ca7ac
47
market.go
47
market.go
@ -96,7 +96,7 @@ var Commands = map[string](func(tg.Update, *tg.BotAPI)){
|
||||
}
|
||||
return
|
||||
}()
|
||||
buttons = append(buttons, Button{Text: text, Data: "somethin"})
|
||||
buttons = append(buttons, Button{Text: text, Data: "something"})
|
||||
}
|
||||
|
||||
msg := tg.NewPhoto(
|
||||
@ -161,52 +161,7 @@ func GetImage(link string) (image.Image, error) {
|
||||
}
|
||||
|
||||
func HandleCommand(update tg.Update, bot *tg.BotAPI) {
|
||||
<<<<<<< HEAD
|
||||
maxCost := 5
|
||||
var err error
|
||||
for i := 0; i <= maxCost; i++ {
|
||||
buf := new(bytes.Buffer)
|
||||
var img = imageutils.Concat(
|
||||
Must(GetImage(fmt.Sprintf(LinkFormat,
|
||||
takeOne(&ShuffledCardPool)))),
|
||||
Must(GetImage(fmt.Sprintf(LinkFormat,
|
||||
takeOne(&ShuffledCardPool)))),
|
||||
imageutils.Right,
|
||||
)
|
||||
err = png.Encode(buf, img)
|
||||
if err != nil {
|
||||
log.Println("error on decode:", err)
|
||||
}
|
||||
|
||||
buttons := []Button{}
|
||||
for j := 0; j < 2; j++ {
|
||||
text := func() (s string) {
|
||||
s = fmt.Sprintf("buy for %d", i)
|
||||
if RupeesOnCards[j] >= i {
|
||||
s += fmt.Sprintf(", get 1")
|
||||
}
|
||||
return
|
||||
}()
|
||||
buttons = append(buttons, Button{Text: text, Data: "somethin"})
|
||||
}
|
||||
|
||||
msg := tg.NewPhoto(
|
||||
update.Message.Chat.ID,
|
||||
tg.FileBytes{Name: "cards", Bytes: buf.Bytes()},
|
||||
)
|
||||
msg.ReplyMarkup = Buttons(buttons)
|
||||
|
||||
responseMsg, err := bot.Send(msg) // get response message
|
||||
if err != nil {
|
||||
log.Println("failed to send message on command:",
|
||||
err)
|
||||
}
|
||||
|
||||
log.Print("message sent. id:", responseMsg.MessageID)
|
||||
}
|
||||
=======
|
||||
Commands[update.Message.Command()](update, bot)
|
||||
>>>>>>> 5d7fe44 (separated commands)
|
||||
}
|
||||
|
||||
func HandleUpdate(update tg.Update, bot *tg.BotAPI) {
|
||||
|
Loading…
Reference in New Issue
Block a user