✨ Added poll utils
This commit is contained in:
parent
df9a37c6bd
commit
52ea28b0c7
1
const.go
1
const.go
|
@ -190,6 +190,7 @@ const (
|
||||||
UpdateEditedMessage string = "edited_message"
|
UpdateEditedMessage string = "edited_message"
|
||||||
UpdateInlineQuery string = "inline_query"
|
UpdateInlineQuery string = "inline_query"
|
||||||
UpdateMessage string = "message"
|
UpdateMessage string = "message"
|
||||||
|
UpdatePoll string = "poll"
|
||||||
UpdatePreCheckoutQuery string = "pre_checkout_query"
|
UpdatePreCheckoutQuery string = "pre_checkout_query"
|
||||||
UpdateShippingQuery string = "shipping_query"
|
UpdateShippingQuery string = "shipping_query"
|
||||||
)
|
)
|
||||||
|
|
16
utils.go
16
utils.go
|
@ -1860,6 +1860,11 @@ func (m *Message) IsSuccessfulPayment() bool {
|
||||||
return m != nil && m.SuccessfulPayment != nil
|
return m != nil && m.SuccessfulPayment != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsPoll checks that the current message is a poll.
|
||||||
|
func (m *Message) IsPoll() bool {
|
||||||
|
return m != nil && m.Poll != nil
|
||||||
|
}
|
||||||
|
|
||||||
// HasEntities checks that the current message contains entities.
|
// HasEntities checks that the current message contains entities.
|
||||||
func (m *Message) HasEntities() bool {
|
func (m *Message) HasEntities() bool {
|
||||||
return m != nil && len(m.Entities) > 0
|
return m != nil && len(m.Entities) > 0
|
||||||
|
@ -1991,10 +1996,6 @@ func (m *Message) SmallChatPhoto() *PhotoSize {
|
||||||
return &sp[0]
|
return &sp[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Message) HasPoll() bool {
|
|
||||||
return m != nil && m.Poll != nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func decrypt(pk *rsa.PrivateKey, s, h, d string) (obj []byte, err error) {
|
func decrypt(pk *rsa.PrivateKey, s, h, d string) (obj []byte, err error) {
|
||||||
// Note that all base64-encoded fields should be decoded before use.
|
// Note that all base64-encoded fields should be decoded before use.
|
||||||
secret, err := decodeField(s)
|
secret, err := decodeField(s)
|
||||||
|
@ -2581,6 +2582,11 @@ func (u *Update) IsPreCheckoutQuery() bool {
|
||||||
return u != nil && u.PreCheckoutQuery != nil
|
return u != nil && u.PreCheckoutQuery != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsPoll checks that the current update is a poll update.
|
||||||
|
func (u *Update) IsPoll() bool {
|
||||||
|
return u != nil && u.Poll != nil
|
||||||
|
}
|
||||||
|
|
||||||
// Type return update type for current update.
|
// Type return update type for current update.
|
||||||
func (u *Update) Type() string {
|
func (u *Update) Type() string {
|
||||||
switch {
|
switch {
|
||||||
|
@ -2602,6 +2608,8 @@ func (u *Update) Type() string {
|
||||||
return UpdatePreCheckoutQuery
|
return UpdatePreCheckoutQuery
|
||||||
case u.IsShippingQuery():
|
case u.IsShippingQuery():
|
||||||
return UpdateShippingQuery
|
return UpdateShippingQuery
|
||||||
|
case u.IsPoll():
|
||||||
|
return UpdatePoll
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user