Initial bot functionality
* The bot now properly joins the management room * The management room is persisted in the database * Welcome/help messages are sent in the management room
This commit is contained in:
@@ -15,6 +15,10 @@ type Database struct {
|
||||
*sql.DB
|
||||
log log.Logger
|
||||
dialect string
|
||||
|
||||
User *UserQuery
|
||||
Portal *PortalQuery
|
||||
Puppet *PuppetQuery
|
||||
}
|
||||
|
||||
func New(dbType, uri string, maxOpenConns, maxIdleConns int, baseLog log.Logger) (*Database, error) {
|
||||
@@ -42,5 +46,20 @@ func New(dbType, uri string, maxOpenConns, maxIdleConns int, baseLog log.Logger)
|
||||
dialect: dbType,
|
||||
}
|
||||
|
||||
db.User = &UserQuery{
|
||||
db: db,
|
||||
log: db.log.Sub("User"),
|
||||
}
|
||||
|
||||
db.Portal = &PortalQuery{
|
||||
db: db,
|
||||
log: db.log.Sub("Portal"),
|
||||
}
|
||||
|
||||
db.Puppet = &PuppetQuery{
|
||||
db: db,
|
||||
log: db.log.Sub("Puppet"),
|
||||
}
|
||||
|
||||
return db, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user