mirror of
https://github.com/tucnak/telebot
synced 2024-11-03 09:40:18 +00:00
dice: added constants
This commit is contained in:
parent
3915e8596b
commit
9268c6dff7
2
bot.go
2
bot.go
@ -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
|
||||
|
4
media.go
4
media.go
@ -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…
Reference in New Issue
Block a user