WIP v0.5.0
This commit is contained in:
242
tgapi/chat_types.go
Normal file
242
tgapi/chat_types.go
Normal file
@@ -0,0 +1,242 @@
|
||||
package tgapi
|
||||
|
||||
type Chat struct {
|
||||
ID int `json:"id"`
|
||||
Type string `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"`
|
||||
}
|
||||
|
||||
type ChatType string
|
||||
|
||||
const (
|
||||
ChatTypePrivate ChatType = "private"
|
||||
ChatTypeGroup ChatType = "group"
|
||||
ChatTypeSupergroup ChatType = "supergroup"
|
||||
ChatTypeChannel ChatType = "channel"
|
||||
)
|
||||
|
||||
type ChatFullInfo struct {
|
||||
ID int `json:"id"`
|
||||
Type ChatType `json:"type"`
|
||||
Title string `json:"title"`
|
||||
Username string `json:"username"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName string `json:"last_name"`
|
||||
IsForum bool `json:"is_forum"`
|
||||
IsDirectMessages bool `json:"is_direct_messages"`
|
||||
AccentColorID int `json:"accent_color_id"`
|
||||
MaxReactionCount int `json:"max_reaction_count"`
|
||||
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"`
|
||||
|
||||
AvailableReaction []BaseReaction `json:"available_reaction,omitempty"`
|
||||
|
||||
BackgroundCustomEmojiID *string `json:"background_custom_emoji_id,omitempty"`
|
||||
ProfileAccentColorID *int `json:"profile_accent_color_id,omitempty"`
|
||||
ProfileBackgroundCustomEmojiID *string `json:"profile_background_custom_emoji_id,omitempty"`
|
||||
EmojiStatusCustomEmojiID *string `json:"emoji_status_custom_emoji_id,omitempty"`
|
||||
EmojiStatusExpirationDate *int `json:"emoji_status_expiration_date,omitempty"`
|
||||
|
||||
Bio *string `json:"bio,omitempty"`
|
||||
HasPrivateForwards *bool `json:"has_private_forwards,omitempty"`
|
||||
HasRestrictedVoiceAndVideoMessages *bool `json:"has_restricted_voice_and_video_messages,omitempty"`
|
||||
JoinToSendMessages *bool `json:"join_to_send_messages,omitempty"`
|
||||
JoinByRequest *bool `json:"join_by_request,omitempty"`
|
||||
|
||||
Description *string `json:"description,omitempty"`
|
||||
InviteLink *string `json:"invite_link,omitempty"`
|
||||
PinnedMessage *Message `json:"pinned_message,omitempty"`
|
||||
Permissions *ChatPermissions `json:"permissions,omitempty"`
|
||||
AcceptedGiftTypes *AcceptedGiftTypes `json:"accepted_gift_types,omitempty"`
|
||||
|
||||
CanSendPaidMedia *bool `json:"can_send_paid_media,omitempty"`
|
||||
SlowModeDelay *int `json:"slow_mode_delay,omitempty"`
|
||||
UnrestrictedBoostCount *int `json:"unrestricted_boost_count,omitempty"`
|
||||
MessageAutoDeleteTime *int `json:"message_auto_delete_time,omitempty"`
|
||||
HasAggressiveAntiSpamEnabled *bool `json:"has_aggressive_anti_spam_enabled,omitempty"`
|
||||
HasHiddenMembers *bool `json:"has_hidden_members,omitempty"`
|
||||
HasProtectedContent *bool `json:"has_protected_content,omitempty"`
|
||||
HasVisibleHistory *bool `json:"has_visible_history,omitempty"`
|
||||
StickerSetName *string `json:"sticker_set_name,omitempty"`
|
||||
CanSetStickerSet *bool `json:"can_set_sticker_set,omitempty"`
|
||||
CustomEmojiStickerSetName *string `json:"custom_emoji_sticker_set_name,omitempty"`
|
||||
LinkedChatID *int `json:"linked_chat_id,omitempty"`
|
||||
|
||||
Location *ChatLocation `json:"location,omitempty"`
|
||||
Rating *UserRating `json:"rating,omitempty"`
|
||||
FirstProfileAudio *Audio `json:"first_profile_audio,omitempty"`
|
||||
UniqueGiftColors *UniqueGiftColors `json:"unique_gift_colors,omitempty"`
|
||||
PaidMessageStarCount *int `json:"paid_message_star_count,omitempty"`
|
||||
}
|
||||
|
||||
type ChatPhoto struct {
|
||||
SmallFileID string `json:"small_file_id"`
|
||||
SmallFileUniqueID string `json:"small_file_unique_id"`
|
||||
BigFileID string `json:"big_file_id"`
|
||||
BigFileUniqueID string `json:"big_file_unique_id"`
|
||||
}
|
||||
|
||||
type ChatPermissions struct {
|
||||
CanSendMessages bool `json:"can_send_messages"`
|
||||
CanSendAudios bool `json:"can_send_audios"`
|
||||
CanSendDocuments bool `json:"can_send_documents"`
|
||||
CanSendPhotos bool `json:"can_send_photos"`
|
||||
CanSendVideoNotes bool `json:"can_send_video_notes"`
|
||||
CanSendVoiceNotes bool `json:"can_send_voice_notes"`
|
||||
CanSendPolls bool `json:"can_send_polls"`
|
||||
CanSendOtherMessages bool `json:"can_send_other_messages"`
|
||||
CanAddWebPagePreview bool `json:"can_add_web_page_preview"`
|
||||
CanChangeInfo bool `json:"can_change_info"`
|
||||
CanInviteUsers bool `json:"can_invite_users"`
|
||||
CanPinMessages bool `json:"can_pin_messages"`
|
||||
CanManageTopics bool `json:"can_manage_topics"`
|
||||
}
|
||||
type ChatLocation struct {
|
||||
Location Location `json:"location"`
|
||||
Address string `json:"address"`
|
||||
}
|
||||
type ChatInviteLink struct {
|
||||
InviteLink string `json:"invite_link"`
|
||||
Creator User `json:"creator"`
|
||||
CreateJoinRequest bool `json:"create_join_request"`
|
||||
IsPrimary bool `json:"is_primary"`
|
||||
IsRevoked bool `json:"is_revoked"`
|
||||
|
||||
Name *string `json:"name,omitempty"`
|
||||
ExpireDate *int `json:"expire_date,omitempty"`
|
||||
MemberLimit *int `json:"member_limit,omitempty"`
|
||||
PendingJoinRequestCount *int `json:"pending_join_request_count,omitempty"`
|
||||
SubscriptionPeriod *int `json:"subscription_period,omitempty"`
|
||||
SubscriptionPrice *int `json:"subscription_price,omitempty"`
|
||||
}
|
||||
|
||||
type ChatMemberStatusType string
|
||||
|
||||
const (
|
||||
ChatMemberStatusOwner ChatMemberStatusType = "owner"
|
||||
ChatMemberStatusAdministrator ChatMemberStatusType = "administrator"
|
||||
ChatMemberStatusMember ChatMemberStatusType = "member"
|
||||
ChatMemberStatusRestricted ChatMemberStatusType = "restricted"
|
||||
ChatMemberStatusLeft ChatMemberStatusType = "left"
|
||||
ChatMemberStatusBanned ChatMemberStatusType = "kicked"
|
||||
)
|
||||
|
||||
type ChatMember interface {
|
||||
ChatMemberOwner | ChatMemberAdministrator | ChatMemberMember | ChatMemberRestricted | ChatMemberLeft | ChatMemberBanned
|
||||
}
|
||||
type BaseChatMember struct {
|
||||
Status ChatMemberStatusType `json:"status"`
|
||||
User User `json:"user"`
|
||||
}
|
||||
type ChatMemberOwner struct {
|
||||
BaseChatMember
|
||||
|
||||
IsAnonymous bool `json:"is_anonymous"`
|
||||
CustomTitle *string `json:"custom_title,omitempty"`
|
||||
}
|
||||
type ChatMemberAdministrator struct {
|
||||
BaseChatMember
|
||||
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"`
|
||||
CanPostStories bool `json:"can_post_stories"`
|
||||
CanEditStories bool `json:"can_edit_stories"`
|
||||
CanDeleteStories bool `json:"can_delete_stories"`
|
||||
|
||||
CanPostMessages *bool `json:"can_post_messages,omitempty"`
|
||||
CanEditMessages *bool `json:"can_edit_messages,omitempty"`
|
||||
CanPinMessages *bool `json:"can_pin_messages,omitempty"`
|
||||
CanManageTopics *bool `json:"can_manage_topics,omitempty"`
|
||||
CanManageDirectMessages *bool `json:"can_manage_direct_messages,omitempty"`
|
||||
CustomTitle *string `json:"custom_title,omitempty"`
|
||||
}
|
||||
type ChatMemberMember struct {
|
||||
BaseChatMember
|
||||
UntilDate *int `json:"until_date,omitempty"`
|
||||
}
|
||||
type ChatMemberRestricted struct {
|
||||
BaseChatMember
|
||||
IsMember bool `json:"is_member"`
|
||||
CanSendMessages bool `json:"can_send_messages"`
|
||||
CanSendAudios bool `json:"can_send_audios"`
|
||||
CanSendDocuments bool `json:"can_send_documents"`
|
||||
CanSendVideos bool `json:"can_send_videos"`
|
||||
CanSendVideoNotes bool `json:"can_send_video_notes"`
|
||||
CanSendVoiceNotes bool `json:"can_send_voice_notes"`
|
||||
CanSendPolls bool `json:"can_send_polls"`
|
||||
CanSendOtherMessages bool `json:"can_send_other_messages"`
|
||||
CanAddWebPagePreview bool `json:"can_add_web_page_preview"`
|
||||
CanChangeInfo bool `json:"can_change_info"`
|
||||
CanInviteUsers bool `json:"can_invite_users"`
|
||||
CanPinMessages bool `json:"can_pin_messages"`
|
||||
CanManageTopics bool `json:"can_manage_topics"`
|
||||
UntilDate int `json:"until_date"`
|
||||
}
|
||||
type ChatMemberLeft struct {
|
||||
BaseChatMember
|
||||
}
|
||||
type ChatMemberBanned struct {
|
||||
BaseChatMember
|
||||
UntilDate int `json:"until_date"`
|
||||
}
|
||||
|
||||
type BaseChatBoostSource struct {
|
||||
Source string `json:"source"`
|
||||
User User `json:"user"`
|
||||
}
|
||||
type ChatBoostSourcePremium struct{ BaseChatBoostSource }
|
||||
type ChatBoostSourceGiftCode struct{ BaseChatBoostSource }
|
||||
type ChatBoostSourceGiveaway struct {
|
||||
BaseChatBoostSource
|
||||
GiveawayMessageID int `json:"giveaway_message_id"`
|
||||
PrizeStarCount *int `json:"prize_star_count,omitempty"`
|
||||
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 {
|
||||
Boosts []ChatBoost[BaseChatBoostSource] `json:"boosts"`
|
||||
}
|
||||
|
||||
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"`
|
||||
CanPostStories bool `json:"can_post_stories"`
|
||||
CanEditStories bool `json:"can_edit_stories"`
|
||||
CanDeleteStories bool `json:"can_delete_stories"`
|
||||
|
||||
CanPostMessages *bool `json:"can_post_messages,omitempty"`
|
||||
CanEditMessages *bool `json:"can_edit_messages,omitempty"`
|
||||
CanPinMessages *bool `json:"can_pin_messages,omitempty"`
|
||||
CanManageTopics *bool `json:"can_manage_topics,omitempty"`
|
||||
CanManageDirectMessages *bool `json:"can_manage_direct_messages,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user