wotoGlobals

package
v0.0.0-...-85f0429 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PeerTypeEmpty = iota
	PeerTypeSelf
	PeerTypeChat
	PeerTypeUser
	PeerTypeChannel
	PeerTypeUserFromMessage
	PeerTypeChannelFromMessage
)

case *tg.InputPeerEmpty: // inputPeerEmpty#7f3b18ea case *tg.InputPeerSelf: // inputPeerSelf#7da07ec9 case *tg.InputPeerChat: // inputPeerChat#35a95cb9 case *tg.InputPeerUser: // inputPeerUser#dde8a54c case *tg.InputPeerChannel: // inputPeerChannel#27bcbbfc case *tg.InputPeerUserFromMessage: // inputPeerUserFromMessage#a87b0a1c case *tg.InputPeerChannelFromMessage: // inputPeerChannelFromMessage#bd2a0840

View Source
const (
	AppVersion = "1.0.0"
)
View Source
const (
	BaseUploadGoroutines = 20
)

Variables

View Source
var (
	GCtx          = context.Background()
	Client        *telegram.Client
	API           *tg.Client
	Self          *tg.User
	UpdateManager *updates.Manager
	SenderHelper  *tgMessage.Sender
)
View Source
var (
	ErrPeerIdInvalid = errors.New("[400 PEER_ID_INVALID] - The peer id being used is invalid or not known yet. Make sure you meet the peer before interacting with it")
)

Functions

func IsBackupUniqueId

func IsBackupUniqueId(value string) bool

func IsPostgresDatabaseUrl

func IsPostgresDatabaseUrl(value string) bool

func IsValidLocalFileOrDir

func IsValidLocalFileOrDir(value string) bool

IsValidLocalFileOrDir function will return true if and only if the value passed as argument to it represents an existing (and correct), local file/directory path.

Types

type BackupInfo

type BackupInfo struct {
	BackupUniqueId BackupUniqueIdValue `gorm:"primaryKey"`
	DatabaseName   string
	BackupDate     time.Time
	RequestedBy    int64
	Status         BackupStatus
	Message        string
}

BackupInfo contains the information about each backup the bot gets.

func (*BackupInfo) GetStrStatus

func (i *BackupInfo) GetStrStatus() string

func (*BackupInfo) SetAsCanceled

func (i *BackupInfo) SetAsCanceled()

func (*BackupInfo) SetAsFailed

func (i *BackupInfo) SetAsFailed(err error)

func (*BackupInfo) SetAsFinished

func (i *BackupInfo) SetAsFinished()

func (*BackupInfo) SetAsPending

func (i *BackupInfo) SetAsPending()

type BackupStatus

type BackupStatus int
const (
	// BackupStatusUnknown is only there as a default and invalid
	// backup status, the Status field of `BackupInfo` struct should not
	// contain this value at all, if it does, user will just face an
	// unknown situation (which is considered as a bug and has to be fixed).
	BackupStatusUnknown BackupStatus = iota
	// BackupStatusPending, as it sounds like, is when the backup is
	// pending (it's within the range of our BackupScheduleManager
	// time interval and it's sleeping till it gets the right time to
	// trigger its backup), or maybe it's in the middle of backup process,
	// or zipping the file, or uploading the files, etc etc...
	BackupStatusPending
	// BackupStatusCanceled is when the backup is canceled by user.
	// Please notice that only this time will get canceled by user,
	// the next time we reach the right time, we have to start backup
	//  process. (if users want to completely remove the backup process
	//  of a database, they have to remove the section from the config file).
	BackupStatusCanceled
	// BackupStatusFailed is when there has been an error in the backup
	// process, those errors have to be reported to users and inserted
	//  into database as past records, so when users want to see the
	// backup status in the future, they get access to it.
	BackupStatusFailed
	// BackupStatusFinished is when the backup process has been
	// finished successfully without encountering any errors in the
	// middle of way.
	BackupStatusFinished
)

func (BackupStatus) IsCanceled

func (s BackupStatus) IsCanceled() bool

func (BackupStatus) IsFailed

func (s BackupStatus) IsFailed() bool

func (BackupStatus) IsFinished

func (s BackupStatus) IsFinished() bool

func (BackupStatus) IsPending

func (s BackupStatus) IsPending() bool

func (BackupStatus) IsUnknown

func (s BackupStatus) IsUnknown() bool

type BackupUniqueIdValue

type BackupUniqueIdValue string

func GenerateBackupUniqueId

func GenerateBackupUniqueId() BackupUniqueIdValue

func (BackupUniqueIdValue) IsInvalid

func (i BackupUniqueIdValue) IsInvalid() bool

type DataBaseInfo

type DataBaseInfo struct {
	DatabaseName       string `gorm:"primaryKey"`
	LastBackup         time.Time
	LastBackupUniqueId BackupUniqueIdValue
}

DataBaseInfo contains information about a database with its name using as the primary key.

type PeerInfo

type PeerInfo struct {
	PeerId     int64    `json:"peer_id" gorm:"primaryKey"`
	AccessHash int64    `json:"access_hash"`
	PeerType   PeerType `json:"peer_type"`
}

func (*PeerInfo) GetRealID

func (i *PeerInfo) GetRealID() int64

type PeerType

type PeerType int

type UserPermission

type UserPermission int
const (
	NormalUser UserPermission = iota
	Stalk
	Special
	Friend
	PseudoSudo
	Sudo
	Owner
)

Jump to

Keyboard shortcuts

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