Documentation ¶
Index ¶
- Constants
- Variables
- func CreateUser(username string, chatid int64, repo UserRepo) error
- func InitBot()
- func IsAuthorized(user *tgbotapi.User, repo UserRepo, rds RedisUserRepo) bool
- func NewPostgreRepo() *postgreRepo
- func NewRedisRepo() *redisRepo
- func Register(user *tgbotapi.User, chatid int64, repo UserRepo, rds RedisUserRepo)
- type BotLogger
- type DataTransfer
- type Level
- type RedisUserRepo
- type Repos
- type RequestMD
- type TaskWorker
- type UserRepo
Constants ¶
View Source
const ( NOT_AUTHORIZED_MSG = "You are not athorized to use this bot contact with @Gulolio or @SunShiNeXS. Btw, who the hell are you?" //Logging Levels //LevelDebug debugging LevelDebug Level = iota //LevelInfo info LevelInfo //LevelWarn warning LevelWarn //LevelError error LevelError //LevelCrit critic error LevelCrit RESULT_QUEUE = "results" BACKUP_RESULT_QUEUE = "results_back" TASK_QUEUE = "tasks" MAX_DOWNLOAD = 3 SESSION_EXP = 52 * time.Minute )
View Source
const PING_TIMEOUT = 10 * time.Second
Variables ¶
View Source
var ( TOKEN_API = os.Getenv("TOKEN_TELGRAM_API") CLOUDINARY_URL = os.Getenv("CLOUDINARY_URL") )
View Source
var ( REDIS_URL = os.Getenv("REDIS_URL") REDIS_PASSWORD = os.Getenv("REDIS_PASSWORD") )
View Source
var (
DATABASE_URL = os.Getenv("DATABASE_URL")
)
Functions ¶
func CreateUser ¶
CreateUser insert a user in DB
func IsAuthorized ¶
func IsAuthorized(user *tgbotapi.User, repo UserRepo, rds RedisUserRepo) bool
IsAuthorized check if given user is authorized
func NewPostgreRepo ¶
func NewPostgreRepo() *postgreRepo
Types ¶
type DataTransfer ¶
type DataTransfer struct { URL string `json:"url"` ImageURL string `json:"imageurl"` ChatID string `json:"chatid"` Path string `json:"path"` HashKey string `json:"hashkey"` }
DataTransfer is the data passed between ZeroMQ sockets
type RedisUserRepo ¶
RedisUserRepo ...
type TaskWorker ¶
Click to show internal directories.
Click to hide internal directories.