models

package
v0.0.0-...-57913f4 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddWarningToID

func AddWarningToID(tgID int64, warnText string) error

AddWarningToID logs a new warning for a given user

func MakeDB

func MakeDB(dbConnectString string) error

MakeDB connects to a database based on the dbConnectString

func SetModPing

func SetModPing(tgID int64, status bool) error

SetModPing sets the user's ability to use the moderator ping functionality

func UpdateAliases

func UpdateAliases(firstName string, lastName string, tgID int64) error

UpdateAliases records new names users adopt as aliases, and updates the time changed if a user adopts an old alias

Types

type ChatUser

type ChatUser struct {
	TgID        int64
	UserName    string
	PingAllowed bool
}

ChatUser represents a member of the chat

func ChatUserFromID

func ChatUserFromID(inID int64) (*ChatUser, error)

ChatUserFromID finds a user with the provided ID

func ChatUserFromTGID

func ChatUserFromTGID(tgID int, userName string) (*ChatUser, error)

ChatUserFromTGID finds a user with the provided TGID

func ChatUserFromTGIDNoUpd

func ChatUserFromTGIDNoUpd(tgID int) (*ChatUser, error)

ChatUserFromTGIDNoUpd finds a user with the provided TGID without updating the database

func LookupAlias

func LookupAlias(query string) ([]ChatUser, error)

LookupAlias finds a ChatUser even if only part of one of their aliases is provided

func SearchUserByUsername

func SearchUserByUsername(userName string) (*ChatUser, error)

SearchUserByUsername finds a user with the provided username

type UserAlias

type UserAlias struct {
	ID         int64
	Name       string
	ChangeDate time.Time
	TgID       int64
}

UserAlias represents a name that a chat member went by

func GetAliases

func GetAliases(u *ChatUser) ([]UserAlias, error)

GetAliases finds aliases for a given ChatUser

func GetLatestAliasFromUserID

func GetLatestAliasFromUserID(userID int64) (*UserAlias, error)

GetLatestAliasFromUserID finds the most recently used alias for a given userID

type Warning

type Warning struct {
	ID          int64
	WarningText string
	WarnDate    time.Time
	TgID        int64
}

Warning represents a warning issues to a chat member

func GetUsersWarnings

func GetUsersWarnings(userIn *ChatUser) ([]Warning, error)

GetUsersWarnings finds all warnings for a given user

Jump to

Keyboard shortcuts

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