update
This commit is contained in:
11 files changed
+367
-7
No files matched your search
@@ -12,11 +12,18 @@ import cn.rtast.rob.util.BaseCommand
|
||||
import cn.rtast.rob.util.ob.OBMessage
|
||||
import kotlin.random.Random
|
||||
|
||||
class JrrpCommand: BaseCommand() {
|
||||
override val commandName = "/jrrp"
|
||||
class JrrpCommand : BaseCommand() {
|
||||
override val commandName = "/今日人品"
|
||||
|
||||
override fun executeGroup(listener: OBMessage, message: GroupMessage, args: List<String>) {
|
||||
val score = Random.nextInt(0, 101)
|
||||
listener.sendGroupMessage(message.groupId, score.toString())
|
||||
val randomNumber = Random.nextInt(0, 101)
|
||||
val scoreDesc = when (randomNumber) {
|
||||
in 0..10 -> "人品不太好呢"
|
||||
in 30..50 -> "人品一般般"
|
||||
in 70..90 -> "人品还不错哦"
|
||||
in 90..100 -> "人品超级好呢!"
|
||||
else -> "人品还行哦"
|
||||
}
|
||||
listener.sendGroupMessage(message.groupId, scoreDesc)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright © 2024 RTAkland
|
||||
* Author: RTAkland
|
||||
* Date: 2024/8/27
|
||||
*/
|
||||
|
||||
|
||||
package cn.rtast.fancybot.commands
|
||||
|
||||
import cn.rtast.fancybot.entity.Search
|
||||
import cn.rtast.fancybot.entity.SongUrl
|
||||
import cn.rtast.fancybot.util.Http
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
import cn.rtast.rob.util.BaseCommand
|
||||
import cn.rtast.rob.util.ob.OBMessage
|
||||
|
||||
class MusicCommand : BaseCommand() {
|
||||
override val commandName = "/点歌"
|
||||
|
||||
override fun executeGroup(listener: OBMessage, message: GroupMessage, args: List<String>) {
|
||||
val keyword = args.joinToString(" ")
|
||||
Http.getAsync<Search>("https://music.api.yhdzz.cn/search?keywords=$keyword") {
|
||||
val name = it!!.result.songs.first().name
|
||||
val id = it.result.songs.first().id
|
||||
val artists = it.result.songs.first().artists.joinToString(", ") { it.name }
|
||||
Http.getAsync<SongUrl>("https://music.api.yhdzz.cn/song/url?id=$id") { songUrl ->
|
||||
listener.sendGroupMessage(
|
||||
message.groupId,
|
||||
"[CQ:music," +
|
||||
"type=custom," +
|
||||
"url=https://music.163.com/#/song?id=$id," +
|
||||
"audio=${songUrl?.data?.first()?.url}," +
|
||||
"title=《$name》-- $artists]\n"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user