- Added a logging service to manage server event logs including message edits, deletions, member joins/leaves, and moderation actions. - Introduced commands to configure logging settings, including setting the log channel and enabling/disabling logging. - Updated the README to document the new logging features and commands. - Enhanced moderation commands to log actions taken on members.
33 lines
810 B
Go
33 lines
810 B
Go
package logsettings
|
|
|
|
import (
|
|
"context"
|
|
|
|
"velox-bot/internal/db/repos/settingsrepo"
|
|
)
|
|
|
|
type Service struct {
|
|
settings *settingsrepo.Repo
|
|
}
|
|
|
|
func New(settings *settingsrepo.Repo) *Service {
|
|
return &Service{settings: settings}
|
|
}
|
|
|
|
func (s *Service) SetChannel(ctx context.Context, guildID, channelID int64) error {
|
|
return s.settings.SetLogChannel(ctx, guildID, channelID)
|
|
}
|
|
|
|
func (s *Service) SetEnabled(ctx context.Context, guildID int64, enabled bool) error {
|
|
return s.settings.SetLogEnabled(ctx, guildID, enabled)
|
|
}
|
|
|
|
func (s *Service) GetSettings(ctx context.Context, guildID int64) (*settingsrepo.LogSettings, error) {
|
|
return s.settings.GetLogSettings(ctx, guildID)
|
|
}
|
|
|
|
func (s *Service) HasSettings(ctx context.Context, guildID int64) (bool, error) {
|
|
return s.settings.HasLogSettings(ctx, guildID)
|
|
}
|
|
|