chore: improve rdm command
This commit is contained in:
19 files changed
+82
-82
No files matched your search
@@ -66,7 +66,7 @@ class AICommand : BaseCommand() {
|
||||
val msg = MessageChain.Builder()
|
||||
.addText(response.choices.first().message.content)
|
||||
.build()
|
||||
nodeMsg.addMessageChain(msg, message.sender.userId)
|
||||
nodeMsg.addMessageChain(msg, configManager.selfId)
|
||||
listener.sendGroupForwardMsg(message.groupId, nodeMsg.build())
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ class LlamaCommand : BaseCommand() {
|
||||
.addNewLine()
|
||||
.addText(response.message.content)
|
||||
.build()
|
||||
nodeMsg.addMessageChain(msg, message.sender.userId)
|
||||
nodeMsg.addMessageChain(msg, configManager.selfId)
|
||||
listener.sendGroupForwardMsg(message.groupId, nodeMsg.build())
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
package cn.rtast.fancybot.commands.lookup
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.configManager
|
||||
import cn.rtast.fancybot.entity.cigarette.Cigarette
|
||||
import cn.rtast.fancybot.util.Http
|
||||
import cn.rtast.fancybot.util.str.encodeToBase64
|
||||
@@ -53,12 +54,12 @@ class CigaretteCommand : BaseCommand() {
|
||||
.addText("参考价: 单盒: ${it.packPrice}元 | 整条: ${it.barPrice}元")
|
||||
.addNewLine()
|
||||
.build()
|
||||
nodeMsg.addMessageChain(tempMsg, message.sender.userId)
|
||||
nodeMsg.addMessageChain(tempMsg, configManager.selfId)
|
||||
}
|
||||
val footerMsg = MessageChain.Builder()
|
||||
.addText("吸烟有害健康, 尽早戒烟有益健康。")
|
||||
.build()
|
||||
nodeMsg.addMessageChain(footerMsg, message.sender.userId)
|
||||
nodeMsg.addMessageChain(footerMsg, configManager.selfId)
|
||||
message.reply(nodeMsg.build())
|
||||
message.sender.groupPoke()
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
package cn.rtast.fancybot.commands.lookup
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.configManager
|
||||
import cn.rtast.fancybot.entity.bgm.BGMSearch
|
||||
import cn.rtast.fancybot.util.Http
|
||||
import cn.rtast.fancybot.util.str.encodeToBase64
|
||||
@@ -53,10 +54,10 @@ class DMSearchCommand : BaseCommand() {
|
||||
.addNewLine()
|
||||
.addText(it.url)
|
||||
.build()
|
||||
nodeMsg.addMessageChain(tempMsg, message.sender.userId)
|
||||
nodeMsg.addMessageChain(tempMsg, configManager.selfId)
|
||||
}
|
||||
val footerNode = MessageChain.Builder().addText("数据来源: Bangumi").build()
|
||||
nodeMsg.addMessageChain(footerNode, message.sender.userId)
|
||||
nodeMsg.addMessageChain(footerNode, configManager.selfId)
|
||||
listener.sendGroupForwardMsg(message.groupId, nodeMsg.build())
|
||||
} catch (_: Exception) {
|
||||
message.reply("没有搜索到结果呢~")
|
||||
|
||||
@@ -45,11 +45,7 @@ class MusicCommand : BaseCommand() {
|
||||
|
||||
private suspend fun legacyMusicCommand(listener: OneBotListener, message: GroupMessage, args: List<String>) {
|
||||
if (args.isEmpty()) {
|
||||
val msg = MessageChain.Builder()
|
||||
.addAt(message.sender.userId)
|
||||
.addText("发送`/点歌`或者`/music` <关键词> 来搜索音乐~")
|
||||
.build()
|
||||
listener.sendGroupMessage(message.groupId, msg)
|
||||
message.reply("发送`/点歌` <关键词> 来搜索音乐~")
|
||||
return
|
||||
}
|
||||
searchedResult.forEach { (key, results) ->
|
||||
@@ -72,13 +68,9 @@ class MusicCommand : BaseCommand() {
|
||||
val msg = MessageChain.Builder()
|
||||
.addMusicShare(MusicShareType.Netease, finalResult.id.toString())
|
||||
.build()
|
||||
listener.sendGroupMessage(message.groupId, msg)
|
||||
message.reply(msg)
|
||||
} catch (_: Exception) {
|
||||
val msg = MessageChain.Builder()
|
||||
.addAt(message.sender.userId)
|
||||
.addText("输入有误请重新搜索本次搜索结果已清除")
|
||||
.build()
|
||||
listener.sendGroupMessage(message.groupId, msg)
|
||||
message.reply("输入有误请重新搜索本次搜索结果已清除")
|
||||
}
|
||||
searchedResult.remove(message.sender.userId)
|
||||
}
|
||||
@@ -86,11 +78,7 @@ class MusicCommand : BaseCommand() {
|
||||
else -> {
|
||||
if (searchedResult.containsKey(message.sender.userId)) {
|
||||
searchedResult.remove(message.sender.userId)
|
||||
val msg = MessageChain.Builder()
|
||||
.addAt(message.sender.userId)
|
||||
.addText("你上次的搜索结果还没用呢, 已经帮你把上次的搜索结果清除掉啦~")
|
||||
.build()
|
||||
listener.sendGroupMessage(message.groupId, msg)
|
||||
message.reply("你上次的搜索结果还没用呢, 已经帮你把上次的搜索结果清除掉啦~")
|
||||
}
|
||||
val keyword = args.joinToString(" ")
|
||||
val result = searchSong(keyword)
|
||||
@@ -105,11 +93,7 @@ class MusicCommand : BaseCommand() {
|
||||
stringResult.append("| $index | 《${searchedResult.name}》-- ${searchedResult.artists}\n")
|
||||
}
|
||||
stringResult.append("输入/music p <序号> 播放\n你有30秒的时间进行操作")
|
||||
val msg = MessageChain.Builder()
|
||||
.addAt(message.sender.userId)
|
||||
.addText(stringResult.toString())
|
||||
.build()
|
||||
listener.sendGroupMessage(message.groupId, msg)
|
||||
message.reply(stringResult.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,7 +105,7 @@ class MusicCommand : BaseCommand() {
|
||||
}
|
||||
if (args.isEmpty()) {
|
||||
val msg = MessageChain.Builder()
|
||||
.addAt(message.sender.userId)
|
||||
.addReply(message.messageId)
|
||||
.addText("发送`点歌 <歌名>`即可点第一首搜索到的歌曲~")
|
||||
.addNewLine()
|
||||
.addText("发送`点歌 <歌名> [l|legacy]`即可使用旧版点歌系统")
|
||||
@@ -243,7 +227,7 @@ class QQMusicCommand : BaseCommand() {
|
||||
.addNewLine()
|
||||
.addText("时长: ${it.interval.formatToMinutes()}")
|
||||
.build()
|
||||
nodeMsg.addMessageChain(msg, message.sender.userId)
|
||||
nodeMsg.addMessageChain(msg, configManager.selfId)
|
||||
} catch (_: FileNotFoundException) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
package cn.rtast.fancybot.commands.lookup
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.configManager
|
||||
import cn.rtast.fancybot.entity.pixiv.Ranking
|
||||
import cn.rtast.fancybot.util.Http
|
||||
import cn.rtast.fancybot.util.str.encodeToBase64
|
||||
@@ -51,11 +52,13 @@ class PixivCommand : BaseCommand() {
|
||||
.addText("用户: ${it.userName}(${it.userId}) | 作品ID: ${it.illustId}")
|
||||
.addNewLine()
|
||||
.addText("日期: ${it.date}")
|
||||
node.addMessageChain(msg.build(), message.sender.userId)
|
||||
node.addMessageChain(msg.build(), configManager.selfId)
|
||||
} catch (_: Exception) {
|
||||
}
|
||||
}
|
||||
node.addMessageChain(MessageChain.Builder().addText("图片来源: Pixiv").build(), message.sender.userId)
|
||||
node.addMessageChain(MessageChain.Builder()
|
||||
.addText("图片来源: Pixiv")
|
||||
.build(), configManager.selfId)
|
||||
message.reply(node.build())
|
||||
return
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class ShotOtherCommand : BaseCommand() {
|
||||
|
||||
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
|
||||
if (args.isEmpty()) {
|
||||
message.reply("发送`骂 @某人`可以骂他~")
|
||||
listener.sendGroupForwardMsg(message.groupId, generateNodeMessage(message.sender.userId.toString(), 20))
|
||||
return
|
||||
}
|
||||
var times = if (args.size == 1) 10 else if (args.last() == "") 10 else args.last().toInt()
|
||||
|
||||
Reference in New Issue
Block a user