Documentation
¶
Index ¶
- Constants
- type APIError
- type Bot
- type CallbackQuery
- type Chat
- type Client
- func (c *Client) AnswerCallbackQuery(ctx context.Context, id, text string) error
- func (c *Client) EditMessageText(ctx context.Context, chatID string, messageID int64, text string) error
- func (c *Client) GetMe(ctx context.Context) (Bot, error)
- func (c *Client) GetUpdates(ctx context.Context, offset int64, timeout int) ([]Update, error)
- func (c *Client) SendMessage(ctx context.Context, chatID, text string) error
- func (c *Client) SendMessageWithMarkup(ctx context.Context, chatID, text string, markup *InlineKeyboardMarkup) error
- func (c *Client) Token() string
- func (c *Client) WithAPIBase(base string) *Client
- func (c *Client) WithHTTPClient(h *http.Client) *Client
- type InlineKeyboardButton
- type InlineKeyboardMarkup
- type Message
- type Pollers
- type Registry
- type SendMessageRequest
- type Service
- func (s *Service) SendReminder(ctx context.Context, userID, chatID, text, taskID, buttonLabel string) error
- func (s *Service) SendTest(ctx context.Context, userID, chatID, text string) error
- func (s *Service) StartAll(ctx context.Context) error
- func (s *Service) StartForUser(ctx context.Context, userID string) error
- func (s *Service) StopAll()
- func (s *Service) StopForUser(userID string) error
- func (s *Service) ValidateToken(ctx context.Context, botToken string) (string, error)
- type Update
- type User
Constants ¶
View Source
const LongPollSeconds = 50
LongPollSeconds is the getUpdates long-poll timeout; the HTTP client timeout above must be larger.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallbackQuery ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AnswerCallbackQuery ¶
func (*Client) EditMessageText ¶
func (*Client) GetUpdates ¶
func (*Client) SendMessage ¶
func (*Client) SendMessageWithMarkup ¶
func (*Client) WithAPIBase ¶
type InlineKeyboardButton ¶
type InlineKeyboardMarkup ¶
type InlineKeyboardMarkup struct {
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
}
type Pollers ¶
type Pollers struct {
// contains filtered or unexported fields
}
func NewPollers ¶
func (*Pollers) StartForUser ¶
StartForUser launches a poller goroutine. The goroutine's lifetime is bound to the server-wide root context (not the caller's ctx, which for an API request is cancelled as soon as the response is sent); the returned stop channel and StopForUser control per-user shutdown.
func (*Pollers) StopForUser ¶
func (*Pollers) WithAPIBase ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func (*Registry) GetOrCreate ¶
func (*Registry) Invalidate ¶
func (*Registry) WithAPIBase ¶
type SendMessageRequest ¶
type SendMessageRequest struct {
ChatID string `json:"chat_id"`
Text string `json:"text"`
ParseMode string `json:"parse_mode,omitempty"`
ReplyMarkup json.RawMessage `json:"reply_markup,omitempty"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) SendReminder ¶
func (s *Service) SendReminder(ctx context.Context, userID, chatID, text, taskID, buttonLabel string) error
SendReminder sends a due-task reminder carrying an inline "Complete" button whose callback data completes the task straight from Telegram.
func (*Service) StartForUser ¶
func (*Service) StopForUser ¶
type Update ¶
type Update struct {
UpdateID int64 `json:"update_id"`
Message *Message `json:"message"`
CallbackQuery *CallbackQuery `json:"callback_query"`
}
Click to show internal directories.
Click to hide internal directories.