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:
Gary Kramlich
2021-12-30 09:33:06 -06:00
parent 78ab3d3804
commit 456a15ba56
19 changed files with 859 additions and 16 deletions

View File

@@ -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
}