Commit graph

8 commits

Author SHA1 Message Date
e7d229c217 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>
2025-01-07 16:43:55 -08:00
41c420ebcc Merge branch 'ava-docbuf-insanity' into 'main'
runtime data persistence

See merge request whom/bingobot!16
2024-12-06 00:48:22 +00:00
9d3ca54ad4 initialize state package in main.go
This commit adds config values to the config package for state configuration.
This commit also adds a call to state.Init() to the main function.

Signed-off-by: Ava Affine <ava@sunnypup.io>
2024-12-05 16:40:34 -08:00
Piper Pentagram
0c64670c33 Use absolute paths where possible
bingobot blindly uses the shell's working dir to write logs and read
configs. This change introduces the following changes:

1. start.sh now determines the project root's absolute path before
   reading the token file and starting the app.
2. the config package now determine's the executable's working directory
   (rather than assuming it's the same as the shell's) before loading
   configs. It also now exposes this for use in other packages.
3. the logging package now uses config.GetWorkingDir() to determine
   where to write logs.
2024-11-14 11:16:30 -08:00
Piper Pentagram
9b00241d2b Implement UserActive events
This change introduces the UserActiveTimer,  which tracks voice activity
and emits UserActive events.

UserActiveTimer is basically a fancy wrapper around a context with
a deadline and cancelFunc. When a user joins a voice channel, a
UserActiveTimer is started.

If the user stays in the voice channel for an amount of time defined in the configs,
the timer context's deadline trips and a UserActive event is emitted. A new timer is then started.

If instead the user leaves the voice channel, the timer's context is
cancelled.

This change introduces two config values to manage this process:

VoiceActivityThresholdSeconds defines the length of time a user is
required to stay in vc before a UserActive event is generated.

VoiceActivityTimerSleepInterval defines how long the timer sleeps at any
one time. After this interval, it wakes up to check if its context has
been cancelled.

This change also changes the state package's UserEvent validation to
remove an import loop. We will now assume that the discord package
has already validated any UIDs it passes along to the state package.
2024-11-14 10:42:02 -08:00
6afd0122c9 Fix config unit tests
Recent changes to config and logging modules have left the tests needing
to initialize both config and logging packages. This commit updates the
config module to automatically initialize into at least useful defaults
at module load time. This commit also fixes the config unit tests by
using the more up to date interface that the package provides.

Signed-off-by: Ava Affine <ava@sunnypup.io>
2024-11-14 10:27:45 -08:00
piper pentagram
07223320af Move the config package to a singleton pattern 2024-11-13 22:03:57 +00:00
Piper Pentagram
450d425b04 move config & logging packages into internal submodules 2024-11-06 16:01:38 -08:00
Renamed from config.go (Browse further)