Commit graph

8 commits

Author SHA1 Message Date
fed49ba3cb refactor main, and fix bugs from initial manual run
Signed-off-by: Ava Affine <ava@sunnypup.io>
2025-01-13 15:45:07 -08:00
55f9725af1 fix nil map dereference in discord commands, and add option type to slash command option
Signed-off-by: Ava Affine <ava@sunnypup.io>
2025-01-08 15:28:24 -08:00
359ff427e3 fix bug in activity timers
Signed-off-by: Ava Affine <ava@sunnypup.io>
2025-01-08 15:27:27 -08:00
430c0afaa6 Confessions module
This commit adds a confessions feature that allows users to mark a
"confessional" channel and also to post anonymously to it. The changes
that this comprises of are as follows:

- New discord "slash" commands for both marking a confessional and
  posting to it
- a bunch of stuff in the discord module to register and deregister
  "slash" commands
- New event type to track marked confessionals
- confession module that processes new confession channel links
  and also posts confessions to corresponding confessionals

Not included in this commit:
- a way to cleanup obsolete or reconfigured confession channel links
- access control for the confessional slash commands

Signed-off-by: Ava Affine <ava@sunnypup.io>
2025-01-08 13:40:11 -08:00
Piper Pentagram
fe860726b3 inline _activityTimerExists() into stopActivityTimer() 2024-11-14 10:58:15 -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
Piper Pentagram
8b54f09a95 Check the session pointer for nil before calling session.connected 2024-11-08 16:33:49 -08:00
Piper Pentagram
bbcf6ef6cf Create discord package and connect/disconnect handlers
This change moves the discord session singleton to the internal/discord
package, and implements basic Connect/Disconnect handlers.
2024-11-08 16:26:05 -08:00