some fixes and changes; #4
This commit is contained in:
@@ -3,6 +3,8 @@ package red
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"kurumibot/utils"
|
||||
"strings"
|
||||
|
||||
"git.nix13.pw/scuroneko/laniakea"
|
||||
"github.com/google/uuid"
|
||||
@@ -109,16 +111,16 @@ func (rep *RPRepository) GetChatSettingID(userId, waifuId int) int {
|
||||
return i
|
||||
}
|
||||
|
||||
func (rep *RPRepository) SetChatScenarioID(userId, waifuId, scenarioId int) error {
|
||||
func (rep *RPRepository) SetChatScenariosIDs(userId, waifuId int, scenarioIds string) error {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.scenario_id", userId, waifuId)
|
||||
return rep.client.Set(ctx, key, scenarioId, 0).Err()
|
||||
return rep.client.Set(ctx, key, scenarioIds, 0).Err()
|
||||
}
|
||||
func (rep *RPRepository) GetChatScenarioID(userId, waifuId int) int {
|
||||
func (rep *RPRepository) GetChatScenariosIDs(userId, waifuId int) []int {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.scenario_id", userId, waifuId)
|
||||
res := rep.client.Get(ctx, key)
|
||||
if res.Err() != nil {
|
||||
return 0
|
||||
return []int{0}
|
||||
}
|
||||
i, _ := res.Int()
|
||||
return i
|
||||
ids := strings.Split(res.Val(), ",")
|
||||
return utils.Map(utils.StringToInt, ids)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user