feat: add remake command
This commit is contained in:
4 files changed
+84
-1
No files matched your search
@@ -19,6 +19,7 @@ import cn.rtast.fancybot.commands.MusicCommand
|
|||||||
import cn.rtast.fancybot.commands.MyPointCommand
|
import cn.rtast.fancybot.commands.MyPointCommand
|
||||||
import cn.rtast.fancybot.commands.QRCodeCommand
|
import cn.rtast.fancybot.commands.QRCodeCommand
|
||||||
import cn.rtast.fancybot.commands.RedeemCommand
|
import cn.rtast.fancybot.commands.RedeemCommand
|
||||||
|
import cn.rtast.fancybot.commands.RemakeCommand
|
||||||
import cn.rtast.fancybot.commands.SignCommand
|
import cn.rtast.fancybot.commands.SignCommand
|
||||||
import cn.rtast.fancybot.commands.WeatherCommand
|
import cn.rtast.fancybot.commands.WeatherCommand
|
||||||
import cn.rtast.fancybot.entity.enums.WSType
|
import cn.rtast.fancybot.entity.enums.WSType
|
||||||
@@ -85,7 +86,8 @@ val commands = listOf(
|
|||||||
HitokotoCommand(), FKXQSCommand(),
|
HitokotoCommand(), FKXQSCommand(),
|
||||||
QRCodeCommand(), AntiRevokeCommand(),
|
QRCodeCommand(), AntiRevokeCommand(),
|
||||||
MCPingCommand(), HelpCommand(),
|
MCPingCommand(), HelpCommand(),
|
||||||
WeatherCommand(), CigaretteCommand()
|
WeatherCommand(), CigaretteCommand(),
|
||||||
|
RemakeCommand()
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun main() {
|
suspend fun main() {
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2024 RTAkland
|
||||||
|
* Author: RTAkland
|
||||||
|
* Date: 2024/9/5
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package cn.rtast.fancybot.commands
|
||||||
|
|
||||||
|
import cn.rtast.fancybot.entity.enums.CountryList
|
||||||
|
import cn.rtast.fancybot.util.randomBooleanWithProbability
|
||||||
|
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.OBMessage
|
||||||
|
|
||||||
|
class RemakeCommand : BaseCommand() {
|
||||||
|
override val commandNames = listOf("/remake", "/重开", "remake", "重开")
|
||||||
|
|
||||||
|
private val locations = listOf(
|
||||||
|
"厕所", "首都", "农村", "市区", "大学"
|
||||||
|
)
|
||||||
|
|
||||||
|
private val roles = listOf(
|
||||||
|
"男孩子", "女孩子", "小男娘", "伞兵",
|
||||||
|
"人机", "114514", "是吧", "罕见",
|
||||||
|
"鸽子", "鼠鼠", "化石", "狗狗"
|
||||||
|
)
|
||||||
|
|
||||||
|
override suspend fun executeGroup(listener: OBMessage, message: GroupMessage, args: List<String>) {
|
||||||
|
val isSuccess = randomBooleanWithProbability(0.7)
|
||||||
|
val msg = MessageChain.Builder().addReply(message.messageId)
|
||||||
|
if (isSuccess) {
|
||||||
|
val country = CountryList.getRandomCountry()
|
||||||
|
val location = locations.random()
|
||||||
|
val role = roles.random()
|
||||||
|
msg.addText("重开成功! 你转生在${country.chineseName}的$location, 是一个$role")
|
||||||
|
} else
|
||||||
|
msg.addText("转生失败~")
|
||||||
|
listener.sendGroupMessage(message.groupId, msg.build())
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2024 RTAkland
|
||||||
|
* Author: RTAkland
|
||||||
|
* Date: 2024/9/5
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package cn.rtast.fancybot.entity.enums
|
||||||
|
|
||||||
|
enum class CountryList(val chineseName: String) {
|
||||||
|
China("中国"), UnitedStates("美国"), Russia("俄罗斯"),
|
||||||
|
Germany("德国"), France("法国"), UnitedKingdom("英国"),
|
||||||
|
Japan("日本"), Brazil("巴西"), Canada("加拿大"),
|
||||||
|
Australia("澳大利亚"), India("印度"), Italy("意大利"),
|
||||||
|
Spain("西班牙"), SouthKorea("韩国"), Mexico("墨西哥"),
|
||||||
|
Indonesia("印度尼西亚"), Turkey("土耳其"), SouthAfrica("南非"),
|
||||||
|
Argentina("阿根廷"), Netherlands("荷兰");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun getRandomCountry(): CountryList {
|
||||||
|
return entries.random()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2024 RTAkland
|
||||||
|
* Author: RTAkland
|
||||||
|
* Date: 2024/9/5
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package cn.rtast.fancybot.util
|
||||||
|
|
||||||
|
import kotlin.random.Random
|
||||||
|
|
||||||
|
fun randomBooleanWithProbability(probability: Double): Boolean {
|
||||||
|
val randomValue = Random.nextInt(100)
|
||||||
|
return randomValue <= (probability * 100)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user