dice: added constants

This commit is contained in:
dande 2020-04-25 15:59:53 +03:00
parent 3915e8596b
commit 9268c6dff7
5 changed files with 12 additions and 5 deletions

2
bot.go
View File

@ -487,7 +487,7 @@ func (b *Bot) handleMedia(m *Message) bool {
b.handle(OnLocation, m)
case m.Venue != nil:
b.handle(OnVenue, m)
case m.DiceResult != nil:
case m.Dice != nil:
b.handle(OnDice, m)
default:
return false

View File

@ -212,6 +212,6 @@ type Venue struct {
}
type Dice struct {
EmojiType string `json:"emoji"`
Value int `json:"value"`
Type DiceType `json:"emoji"`
Value int `json:"value"`
}

View File

@ -192,7 +192,7 @@ type Message struct {
// Inline keyboard attached to the message.
ReplyMarkup InlineKeyboardMarkup `json:"reply_markup"`
DiceResult *Dice `json:"dice"`
Dice *Dice `json:"dice"`
}
// MessageEntity object represents "special" parts of text messages,

View File

@ -356,7 +356,7 @@ func (p *Poll) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, error) {
func (d *Dice) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, error) {
params := map[string]string{
"chat_id": to.Recipient(),
"emoji": d.EmojiType,
"emoji": string(d.Type),
}
embedSendOptions(params, opt)
data, err := b.Raw("sendDice", params)

View File

@ -200,3 +200,10 @@ const (
)
const DefaultApiURL = "https://api.telegram.org"
type DiceType string
var (
Cube = &Dice{Type: "🎲"}
Dart = &Dice{Type: "🎯"}
)