commands

package
v0.0.0-...-5d77e96 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2024 License: CC0-1.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Callbacks = []Callback{}
View Source
var Commands = []Command{}
View Source
var SampleInserts = `` /* 1464-byte string literal not displayed */
View Source
var SampleQueries = `` /* 503-byte string literal not displayed */
View Source
var WelcomeBackMessage = `
Hello %s!, welcome back to SQL Sensi, your account already exists!
`
View Source
var WelcomeMessage = `` /* 426-byte string literal not displayed */

Functions

func Handle

func Handle(bot *telegram.BotAPI, message *telegram.Message)

func HandleCallback

func HandleCallback(bot *telegram.BotAPI, update *telegram.Update)

func Initialize

func Initialize(db *database.MySQL)

func Register

func Register(command Command)

func RegisterCallback

func RegisterCallback(callback Callback)

func SetAPIKey

func SetAPIKey(bot *telegram.BotAPI, message *telegram.Message)

Types

type Callback

type Callback struct {
	Name    string
	Handler func(*telegram.BotAPI, *telegram.CallbackQuery)
}

type ChatSession

type ChatSession struct {
	History []*genai.Content
}

ChatSession represents a single chat session with history

type Command

type Command struct {
	Name        string
	Description string
	Handler     func(*telegram.BotAPI, *telegram.Message)
	Usage       string
}

func HelpCommand

func HelpCommand() Command

func (Command) String

func (c Command) String() string

type SessionManager

type SessionManager struct {
	// contains filtered or unexported fields
}

SessionManager manages chat sessions for different users

func NewSessionManager

func NewSessionManager() *SessionManager

NewSessionManager creates a new session manager

func (*SessionManager) Clear

func (sm *SessionManager) Clear(chatID int64)

Clear clears the chat history for a given chat ID

func (*SessionManager) GetOrCreate

func (sm *SessionManager) GetOrCreate(chatID int64) *ChatSession

GetOrCreate gets an existing session or creates a new one

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL