WIP v0.5.0
This commit is contained in:
@@ -177,26 +177,24 @@ type ChatMember struct {
|
|||||||
CanAddWebPagePreview *bool `json:"can_add_web_page_preview,omitempty"`
|
CanAddWebPagePreview *bool `json:"can_add_web_page_preview,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type BaseChatBoostSource struct {
|
type ChatBoostSource struct {
|
||||||
Source string `json:"source"`
|
Source string `json:"source"`
|
||||||
User User `json:"user"`
|
User User `json:"user"`
|
||||||
|
|
||||||
|
// Giveaway
|
||||||
|
GiveawayMessageID *int `json:"giveaway_message_id,omitempty"`
|
||||||
|
PrizeStarCount *int `json:"prize_star_count,omitempty"`
|
||||||
|
IsUnclaimed *bool `json:"is_unclaimed,omitempty"`
|
||||||
}
|
}
|
||||||
type ChatBoostSourcePremium struct{ BaseChatBoostSource }
|
|
||||||
type ChatBoostSourceGiftCode struct{ BaseChatBoostSource }
|
type ChatBoost struct {
|
||||||
type ChatBoostSourceGiveaway struct {
|
BoostID int `json:"boost_id"`
|
||||||
BaseChatBoostSource
|
AddDate int `json:"add_date"`
|
||||||
GiveawayMessageID int `json:"giveaway_message_id"`
|
ExpirationDate int `json:"expiration_date"`
|
||||||
PrizeStarCount *int `json:"prize_star_count,omitempty"`
|
Source ChatBoostSource `json:"source"`
|
||||||
IsUnclaimed bool `json:"is_unclaimed"`
|
|
||||||
}
|
|
||||||
type ChatBoost[T BaseChatBoostSource] struct {
|
|
||||||
BoostID int `json:"boost_id"`
|
|
||||||
AddDate int `json:"add_date"`
|
|
||||||
ExpirationDate int `json:"expiration_date"`
|
|
||||||
Source T `json:"source"`
|
|
||||||
}
|
}
|
||||||
type UserChatBoosts struct {
|
type UserChatBoosts struct {
|
||||||
Boosts []ChatBoost[BaseChatBoostSource] `json:"boosts"`
|
Boosts []ChatBoost `json:"boosts"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChatAdministratorRights struct {
|
type ChatAdministratorRights struct {
|
||||||
@@ -218,3 +216,15 @@ type ChatAdministratorRights struct {
|
|||||||
CanManageTopics *bool `json:"can_manage_topics,omitempty"`
|
CanManageTopics *bool `json:"can_manage_topics,omitempty"`
|
||||||
CanManageDirectMessages *bool `json:"can_manage_direct_messages,omitempty"`
|
CanManageDirectMessages *bool `json:"can_manage_direct_messages,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ChatBoostUpdated struct {
|
||||||
|
Chat Chat `json:"chat"`
|
||||||
|
Boost ChatBoost `json:"boost"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ChatBoostRemoved struct {
|
||||||
|
Chat Chat `json:"chat"`
|
||||||
|
BoostID string `json:"boost_id"`
|
||||||
|
RemoveDate int `json:"remove_date"`
|
||||||
|
Source ChatBoostSource `json:"source"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,9 +13,10 @@ type EmptyParams struct{}
|
|||||||
var NoParams = EmptyParams{}
|
var NoParams = EmptyParams{}
|
||||||
|
|
||||||
type UpdateParams struct {
|
type UpdateParams struct {
|
||||||
Offset int `json:"offset"`
|
Offset *int `json:"offset,omitempty"`
|
||||||
Timeout int `json:"timeout"`
|
Limit *int `json:"limit,omitempty"`
|
||||||
AllowedUpdates []string `json:"allowed_updates"`
|
Timeout *int `json:"timeout,omitempty"`
|
||||||
|
AllowedUpdates []UpdateType `json:"allowed_updates"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) GetMe() (User, error) {
|
func (api *Api) GetMe() (User, error) {
|
||||||
|
|||||||
@@ -1,5 +1,35 @@
|
|||||||
package tgapi
|
package tgapi
|
||||||
|
|
||||||
|
type UpdateType string
|
||||||
|
|
||||||
|
const (
|
||||||
|
UpdateTypeMessage UpdateType = "message"
|
||||||
|
UpdateTypeEditedMessage UpdateType = "edited_message"
|
||||||
|
UpdateTypeChannelPost UpdateType = "channel_post"
|
||||||
|
UpdateTypeEditedChannelPost UpdateType = "edited_channel_post"
|
||||||
|
UpdateTypeMessageReaction UpdateType = "message_reaction"
|
||||||
|
UpdateTypeMessageReactionCount UpdateType = "message_reaction_count"
|
||||||
|
|
||||||
|
UpdateTypeBusinessConnection UpdateType = "business_connection"
|
||||||
|
UpdateTypeBusinessMessage UpdateType = "business_message"
|
||||||
|
UpdateTypeEditedBusinessMessage UpdateType = "edited_business_message"
|
||||||
|
UpdateTypeDeletedBusinessMessage UpdateType = "deleted_business_message"
|
||||||
|
|
||||||
|
UpdateTypeInlineQuery UpdateType = "inline_query"
|
||||||
|
UpdateTypeChosenInlineResult UpdateType = "chosen_inline_result"
|
||||||
|
UpdateTypeCallbackQuery UpdateType = "callback_query"
|
||||||
|
UpdateTypeShippingQuery UpdateType = "shipping_query"
|
||||||
|
UpdateTypePreCheckoutQuery UpdateType = "pre_checkout_query"
|
||||||
|
UpdateTypePurchasedPaidMedia UpdateType = "purchased_paid_media"
|
||||||
|
UpdateTypePoll UpdateType = "poll"
|
||||||
|
UpdateTypePollAnswer UpdateType = "poll_answer"
|
||||||
|
UpdateTypeMyChatMember UpdateType = "my_chat_member"
|
||||||
|
UpdateTypeChatMember UpdateType = "chat_member"
|
||||||
|
UpdateTypeChatJoinRequest UpdateType = "chat_join_request"
|
||||||
|
UpdateTypeChatBoost UpdateType = "chat_boost"
|
||||||
|
UpdateTypeRemovedChatBoost UpdateType = "removed_chat_boost"
|
||||||
|
)
|
||||||
|
|
||||||
type Update struct {
|
type Update struct {
|
||||||
UpdateID int `json:"update_id"`
|
UpdateID int `json:"update_id"`
|
||||||
Message *Message `json:"message,omitempty"`
|
Message *Message `json:"message,omitempty"`
|
||||||
@@ -21,13 +51,13 @@ type Update struct {
|
|||||||
PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`
|
PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`
|
||||||
PurchasedPaidMedia *PaidMediaPurchased `json:"purchased_paid_media,omitempty"`
|
PurchasedPaidMedia *PaidMediaPurchased `json:"purchased_paid_media,omitempty"`
|
||||||
|
|
||||||
Poll any `json:"poll,omitempty"`
|
Poll *Poll `json:"poll,omitempty"`
|
||||||
PollAnswer any `json:"poll_answer,omitempty"`
|
PollAnswer *PollAnswer `json:"poll_answer,omitempty"`
|
||||||
MyChatMember any `json:"my_chat_member,omitempty"`
|
MyChatMember *ChatMemberUpdated `json:"my_chat_member,omitempty"`
|
||||||
ChatMember any `json:"chat_member,omitempty"`
|
ChatMember *ChatMemberUpdated `json:"chat_member,omitempty"`
|
||||||
ChatJoinRequest any `json:"chat_join_request,omitempty"`
|
ChatJoinRequest *ChatJoinRequest `json:"chat_join_request,omitempty"`
|
||||||
ChatBoost any `json:"chat_boost,omitempty"`
|
ChatBoost *ChatBoostUpdated `json:"chat_boost,omitempty"`
|
||||||
RemovedChatBoost any `json:"removed_chat_boost,omitempty"`
|
RemovedChatBoost *ChatBoostRemoved `json:"removed_chat_boost,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type InlineQuery struct {
|
type InlineQuery struct {
|
||||||
@@ -102,6 +132,54 @@ type Audio struct {
|
|||||||
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
|
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PollOption struct {
|
||||||
|
Text string `json:"text"`
|
||||||
|
TextEntities []MessageEntity `json:"text_entities"`
|
||||||
|
VoterCount int `json:"voter_count"`
|
||||||
|
}
|
||||||
|
type Poll struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Question string `json:"question"`
|
||||||
|
QuestionEntities []MessageEntity `json:"question_entities"`
|
||||||
|
Options []PollOption `json:"options"`
|
||||||
|
TotalVoterCount int `json:"total_voter_count"`
|
||||||
|
IsClosed bool `json:"is_closed"`
|
||||||
|
IsAnonymous bool `json:"is_anonymous"`
|
||||||
|
Type PollType `json:"type"`
|
||||||
|
|
||||||
|
AllowsMultipleAnswers bool `json:"allows_multiple_answers"`
|
||||||
|
CorrectOptionID *int `json:"correct_option_id,omitempty"`
|
||||||
|
Explanation *string `json:"explanation,omitempty"`
|
||||||
|
ExplanationEntities []MessageEntity `json:"explanation_entities,omitempty"`
|
||||||
|
OpenPeriod int `json:"open_period,omitempty"`
|
||||||
|
CloseDate int `json:"close_date,omitempty"`
|
||||||
|
}
|
||||||
|
type PollAnswer struct {
|
||||||
|
PollID string `json:"poll_id"`
|
||||||
|
VoterChat Chat `json:"voter_chat"`
|
||||||
|
User User `json:"user"`
|
||||||
|
OptionIDS []int `json:"option_ids"`
|
||||||
|
}
|
||||||
|
type ChatMemberUpdated struct {
|
||||||
|
Chat Chat `json:"chat"`
|
||||||
|
From User `json:"from"`
|
||||||
|
Date int64 `json:"date"`
|
||||||
|
OldChatMember ChatMember `json:"old_chat_member"`
|
||||||
|
NewChatMember ChatMember `json:"new_chat_member"`
|
||||||
|
InviteLink *ChatInviteLink `json:"invite_link,omitempty"`
|
||||||
|
ViaJoinRequest *bool `json:"via_join_request,omitempty"`
|
||||||
|
ViaChatFolderInviteLink *bool `json:"via_chat_folder_invite_link,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ChatJoinRequest struct {
|
||||||
|
Chat Chat `json:"chat"`
|
||||||
|
From User `json:"from"`
|
||||||
|
UserChatID int `json:"user_chat_id"`
|
||||||
|
Date int64 `json:"date"`
|
||||||
|
Bio *string `json:"bio,omitempty"`
|
||||||
|
InviteLink *ChatInviteLink `json:"invite_link,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type Location struct {
|
type Location struct {
|
||||||
Latitude float64 `json:"latitude"`
|
Latitude float64 `json:"latitude"`
|
||||||
Longitude float64 `json:"longitude"`
|
Longitude float64 `json:"longitude"`
|
||||||
|
|||||||
Reference in New Issue
Block a user