Documentation
¶
Index ¶
- Variables
- func Ask(bot *gotgbot.Bot, text string, chat *gotgbot.Chat, user *gotgbot.User) *gotgbot.Message
- func Contains(l []string, v string) bool
- func IsAdmin(u int64) bool
- func ListenMessage(ctx context.Context, filter filters.Message) (*gotgbot.Message, error)
- func RandString(length int) string
- func RunListening(bot *gotgbot.Bot, update *ext.Context) error
- type Listeners
Constants ¶
This section is empty.
Variables ¶
View Source
var ListenTimeout error
View Source
var Listening []Listeners
Functions ¶
func Ask ¶
Sends a text message to the given chat and listens for a reply.
bot - The bot that handles the conversation. text - Content of the request message to be sent. chat - The chat in which the conversion takes place user - The user expected to answer
func ListenMessage ¶
Listens for a message that matches the given filter.
ctx - Context with ideally a deadline set filter - The filter that the message must match (use customfilters package for prebuilts)
Returns either the message if it was received or a ListenTimeout error
func RandString ¶
Types ¶
type Listeners ¶
type Listeners struct {
// Filter which checks if message is a match
Filter filters.Message
// Function to be called if filter matches
Callback handlers.Response
// Unix timestamp at which the handler was added (Timeout after 300s)
AddedTime int64
// Channel to which message is passed
Channel chan *gotgbot.Message
}
Click to show internal directories.
Click to hide internal directories.