dice: added constants

pull/269/head
dande 4 years ago
parent 3915e8596b
commit 9268c6dff7

@ -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

@ -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"`
}

@ -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,

@ -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)

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

Loading…
Cancel
Save