laniakea v1.0.0 rc1
This commit is contained in:
13
.dockerignore
Normal file
13
.dockerignore
Normal file
@@ -0,0 +1,13 @@
|
||||
.git
|
||||
.gitignore
|
||||
.idea
|
||||
.env
|
||||
.env.*
|
||||
*.log
|
||||
logs/
|
||||
Dockerfile
|
||||
README.md
|
||||
Makefile
|
||||
build.bat
|
||||
docker-compose.yml
|
||||
db.docker-compose.yml
|
||||
37
Dockerfile
37
Dockerfile
@@ -1,25 +1,28 @@
|
||||
# syntax=docker/dockerfile:1.7
|
||||
FROM golang:1.26-alpine3.23 AS builder
|
||||
ARG BUILD_TIME
|
||||
ARG GIT_COMMIT
|
||||
ARG BUILD_TIME=unknown
|
||||
ARG GIT_COMMIT=unknown
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
|
||||
WORKDIR /usr/src/ymgb
|
||||
COPY go.mod go.sum ./
|
||||
#COPY ./laniakea ./laniakea
|
||||
RUN --mount=type=cache,target=/go/pkg/mod go mod download -x
|
||||
COPY ./database ./database
|
||||
COPY ./plugins ./plugins
|
||||
COPY ./utils ./utils
|
||||
COPY ./openai ./openai
|
||||
COPY ./main.go ./
|
||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
--mount=type=cache,target=/go/pkg/mod \
|
||||
CGO_ENABLED=0 go build -trimpath \
|
||||
RUN --mount=type=cache,target=/go/pkg/mod,sharing=locked \
|
||||
go mod download
|
||||
COPY . .
|
||||
RUN --mount=type=cache,target=/root/.cache/go-build,sharing=locked \
|
||||
--mount=type=cache,target=/go/pkg/mod,sharing=locked \
|
||||
CGO_ENABLED=0 GOOS="${TARGETOS:-linux}" GOARCH="${TARGETARCH:-amd64}" \
|
||||
go build -trimpath \
|
||||
-ldflags="-s -w -X 'ymgb/utils.BuildTime=$BUILD_TIME' -X 'ymgb/utils.GitCommit=$GIT_COMMIT'" \
|
||||
-v -o /usr/local/bin/ymgb ./
|
||||
-o /out/ymgb ./
|
||||
|
||||
FROM alpine:3.23 AS runner
|
||||
RUN apk add --no-cache ca-certificates tzdata \
|
||||
&& addgroup -S ymgb \
|
||||
&& adduser -S -D -H -G ymgb ymgb
|
||||
WORKDIR /app
|
||||
ENV TZ=Europe/Moscow
|
||||
ENV GOMEMLIMIT=256MiB
|
||||
COPY --from=builder /usr/local/bin/ymgb /app/ymgb
|
||||
CMD ["/app/ymgb"]
|
||||
USER nobody
|
||||
COPY --from=builder --chown=ymgb:ymgb /out/ymgb /app/ymgb
|
||||
USER ymgb:ymgb
|
||||
ENTRYPOINT ["/app/ymgb"]
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
While development, if needed to change core code, clone dev branch [Laniakea](https://git.nix13.pw/ScuroNeko/Laniakea) inside root folder as `laniakea`.
|
||||
Uncomment `replace git.nix13.pw/scuroneko/laniakea v{VERSION} => ./laniakea`.
|
||||
|
||||
You can build docker with custom core. Add `COPY ./laniakea ./laniakea` after `COPY go.mod go.sum ./`.
|
||||
Docker build now copies the whole project context except files excluded by `.dockerignore`, so a local `./laniakea` folder is picked up automatically when the `replace` directive is enabled.
|
||||
|
||||
To build with release core, remove rename from `go.mod`
|
||||
To build with release core, remove rename from `go.mod`
|
||||
|
||||
@@ -48,7 +48,7 @@ func GetConsoleLogs(db *database.Context) ([]ConsoleLogEntry, error) {
|
||||
|
||||
type MessageLogEntry struct {
|
||||
MessageID int `bson:"messageId" json:"message_id"`
|
||||
SenderID int `bson:"senderId" json:"sender_id"`
|
||||
SenderID int64 `bson:"senderId" json:"sender_id"`
|
||||
ChatID int64 `bson:"chatId" json:"chat_id"`
|
||||
Text string `bson:"text" json:"text"`
|
||||
TimeStamp int64 `bson:"timestamp" json:"timestamp"`
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
type User struct {
|
||||
ID int
|
||||
ID int64
|
||||
Balance decimal.Decimal
|
||||
Name string
|
||||
GroupID int `db:"group_id"`
|
||||
@@ -60,7 +60,7 @@ func NewUserRepository(db *database.Context) UserRepository {
|
||||
return newUserRepository(db.Postgres)
|
||||
}
|
||||
|
||||
func (rep UserRepository) GetOrCreate(tgId int, name string) (*User, error) {
|
||||
func (rep UserRepository) GetOrCreate(tgId int64, name string) (*User, error) {
|
||||
user, err := rep.GetById(tgId)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
user, err = rep.Create(tgId, name)
|
||||
@@ -68,13 +68,13 @@ func (rep UserRepository) GetOrCreate(tgId int, name string) (*User, error) {
|
||||
return user, err
|
||||
}
|
||||
|
||||
func (rep UserRepository) Create(id int, name string) (*User, error) {
|
||||
func (rep UserRepository) Create(id int64, name string) (*User, error) {
|
||||
user := new(User)
|
||||
err := rep.db.Get(user, "INSERT INTO users (id, name) VALUES ($1, $2) RETURNING *;", id, name)
|
||||
return user, err
|
||||
}
|
||||
|
||||
func (rep UserRepository) GetById(telegramId int) (*User, error) {
|
||||
func (rep UserRepository) GetById(telegramId int64) (*User, error) {
|
||||
user := new(User)
|
||||
err := rep.db.Get(user, "SELECT * FROM users WHERE id=$1;", telegramId)
|
||||
if err != nil {
|
||||
@@ -125,7 +125,7 @@ func (rep UserRepository) GetJoins(user *User) (*User, error) {
|
||||
user.Miner = &miner
|
||||
}
|
||||
if user.PairID.Valid {
|
||||
pair, err := rep.GetById(int(user.PairID.Int64))
|
||||
pair, err := rep.GetById(user.PairID.Int64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
type Waifu struct {
|
||||
ID int
|
||||
ID int64
|
||||
OwnerID sql.NullInt64 `db:"owner_id"`
|
||||
Name string
|
||||
Rarity int
|
||||
@@ -51,7 +51,7 @@ func (rep *WaifuRepository) GetAll() ([]*Waifu, error) {
|
||||
return waifus, err
|
||||
}
|
||||
|
||||
func (rep *WaifuRepository) GetByUserId(userId int) ([]*Waifu, error) {
|
||||
func (rep *WaifuRepository) GetByUserId(userId int64) ([]*Waifu, error) {
|
||||
waifus, err := sqlx.List[*Waifu](rep.db, "SELECT waifus.* FROM waifus WHERE owner_id=$1;", userId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -69,7 +69,7 @@ func (rep *WaifuRepository) GetByUserId(userId int) ([]*Waifu, error) {
|
||||
return waifus, nil
|
||||
}
|
||||
|
||||
func (rep *WaifuRepository) GetCountByUserId(userId int) (int64, error) {
|
||||
func (rep *WaifuRepository) GetCountByUserId(userId int64) (int64, error) {
|
||||
var count int64 = 0
|
||||
err := rep.db.QueryRow("SELECT COUNT(*) FROM waifus WHERE owner_id=$1;", userId).Scan(&count)
|
||||
return count, err
|
||||
@@ -91,7 +91,7 @@ func (rep *WaifuRepository) GetFreeByRarity(rarity int) ([]Waifu, error) {
|
||||
return waifus, err
|
||||
}
|
||||
|
||||
func (rep *WaifuRepository) GetById(id int) (*Waifu, error) {
|
||||
func (rep *WaifuRepository) GetById(id int64) (*Waifu, error) {
|
||||
waifu := new(Waifu)
|
||||
err := rep.db.Get(waifu, "SELECT * FROM waifus WHERE id=$1;", id)
|
||||
if err != nil {
|
||||
|
||||
@@ -23,8 +23,8 @@ type RPRepository struct {
|
||||
|
||||
type RPChat struct {
|
||||
ID uuid.UUID
|
||||
UserID int
|
||||
WaifuID int
|
||||
UserID int64
|
||||
WaifuID int64
|
||||
Prompt string
|
||||
Counter int
|
||||
ChatTokens int64
|
||||
@@ -39,25 +39,25 @@ func NewRPRepository(db *database.Context) RPRepository {
|
||||
return RPRepository{db.Redis, db}
|
||||
}
|
||||
|
||||
func (rep RPRepository) SetSelectedWaifu(userId, waifuId int) error {
|
||||
func (rep RPRepository) SetSelectedWaifu(userId, waifuId int64) error {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d", userId)
|
||||
return rep.client.Set(ctx, key, waifuId, 0).Err()
|
||||
}
|
||||
func (rep RPRepository) GetSelectedWaifu(userId int) int {
|
||||
func (rep RPRepository) GetSelectedWaifu(userId int64) int64 {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d", userId)
|
||||
res := rep.client.Get(ctx, key)
|
||||
if res.Err() != nil {
|
||||
return 0
|
||||
}
|
||||
i, _ := res.Int()
|
||||
return i
|
||||
return int64(i)
|
||||
}
|
||||
|
||||
func (rep RPRepository) SetChatId(userId, waifuId int, chatId string) error {
|
||||
func (rep RPRepository) SetChatId(userId, waifuId int64, chatId string) error {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.chat", userId, waifuId)
|
||||
return rep.client.Set(context.Background(), key, chatId, 0).Err()
|
||||
}
|
||||
func (rep RPRepository) GetChatId(userId, waifuId int) string {
|
||||
func (rep RPRepository) GetChatId(userId, waifuId int64) string {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.chat", userId, waifuId)
|
||||
res := rep.client.Get(ctx, key)
|
||||
if res.Err() != nil {
|
||||
@@ -65,7 +65,7 @@ func (rep RPRepository) GetChatId(userId, waifuId int) string {
|
||||
}
|
||||
return res.Val()
|
||||
}
|
||||
func (rep RPRepository) GetOrCreateChatId(userId, waifuId int) (string, error) {
|
||||
func (rep RPRepository) GetOrCreateChatId(userId, waifuId int64) (string, error) {
|
||||
chatId := rep.GetChatId(userId, waifuId)
|
||||
if chatId == "" {
|
||||
chatId = uuid.New().String()
|
||||
@@ -73,7 +73,7 @@ func (rep RPRepository) GetOrCreateChatId(userId, waifuId int) (string, error) {
|
||||
err := rep.SetChatId(userId, waifuId, chatId)
|
||||
return chatId, err
|
||||
}
|
||||
func (rep RPRepository) GetChat(userId int) (RPChat, error) {
|
||||
func (rep RPRepository) GetChat(userId int64) (RPChat, error) {
|
||||
var chat RPChat
|
||||
waifuId := rep.GetSelectedWaifu(userId)
|
||||
if waifuId == 0 {
|
||||
@@ -133,7 +133,7 @@ func (rep RPRepository) SaveChat(chat RPChat) error {
|
||||
if err = rep.SetCounter(userId, waifuId, chat.Counter); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = rep.SetChatTokens(userId, waifuId, int(chat.ChatTokens)); err != nil {
|
||||
if err = rep.SetChatTokens(userId, waifuId, chat.ChatTokens); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -161,11 +161,11 @@ func (rep RPRepository) SaveChat(chat RPChat) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rep RPRepository) SetChatPrompt(userId, waifuId int, prompt string) error {
|
||||
func (rep RPRepository) SetChatPrompt(userId, waifuId int64, prompt string) error {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.prompt", userId, waifuId)
|
||||
return rep.client.Set(context.Background(), key, prompt, 0).Err()
|
||||
}
|
||||
func (rep RPRepository) GetChatPrompt(userId, waifuId int) string {
|
||||
func (rep RPRepository) GetChatPrompt(userId, waifuId int64) string {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.prompt", userId, waifuId)
|
||||
res := rep.client.Get(ctx, key)
|
||||
if res.Err() != nil {
|
||||
@@ -174,11 +174,11 @@ func (rep RPRepository) GetChatPrompt(userId, waifuId int) string {
|
||||
return res.Val()
|
||||
}
|
||||
|
||||
func (rep RPRepository) SetCounter(userId, waifuId, counter int) error {
|
||||
func (rep RPRepository) SetCounter(userId, waifuId int64, counter int) error {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.counter", userId, waifuId)
|
||||
return rep.client.Set(ctx, key, counter, 0).Err()
|
||||
}
|
||||
func (rep RPRepository) GetCounter(userId, waifuId int) int {
|
||||
func (rep RPRepository) GetCounter(userId, waifuId int64) int {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.counter", userId, waifuId)
|
||||
res := rep.client.Get(ctx, key)
|
||||
if res.Err() != nil {
|
||||
@@ -188,25 +188,25 @@ func (rep RPRepository) GetCounter(userId, waifuId int) int {
|
||||
return i
|
||||
}
|
||||
|
||||
func (rep RPRepository) SetChatTokens(userId, waifuId, tokens int) error {
|
||||
func (rep RPRepository) SetChatTokens(userId, waifuId, tokens int64) error {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.tokens", userId, waifuId)
|
||||
return rep.client.Set(ctx, key, tokens, 0).Err()
|
||||
}
|
||||
func (rep RPRepository) GetChatTokens(userId, waifuId int) int {
|
||||
func (rep RPRepository) GetChatTokens(userId, waifuId int64) int64 {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.tokens", userId, waifuId)
|
||||
res := rep.client.Get(ctx, key)
|
||||
if res.Err() != nil {
|
||||
return 0
|
||||
}
|
||||
i, _ := res.Int()
|
||||
return i
|
||||
return int64(i)
|
||||
}
|
||||
|
||||
func (rep RPRepository) SetChatSettingID(userId, waifuId, settingId int) error {
|
||||
func (rep RPRepository) SetChatSettingID(userId, waifuId int64, settingId int) error {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.setting_id", userId, waifuId)
|
||||
return rep.client.Set(ctx, key, settingId, 0).Err()
|
||||
}
|
||||
func (rep RPRepository) GetChatSettingID(userId, waifuId int) int {
|
||||
func (rep RPRepository) GetChatSettingID(userId, waifuId int64) int {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.setting_id", userId, waifuId)
|
||||
res := rep.client.Get(ctx, key)
|
||||
if res.Err() != nil {
|
||||
@@ -216,12 +216,12 @@ func (rep RPRepository) GetChatSettingID(userId, waifuId int) int {
|
||||
return i
|
||||
}
|
||||
|
||||
func (rep RPRepository) SetChatScenariosIDs(userId, waifuId int, scenarioIds []int) error {
|
||||
func (rep RPRepository) SetChatScenariosIDs(userId, waifuId int64, scenarioIds []int) error {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.scenario_id", userId, waifuId)
|
||||
ids := strings.Join(utils.Map(scenarioIds, utils.AnyToString), ",")
|
||||
return rep.client.Set(ctx, key, ids, 0).Err()
|
||||
}
|
||||
func (rep RPRepository) GetChatScenariosIDs(userId, waifuId int) []int {
|
||||
func (rep RPRepository) GetChatScenariosIDs(userId, waifuId int64) []int {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.scenario_id", userId, waifuId)
|
||||
res := rep.client.Get(ctx, key)
|
||||
if res.Err() != nil {
|
||||
|
||||
8
go.mod
8
go.mod
@@ -3,9 +3,9 @@ module ymgb
|
||||
go 1.26.1
|
||||
|
||||
require (
|
||||
git.nix13.pw/scuroneko/extypes v1.2.1
|
||||
git.nix13.pw/scuroneko/laniakea v1.0.0-beta.21
|
||||
git.nix13.pw/scuroneko/slog v1.0.2
|
||||
git.nix13.pw/scuroneko/extypes v1.2.2
|
||||
git.nix13.pw/scuroneko/laniakea v1.0.0-rc.1
|
||||
git.nix13.pw/scuroneko/slog v1.1.2
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/joho/godotenv v1.5.1
|
||||
github.com/lib/pq v1.11.2
|
||||
@@ -15,7 +15,7 @@ require (
|
||||
go.mongodb.org/mongo-driver/v2 v2.5.0
|
||||
)
|
||||
|
||||
//replace git.nix13.pw/scuroneko/laniakea v1.0.0-beta.21 => ./laniakea
|
||||
//replace git.nix13.pw/scuroneko/laniakea v1.0.0-rc.1 => ./laniakea
|
||||
//replace git.nix13.pw/scuroneko/extypes v1.2.1 => ../go-extypes
|
||||
//replace git.nix13.pw/scuroneko/slog v1.0.2 => ../slog
|
||||
|
||||
|
||||
12
go.sum
12
go.sum
@@ -1,11 +1,11 @@
|
||||
filippo.io/edwards25519 v1.1.1 h1:YpjwWWlNmGIDyXOn8zLzqiD+9TyIlPhGFG96P39uBpw=
|
||||
filippo.io/edwards25519 v1.1.1/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
git.nix13.pw/scuroneko/extypes v1.2.1 h1:IYrOjnWKL2EAuJYtYNa+luB1vBe6paE8VY/YD+5/RpQ=
|
||||
git.nix13.pw/scuroneko/extypes v1.2.1/go.mod h1:uZVs8Yo3RrYAG9dMad6qR6lsYY67t+459D9c65QAYAw=
|
||||
git.nix13.pw/scuroneko/laniakea v1.0.0-beta.21 h1:bit6fm6xtwoDh3BTjKduzyg++4BLiiQ392NmxnSr5lI=
|
||||
git.nix13.pw/scuroneko/laniakea v1.0.0-beta.21/go.mod h1:M8jwm195hzAl9bj9Bkl95WfHmWvuBX6micsdtOs/gmE=
|
||||
git.nix13.pw/scuroneko/slog v1.0.2 h1:vZyUROygxC2d5FJHUQM/30xFEHY1JT/aweDZXA4rm2g=
|
||||
git.nix13.pw/scuroneko/slog v1.0.2/go.mod h1:3Qm2wzkR5KjwOponMfG7TcGSDjmYaFqRAmLvSPTuWJI=
|
||||
git.nix13.pw/scuroneko/extypes v1.2.2 h1:N54c1ejrPs1yfIkvYuwqI7B1+8S9mDv2GqQA6sct4dk=
|
||||
git.nix13.pw/scuroneko/extypes v1.2.2/go.mod h1:b4XYk1OW1dVSiE2MT/OMuX/K/UItf1swytX6eroVYnk=
|
||||
git.nix13.pw/scuroneko/laniakea v1.0.0-rc.1 h1:zh4Mrp9qEX/9p/NGMUXzaWj4G6koTQMYWJeHJ9fB5sM=
|
||||
git.nix13.pw/scuroneko/laniakea v1.0.0-rc.1/go.mod h1:gBo6l+CqxhcL6oI4YgAK7Z5PkwkZRRzhVrQWji2WAAg=
|
||||
git.nix13.pw/scuroneko/slog v1.1.2 h1:pl7tV5FN25Yso7sLYoOgBXi9+jLo5BDJHWmHlNPjpY0=
|
||||
git.nix13.pw/scuroneko/slog v1.1.2/go.mod h1:UcfRIHDqpVQHahBGM93awLDK8//AsAvOqBwwbWqMkjM=
|
||||
github.com/alitto/pond/v2 v2.7.0 h1:c76L+yN916m/DRXjGCeUBHHu92uWnh/g1bwVk4zyyXg=
|
||||
github.com/alitto/pond/v2 v2.7.0/go.mod h1:xkjYEgQ05RSpWdfSd1nM3OVv7TBhLdy7rMp3+2Nq+yE=
|
||||
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
||||
|
||||
@@ -107,7 +107,7 @@ func uploadPhoto(ctx *laniakea.MsgContext, _ *database.Context) {
|
||||
return
|
||||
}
|
||||
filename := filepath.Base(f.FilePath)
|
||||
msg, err := u.UploadPhoto(tgapi.UploadPhotoP{
|
||||
msg, err := u.SendPhoto(tgapi.UploadPhotoP{
|
||||
ChatID: ctx.Msg.Chat.ID,
|
||||
Caption: ctx.Msg.Caption,
|
||||
}, tgapi.NewUploaderFile(filename, content))
|
||||
|
||||
@@ -189,14 +189,14 @@ func rpWaifuSet(ctx *laniakea.MsgContext, db *database.Context) {
|
||||
return
|
||||
}
|
||||
rpRepRed := red.NewRPRepository(db)
|
||||
err = rpRepRed.SetSelectedWaifu(ctx.FromID, waifuId)
|
||||
err = rpRepRed.SetSelectedWaifu(ctx.FromID, int64(waifuId))
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
return
|
||||
}
|
||||
//rpRepPsql := psql.NewRPRepository(db)
|
||||
waifuRep := psql.NewWaifuRepository(db)
|
||||
waifu, err := waifuRep.GetById(waifuId)
|
||||
waifu, err := waifuRep.GetById(int64(waifuId))
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
}
|
||||
@@ -756,7 +756,7 @@ func generate(ctx *laniakea.MsgContext, db *database.Context) {
|
||||
}
|
||||
|
||||
tokens := redisRpRep.GetChatTokens(ctx.FromID, waifuId)
|
||||
tokens += len(userMessage) + len(answerContent)
|
||||
tokens += int64(len(userMessage) + len(answerContent))
|
||||
err = redisRpRep.SetChatTokens(ctx.FromID, waifuId, tokens)
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
@@ -780,7 +780,7 @@ func generate(ctx *laniakea.MsgContext, db *database.Context) {
|
||||
m.Delete()
|
||||
}
|
||||
case "tokens":
|
||||
if tokens >= rpUser.CompressLimit*1000 {
|
||||
if tokens >= int64(rpUser.CompressLimit*1000) {
|
||||
m = ctx.Answer("Запущено сжатие чата…")
|
||||
_compress(ctx, db)
|
||||
m.Delete()
|
||||
@@ -966,7 +966,7 @@ func _compress(ctx *laniakea.MsgContext, db *database.Context) {
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
}
|
||||
err = redisRpRep.SetChatTokens(ctx.FromID, waifuId, tokens)
|
||||
err = redisRpRep.SetChatTokens(ctx.FromID, waifuId, int64(tokens))
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ func waifuSell(ctx *laniakea.MsgContext, db *database.Context) {
|
||||
}
|
||||
|
||||
rep := psql.NewWaifuRepository(db)
|
||||
waifu, err := rep.GetById(waifuId)
|
||||
waifu, err := rep.GetById(int64(waifuId))
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
return
|
||||
@@ -164,7 +164,7 @@ func waifuInfo(ctx *laniakea.MsgContext, db *database.Context) {
|
||||
}
|
||||
|
||||
rep := psql.NewWaifuRepository(db)
|
||||
waifu, err := rep.GetById(waifuId)
|
||||
waifu, err := rep.GetById(int64(waifuId))
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user