Documentation
¶
Index ¶
- Variables
- type Bot
- func (b *Bot) AnswerCallbackQuery(callbackQueryId string) (string, error)
- func (b *Bot) AnswerCallbackQueryNotification(callbackQueryId string, text string, showAlert bool) (string, error)
- func (b *Bot) DeleteMessage(chatId int, messageId int) (string, error)
- func (b *Bot) EditInlineKeyboardTextMessage(chatId int, newText string, messageId int, newKeyboard InlineKeyboardMarkup, ...) (string, error)
- func (b *Bot) EditMessageInlineKeyboardMarkup(chatId int, messageId int, newKeyboard InlineKeyboardMarkup) (string, error)
- func (b *Bot) EditTextMessage(chatId int, newText string, messageId int, options SendMessageOptions) (string, error)
- func (b *Bot) KickChatMember(chatId int, userId int) (string, error)
- func (b *Bot) OnCallback(data string, handler func(u *Update))
- func (b *Bot) OnCommand(text string, description string, handler func(u *Update))
- func (b *Bot) OnPayload(data string, handler func(u *Update))
- func (b *Bot) OnText(text string, handler func(u *Update))
- func (b *Bot) SendDice(chatId int, options SendMessageOptions) (string, error)
- func (b *Bot) SendDiceEmoji(chatId int, emoji string, options SendMessageOptions) (string, error)
- func (b *Bot) SendInlineKeyboardMarkupTextMessage(chatId int, text string, keyboard InlineKeyboardMarkup, ...) (string, error)
- func (b *Bot) SendRandomDice(chatId int, options SendMessageOptions) (string, error)
- func (b *Bot) SendReplyKeyboardMarkupTextMessage(chatId int, text string, keyboard ReplyKeyboardMarkup, ...) (string, error)
- func (b *Bot) SendReplyKeyboardRemoveTextMessage(chatId int, text string, selective bool, options SendMessageOptions) (string, error)
- func (b *Bot) SendTextMessage(chatId int, text string, options SendMessageOptions) (string, error)
- func (b *Bot) Start()
- func (b *Bot) UnbanChatMember(chatId int, userId int) (string, error)
- type BotCommand
- type CallbackQuery
- type Cert
- type Chat
- type Event
- type GetUpdateResponse
- type InlineKeyboardButton
- type InlineKeyboardMarkup
- type KeyboardButton
- type Message
- type ReplyKeyboardMarkup
- type ReplyKeyboardRemove
- type SendMessageOptions
- type Update
- type User
Constants ¶
This section is empty.
Variables ¶
var ONCALLBACK = Event{ Identifier: "oncallback", Checker: func(toCheck string, filter string) bool { return toCheck == filter }, }
Match a CallbackQuery with exact data match
var ONCOMMAND = Event{ Identifier: "oncommand", Checker: func(toCheck string, filter string) bool { var match bool if len(toCheck) > 0 && toCheck[0:1] == "/" { match, _ = regexp.MatchString("^"+toCheck+".*", filter) } else { match, _ = regexp.MatchString("^/"+toCheck+".*", filter) } return match }, }
Match commands (i.e. when text starts with the filter but can contain more text)
var ONPAYLOAD = Event{ Identifier: "onpayload", Checker: func(toCheck string, filter string) bool { match, _ := regexp.MatchString("^"+toCheck+".*", filter) return match }, }
Match a CallbackQuery with data starting with filter
var ONTEXT = Event{ Identifier: "ontext", Checker: func(toCheck string, filter string) bool { return toCheck == filter }, }
Match text (i.e. exact match between text and filter)
Functions ¶
This section is empty.
Types ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
Bot object definition.
func (*Bot) AnswerCallbackQuery ¶ added in v0.4.0
Answer a callback query without notification
func (*Bot) AnswerCallbackQueryNotification ¶ added in v0.4.0
func (b *Bot) AnswerCallbackQueryNotification(callbackQueryId string, text string, showAlert bool) (string, error)
Answer a callback query with notification
func (*Bot) DeleteMessage ¶ added in v0.5.0
Delete a message
func (*Bot) EditInlineKeyboardTextMessage ¶ added in v0.5.0
func (b *Bot) EditInlineKeyboardTextMessage(chatId int, newText string, messageId int, newKeyboard InlineKeyboardMarkup, options SendMessageOptions) (string, error)
Edit a text message with InlineKeyboardMarkup
func (*Bot) EditMessageInlineKeyboardMarkup ¶ added in v0.5.0
func (b *Bot) EditMessageInlineKeyboardMarkup(chatId int, messageId int, newKeyboard InlineKeyboardMarkup) (string, error)
Edit the inline keyboard of a message
func (*Bot) EditTextMessage ¶ added in v0.5.0
func (b *Bot) EditTextMessage(chatId int, newText string, messageId int, options SendMessageOptions) (string, error)
Edit a text message.
func (*Bot) KickChatMember ¶ added in v0.3.3
Kick an user from a group.
func (*Bot) OnCallback ¶ added in v0.4.0
Match CallbackQuery
func (*Bot) OnCommand ¶ added in v0.2.0
Match commands (i.e. when text starts with the filter but can contain more text)
func (*Bot) SendDice ¶ added in v0.3.2
func (b *Bot) SendDice(chatId int, options SendMessageOptions) (string, error)
send a dice
func (*Bot) SendDiceEmoji ¶ added in v1.0.0
Send a dice Emoji (Supported emojis : “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Default is “🎲”. )
func (*Bot) SendInlineKeyboardMarkupTextMessage ¶ added in v0.4.0
func (b *Bot) SendInlineKeyboardMarkupTextMessage(chatId int, text string, keyboard InlineKeyboardMarkup, options SendMessageOptions) (string, error)
Send a text message with an inline keyboard
func (*Bot) SendRandomDice ¶ added in v1.0.0
func (b *Bot) SendRandomDice(chatId int, options SendMessageOptions) (string, error)
send a random dice
func (*Bot) SendReplyKeyboardMarkupTextMessage ¶ added in v0.4.0
func (b *Bot) SendReplyKeyboardMarkupTextMessage(chatId int, text string, keyboard ReplyKeyboardMarkup, options SendMessageOptions) (string, error)
Send a text message with a ReplyKeyboardMarkup keyboard
func (*Bot) SendReplyKeyboardRemoveTextMessage ¶ added in v0.4.0
func (b *Bot) SendReplyKeyboardRemoveTextMessage(chatId int, text string, selective bool, options SendMessageOptions) (string, error)
Send a text message with a ReplyKeyboardRemove keyboard
func (*Bot) SendTextMessage ¶ added in v0.2.0
Send the message text in the chat chatId.
type BotCommand ¶ added in v0.6.0
type CallbackQuery ¶ added in v0.4.0
type Chat ¶
type Chat struct {
Id int `json:"id"`
}
Chat type corresponding to the interesting part of the Chat Object in the Telegram API.
type GetUpdateResponse ¶
Structure of the /getUpdates response body.
type InlineKeyboardButton ¶ added in v0.4.0
type InlineKeyboardMarkup ¶ added in v0.4.0
type InlineKeyboardMarkup struct {
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
}
type KeyboardButton ¶ added in v0.4.0
type KeyboardButton struct {
Text string `json:"text"`
}
type Message ¶
type Message struct {
Id int `json:"message_id"`
Text string `json:"text"`
From User `json:"from"`
Chat Chat `json:"chat"`
}
Message type corresponding to the interesting part of the Message Object in the Telegram API.
type ReplyKeyboardMarkup ¶ added in v0.4.0
type ReplyKeyboardMarkup struct {
Keyboard [][]KeyboardButton `json:"keyboard"`
ResizeKeyboard bool `json:"resize_keyboard"`
OneTimeKeyboard bool `json:"one_time_keyboard"`
Selective bool `json:"selective"`
}
type ReplyKeyboardRemove ¶ added in v0.4.0
type SendMessageOptions ¶ added in v0.3.1
type SendMessageOptions struct {
ParseMode string
DisableWebPagePreview bool
DisableNotification bool
ReplyToMessageId int
AllowSendingWithoutReply bool
}
Option type for the sendMessage API
type Update ¶
type Update struct {
UpdateId int `json:"update_id"`
Message Message `json:"message"`
CallbackQuery CallbackQuery `json:"callback_query"`
}
Update type corresponding to the interesting part of the Update Object in the Telegram API.