Documentation ¶
Index ¶
- Constants
- func New(ctx context.Context, cfg *handlerTY.Config) (handlerTY.Plugin, error)
- type Config
- type Message
- type Response
- type TelegramClient
- func (c *TelegramClient) Close() error
- func (c *TelegramClient) GetMe() (*User, error)
- func (p *TelegramClient) Name() string
- func (c *TelegramClient) Post(parameters map[string]interface{}) error
- func (c *TelegramClient) SendMessage(message *Message) error
- func (c *TelegramClient) Start() error
- func (c *TelegramClient) State() *types.State
- type User
Constants ¶
View Source
const ( ServerURL = "https://api.telegram.org" APIGetMe = "/getMe" APISendMessage = "/sendMessage" )
Telegram server api details
View Source
const ( ParseModeText = "Text" ParseModeMarkdownV2 = "MarkdownV2" ParseModeHTML = "HTML" )
Message types
View Source
const (
PluginTelegram = "telegram"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Message ¶
type Message struct { ChatID string `json:"chat_id"` Text string `json:"text"` ParseMode string `json:"parse_mode"` DisableWebPagePreview bool `json:"disable_web_page_preview"` DisableNotification bool `json:"disable_notification"` ReplyToMessageID int `json:"reply_to_message_id"` }
Message struct
type Response ¶
type Response struct { IsOK bool `json:"ok"` Result map[string]interface{} `json:"result"` ErrorCode int `json:"error_code"` Description string `json:"description"` }
Response struct
type TelegramClient ¶
type TelegramClient struct { Config *Config // contains filtered or unexported fields }
TelegramClient struct
func (*TelegramClient) GetMe ¶
func (c *TelegramClient) GetMe() (*User, error)
GetMe returns about the user profile
func (*TelegramClient) Name ¶
func (p *TelegramClient) Name() string
func (*TelegramClient) Post ¶
func (c *TelegramClient) Post(parameters map[string]interface{}) error
Post handler implementation
func (*TelegramClient) SendMessage ¶
func (c *TelegramClient) SendMessage(message *Message) error
SendMessage func
Click to show internal directories.
Click to hide internal directories.