✨ Added some interfaces
This commit is contained in:
parent
cda1a3c9b4
commit
fe4fd382d5
8
types.go
8
types.go
|
@ -801,6 +801,14 @@ type (
|
|||
RetryAfter int `json:"retry_after,omitempty"`
|
||||
}
|
||||
|
||||
// InputMedia represents the content of a media message to be sent.
|
||||
InputMedia interface {
|
||||
File() string
|
||||
InputMediaCaption() string
|
||||
InputMediaParseMode() string
|
||||
InputMediaType() string
|
||||
}
|
||||
|
||||
// InputMediaPhoto represents a photo to be sent.
|
||||
InputMediaPhoto struct {
|
||||
// Type of the result, must be photo
|
||||
|
|
|
@ -20,6 +20,13 @@ type (
|
|||
Location *Location `json:"location,omitempty"`
|
||||
}
|
||||
|
||||
// InlineQueryResult represents one result of an inline query.
|
||||
InlineQueryResult interface {
|
||||
ResultID() string
|
||||
ResultType() string
|
||||
ResultReplyMarkup() *InlineKeyboardMarkup
|
||||
}
|
||||
|
||||
// InlineQueryResultArticle represents a link to an article or web page.
|
||||
InlineQueryResultArticle struct {
|
||||
// Type of the result, must be article
|
||||
|
@ -740,6 +747,12 @@ type (
|
|||
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
||||
}
|
||||
|
||||
// InputMessageContent represents the content of a message to be sent as a result
|
||||
// of an inline query.
|
||||
InputMessageContent interface {
|
||||
IsInputMessageContent() bool
|
||||
}
|
||||
|
||||
// InputTextMessageContent represents the content of a text message to be
|
||||
// sent as the result of an inline query.
|
||||
InputTextMessageContent struct {
|
||||
|
|
|
@ -3,3 +3,10 @@ package telegram
|
|||
func (a *Animation) HasThumb() bool {
|
||||
return a != nil && a.Thumb != nil
|
||||
}
|
||||
|
||||
func (a *Animation) File() *File {
|
||||
return &File{
|
||||
FileID: a.FileID,
|
||||
FileSize: a.FileSize,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,3 +24,10 @@ func (a *Audio) HasTitle() bool {
|
|||
func (a *Audio) HasThumb() bool {
|
||||
return a != nil && a.Thumb != nil
|
||||
}
|
||||
|
||||
func (a *Audio) File() *File {
|
||||
return &File{
|
||||
FileID: a.FileID,
|
||||
FileSize: a.FileSize,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,3 +3,10 @@ package telegram
|
|||
func (d *Document) HasThumb() bool {
|
||||
return d != nil && d.Thumb != nil
|
||||
}
|
||||
|
||||
func (d *Document) File() *File {
|
||||
return &File{
|
||||
FileID: d.FileID,
|
||||
FileSize: d.FileSize,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,3 +207,243 @@ func NewInlineQueryResultVoice(resultID, voiceURL, title string) *InlineQueryRes
|
|||
Title: title,
|
||||
}
|
||||
}
|
||||
|
||||
func (iqra *InlineQueryResultArticle) ResultID() string {
|
||||
return iqra.ID
|
||||
}
|
||||
|
||||
func (iqra *InlineQueryResultArticle) ResultType() string {
|
||||
return iqra.Type
|
||||
}
|
||||
|
||||
func (iqra *InlineQueryResultArticle) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqra.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrp *InlineQueryResultPhoto) ResultID() string {
|
||||
return iqrp.ID
|
||||
}
|
||||
|
||||
func (iqrp *InlineQueryResultPhoto) ResultType() string {
|
||||
return iqrp.Type
|
||||
}
|
||||
|
||||
func (iqrp *InlineQueryResultPhoto) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrp.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrg *InlineQueryResultGif) ResultID() string {
|
||||
return iqrg.ID
|
||||
}
|
||||
|
||||
func (iqrg *InlineQueryResultGif) ResultType() string {
|
||||
return iqrg.Type
|
||||
}
|
||||
|
||||
func (iqrg *InlineQueryResultGif) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrg.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrm4g *InlineQueryResultMpeg4Gif) ResultID() string {
|
||||
return iqrm4g.ID
|
||||
}
|
||||
|
||||
func (iqrm4g *InlineQueryResultMpeg4Gif) ResultType() string {
|
||||
return iqrm4g.Type
|
||||
}
|
||||
|
||||
func (iqrm4g *InlineQueryResultMpeg4Gif) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrm4g.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrv *InlineQueryResultVideo) ResultID() string {
|
||||
return iqrv.ID
|
||||
}
|
||||
|
||||
func (iqrv *InlineQueryResultVideo) ResultType() string {
|
||||
return iqrv.Type
|
||||
}
|
||||
|
||||
func (iqrv *InlineQueryResultVideo) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrv.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqra *InlineQueryResultAudio) ResultID() string {
|
||||
return iqra.ID
|
||||
}
|
||||
|
||||
func (iqra *InlineQueryResultAudio) ResultType() string {
|
||||
return iqra.Type
|
||||
}
|
||||
|
||||
func (iqra *InlineQueryResultAudio) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqra.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrv *InlineQueryResultVoice) ResultID() string {
|
||||
return iqrv.ID
|
||||
}
|
||||
|
||||
func (iqrv *InlineQueryResultVoice) ResultType() string {
|
||||
return iqrv.Type
|
||||
}
|
||||
|
||||
func (iqrv *InlineQueryResultVoice) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrv.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrd *InlineQueryResultDocument) ResultID() string {
|
||||
return iqrd.ID
|
||||
}
|
||||
|
||||
func (iqrd *InlineQueryResultDocument) ResultType() string {
|
||||
return iqrd.Type
|
||||
}
|
||||
|
||||
func (iqrd *InlineQueryResultDocument) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrd.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrl *InlineQueryResultLocation) ResultID() string {
|
||||
return iqrl.ID
|
||||
}
|
||||
|
||||
func (iqrl *InlineQueryResultLocation) ResultType() string {
|
||||
return iqrl.Type
|
||||
}
|
||||
|
||||
func (iqrl *InlineQueryResultLocation) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrl.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrv *InlineQueryResultVenue) ResultID() string {
|
||||
return iqrv.ID
|
||||
}
|
||||
|
||||
func (iqrv *InlineQueryResultVenue) ResultType() string {
|
||||
return iqrv.Type
|
||||
}
|
||||
|
||||
func (iqrv *InlineQueryResultVenue) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrv.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrc *InlineQueryResultContact) ResultID() string {
|
||||
return iqrc.ID
|
||||
}
|
||||
|
||||
func (iqrc *InlineQueryResultContact) ResultType() string {
|
||||
return iqrc.Type
|
||||
}
|
||||
|
||||
func (iqrc *InlineQueryResultContact) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrc.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrg *InlineQueryResultGame) ResultID() string {
|
||||
return iqrg.ID
|
||||
}
|
||||
|
||||
func (iqrg *InlineQueryResultGame) ResultType() string {
|
||||
return iqrg.Type
|
||||
}
|
||||
|
||||
func (iqrg *InlineQueryResultGame) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrg.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrcp *InlineQueryResultCachedPhoto) ResultID() string {
|
||||
return iqrcp.ID
|
||||
}
|
||||
|
||||
func (iqrcp *InlineQueryResultCachedPhoto) ResultType() string {
|
||||
return iqrcp.Type
|
||||
}
|
||||
|
||||
func (iqrcp *InlineQueryResultCachedPhoto) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrcp.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrcg *InlineQueryResultCachedGif) ResultID() string {
|
||||
return iqrcg.ID
|
||||
}
|
||||
|
||||
func (iqrcg *InlineQueryResultCachedGif) ResultType() string {
|
||||
return iqrcg.Type
|
||||
}
|
||||
|
||||
func (iqrcg *InlineQueryResultCachedGif) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrcg.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrcm4g *InlineQueryResultCachedMpeg4Gif) ResultID() string {
|
||||
return iqrcm4g.ID
|
||||
}
|
||||
|
||||
func (iqrcm4g *InlineQueryResultCachedMpeg4Gif) ResultType() string {
|
||||
return iqrcm4g.Type
|
||||
}
|
||||
|
||||
func (iqrcm4g *InlineQueryResultCachedMpeg4Gif) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrcm4g.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrcs *InlineQueryResultCachedSticker) ResultID() string {
|
||||
return iqrcs.ID
|
||||
}
|
||||
|
||||
func (iqrcs *InlineQueryResultCachedSticker) ResultType() string {
|
||||
return iqrcs.Type
|
||||
}
|
||||
|
||||
func (iqrcs *InlineQueryResultCachedSticker) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrcs.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrcd *InlineQueryResultCachedDocument) ResultID() string {
|
||||
return iqrcd.ID
|
||||
}
|
||||
|
||||
func (iqrcd *InlineQueryResultCachedDocument) ResultType() string {
|
||||
return iqrcd.Type
|
||||
}
|
||||
|
||||
func (iqrcd *InlineQueryResultCachedDocument) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrcd.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrcv *InlineQueryResultCachedVideo) ResultID() string {
|
||||
return iqrcv.ID
|
||||
}
|
||||
|
||||
func (iqrcv *InlineQueryResultCachedVideo) ResultType() string {
|
||||
return iqrcv.Type
|
||||
}
|
||||
|
||||
func (iqrcv *InlineQueryResultCachedVideo) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrcv.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrcv *InlineQueryResultCachedVoice) ResultID() string {
|
||||
return iqrcv.ID
|
||||
}
|
||||
|
||||
func (iqrcv *InlineQueryResultCachedVoice) ResultType() string {
|
||||
return iqrcv.Type
|
||||
}
|
||||
|
||||
func (iqrcv *InlineQueryResultCachedVoice) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrcv.ReplyMarkup
|
||||
}
|
||||
|
||||
func (iqrca *InlineQueryResultCachedAudio) ResultID() string {
|
||||
return iqrca.ID
|
||||
}
|
||||
|
||||
func (iqrca *InlineQueryResultCachedAudio) ResultType() string {
|
||||
return iqrca.Type
|
||||
}
|
||||
|
||||
func (iqrca *InlineQueryResultCachedAudio) ResultReplyMarkup() *InlineKeyboardMarkup {
|
||||
return iqrca.ReplyMarkup
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package telegram
|
||||
|
||||
func (ima *InputMediaAnimation) File() string { return ima.Media }
|
||||
func (ima *InputMediaAnimation) InputMediaCaption() string { return ima.Caption }
|
||||
func (ima *InputMediaAnimation) InputMediaParseMode() string { return ima.ParseMode }
|
||||
func (ima *InputMediaAnimation) InputMediaType() string { return ima.Type }
|
||||
|
||||
func (imd *InputMediaDocument) File() string { return imd.Media }
|
||||
func (imd *InputMediaDocument) InputMediaCaption() string { return imd.Caption }
|
||||
func (imd *InputMediaDocument) InputMediaParseMode() string { return imd.ParseMode }
|
||||
func (imd *InputMediaDocument) InputMediaType() string { return imd.Type }
|
||||
|
||||
func (ima *InputMediaAudio) File() string { return ima.Media }
|
||||
func (ima *InputMediaAudio) InputMediaCaption() string { return ima.Caption }
|
||||
func (ima *InputMediaAudio) InputMediaParseMode() string { return ima.ParseMode }
|
||||
func (ima *InputMediaAudio) InputMediaType() string { return ima.Type }
|
||||
|
||||
func (imp *InputMediaPhoto) File() string { return imp.Media }
|
||||
func (imp *InputMediaPhoto) InputMediaCaption() string { return imp.Caption }
|
||||
func (imp *InputMediaPhoto) InputMediaParseMode() string { return imp.ParseMode }
|
||||
func (imp *InputMediaPhoto) InputMediaType() string { return imp.Type }
|
||||
|
||||
func (imv *InputMediaVideo) File() string { return imv.Media }
|
||||
func (imv *InputMediaVideo) InputMediaCaption() string { return imv.Caption }
|
||||
func (imv *InputMediaVideo) InputMediaParseMode() string { return imv.ParseMode }
|
||||
func (imv *InputMediaVideo) InputMediaType() string { return imv.Type }
|
|
@ -0,0 +1,9 @@
|
|||
package telegram
|
||||
|
||||
func (itmc *InputTextMessageContent) IsInputMessageContent() bool { return true }
|
||||
|
||||
func (ilmc *InputLocationMessageContent) IsInputMessageContent() bool { return true }
|
||||
|
||||
func (ivmc *InputVenueMessageContent) IsInputMessageContent() bool { return true }
|
||||
|
||||
func (icmc *InputContactMessageContent) IsInputMessageContent() bool { return true }
|
|
@ -35,3 +35,10 @@ func (s *Sticker) HasThumb() bool {
|
|||
func (s *Sticker) IsMask() bool {
|
||||
return s != nil && s.MaskPosition != nil
|
||||
}
|
||||
|
||||
func (s *Sticker) File() *File {
|
||||
return &File{
|
||||
FileID: s.FileID,
|
||||
FileSize: s.FileSize,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,3 +3,10 @@ package telegram
|
|||
func (v *Video) HasThumb() bool {
|
||||
return v != nil && v.Thumb != nil
|
||||
}
|
||||
|
||||
func (v *Video) File() *File {
|
||||
return &File{
|
||||
FileID: v.FileID,
|
||||
FileSize: v.FileSize,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,3 +3,10 @@ package telegram
|
|||
func (vn *VideoNote) HasThumb() bool {
|
||||
return vn != nil && vn.Thumb != nil
|
||||
}
|
||||
|
||||
func (vn *VideoNote) File() *File {
|
||||
return &File{
|
||||
FileID: vn.FileID,
|
||||
FileSize: vn.FileSize,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue