{"modulePath":"github.com/mycontroller-org/server/v2","version":"v2.2.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package telegram\n\n## Constants\n\n```go\nconst (\n\tServerURL      = \"https://api.telegram.org\"\n\tAPIGetMe       = \"/getMe\"\n\tAPISendMessage = \"/sendMessage\"\n)\n```\nTelegram server api details\n\n```go\nconst (\n\tParseModeText       = \"Text\"\n\tParseModeMarkdownV2 = \"MarkdownV2\"\n\tParseModeHTML       = \"HTML\"\n)\n```\nMessage types\n\n```go\nconst (\n\tPluginTelegram = \"telegram\"\n)\n```\n\n## Functions\n\n```go\nfunc New(ctx context.Context, cfg *handlerTY.Config) (handlerTY.Plugin, error)\n```\ntelegram handler\n\n## Types\n\n```go\ntype Config struct {\n\tToken   string `json:\"-\"`\n\tChatIDs []string\n}\n```\nConfig data for telegram client\n\n```go\ntype Message struct {\n\tChatID                string `json:\"chat_id\"`\n\tText                  string `json:\"text\"`\n\tParseMode             string `json:\"parse_mode\"`\n\tDisableWebPagePreview bool   `json:\"disable_web_page_preview\"`\n\tDisableNotification   bool   `json:\"disable_notification\"`\n\tReplyToMessageID      int    `json:\"reply_to_message_id\"`\n}\n```\nMessage struct\n\n```go\ntype Response struct {\n\tIsOK        bool                   `json:\"ok\"`\n\tResult      map[string]interface{} `json:\"result\"`\n\tErrorCode   int                    `json:\"error_code\"`\n\tDescription string                 `json:\"description\"`\n}\n```\nResponse struct\n\n```go\ntype TelegramClient struct {\n\tConfig *Config\n\t// contains filtered or unexported fields\n}\n```\nTelegramClient struct\n\n```go\nfunc (c *TelegramClient) Close() error\n```\nClose handler implementation\n\n```go\nfunc (c *TelegramClient) GetMe() (*User, error)\n```\nGetMe returns about the user profile\n\n```go\nfunc (p *TelegramClient) Name() string\n```\n\n```go\nfunc (c *TelegramClient) Post(parameters map[string]interface{}) error\n```\nPost handler implementation\n\n```go\nfunc (c *TelegramClient) SendMessage(message *Message) error\n```\nSendMessage func\n\n```go\nfunc (c *TelegramClient) Start() error\n```\nStart handler implementation\n\n```go\nfunc (c *TelegramClient) State() *types.State\n```\nState implementation\n\n```go\ntype User struct {\n\tID           int    `json:\"id\"`\n\tIsBot        bool   `json:\"is_bot\"`\n\tFirstName    string `json:\"first_name\"`\n\tLastName     string `json:\"last_name\"`\n\tUsername     string `json:\"username\"`\n\tLanguageCode string `json:\"language_code\"`\n}\n```\nUser struct\n\n","path":"github.com/mycontroller-org/server/v2/plugin/handler/telegram","name":"telegram","synopsis":"","isRedistributable":true}
