chore: move ten setu to redeem list
This commit is contained in:
5 files changed
+25
-23
No files matched your search
@@ -22,10 +22,7 @@ import cn.rtast.fancybot.commands.misc.ShortLinkCommand
|
||||
import cn.rtast.fancybot.entity.Config
|
||||
import cn.rtast.fancybot.entity.enums.ImageType
|
||||
import cn.rtast.fancybot.entity.enums.WSType
|
||||
import cn.rtast.fancybot.items.BaisiItem
|
||||
import cn.rtast.fancybot.items.HeisiItem
|
||||
import cn.rtast.fancybot.items.NiuziItem
|
||||
import cn.rtast.fancybot.items.SetuItem
|
||||
import cn.rtast.fancybot.items.*
|
||||
import cn.rtast.fancybot.util.file.ConfigManager
|
||||
import cn.rtast.fancybot.util.file.NiuziBankManager
|
||||
import cn.rtast.fancybot.util.file.NiuziManager
|
||||
@@ -77,7 +74,8 @@ val START_UP_TIME = Instant.now().epochSecond
|
||||
|
||||
val items = listOf(
|
||||
HeisiItem(), BaisiItem(),
|
||||
SetuItem(), NiuziItem()
|
||||
SetuItem(), NiuziItem(),
|
||||
TenSetuItem()
|
||||
)
|
||||
|
||||
val commands = listOf(
|
||||
@@ -95,7 +93,6 @@ val commands = listOf(
|
||||
UnsetZiBiCommand(), WikipediaCommand(),
|
||||
AsciiArtCommand(), StatusCommand(),
|
||||
JueCommand(), ShortLinkCommand(),
|
||||
TenSetuCommand(), ShotSelfCommand(),
|
||||
ShotOtherCommand(), ReverseGIFCommand(),
|
||||
HelpCommand(), MusicCommand(),
|
||||
LikeMeCommand(), NiuziTransferCommand(),
|
||||
@@ -106,5 +103,6 @@ val commands = listOf(
|
||||
BankBalanceCommand(), DepositCommand(),
|
||||
DMSearchCommand(), LlamaCommand(),
|
||||
QQMusicCommand(), BullShitGenerateCommand(),
|
||||
NiuziRankCommand(), NiuziBankRankCommand()
|
||||
NiuziRankCommand(), NiuziBankRankCommand(),
|
||||
ShotSelfCommand()
|
||||
)
|
||||
@@ -16,7 +16,7 @@ import cn.rtast.rob.util.ob.OneBotListener
|
||||
|
||||
class BaisiItem : Item() {
|
||||
override val itemNames = listOf("baisi", "白丝", "bs")
|
||||
override val itemPrice = 5.0
|
||||
override val itemPrice = 3.0
|
||||
|
||||
override suspend fun redeemInGroup(
|
||||
listener: OneBotListener,
|
||||
|
||||
@@ -16,7 +16,7 @@ import cn.rtast.rob.util.ob.OneBotListener
|
||||
|
||||
class HeisiItem : Item() {
|
||||
override val itemNames = listOf("heisi", "黑丝", "hs")
|
||||
override val itemPrice = 5.0
|
||||
override val itemPrice = 3.0
|
||||
|
||||
override suspend fun redeemInGroup(
|
||||
listener: OneBotListener,
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.net.URI
|
||||
|
||||
class SetuItem : Item() {
|
||||
override val itemNames = listOf("setu", "色图", "st")
|
||||
override val itemPrice = 10.0
|
||||
override val itemPrice = 4.0
|
||||
|
||||
override suspend fun redeemInGroup(
|
||||
listener: OneBotListener,
|
||||
|
||||
+17
-13
@@ -1,37 +1,40 @@
|
||||
/*
|
||||
* Copyright © 2024 RTAkland
|
||||
* Author: RTAkland
|
||||
* Date: 2024/9/23
|
||||
* Date: 2024/9/28
|
||||
*/
|
||||
|
||||
|
||||
package cn.rtast.fancybot.commands.misc
|
||||
package cn.rtast.fancybot.items
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.configManager
|
||||
import cn.rtast.fancybot.entity.Setu
|
||||
import cn.rtast.fancybot.util.Http
|
||||
import cn.rtast.fancybot.util.item.Item
|
||||
import cn.rtast.fancybot.util.str.encodeToBase64
|
||||
import cn.rtast.fancybot.util.str.fromArrayJson
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
import cn.rtast.rob.util.BaseCommand
|
||||
import cn.rtast.rob.util.ob.MessageChain
|
||||
import cn.rtast.rob.util.ob.NodeMessageChain
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
import cn.rtast.rob.util.ob.asNode
|
||||
import java.net.URI
|
||||
|
||||
@CommandDescription("老板你好, 给我来十张色图")
|
||||
class TenSetuCommand : BaseCommand() {
|
||||
override val commandNames = listOf("十张色图")
|
||||
class TenSetuItem : Item() {
|
||||
override val itemNames = listOf("十张色图")
|
||||
override val itemPrice = 20.0
|
||||
|
||||
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
|
||||
val nodeMsg = NodeMessageChain.Builder()
|
||||
override suspend fun redeemInGroup(
|
||||
listener: OneBotListener,
|
||||
message: GroupMessage,
|
||||
after: Double
|
||||
): MessageChain.Builder {
|
||||
val imageMessages = mutableListOf<MessageChain>()
|
||||
val response = Http.get("https://api.rtast.cn/api/setu?size=10").fromArrayJson<List<Setu>>()
|
||||
response.filter { !it.r18 }.map { it.urls.large }.forEach {
|
||||
try {
|
||||
val imageBase64 = URI(it).toURL().readBytes().encodeToBase64()
|
||||
val tempMsg = MessageChain.Builder().addImage(imageBase64, true).build()
|
||||
nodeMsg.addMessageChain(tempMsg, configManager.selfId)
|
||||
imageMessages.add(tempMsg)
|
||||
} catch (_: Exception) {
|
||||
}
|
||||
}
|
||||
@@ -40,7 +43,8 @@ class TenSetuCommand : BaseCommand() {
|
||||
.addNewLine()
|
||||
.addText("因为过滤了R18的图片~")
|
||||
.build()
|
||||
nodeMsg.addMessageChain(footerMsg, configManager.selfId)
|
||||
listener.sendGroupForwardMsg(message.groupId, nodeMsg.build())
|
||||
imageMessages.add(footerMsg)
|
||||
message.reply(imageMessages.asNode(configManager.selfId))
|
||||
return MessageChain.Builder()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user