types

package
v0.0.0-...-a157c36 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2018 License: MIT Imports: 1 Imported by: 12

Documentation

Index

Constants

View Source
const (
	// 私聊
	ChatPrivate = "private"
	// 普通群
	ChatGroup = "group"
	// 超级群
	SuperGroup = "supergroup"
	// 频道
	Channel = "channel"
)
View Source
const (
	// 提及用户
	EntityMention = "mention "
	// 哈希标记
	EntityHashTag = "hashtag"
	// 机器人命令
	EntityBotCommand = "bot_command"
	// 超链接
	EntityURL = "url"
	// 电子邮箱
	EntityEmail = "email"
	// 加粗
	EntityBold = "bold"
	// 斜体
	EntityItalic = "italic"
	// 代码
	EntityCode = "code"
	// 预格式化文本
	EntityPre = "pre"
	// 文本链接
	EntityTextLink = "text_link"
	// 文本提及
	EntityTextMention = "text_mention "
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackQuery

type CallbackQuery struct {
	ID              string   `json:"id"`                          // 查询唯一ID
	From            *Chat    `json:"from"`                        // 发送者
	Message         *Message `json:"message"`                     // 消息
	ChatInstance    string   `json:"chat_instance,omitempty"`     // 全局标识符
	Data            string   `json:"data,omitempty"`              // 查询数据
	InlineMessageID *string  `json:"inline_message_id,omitempty"` // 内联消息ID
}

查询回调

func (*CallbackQuery) FromJSON

func (callbackQuery *CallbackQuery) FromJSON(jsb []byte) error

从JSON反序列化

func (*CallbackQuery) ToJSON

func (callbackQuery *CallbackQuery) ToJSON() ([]byte, error)

转换为JSON

type Chat

type Chat struct {
	ID        int64   `json:"id"`                 // 聊天唯一ID
	Type      string  `json:"type"`               // 聊天类型
	FirstName string  `json:"first_name"`         // 用户昵称
	UserName  *string `json:"username,omitempty"` // 用户名
}

聊天信息

func (*Chat) FromJSON

func (chat *Chat) FromJSON(jsb []byte) error

从JSON反序列化

func (*Chat) ToJSON

func (chat *Chat) ToJSON() ([]byte, error)

转换为JSON

type Contact

type Contact struct {
	PhoneNumber string `json:"phone_number"`        // 电话号码
	FirstName   string `json:"first_name"`          // name
	LastName    string `json:"last_name,omitempty"` // name
	UserID      int64  `json:"user_id,omitempty"`   // 用户唯一ID
}

联系人

func (*Contact) FromJSON

func (contact *Contact) FromJSON(jsb []byte) error

从JSON反序列化

func (*Contact) ToJSON

func (contact *Contact) ToJSON() ([]byte, error)

转换为JSON

type Documnet

type Documnet struct {
	FileID   string     `json:"file_id"`             // 文件ID
	Thumb    *PhotoSize `json:"thumb,omitempty"`     // 缩略图信息
	FileName string     `json:"file_name,omitempty"` // 文件名
	MimeType string     `json:"mime_type,omitempty"` // 文件类型
	FileSize uint32     `json:"file_size,omitempty"` // 文件大小
}

文档信息

func (*Documnet) FromJSON

func (document *Documnet) FromJSON(jsb []byte) error

从JSON反序列化

func (*Documnet) ToJSON

func (document *Documnet) ToJSON() ([]byte, error)

转换为JSON

type InlineQuery

type InlineQuery struct {
	ID     string `json:"id"`     // 查询唯一ID
	From   *User  `json:"from"`   // 发送者
	Query  string `json:"query"`  // 查询数据
	Offset string `json:"offset"` // 结果偏移
}

内联回调

func (*InlineQuery) FromJSON

func (inlineQuery *InlineQuery) FromJSON(jsb []byte) error

从JSON反序列化

func (*InlineQuery) ToJSON

func (inlineQuery *InlineQuery) ToJSON() ([]byte, error)

转换为JSON

type Message

type Message struct {
	MessageID            int32            `json:"message_id"`                        // 消息唯一ID
	From                 *User            `json:"from,omitempty"`                    // 消息来源
	Date                 int32            `json:"date"`                              // 消息日期
	Chat                 *Chat            `json:"chat"`                              // 聊天信息
	ForwardFrom          *User            `json:"forward_from,omitempty"`            // 转发消息来源
	ForwardFromChat      *Chat            `json:"forward_from_chat,omitempty"`       // 转发消息来源聊天信息
	ForwardFromMessageID int32            `json:"forward_from_message_id,omitempty"` // 转发消息唯一ID
	ForwardSignature     string           `json:"forward_signature,omitempty"`       // 转发消息签名
	ForwardDate          int32            `json:"forward_date,omitempty"`            // 转发日期
	ReplyToMessage       *Message         `json:"reply_to_message,omitempty"`        // 回复的消息
	EditDate             int32            `json:"edit_date,omitempty"`               // 编辑日期
	AuthorSignature      string           `json:"author_signature,omitempty"`        // 作者签名
	Text                 string           `json:"text,omitempty"`                    // 消息文本
	Entities             []*MessageEntity `json:"entities,omitempty"`                // 文本Entity信息
	Caption              string           `json:"caption,omitempty"`                 // 媒体标题
	CaptionEntities      []*MessageEntity `json:"caption_entities,omitempty"`        // 标题Entity信息
	Photo                []*PhotoSize     `json:"photo,omitempty"`                   // 照片尺寸
	Sticker              *StickerSet      `json:"sticker,omitempty"`                 // 贴纸集合
	Document             *Documnet        `json:"document,omitempty"`                // 文档信息
	Contact              *Contact         `json:"contact,omitempty"`                 // 联系人
}

消息信息

func (*Message) FromJSON

func (message *Message) FromJSON(jsb []byte) error

从JSON反序列化

func (*Message) ToJSON

func (message *Message) ToJSON() ([]byte, error)

转换为JSON

type MessageEntity

type MessageEntity struct {
	Type   string `json:"type"`           // Entity类型
	Offset int32  `json:"offset"`         // 偏移
	Length int32  `json:"length"`         // 长度
	URL    string `json:"url,omitempty"`  // 地址
	User   *User  `json:"user,omitempty"` // 用户信息
}

Entity信息

func (*MessageEntity) FromJSON

func (entity *MessageEntity) FromJSON(jsb []byte) error

从JSON反序列化

func (*MessageEntity) ToJSON

func (entity *MessageEntity) ToJSON() ([]byte, error)

转换为JSON

type Object

type Object interface {
	ToJSON() ([]byte, error)
	FromJSON([]byte) error
}

类型接口

type PhotoSize

type PhotoSize struct {
	FileID   string `json:"file_id"`   // 文件唯一ID
	Width    int32  `json:"width"`     // 照片宽度
	Height   int32  `json:"height"`    // 照片高度
	FileSize int32  `json:"file_size"` // 文件大小
}

照片大小

func (*PhotoSize) FromJSON

func (photoSize *PhotoSize) FromJSON(jsb []byte) error

从JSON反序列化

func (*PhotoSize) ToJSON

func (photoSize *PhotoSize) ToJSON() ([]byte, error)

转换为JSON

type Sticker

type Sticker struct {
	FileID   string     `json:"file_id"`             // 文件ID
	Width    uint32     `json:"width"`               // 宽度
	Height   uint32     `json:"height"`              // 高度
	Thumb    *PhotoSize `json:"thumb,omitempty"`     // 缩略图
	Emoji    string     `json:"emoji,omitempty"`     // 表情
	SetName  string     `json:"set_name,omitempty"`  // 集合名字
	FileSize uint32     `json:"file_size,omitempty"` // 文件大小
}

贴纸信息

type StickerSet

type StickerSet struct {
	Name          string     `json:"name"`                     // 集合名称
	Title         string     `json:"title"`                    // 集合标题
	ContainsMasks bool       `json:"contains_masks,omitempty"` // 包含遮罩
	Stickers      []*Sticker `json:"stickers"`                 // 贴纸列表
}

贴纸集合

func (*StickerSet) FromJSON

func (set *StickerSet) FromJSON(jsb []byte) error

从JSON反序列化

func (*StickerSet) ToJSON

func (set *StickerSet) ToJSON() ([]byte, error)

转换为JSON

type Update

type Update struct {
	UpdateID      int32          `json:"update_id"`                // 更新ID
	Message       *Message       `json:"message,omitempty"`        // 消息
	CallbackQuery *CallbackQuery `json:"callback_query,omitempty"` // 查询回调
	InlineQuery   *InlineQuery   `json:"inline_query,omitempty"`   // 内联回调
}

更新信息

func (*Update) FromJSON

func (update *Update) FromJSON(jsb []byte) error

从JSON反序列化

func (*Update) ToJSON

func (update *Update) ToJSON() ([]byte, error)

转换为JSON

type User

type User struct {
	ID           int64  `json:"id"`                      // 用户唯一ID
	IsBot        bool   `json:"is_bot"`                  // 是否机器人
	FirstName    string `json:"first_name"`              // name
	LastName     string `json:"last_name,omitempty"`     // name
	UserName     string `json:"username,omitempty"`      // 用户名
	LanguageCode string `json:"language_code,omitempty"` // 语言代码
}

用户信息

func (*User) FromJSON

func (user *User) FromJSON(jsb []byte) error

从JSON反序列化

func (*User) ToJSON

func (user *User) ToJSON() ([]byte, error)

转换为JSON

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL