Skip to content

Commit

Permalink
refactor: change post_artwork_r18 behavior to reserveR18
Browse files Browse the repository at this point in the history
  • Loading branch information
krau committed Nov 2, 2024
1 parent 8d0a280 commit 3c4542a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions telegram/handlers/admin_post_artwork.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func PostArtworkCallbackQuery(ctx context.Context, bot *telego.Bot, query telego
return
}
queryDataSlice := strings.Split(query.Data, " ")
asR18 := queryDataSlice[0] == "post_artwork_r18"
reverseR18 := queryDataSlice[0] == "post_artwork_r18"
dataID := queryDataSlice[1]
sourceURL, err := service.GetCallbackDataByID(ctx, dataID)
if err != nil {
Expand Down Expand Up @@ -87,8 +87,8 @@ func PostArtworkCallbackQuery(ctx context.Context, bot *telego.Bot, query telego
})
return
}
if asR18 {
artwork.R18 = true
if reverseR18 {
artwork.R18 = !artwork.R18
}

if IsChannelAvailable {
Expand Down Expand Up @@ -333,7 +333,7 @@ func ArtworkPreview(ctx context.Context, bot *telego.Bot, query telego.CallbackQ
postArtworkKeyboard := []telego.InlineKeyboardButton{
telegoutil.InlineKeyboardButton("发布").WithCallbackData("post_artwork " + dataID),
telegoutil.InlineKeyboardButton("查重").WithCallbackData("search_picture " + dataID),
telegoutil.InlineKeyboardButton("发布(R18)").WithCallbackData("post_artwork_r18 " + dataID),
telegoutil.InlineKeyboardButton("发布(!R18)").WithCallbackData("post_artwork_r18 " + dataID),
}
currentPictureIndexStr := queryDataSlice[4]
currentPictureIndex, err := strconv.Atoi(currentPictureIndexStr)
Expand Down
2 changes: 1 addition & 1 deletion telegram/utils/send_artwork_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func getArtworkInfoReplyMarkup(ctx context.Context, artwork *types.Artwork, isCr
[]telego.InlineKeyboardButton{
telegoutil.InlineKeyboardButton("发布").WithCallbackData("post_artwork " + cbId),
telegoutil.InlineKeyboardButton("查重").WithCallbackData("search_picture " + cbId),
telegoutil.InlineKeyboardButton("发布(R18)").WithCallbackData("post_artwork_r18 " + cbId),
telegoutil.InlineKeyboardButton("发布(!R18)").WithCallbackData("post_artwork_r18 " + cbId),
},
previewKeyboard,
), nil
Expand Down

0 comments on commit 3c4542a

Please sign in to comment.