Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,20 @@ func (b *Bot) StopPoll(ctx context.Context, params *StopPollParams) (*models.Pol
return result, err
}

// ApproveSuggestedPost https://core.telegram.org/bots/api#approvesuggestedpost
func (b *Bot) ApproveSuggestedPost(ctx context.Context, params *ApproveSuggestedPostParams) (bool, error) {
var result bool
err := b.rawRequest(ctx, "approveSuggestedPost", params, &result)
return result, err
}

// DeclineSuggestedPost https://core.telegram.org/bots/api#declinesuggestedpost
func (b *Bot) DeclineSuggestedPost(ctx context.Context, params *DeclineSuggestedPostParams) (bool, error) {
var result bool
err := b.rawRequest(ctx, "declineSuggestedPost", params, &result)
return result, err
}

// DeleteMessage https://core.telegram.org/bots/api#deletemessage
func (b *Bot) DeleteMessage(ctx context.Context, params *DeleteMessageParams) (bool, error) {
var result bool
Expand Down
643 changes: 348 additions & 295 deletions methods_params.go

Large diffs are not rendered by default.

48 changes: 26 additions & 22 deletions models/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,22 @@ type ChatInviteLink struct {

// ChatAdministratorRights https://core.telegram.org/bots/api#chatadministratorrights
type ChatAdministratorRights struct {
IsAnonymous bool `json:"is_anonymous"`
CanManageChat bool `json:"can_manage_chat"`
CanDeleteMessages bool `json:"can_delete_messages"`
CanManageVideoChats bool `json:"can_manage_video_chats"`
CanRestrictMembers bool `json:"can_restrict_members"`
CanPromoteMembers bool `json:"can_promote_members"`
CanChangeInfo bool `json:"can_change_info"`
CanInviteUsers bool `json:"can_invite_users"`
CanPostMessages bool `json:"can_post_messages,omitempty"`
CanEditMessages bool `json:"can_edit_messages,omitempty"`
CanPinMessages bool `json:"can_pin_messages,omitempty"`
CanPostStories bool `json:"can_post_stories,omitempty"`
CanEditStories bool `json:"can_edit_stories,omitempty"`
CanDeleteStories bool `json:"can_delete_stories,omitempty"`
CanManageTopics bool `json:"can_manage_topics,omitempty"`
IsAnonymous bool `json:"is_anonymous"`
CanManageChat bool `json:"can_manage_chat"`
CanDeleteMessages bool `json:"can_delete_messages"`
CanManageVideoChats bool `json:"can_manage_video_chats"`
CanRestrictMembers bool `json:"can_restrict_members"`
CanPromoteMembers bool `json:"can_promote_members"`
CanChangeInfo bool `json:"can_change_info"`
CanInviteUsers bool `json:"can_invite_users"`
CanPostMessages bool `json:"can_post_messages,omitempty"`
CanEditMessages bool `json:"can_edit_messages,omitempty"`
CanPinMessages bool `json:"can_pin_messages,omitempty"`
CanPostStories bool `json:"can_post_stories,omitempty"`
CanEditStories bool `json:"can_edit_stories,omitempty"`
CanDeleteStories bool `json:"can_delete_stories,omitempty"`
CanManageTopics bool `json:"can_manage_topics,omitempty"`
CanManageDirectMessages bool `json:"can_manage_direct_messages,omitempty"`
}

// ChatPermissions https://core.telegram.org/bots/api#chatpermissions
Expand Down Expand Up @@ -91,13 +92,14 @@ const (

// Chat https://core.telegram.org/bots/api#chat
type Chat struct {
ID int64 `json:"id"`
Type ChatType `json:"type"`
Title string `json:"title,omitempty"`
Username string `json:"username,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
IsForum bool `json:"is_forum,omitempty"`
ID int64 `json:"id"`
Type ChatType `json:"type"`
Title string `json:"title,omitempty"`
Username string `json:"username,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
IsForum bool `json:"is_forum,omitempty"`
IsDirectMessages bool `json:"is_direct_messages,omitempty"`
}

// ChatFullInfo https://core.telegram.org/bots/api#chatfullinfo
Expand All @@ -109,13 +111,15 @@ type ChatFullInfo struct {
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
IsForum bool `json:"is_forum,omitempty"`
IsDirectMessages bool `json:"is_direct_messages,omitempty"`
Photo *ChatPhoto `json:"photo,omitempty"`
ActiveUsernames []string `json:"active_usernames,omitempty"`
Birthdate Birthdate `json:"birthdate,omitempty"`
BusinessIntro *BusinessIntro `json:"business_intro,omitempty"`
BusinessLocation *BusinessLocation `json:"business_location,omitempty"`
BusinessOpeningHours *BusinessOpeningHours `json:"business_opening_hours,omitempty"`
PersonalChat *Chat `json:"personal_chat,omitempty"`
ParentChat *Chat `json:"parent_chat,omitempty"`
AvailableReactions []ReactionType `json:"available_reactions,omitempty"`
AccentColorID int `json:"accent_color_id,omitempty"`
MaxReactionCount int `json:"max_reaction_count"`
Expand Down
39 changes: 20 additions & 19 deletions models/chat_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,25 +113,26 @@ type ChatMemberOwner struct {

// ChatMemberAdministrator https://core.telegram.org/bots/api#chatmemberadministrator
type ChatMemberAdministrator struct {
Status ChatMemberType `json:"status"` // The member's status in the chat, always “administrator”
User User `json:"user"`
CanBeEdited bool `json:"can_be_edited"`
IsAnonymous bool `json:"is_anonymous"`
CanManageChat bool `json:"can_manage_chat"`
CanDeleteMessages bool `json:"can_delete_messages"`
CanManageVideoChats bool `json:"can_manage_video_chats"`
CanRestrictMembers bool `json:"can_restrict_members"`
CanPromoteMembers bool `json:"can_promote_members"`
CanChangeInfo bool `json:"can_change_info"`
CanInviteUsers bool `json:"can_invite_users"`
CanPostMessages bool `json:"can_post_messages,omitempty"`
CanEditMessages bool `json:"can_edit_messages,omitempty"`
CanPinMessages bool `json:"can_pin_messages,omitempty"`
CanPostStories bool `json:"can_post_stories,omitempty"`
CanEditStories bool `json:"can_edit_stories,omitempty"`
CanDeleteStories bool `json:"can_delete_stories,omitempty"`
CanManageTopics bool `json:"can_manage_topics,omitempty"`
CustomTitle string `json:"custom_title,omitempty"`
Status ChatMemberType `json:"status"` // The member's status in the chat, always “administrator”
User User `json:"user"`
CanBeEdited bool `json:"can_be_edited"`
IsAnonymous bool `json:"is_anonymous"`
CanManageChat bool `json:"can_manage_chat"`
CanDeleteMessages bool `json:"can_delete_messages"`
CanManageVideoChats bool `json:"can_manage_video_chats"`
CanRestrictMembers bool `json:"can_restrict_members"`
CanPromoteMembers bool `json:"can_promote_members"`
CanChangeInfo bool `json:"can_change_info"`
CanInviteUsers bool `json:"can_invite_users"`
CanPostMessages bool `json:"can_post_messages,omitempty"`
CanEditMessages bool `json:"can_edit_messages,omitempty"`
CanPinMessages bool `json:"can_pin_messages,omitempty"`
CanPostStories bool `json:"can_post_stories,omitempty"`
CanEditStories bool `json:"can_edit_stories,omitempty"`
CanDeleteStories bool `json:"can_delete_stories,omitempty"`
CanManageTopics bool `json:"can_manage_topics,omitempty"`
CanManageDirectMessages bool `json:"can_manage_direct_messages,omitempty"`
CustomTitle string `json:"custom_title,omitempty"`
}

// ChatMemberMember https://core.telegram.org/bots/api#chatmembermember
Expand Down
14 changes: 8 additions & 6 deletions models/gift.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Gift struct {
UpgradeStarCount int `json:"upgrade_star_count,omitempty"`
TotalCount int `json:"total_count,omitempty"`
RemainingCount int `json:"remaining_count,omitempty"`
PublisherChat *Chat `json:"publisher_chat,omitempty"`
}

// AcceptedGiftTypes https://core.telegram.org/bots/api#acceptedgifttypes
Expand Down Expand Up @@ -103,12 +104,13 @@ type OwnedGifts struct {

// UniqueGift https://core.telegram.org/bots/api#uniquegift
type UniqueGift struct {
BaseName string `json:"base_name"`
Name string `json:"name"`
Number int `json:"number"`
Model UniqueGiftModel `json:"model"`
Symbol UniqueGiftSymbol `json:"symbol"`
Backdrop UniqueGiftBackdrop `json:"backdrop"`
BaseName string `json:"base_name"`
Name string `json:"name"`
Number int `json:"number"`
Model UniqueGiftModel `json:"model"`
Symbol UniqueGiftSymbol `json:"symbol"`
Backdrop UniqueGiftBackdrop `json:"backdrop"`
PublisherChat *Chat `json:"publisher_chat,omitempty"`
}

// UniqueGiftModel https://core.telegram.org/bots/api#uniquegiftmodel
Expand Down
15 changes: 15 additions & 0 deletions models/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ type MessageAutoDeleteTimerChanged struct {
type Message struct {
ID int `json:"message_id"`
MessageThreadID int `json:"message_thread_id,omitempty"`
DirectMessagesTopic *DirectMessagesTopic `json:"direct_messages_topic,omitempty"`
From *User `json:"from,omitempty"`
SenderChat *Chat `json:"sender_chat,omitempty"`
SenderBoostCount int `json:"sender_boost_count,omitempty"`
Expand All @@ -86,16 +87,19 @@ type Message struct {
ExternalReply *ExternalReplyInfo `json:"external_reply,omitempty"`
Quote *TextQuote `json:"quote,omitempty"`
ReplyToStore *Story `json:"reply_to_store,omitempty"`
ReplyToChecklistTaskID int `json:"reply_to_checklist_task_id,omitempty"`
ViaBot *User `json:"via_bot,omitempty"`
EditDate int `json:"edit_date,omitempty"`
HasProtectedContent bool `json:"has_protected_content,omitempty"`
IsFromOffline bool `json:"is_from_offline,omitempty"`
IsPaidPost bool `json:"is_paid_post,omitempty"`
MediaGroupID string `json:"media_group_id,omitempty"`
AuthorSignature string `json:"author_signature,omitempty"`
PaidStarCount int `json:"paid_star_count,omitempty"`
Text string `json:"text,omitempty"`
Entities []MessageEntity `json:"entities,omitempty"`
LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info,omitempty"`
EffectID string `json:"effect_id,omitempty"`
Animation *Animation `json:"animation,omitempty"`
Audio *Audio `json:"audio,omitempty"`
Expand Down Expand Up @@ -157,6 +161,11 @@ type Message struct {
GiveawayWinners *GiveawayWinners `json:"giveaway_winners,omitempty"`
GiveawayCompleted *GiveawayCompleted `json:"giveaway_completed,omitempty"`
PaidMessagePriceChanged *PaidMessagePriceChanged `json:"paid_message_price_changed,omitempty"`
SuggestedPostApproved *SuggestedPostApproved `json:"suggested_post_approved,omitempty"`
SuggestedPostApprovalFailed *SuggestedPostApprovalFailed `json:"suggested_post_approval_failed,omitempty"`
SuggestedPostDeclined *SuggestedPostDeclined `json:"suggested_post_declined,omitempty"`
SuggestedPostPaid *SuggestedPostPaid `json:"suggested_post_paid,omitempty"`
SuggestedPostRefunded *SuggestedPostRefunded `json:"suggested_post_refunded,omitempty"`
VoiceChatScheduled *VoiceChatScheduled `json:"voice_chat_scheduled,omitempty"`
VoiceChatStarted *VoiceChatStarted `json:"voice_chat_started,omitempty"`
VoiceChatEnded *VoiceChatEnded `json:"voice_chat_ended,omitempty"`
Expand All @@ -170,3 +179,9 @@ type PreparedInlineMessage struct {
ID string `json:"id"`
ExpirationDate int `json:"expiration_date"`
}

// DirectMessagesTopic https://core.telegram.org/bots/api#directmessagestopic
type DirectMessagesTopic struct {
TopicID int `json:"topic_id"`
User *User `json:"user,omitempty"`
}
1 change: 1 addition & 0 deletions models/reply.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type ReplyParameters struct {
QuoteParseMode ParseMode `json:"quote_parse_mode,omitempty"`
QuoteEntities []MessageEntity `json:"quote_entities,omitempty"`
QuotePosition int `json:"quote_position,omitempty"`
ChecklistTaskID int `json:"checklist_task_id,omitempty"`
}

// MessageOriginType https://core.telegram.org/bots/api#messageorigin
Expand Down
53 changes: 53 additions & 0 deletions models/suggested_post.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package models

// SuggestedPostParameters https://core.telegram.org/bots/api#suggestedpostparameters
type SuggestedPostParameters struct {
Price *SuggestedPostPrice `json:"price,omitempty"`
SendDate int `json:"send_date,omitempty"`
}

// SuggestedPostPrice https://core.telegram.org/bots/api#suggestedpostprice
type SuggestedPostPrice struct {
Currency string `json:"currency"`
Amount int `json:"amount"`
}

// SuggestedPostInfo https://core.telegram.org/bots/api#suggestedpostinfo
type SuggestedPostInfo struct {
State string `json:"state"`
Price *SuggestedPostPrice `json:"price,omitempty"`
SendDate int `json:"send_date,omitempty"`
}

// SuggestedPostApproved https://core.telegram.org/bots/api#suggestedpostapproved
type SuggestedPostApproved struct {
SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`
Price *SuggestedPostPrice `json:"price,omitempty"`
SendDate int `json:"send_date,omitempty"`
}

// SuggestedPostApprovalFailed https://core.telegram.org/bots/api#suggestedpostapprovalfailed
type SuggestedPostApprovalFailed struct {
SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`
Price *SuggestedPostPrice `json:"price,omitempty"`
}

// SuggestedPostDeclined https://core.telegram.org/bots/api#suggestedpostdeclined
type SuggestedPostDeclined struct {
SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`
Comment string `json:"comment,omitempty"`
}

// SuggestedPostPaid https://core.telegram.org/bots/api#suggestedpostpaid
type SuggestedPostPaid struct {
SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`
Currency string `json:"currency"`
Amount int `json:"amount,omitempty"`
StarAmount *StarAmount `json:"star_amount,omitempty"`
}

// SuggestedPostRefunded https://core.telegram.org/bots/api#suggestedpostrefunded
type SuggestedPostRefunded struct {
SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`
Reason string `json:"reason"`
}
Loading