db

package
v0.0.0-...-47bbb21 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteReaction

func DeleteReaction(db *sql.DB, react Reaction) error

func GetMissedMessagesRanges

func GetMissedMessagesRanges(chatID int64, db *sql.DB) ([][2]int, error)

func MarkRangeAsChecked

func MarkRangeAsChecked(chatID int64, start, end int, db *sql.DB) error

func SaveChat

func SaveChat(channel *tg.Channel, db *sql.DB) error

func SaveReaction

func SaveReaction(db *sql.DB, reaction Reaction) error

func SetupDB

func SetupDB() (*sql.DB, error)

func SyncPeerReactions

func SyncPeerReactions(botdb *sql.DB, old, new []Reaction) (err error)

func UpdateForwarded

func UpdateForwarded(db *sql.DB, chatID int64, messageID int) error

func UpdateMessageBody

func UpdateMessageBody(db *sql.DB, msg Message) error

Types

type Chat

type Chat struct {
	ID         int64
	AccessHash int64
	UpdatedAt  time.Time
	CreatedAt  time.Time
	Body       map[string]any
}

func GetOnlySavedChats

func GetOnlySavedChats(sources []tg.InputPeerChannel, db *sql.DB) ([]Chat, error)

type Message

type Message struct {
	ID             int
	UpdatedAt      time.Time
	SentDate       time.Time
	ChatID         int64
	Forwarded      bool
	FwdFromUser    int64
	FwdFromChannel int64
	WithPhoto      bool
	ReplyTo        int
	UserID         int64
	Body           string
	GroupedID      int64
}

func GetMessage

func GetMessage(db *sql.DB, chatID int64, msgID int) (Message, error)

func GetMessagesAfter

func GetMessagesAfter(db *sql.DB, chatID int64, date time.Time) ([]Message, error)

func GetMessagesGroup

func GetMessagesGroup(db *sql.DB, groupedID int64) ([]Message, error)

func GetReplies

func GetReplies(db *sql.DB, chatID int64, replyTo int) ([]Message, error)

func SaveMessage

func SaveMessage(msg *tg.Message, chatID int64, db *sql.DB) (Message, error)

func ScanMessageRows

func ScanMessageRows(rows *sql.Rows) ([]Message, error)

type Reaction

type Reaction struct {
	ChatID     int64
	MessageID  int
	UserID     int64
	Emoticon   string
	DocumentID int64
	SentDate   time.Time
	Flags      bin.Fields
	Big        bool
}

func GetSavedReactions

func GetSavedReactions(db *sql.DB, chatID int64, messageID int) ([]Reaction, error)

Jump to

Keyboard shortcuts

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