Beta server and role come from the dashboard
The owner sets them on the admin page; the bot polls the shared beta_settings row (30s) and moves the beta commands if the server changes. BETA_* env vars are gone. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
1 parent
a364435bab
commit
1ee6280d91
7 files changed
+157
-24
No files matched your search
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"strconv"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgconn"
|
||||
)
|
||||
@@ -401,3 +402,23 @@ func (r *Repo) SetMusicEnabled(ctx context.Context, guildID int64, enabled bool)
|
||||
_, err := r.db.ExecContext(ctx, q, guildID, enabled)
|
||||
return err
|
||||
}
|
||||
|
||||
// GetBetaSettings returns the beta server and Beta Tester role as set on the
|
||||
// dashboard. Either is "" when not set (or when there's no row yet).
|
||||
func (r *Repo) GetBetaSettings(ctx context.Context) (guildID, roleID string, err error) {
|
||||
var g, role sql.NullInt64
|
||||
err = r.db.QueryRowContext(ctx, `SELECT guild_id, role_id FROM beta_settings WHERE id = TRUE`).Scan(&g, &role)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return "", "", nil
|
||||
}
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
if g.Valid {
|
||||
guildID = strconv.FormatInt(g.Int64, 10)
|
||||
}
|
||||
if role.Valid {
|
||||
roleID = strconv.FormatInt(role.Int64, 10)
|
||||
}
|
||||
return guildID, roleID, nil
|
||||
}
|
||||
Reference in new issue
Block a user