database

package
v0.0.0-...-86cb488 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatSettings

type ChatSettings struct {
	//Stopped Global Filters
	Stopped []string
}

type Database

type Database struct {

	//Mongo Client
	Client *mongo.Client

	//Database
	Db *mongo.Database

	//Users Collection
	Ucol *mongo.Collection

	//Main Collection
	Col *mongo.Collection

	//Manual Filters Collection
	Mcol *mongo.Collection
}

func NewDatabase

func NewDatabase() Database

func (Database) AddUser

func (db Database) AddUser(userid int64) error

func (Database) ConnectUser

func (db Database) ConnectUser(user_id int64, chat_id int64)

func (Database) DeleteConnection

func (db Database) DeleteConnection(user_id int64)

func (Database) DeleteMfilter

func (db Database) DeleteMfilter(chat_id int64, key string)

func (Database) GetAlert

func (db Database) GetAlert(uniqueID string, index int) string

func (Database) GetCachedSetting

func (db Database) GetCachedSetting(chat_id int64) *ChatSettings

func (Database) GetConnection

func (db Database) GetConnection(user_id int64) (int64, bool)

func (Database) GetMfilter

func (db Database) GetMfilter(chat_id int64, key string) (bson.M, bool)

func (Database) GetMfilters

func (db Database) GetMfilters(chat_id int64) (*mongo.Cursor, error)

func (Database) RecacheSettings

func (db Database) RecacheSettings(chat_id int64)

func (Database) SaveMfilter

func (db Database) SaveMfilter(data Filter)

func (Database) SetChatSetting

func (db Database) SetChatSetting(chat_id int64, key string, value any)

func (Database) SetDefaultSettings

func (db Database) SetDefaultSettings(chat_id int64)

func (Database) StartGfilter

func (db Database) StartGfilter(chat_id int64, key string)

func (Database) Stats

func (db Database) Stats() string

func (Database) StopGfilter

func (db Database) StopGfilter(chat_id int64, key string)

func (Database) StringMfilter

func (db Database) StringMfilter(chat_id int64) string

type Filter

type Filter struct {

	//Unique id of the filter
	Id string `bson:"_id"`

	//Chat where the filter is in effect
	ChatId int64 `bson:"group_id"`

	//The key/text which is filtered
	Text string `bson:"text"`

	//The text content/caption saved
	Content string `bson:"content"`

	//The id of a media saved for the filter if any
	FileID string `bson:"file"`

	//Buttons/markup saved for a filter if any
	Markup [][]map[string]string `bson:"button"`

	//Alerts saved for a filter if any
	Alerts []string `bson:"alert"`

	//Length of the text according to which filters are sorted
	Length int `bson:"length"`

	//Type of media saved if any
	MediaType string `bson:"mediaType"`
}

Jump to

Keyboard shortcuts

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