Documentation
¶
Index ¶
- func EnqueueLogRecord(UserID int, EventName string)
- func FormatRecord(record *LogRecord) string
- func RunLogger(filename string) error
- type Chat
- type LogRecord
- type Message
- type ResponseMe
- type ResponseUpdates
- type SendMessage
- type SendPhoto
- type Storage
- func (s *Storage) Close()
- func (s *Storage) GenToken(bucket *bolt.Bucket) (string, error)
- func (s *Storage) InsertUser(user *User) (string, error)
- func (s *Storage) IsTokenRevokedBy(token string) (bool, error)
- func (s *Storage) NextToken() (string, error)
- func (s *Storage) RevokeTokenBy(user *User) error
- func (s *Storage) SelectTokenBy(user *User) (string, error)
- func (s *Storage) SelectUserBy(token string) (*User, error)
- type TelePyth
- func (t *TelePyth) FindUser(req *http.Request) (*User, int)
- func (t *TelePyth) HandleMultipartNotifyRequest(w http.ResponseWriter, req *http.Request) int
- func (t *TelePyth) HandleNotifyRequest(w http.ResponseWriter, req *http.Request)
- func (t *TelePyth) HandlePingRequest(w http.ResponseWriter, req *http.Request)
- func (t *TelePyth) HandlePlainTextNotifyRequest(w http.ResponseWriter, req *http.Request) int
- func (t *TelePyth) HandleTelegramUpdate(update *Update)
- func (t *TelePyth) HandleWebhookRequest(w http.ResponseWriter, req *http.Request)
- func (t *TelePyth) PollUpdates()
- func (t *TelePyth) Serve() error
- type TelegramBotApi
- type Update
- type User
- type UserToken
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnqueueLogRecord ¶ added in v0.2.0
func FormatRecord ¶ added in v0.2.0
Types ¶
type Chat ¶
type Chat struct { Id int `json:"id,omitempty"` Type string `json:"type,omitempty"` Title string `json:"title,omitempty"` UserName string `json:"username,omitempty"` FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` AllMembersAreAdministrators bool `json:"all_members_are_administrators,omitempty"` }
type Message ¶
type Message struct { MessageId int `json:"message_id,omitempty"` From User `json:"from,omitempty"` Text string `json:"text,omitempty"` FrowardedFrom User `json:"forwarded_from,omitempty"` Caption string `json:"caption,omitempty"` NewChatMember User `json:"new_chat_member,omitempty"` LeftChatMember User `json:"left_chat_member,omitempty"` }
type ResponseMe ¶
type ResponseUpdates ¶
type SendMessage ¶
type SendMessage struct { ChatId int `json:"chat_id"` Text string `json:"text"` ParseMode string `json:"parse_mode,omitempty"` DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` }
func (*SendMessage) To ¶
func (s *SendMessage) To(t *TelegramBotApi) error
type SendPhoto ¶ added in v0.1.3
type SendPhoto struct { ChatId int `json:"chat_id"` // Photo is type of either string or io.Writer in case of uploading Photo interface{} `json:"photo,omitempty"` Caption string `json:"caption,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ReplyToMessageId int `json:"reply_to_message_id,omitempty"` ReplyMarkup interface{} `json:"reply_markup"` }
func (*SendPhoto) ExistingTo ¶ added in v0.1.3
func (s *SendPhoto) ExistingTo(t *TelegramBotApi) error
func (*SendPhoto) NewTo ¶ added in v0.1.3
func (s *SendPhoto) NewTo(t *TelegramBotApi) error
func (*SendPhoto) To ¶ added in v0.1.3
func (s *SendPhoto) To(t *TelegramBotApi) error
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage stores persistently information about users and tokens. It is build on top of BoltDB.
func NewStorage ¶
func (*Storage) IsTokenRevokedBy ¶ added in v0.1.2
IsTokenRevokedBy test whether access token was revoked.
func (*Storage) RevokeTokenBy ¶ added in v0.1.2
RevokeTokenBy revokes access token and implicitly update user info.
type TelePyth ¶
type TelePyth struct { Api *TelegramBotApi Storage *Storage Polling bool Timeout int MetricsLog string }
func (*TelePyth) HandleMultipartNotifyRequest ¶ added in v0.1.3
func (*TelePyth) HandleNotifyRequest ¶
func (t *TelePyth) HandleNotifyRequest(w http.ResponseWriter, req *http.Request)
func (*TelePyth) HandlePingRequest ¶ added in v0.1.0
func (t *TelePyth) HandlePingRequest(w http.ResponseWriter, req *http.Request)
func (*TelePyth) HandlePlainTextNotifyRequest ¶ added in v0.1.3
func (*TelePyth) HandleTelegramUpdate ¶
func (*TelePyth) HandleWebhookRequest ¶
func (t *TelePyth) HandleWebhookRequest(w http.ResponseWriter, req *http.Request)
func (*TelePyth) PollUpdates ¶
func (t *TelePyth) PollUpdates()
type TelegramBotApi ¶
type TelegramBotApi struct {
// contains filtered or unexported fields
}
func New ¶
func New(token string) *TelegramBotApi
func (*TelegramBotApi) GetMe ¶
func (t *TelegramBotApi) GetMe() (*User, error)
func (*TelegramBotApi) GetToken ¶
func (t *TelegramBotApi) GetToken() string
func (*TelegramBotApi) GetUpdates ¶
func (t *TelegramBotApi) GetUpdates(offset, limit, timeout int, allowedUpdates []string) ([]Update, error)
type UserToken ¶ added in v0.1.2
UserToken represents Telegram user and some system information used to validate and revoke tokens.
func UserTokenDecode ¶ added in v0.1.2
func (*UserToken) UserTokenEncode ¶ added in v0.1.2
Click to show internal directories.
Click to hide internal directories.