mirror of
https://github.com/tucnak/telebot
synced 2024-11-15 06:13:01 +00:00
commit
81f4447261
2
bot.go
2
bot.go
@ -487,6 +487,8 @@ func (b *Bot) handleMedia(m *Message) bool {
|
|||||||
b.handle(OnLocation, m)
|
b.handle(OnLocation, m)
|
||||||
case m.Venue != nil:
|
case m.Venue != nil:
|
||||||
b.handle(OnVenue, m)
|
b.handle(OnVenue, m)
|
||||||
|
case m.Dice != nil:
|
||||||
|
b.handle(OnDice, m)
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
5
media.go
5
media.go
@ -210,3 +210,8 @@ type Venue struct {
|
|||||||
FoursquareID string `json:"foursquare_id,omitempty"`
|
FoursquareID string `json:"foursquare_id,omitempty"`
|
||||||
FoursquareType string `json:"foursquare_type,omitempty"`
|
FoursquareType string `json:"foursquare_type,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Dice struct {
|
||||||
|
Type DiceType `json:"emoji"`
|
||||||
|
Value int `json:"value"`
|
||||||
|
}
|
||||||
|
@ -191,6 +191,8 @@ type Message struct {
|
|||||||
|
|
||||||
// Inline keyboard attached to the message.
|
// Inline keyboard attached to the message.
|
||||||
ReplyMarkup InlineKeyboardMarkup `json:"reply_markup"`
|
ReplyMarkup InlineKeyboardMarkup `json:"reply_markup"`
|
||||||
|
|
||||||
|
Dice *Dice `json:"dice"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MessageEntity object represents "special" parts of text messages,
|
// MessageEntity object represents "special" parts of text messages,
|
||||||
|
16
sendable.go
16
sendable.go
@ -353,3 +353,19 @@ func (p *Poll) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, error) {
|
|||||||
|
|
||||||
return extractMessage(data)
|
return extractMessage(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send delivers dice through bot b to recipient
|
||||||
|
func (d *Dice) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, error) {
|
||||||
|
params := map[string]string{
|
||||||
|
"chat_id": to.Recipient(),
|
||||||
|
"emoji": string(d.Type),
|
||||||
|
}
|
||||||
|
embedSendOptions(params, opt)
|
||||||
|
|
||||||
|
data, err := b.Raw("sendDice", params)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return extractMessage(data)
|
||||||
|
}
|
||||||
|
@ -58,7 +58,7 @@ const (
|
|||||||
OnPinned = "\apinned"
|
OnPinned = "\apinned"
|
||||||
OnChannelPost = "\achan_post"
|
OnChannelPost = "\achan_post"
|
||||||
OnEditedChannelPost = "\achan_edited_post"
|
OnEditedChannelPost = "\achan_edited_post"
|
||||||
|
OnDice = "\adice"
|
||||||
// Will fire when bot is added to a group.
|
// Will fire when bot is added to a group.
|
||||||
OnAddedToGroup = "\aadded_to_group"
|
OnAddedToGroup = "\aadded_to_group"
|
||||||
// Group events:
|
// Group events:
|
||||||
@ -200,3 +200,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const DefaultApiURL = "https://api.telegram.org"
|
const DefaultApiURL = "https://api.telegram.org"
|
||||||
|
|
||||||
|
type DiceType string
|
||||||
|
|
||||||
|
var (
|
||||||
|
Cube = &Dice{Type: "🎲"}
|
||||||
|
Dart = &Dice{Type: "🎯"}
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user