database

package
v0.0.0-...-f829b0e Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: Unlicense Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const UsersTable = "users"

Variables

View Source
var ErrPandaExists = errors.New("This panda already exists")

ErrPandaExists error returned when a user or nick is not in the DB

View Source
var ErrPandaNotFound = errors.New("No such Panda")

ErrPandaNotFound error returned when a user or nick is not in the DB

Functions

func AdminSetNick

func AdminSetNick(user *tgbotapi.User, nick string) error

AdminSetNick associates the telegram user and given nick even if those are associated before

func FindQuoteById

func FindQuoteById(recnum int, includeDeleted bool) (*quotes.Quote, error)

FindQuoteById Finds a quote by it's unique id recnum: quote id to find includeDeleted: true to inlcude deleted quotes in search

func GetQuote

func GetQuote(q string, offset int) (string, error)

GetQuote performs a quote search

func Info

func Info(recnum int, text ...string) (*quotes.Quote, error)

Info returns all info for a quote

func Init

func Init()

Init initializes the connection to the database

func InsertQuote

func InsertQuote(quote quotes.Quote) (quotes.Quote, error)

InsertQuote adds a new quote record to the database

func MarkQuoteAsDeleted

func MarkQuoteAsDeleted(recnum int, user string) error

MarkQuoteAsDeleted marks a quote with identifier id as deleted

func NickFromTGUser

func NickFromTGUser(user *tgbotapi.User) (string, error)

NickFromTGUser return the nick for a given Telegram User

func NickFromTGUserName

func NickFromTGUserName(username string) (string, error)

NickFromTGUserName return the nick for a given Telegram User

func SetNick

func SetNick(user *tgbotapi.User, nick string) error

SetNick associates the telegram user and given nick

func TGUserFromNick

func TGUserFromNick(nick string) (string, error)

TGUserFromNick return the Telegram user ID from a given nick

func Top

func Top(i int) (string, error)

Top performs some unknown stuff (muahaha)

func UnmarkQuoteAsDeleted

func UnmarkQuoteAsDeleted(recnum int) error

UnmarkQuoteAsDeleted marks a deleted quote with identifier id as undeleted

func UserNickIsAssociated

func UserNickIsAssociated(user *tgbotapi.User, nick string) error

UserNickIsAssociated Checks if the user or the nick has a previous association

Types

This section is empty.

Jump to

Keyboard shortcuts

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