mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
move application and config struct to main
This commit is contained in:
parent
8ce13d01c3
commit
61f15ef9e3
12
cmd/bot/errors.go
Normal file
12
cmd/bot/errors.go
Normal file
|
@ -0,0 +1,12 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrUserLevelNotInteger = errors.New("user level must be a number")
|
||||
ErrCommandLevelNotInteger = errors.New("command level must be a number")
|
||||
ErrRecordNotFound = errors.New("user not found in the database")
|
||||
ErrUserInsufficientLevel = errors.New("user has insufficient level")
|
||||
)
|
|
@ -16,6 +16,26 @@ import (
|
|||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type config struct {
|
||||
twitchUsername string
|
||||
twitchOauth string
|
||||
commandPrefix string
|
||||
environment string
|
||||
db struct {
|
||||
dsn string
|
||||
maxOpenConns int
|
||||
maxIdleConns int
|
||||
maxIdleTime string
|
||||
}
|
||||
}
|
||||
|
||||
type Application struct {
|
||||
TwitchClient *twitch.Client
|
||||
Logger *zap.SugaredLogger
|
||||
Db *sql.DB
|
||||
Models data.Models
|
||||
}
|
||||
|
||||
func main() {
|
||||
var cfg config
|
||||
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"errors"
|
||||
|
||||
"github.com/gempir/go-twitch-irc/v3"
|
||||
"github.com/lyx0/nourybot/internal/data"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrUserLevelNotInteger = errors.New("user level must be a number")
|
||||
ErrCommandLevelNotInteger = errors.New("command level must be a number")
|
||||
ErrRecordNotFound = errors.New("user not found in the database")
|
||||
ErrUserInsufficientLevel = errors.New("user has insufficient level")
|
||||
)
|
||||
|
||||
type config struct {
|
||||
twitchUsername string
|
||||
twitchOauth string
|
||||
commandPrefix string
|
||||
environment string
|
||||
db struct {
|
||||
dsn string
|
||||
maxOpenConns int
|
||||
maxIdleConns int
|
||||
maxIdleTime string
|
||||
}
|
||||
}
|
||||
|
||||
type Application struct {
|
||||
TwitchClient *twitch.Client
|
||||
Logger *zap.SugaredLogger
|
||||
Db *sql.DB
|
||||
Models data.Models
|
||||
}
|
Loading…
Reference in a new issue