chat actions and file uploading; v0.3.7

This commit is contained in:
2026-02-04 11:13:26 +03:00
parent c71aad0c79
commit 913fa20e19
7 changed files with 360 additions and 29 deletions

View File

@@ -73,21 +73,36 @@ func (b *Bot) SendMessage(params *SendMessageP) (*Message, error) {
return req.Do(b)
}
type SendPhotoBaseP struct {
BusinessConnectionID string `json:"business_connection_id,omitempty"`
ChatID int `json:"chat_id"`
MessageThreadID int `json:"message_thread_id,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
Caption string `json:"caption,omitempty"`
CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
HasSpoiler bool `json:"has_spoiler,omitempty"`
DisableNotifications bool `json:"disable_notifications,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
type SendPhotoP struct {
BusinessConnectionID string `json:"business_connection_id,omitempty"`
ChatID int `json:"chat_id"`
MessageThreadID int `json:"message_thread_id,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
Photo string `json:"photo"`
Caption string `json:"caption,omitempty"`
CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`
ShowCaptionAboveMedia bool `json:"show_caption_above_media"`
HasSpoiler bool `json:"has_spoiler"`
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
HasSpoiler bool `json:"has_spoiler,omitempty"`
DisableNotifications bool `json:"disable_notifications,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyMarkup InlineKeyboardMarkup `json:"reply_markup,omitempty"`
Photo string `json:"photo"`
}
func (b *Bot) SendPhoto(params *SendPhotoP) (*Message, error) {
@@ -164,3 +179,19 @@ func (b *Bot) GetFile(params *GetFileP) (*File, error) {
req := NewRequest[File]("getFile", params)
return req.Do(b)
}
type SendChatActionP struct {
BusinessConnectionID string `json:"business_connection_id,omitempty"`
ChatID int `json:"chat_id"`
MessageThreadID int `json:"message_thread_id,omitempty"`
Action ChatActions `json:"action"`
}
func (b *Bot) SendChatAction(params SendChatActionP) (bool, error) {
req := NewRequest[bool]("sendChatAction", params)
res, err := req.Do(b)
if err != nil {
return false, err
}
return *res, err
}