Documentation ¶
Index ¶
- func EscapeMarkdown(text string) string
- type Client
- type ClientInterface
- type ConfigStruct
- type Handler
- type MessageResponseBodyStruct
- type MessageStruct
- func MarkdownMessage(text string) MessageStruct
- func MarkdownPhoto(photo string, caption string) MessageStruct
- func MarkdownReply(text string, messageID int64) MessageStruct
- func Message(text string) MessageStruct
- func Photo(photo string, caption string) MessageStruct
- func Reply(text string, messageID int64) MessageStruct
- type MockClient
- type WebhookBodyStruct
- type WebhookHandlerInterface
- type WebhookMessageChatStruct
- type WebhookMessagePhotoStruct
- type WebhookMessageStruct
- type WebhookMessageUserStruct
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EscapeMarkdown ¶
Types ¶
type Client ¶
type Client struct { Log logger.Interface Cfg ConfigStruct }
func NewClient ¶
func NewClient(config ConfigStruct) *Client
func (Client) SendMessage ¶
func (c Client) SendMessage(chatID int64, message MessageStruct) error
type ClientInterface ¶
type ClientInterface interface {
SendMessage(chatID int64, messageOut MessageStruct) error
}
type ConfigStruct ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler( config *ConfigStruct, fn func(messageIn WebhookMessageStruct), ) *Handler
type MessageStruct ¶
type MessageStruct struct { ChatID int64 `json:"chat_id"` //nolint:tagliatelle ReplyToMessageID int64 `json:"reply_to_message_id"` //nolint:tagliatelle Text string `json:"text"` Photo string `json:"photo"` Caption string `json:"caption"` ParseMode string `json:"parse_mode"` //nolint:tagliatelle DisableWebPagePreview bool `json:"disable_web_page_preview"` //nolint:tagliatelle DisableNotification bool `json:"disable_notification"` //nolint:tagliatelle }
func MarkdownMessage ¶
func MarkdownMessage(text string) MessageStruct
func MarkdownPhoto ¶
func MarkdownPhoto(photo string, caption string) MessageStruct
func MarkdownReply ¶
func MarkdownReply(text string, messageID int64) MessageStruct
func Message ¶
func Message(text string) MessageStruct
func Photo ¶
func Photo(photo string, caption string) MessageStruct
func Reply ¶
func Reply(text string, messageID int64) MessageStruct
type MockClient ¶
type MockClient struct{}
func NewMockClient ¶
func NewMockClient() *MockClient
func (MockClient) SendMessage ¶
func (c MockClient) SendMessage(_ int64, _ MessageStruct) error
type WebhookBodyStruct ¶
type WebhookBodyStruct struct {
Message WebhookMessageStruct `json:"message"`
}
type WebhookHandlerInterface ¶
type WebhookHandlerInterface interface {
ServeHTTP(res http.ResponseWriter, req *http.Request)
}
type WebhookMessageChatStruct ¶
type WebhookMessageChatStruct struct { ID int64 `json:"id"` Type string `json:"type"` Username string `json:"username"` }
func TestWebhookMessageChat ¶
func TestWebhookMessageChat() WebhookMessageChatStruct
type WebhookMessageStruct ¶
type WebhookMessageStruct struct { ID int64 `json:"message_id"` //nolint:tagliatelle From WebhookMessageUserStruct `json:"from"` Chat WebhookMessageChatStruct `json:"chat"` Text string `json:"text"` Date int64 `json:"date"` Photo []WebhookMessagePhotoStruct `json:"photo"` Caption string `json:"caption"` }
func TestWebhookMessage ¶
func TestWebhookMessage(text string) WebhookMessageStruct
func (WebhookMessageStruct) TextOrCaption ¶
func (m WebhookMessageStruct) TextOrCaption() string
func (WebhookMessageStruct) WordCount ¶
func (m WebhookMessageStruct) WordCount() int
type WebhookMessageUserStruct ¶
type WebhookMessageUserStruct struct { ID int64 `json:"id"` IsBot bool `json:"is_bot"` //nolint:tagliatelle FirstName string `json:"first_name"` //nolint:tagliatelle LastName string `json:"last_name"` //nolint:tagliatelle Username string `json:"username"` LanguageCode string `json:"language_code"` //nolint:tagliatelle }
func TestWebhookMessageUser ¶
func TestWebhookMessageUser(isBot bool) WebhookMessageUserStruct
func (WebhookMessageUserStruct) FirstnameOrUsername ¶
func (u WebhookMessageUserStruct) FirstnameOrUsername() string
func (WebhookMessageUserStruct) UsernameOrName ¶
func (u WebhookMessageUserStruct) UsernameOrName() string
Click to show internal directories.
Click to hide internal directories.