Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
func (*Bot) SendMessage ¶
func (b *Bot) SendMessage(msg string, chatId string, parseMode BotMessageType, opts ...SendMessageOptions) (resp *SendMessageResponse, err error)
SendMessage 发送消息的底层实现
type BotMessageType ¶
type BotMessageType string
BotMessageType 定义消息类型枚举
const ( Text BotMessageType = "Text" Markdown BotMessageType = "Markdown" MarkdownV2 BotMessageType = "MarkdownV2" HTML BotMessageType = "HTML" )
type SendMessageOptions ¶
type SendMessageOptions struct {
DisablePreview bool // 关闭链接预览
DisableNotification bool // 静默消息,不触发通知
ProtectContent bool // 保护消息内容,防止转发
ReplyToMessageID int // 回复的消息 ID
AllowSendingWithoutReply bool // 允许在没有有效回复时发送
ReplyMarkup interface{} // 自定义键盘
}
SendMessageOptions 发送消息的可选参数
type SendMessageResponse ¶
type SendMessageResponse struct {
OK bool `json:"ok"`
Result struct {
MessageID int `json:"message_id"`
From struct {
ID int64 `json:"id"`
IsBot bool `json:"is_bot"`
FirstName string `json:"first_name"`
Username string `json:"username"`
} `json:"from"`
Chat struct {
ID int64 `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Type string `json:"type"`
} `json:"chat"`
Date int `json:"date"`
Text string `json:"text"`
} `json:"result"`
}
Click to show internal directories.
Click to hide internal directories.