Early functionality modules
0. tests for event replay Tests are now included for the event replay features. This includes many fixes on top of the last commit as well as some tweaks to config module values. 1. activity module An activity module is created to track the useractive events and provide a counter for them. It also encapsulates logic to discard old useractive events. 2. web module A web module is created. This module serves a static webpage showing runtime information. Currently it only shows a snapshot of the user activity data. It is my intention that it eventually also shows an audit log, known users and channels, uptime, and more. Future work will also be needed in order to use HTML templating so that it doesn't look so... basic. Live updates to the information may also be desired. Signed-off-by: Ava Affine <ava@sunnypup.io>
This commit is contained in:
parent
2515d396a0
commit
e7d229c217
8 changed files with 353 additions and 45 deletions
17
main.go
17
main.go
|
|
@ -4,10 +4,12 @@ import (
|
|||
"flag"
|
||||
"log"
|
||||
|
||||
"gitlab.com/whom/bingobot/internal/activity"
|
||||
"gitlab.com/whom/bingobot/internal/config"
|
||||
"gitlab.com/whom/bingobot/internal/discord"
|
||||
"gitlab.com/whom/bingobot/internal/logging"
|
||||
"gitlab.com/whom/bingobot/internal/state"
|
||||
"gitlab.com/whom/bingobot/internal/web"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -33,15 +35,22 @@ func main() {
|
|||
log.Fatalf("couldn't initialize state engine: %s", err.Error())
|
||||
}
|
||||
|
||||
// TODO: start modules HERE and not elsewhere
|
||||
err = startBot()
|
||||
if err := activity.Start(); err != nil {
|
||||
// TODO: handle gracefully and continue?
|
||||
log.Fatalf("failed to start activity module: %s", err.Error())
|
||||
}
|
||||
|
||||
if err := web.Start(); err != nil {
|
||||
log.Fatalf("failed to start local web server: %s", err.Error())
|
||||
}
|
||||
|
||||
// start this LAST
|
||||
if err := state.Start(); err != nil {
|
||||
log.Fatal("failed to start state machine: %s", err.Error())
|
||||
log.Fatalf("failed to start state machine: %s", err.Error())
|
||||
}
|
||||
defer state.Teardown()
|
||||
|
||||
if err != nil {
|
||||
if err := startBot(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue