fix: fix music command not work and bump ronebot version
This commit is contained in:
20 files changed
+60
-67
No files matched your search
@@ -1,6 +1,6 @@
|
||||
[versions]
|
||||
kotlinVersion = "2.0.20"
|
||||
ronebotVersion = "2.0.5"
|
||||
ronebotVersion = "2.1.2"
|
||||
shadowVersion = "8.3.0"
|
||||
okhttpVersion = "5.0.0-alpha.14"
|
||||
exposedVersion = "0.53.0"
|
||||
|
||||
@@ -34,6 +34,7 @@ import cn.rtast.fancybot.util.file.NiuziBankManager
|
||||
import cn.rtast.fancybot.util.file.NiuziManager
|
||||
import cn.rtast.fancybot.util.file.RCONManager
|
||||
import cn.rtast.fancybot.util.item.ItemManager
|
||||
import cn.rtast.rob.util.ob.OneBotAction
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.GsonBuilder
|
||||
import java.time.Instant
|
||||
@@ -111,14 +112,6 @@ val items = listOf(
|
||||
TenSetuItem(), TenSetuR18Item()
|
||||
)
|
||||
|
||||
val tasks = mapOf(
|
||||
10000000L to suspend {
|
||||
configManager.admins.forEach {
|
||||
instance.action.sendLike(it, 1)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
val commands = listOf(
|
||||
EchoCommand(), JrrpCommand(), NiuziRedeemCommand(), HitokotoCommand(),
|
||||
KFCCommand(), GenerateQRCodeCommand(), AntiRevokeCommand(), MCPingCommand(),
|
||||
|
||||
@@ -30,6 +30,7 @@ import cn.rtast.rob.entity.lagrange.PokeEvent
|
||||
import cn.rtast.rob.enums.ArrayMessageType
|
||||
import cn.rtast.rob.enums.QQFace
|
||||
import cn.rtast.rob.util.ob.MessageChain
|
||||
import cn.rtast.rob.util.ob.OneBotAction
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -43,8 +44,8 @@ class FancyBot : OneBotListener {
|
||||
private val logger = Logger.getLogger<FancyBot>()
|
||||
private val coroutineScope = CoroutineScope(Dispatchers.IO)
|
||||
|
||||
override suspend fun onWebsocketOpenEvent() {
|
||||
instance.action.sendPrivateMessage(configManager.noticeUser, "FancyBot启动完成~")
|
||||
override suspend fun onWebsocketOpenEvent(action: OneBotAction) {
|
||||
action.sendPrivateMessage(configManager.noticeUser, "FancyBot启动完成~")
|
||||
}
|
||||
|
||||
override suspend fun onGroupMessage(message: GroupMessage, json: String) {
|
||||
@@ -142,10 +143,10 @@ class FancyBot : OneBotListener {
|
||||
.addNewLine()
|
||||
.addText("使用/revoke ${message.messageId} 来获取被撤回的消息")
|
||||
.build()
|
||||
instance.action.sendGroupMessage(message.groupId, msg)
|
||||
message.action.sendGroupMessage(message.groupId, msg)
|
||||
}
|
||||
|
||||
override suspend fun onWebsocketErrorEvent(ex: Exception) {
|
||||
override suspend fun onWebsocketErrorEvent(action: OneBotAction, ex: Exception) {
|
||||
ex.printStackTrace()
|
||||
}
|
||||
|
||||
@@ -174,19 +175,20 @@ class FancyBot : OneBotListener {
|
||||
.addAt(event.userId)
|
||||
.addText("你${event.action.first()}牛魔呢")
|
||||
.build()
|
||||
instance.action.sendGroupMessage(event.groupId!!, msg)
|
||||
event.onebotAction.sendGroupMessage(event.groupId!!, msg)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun onBeKicked(event: BeKickEvent) {
|
||||
blackListManager.insertGroup(event.groupId, event.operator, event.time)
|
||||
instance.action.sendPrivateMessage(
|
||||
event.action.sendPrivateMessage(
|
||||
configManager.noticeUser,
|
||||
"被: ${event.groupId}踢出! 操作人: ${event.operator} 时间: ${event.time.convertToDate()} 已将其拉入黑名单!"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun main() {
|
||||
val fancyBot = FancyBot()
|
||||
val workType = configManager.wsType
|
||||
val accessToken = configManager.accessToken
|
||||
@@ -200,7 +202,6 @@ val instance = if (workType == WSType.Client) {
|
||||
.also { it.addListeningGroups(*configManager.listeningGroups.toLongArray()) }
|
||||
}
|
||||
|
||||
suspend fun main() {
|
||||
initDatabase()
|
||||
initFilesDir()
|
||||
initCommand()
|
||||
|
||||
@@ -14,7 +14,6 @@ import cn.rtast.fancybot.entity.gpt.ChatCompletionsResponse
|
||||
import cn.rtast.fancybot.entity.gpt.LlamaResponse
|
||||
import cn.rtast.fancybot.entity.gpt.ModelList
|
||||
import cn.rtast.fancybot.enums.CommandAction
|
||||
import cn.rtast.fancybot.instance
|
||||
import cn.rtast.fancybot.util.Http
|
||||
import cn.rtast.fancybot.util.file.insertActionRecord
|
||||
import cn.rtast.fancybot.util.str.toJson
|
||||
@@ -70,7 +69,7 @@ class AICommand : BaseCommand() {
|
||||
.addText(response.choices.first().message.content)
|
||||
.build()
|
||||
nodeMsg.addMessageChain(msg, configManager.selfId)
|
||||
instance.action.sendGroupForwardMsg(message.groupId, nodeMsg.build())
|
||||
message.action.sendGroupForwardMsg(message.groupId, nodeMsg.build())
|
||||
insertActionRecord(CommandAction.AI, message.sender.userId, "$content-$model-GPT")
|
||||
}
|
||||
}
|
||||
@@ -97,7 +96,7 @@ class LlamaCommand : BaseCommand() {
|
||||
.addText(response.message.content)
|
||||
.build()
|
||||
nodeMsg.addMessageChain(msg, configManager.selfId)
|
||||
instance.action.sendGroupForwardMsg(message.groupId, nodeMsg.build())
|
||||
message.action.sendGroupForwardMsg(message.groupId, nodeMsg.build())
|
||||
insertActionRecord(CommandAction.AI, message.sender.userId, "$prompt-LLAMA")
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ 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.instance
|
||||
import cn.rtast.fancybot.util.Http
|
||||
import cn.rtast.fancybot.util.str.encodeToBase64
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
@@ -59,7 +58,7 @@ class AnimeSearchCommand : BaseCommand() {
|
||||
}
|
||||
val footerNode = MessageChain.Builder().addText("数据来源: Bangumi").build()
|
||||
nodeMsg.addMessageChain(footerNode, configManager.selfId)
|
||||
instance.action.sendGroupForwardMsg(message.groupId, nodeMsg.build())
|
||||
message.action.sendGroupForwardMsg(message.groupId, nodeMsg.build())
|
||||
} catch (_: Exception) {
|
||||
message.reply("没有搜索到结果呢~")
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ class MusicCommand : BaseCommand() {
|
||||
val msg = MessageChain.Builder()
|
||||
.addMusicShare(MusicShareType.Netease, result.toString())
|
||||
.build()
|
||||
message.reply(msg)
|
||||
message.action.sendGroupMessage(message.groupId, msg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,6 +162,6 @@ class QQMusicCommand : BaseCommand() {
|
||||
mapOf("key" to keyword)
|
||||
).response.data.song.list.first().songId
|
||||
val msg = MessageChain.Builder().addMusicShare(MusicShareType.QQ, response.toString()).build()
|
||||
message.reply(msg)
|
||||
message.action.sendGroupMessage(message.groupId, msg)
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@
|
||||
package cn.rtast.fancybot.commands.lookup
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.instance
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
import cn.rtast.rob.enums.ArrayMessageType
|
||||
import cn.rtast.rob.util.BaseCommand
|
||||
@@ -31,7 +30,7 @@ class ShotSelfCommand : BaseCommand() {
|
||||
override val commandNames = listOf("骂我")
|
||||
|
||||
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
|
||||
instance.action.sendGroupForwardMsg(message.groupId, generateNodeMessage(message.sender.userId.toString()))
|
||||
message.action.sendGroupForwardMsg(message.groupId, generateNodeMessage(message.sender.userId.toString()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +40,7 @@ class ShotOtherCommand : BaseCommand() {
|
||||
|
||||
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
|
||||
if (args.isEmpty()) {
|
||||
instance.action.sendGroupForwardMsg(
|
||||
message.action.sendGroupForwardMsg(
|
||||
message.groupId, generateNodeMessage(message.sender.userId.toString(), 20)
|
||||
)
|
||||
return
|
||||
@@ -49,6 +48,6 @@ class ShotOtherCommand : BaseCommand() {
|
||||
var times = if (args.size == 1) 10 else if (args.last() == "") 10 else args.last().toInt()
|
||||
if (times >= 200) times = 10
|
||||
val target = message.message.find { it.type == ArrayMessageType.at }?.data!!
|
||||
instance.action.sendGroupForwardMsg(message.groupId, generateNodeMessage(target.qq!!, times))
|
||||
message.action.sendGroupForwardMsg(message.groupId, generateNodeMessage(target.qq!!, times))
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ package cn.rtast.fancybot.commands.misc
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.enums.CommandAction
|
||||
import cn.rtast.fancybot.instance
|
||||
import cn.rtast.fancybot.util.file.insertActionRecord
|
||||
import cn.rtast.rob.entity.ArrayMessage
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
@@ -24,12 +23,12 @@ class AntiRevokeCommand : BaseCommand() {
|
||||
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
|
||||
if (message.sender.isAdmin || message.sender.isOwner) {
|
||||
val messageId = args.first().toLong()
|
||||
val getMsg = instance.action.getMessage(messageId)
|
||||
val getMsg = message.action.getMessage(messageId)
|
||||
val msgList = mutableListOf<ArrayMessage>()
|
||||
msgList.add(ArrayMessage(ArrayMessageType.at, ArrayMessage.Data(qq = message.sender.userId.toString())))
|
||||
msgList.add(ArrayMessage(ArrayMessageType.text, ArrayMessage.Data(text = "\n被撤回的消息如下: \n")))
|
||||
msgList.addAll(getMsg.message)
|
||||
instance.action.sendGroupMessage(message.groupId, msgList)
|
||||
message.action.sendGroupMessage(message.groupId, msgList)
|
||||
insertActionRecord(CommandAction.AntiRevoke, message.sender.userId, getMsg.messageId.toString())
|
||||
} else {
|
||||
message.reply("你不许用防撤回")
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
package cn.rtast.fancybot.commands.misc
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.instance
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
import cn.rtast.rob.util.BaseCommand
|
||||
import cn.rtast.rob.util.ob.MessageChain
|
||||
@@ -19,7 +18,7 @@ class SendLikeCommand : BaseCommand() {
|
||||
override val commandNames = listOf("赞我")
|
||||
|
||||
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
|
||||
instance.action.sendLike(message.sender.userId, 10)
|
||||
message.action.sendLike(message.sender.userId, 10)
|
||||
val msg = MessageChain.Builder()
|
||||
.addReply(message.messageId)
|
||||
.addText("👍了你十下~~😁")
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
package cn.rtast.fancybot.commands.misc
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.instance
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
import cn.rtast.rob.entity.PrivateMessage
|
||||
import cn.rtast.rob.util.BaseCommand
|
||||
@@ -56,7 +55,7 @@ class UnsetZiBiCommand : BaseCommand() {
|
||||
message.reply(msg)
|
||||
return
|
||||
}
|
||||
instance.action.setGroupBan(users.getValue(message.sender.userId), message.sender.userId, 0)
|
||||
message.action.setGroupBan(users.getValue(message.sender.userId), message.sender.userId, 0)
|
||||
val msg = MessageChain.Builder()
|
||||
.addText("祝你天天开心不要自闭~~")
|
||||
.build()
|
||||
|
||||
@@ -9,7 +9,6 @@ package cn.rtast.fancybot.commands.niuzi
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.commands
|
||||
import cn.rtast.fancybot.instance
|
||||
import cn.rtast.fancybot.niuziBankManager
|
||||
import cn.rtast.fancybot.niuziManager
|
||||
import cn.rtast.fancybot.util.misc.getUserName
|
||||
@@ -69,7 +68,7 @@ class CreateBankAccountCommand : BaseCommand() {
|
||||
message.reply("你已经有账户了!")
|
||||
return
|
||||
}
|
||||
val userInfo = instance.action.getGroupMemberInfo(message.groupId, message.sender.userId)
|
||||
val userInfo = message.action.getGroupMemberInfo(message.groupId, message.sender.userId)
|
||||
niuziBankManager.createBlankAccount(message.sender.userId, userInfo.card ?: userInfo.nickname)
|
||||
message.reply("成功创建了一个账户!")
|
||||
}
|
||||
@@ -95,7 +94,7 @@ class BankTransferCommand : BaseCommand() {
|
||||
message.reply("你的牛子长度不够转账!")
|
||||
return
|
||||
}
|
||||
val username = listener.getUserName(message.groupId, message.sender.userId)
|
||||
val username = listener.getUserName(message.action, message.groupId, message.sender.userId)
|
||||
val result = niuziBankManager.transfer(message.sender.userId, target, amount, username)
|
||||
message.reply("转账成功! 你在银行内剩余的牛子长度为: ${result?.balance}")
|
||||
}
|
||||
@@ -125,7 +124,7 @@ class WithdrawCommand : BaseCommand() {
|
||||
message.reply("取出的长度必须大于0!")
|
||||
return
|
||||
}
|
||||
val username = listener.getUserName(message.groupId, message.sender.userId)
|
||||
val username = listener.getUserName(message.action, message.groupId, message.sender.userId)
|
||||
val result = niuziBankManager.withdraw(message.sender.userId, amount, username)
|
||||
niuziManager.updateLength(message.sender.userId, amount + amount * INTEREST_RATE)
|
||||
message.reply("取牛子成功, 你现在还剩${result.balance}cm的牛子在银行内")
|
||||
@@ -156,7 +155,7 @@ class DepositCommand : BaseCommand() {
|
||||
message.reply("你身上的牛子不够用啦, 没办法存进银行! >>> ${niuzi.length}")
|
||||
return
|
||||
}
|
||||
val username = listener.getUserName(message.groupId, message.sender.userId)
|
||||
val username = listener.getUserName(message.action, message.groupId, message.sender.userId)
|
||||
val self = niuziManager.updateLength(message.sender.userId, -amount)
|
||||
val result = niuziBankManager.deposit(message.sender.userId, amount, username)
|
||||
message.reply("存入成功你身上的牛子还有${self?.length}cm 银行账户内还有: ${result.balance}cm")
|
||||
|
||||
@@ -36,7 +36,9 @@ class NiuziManagerCommand : BaseCommand() {
|
||||
when (type) {
|
||||
"yh", "银行" -> {
|
||||
val before = niuziBankManager.getUser(target)
|
||||
niuziBankManager.deposit(target, amount, listener.getUserName(message.groupId, target))
|
||||
niuziBankManager.deposit(
|
||||
target, amount, listener.getUserName(message.action, message.groupId, target)
|
||||
)
|
||||
val after = niuziBankManager.getUser(target)
|
||||
val msg = MessageChain.Builder()
|
||||
.addText("设置成功! 金额: $amount")
|
||||
|
||||
@@ -24,7 +24,7 @@ class NiuziSignCommand : BaseCommand() {
|
||||
message.reply("你今天已经对你的牛子使用了签到啦,明天再来吧~")
|
||||
return
|
||||
}
|
||||
val username = listener.getUserName(message.groupId, message.sender.userId)
|
||||
val username = listener.getUserName(message.action, message.groupId, message.sender.userId)
|
||||
val afterStatus = niuziManager.sign(message.sender.userId, username)
|
||||
val msg = MessageChain.Builder()
|
||||
.addReply(message.messageId)
|
||||
|
||||
@@ -41,6 +41,7 @@ class AsciiArtCommand : BaseCommand() {
|
||||
private val font = Font("Monospaced", Font.PLAIN, FONT_SIZE)
|
||||
private val logger = Logger.getLogger<AsciiArtCommand>()
|
||||
val waitingList = mutableListOf<Long>()
|
||||
private lateinit var imageBed: ImageBed
|
||||
|
||||
private fun BufferedImage.convertToAscii(): String {
|
||||
val width = this.width
|
||||
@@ -157,7 +158,7 @@ class AsciiArtCommand : BaseCommand() {
|
||||
return getImageUrlFromUnified(toUnifiedMessage(groupMessage))
|
||||
}
|
||||
|
||||
fun getImageUrl(getMessageData: GetMessage.Data): String {
|
||||
fun getImageUrl(getMessageData: GetMessage.Message): String {
|
||||
return getImageUrlFromUnified(toUnifiedMessage(getMessageData))
|
||||
}
|
||||
|
||||
@@ -171,7 +172,7 @@ class AsciiArtCommand : BaseCommand() {
|
||||
return groupMessage.message.map { UnifiedMessage(it.type, it.data.file, it.data.url) }
|
||||
}
|
||||
|
||||
private fun toUnifiedMessage(getMessageData: GetMessage.Data): List<UnifiedMessage> {
|
||||
private fun toUnifiedMessage(getMessageData: GetMessage.Message): List<UnifiedMessage> {
|
||||
return getMessageData.message.map { UnifiedMessage(it.type, it.data.file, it.data.url) }
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import cn.rtast.rob.util.ob.asNode
|
||||
|
||||
object ImageURLCommand {
|
||||
|
||||
fun getImageUrl(message: GetMessage.Data): List<String> {
|
||||
fun getImageUrl(message: GetMessage.Message): List<String> {
|
||||
try {
|
||||
val images = mutableListOf<String>()
|
||||
message.message.forEach {
|
||||
@@ -30,7 +30,7 @@ object ImageURLCommand {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun callback(groupMessage: GroupMessage, message: GetMessage.Data) {
|
||||
suspend fun callback(groupMessage: GroupMessage, message: GetMessage.Message) {
|
||||
val images = getImageUrl(message)
|
||||
if (images.isEmpty()) {
|
||||
groupMessage.reply("这个消息里没有图片呢!")
|
||||
|
||||
@@ -35,7 +35,7 @@ class ReverseGIFCommand : BaseCommand() {
|
||||
return gifBytes.encodeToBase64()
|
||||
}
|
||||
|
||||
suspend fun reverse(message: GroupMessage, getMsg: GetMessage.Data) {
|
||||
suspend fun reverse(message: GroupMessage, getMsg: GetMessage.Message) {
|
||||
val imageObject = getMsg.message.find { it.type == ArrayMessageType.image }
|
||||
if (imageObject == null) {
|
||||
message.reply("这个消息中没有图片呢")
|
||||
|
||||
@@ -20,7 +20,7 @@ import cn.rtast.rob.util.ob.asNode
|
||||
import okio.IOException
|
||||
|
||||
object ImageBedCommand {
|
||||
suspend fun execute(getMsg: GetMessage.Data, message: GroupMessage) {
|
||||
suspend fun execute(getMsg: GetMessage.Message, message: GroupMessage) {
|
||||
val imagesUrl = ImageURLCommand.getImageUrl(getMsg)
|
||||
if (imagesUrl.isEmpty()) {
|
||||
message.reply("这个消息里没有图片呢!")
|
||||
|
||||
@@ -8,5 +8,5 @@
|
||||
package cn.rtast.fancybot.enums
|
||||
|
||||
enum class ImageBedType {
|
||||
Github, CloudflareR2, QQ
|
||||
Github, CloudflareR2
|
||||
}
|
||||
@@ -11,11 +11,11 @@ import cn.rtast.fancybot.configManager
|
||||
import cn.rtast.fancybot.entity.github.UploadContentPayload
|
||||
import cn.rtast.fancybot.entity.github.UploadContentResponse
|
||||
import cn.rtast.fancybot.enums.ImageBedType
|
||||
import cn.rtast.fancybot.instance
|
||||
import cn.rtast.fancybot.util.Http
|
||||
import cn.rtast.fancybot.util.str.encodeToBase64
|
||||
import cn.rtast.fancybot.util.str.proxy
|
||||
import cn.rtast.fancybot.util.str.toJson
|
||||
import cn.rtast.rob.util.ob.OneBotAction
|
||||
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials
|
||||
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider
|
||||
import software.amazon.awssdk.core.sync.RequestBody
|
||||
@@ -44,7 +44,7 @@ object ImageBed {
|
||||
.build()
|
||||
}
|
||||
|
||||
suspend fun upload(file: ByteArray, fileType: String = ""): String {
|
||||
fun upload(file: ByteArray, fileType: String = ""): String {
|
||||
val randomUUID = UUID.randomUUID().toString()
|
||||
return when (configManager.imageBedType) {
|
||||
ImageBedType.Github -> {
|
||||
@@ -67,8 +67,6 @@ object ImageBed {
|
||||
s3Client.putObject(putObjectRequest, RequestBody.fromBytes(file))
|
||||
return "${configManager.cloudflareR2PublicUrl}/$key".proxy
|
||||
}
|
||||
|
||||
ImageBedType.QQ -> instance.action.uploadImage(file.encodeToBase64(), true)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import cn.rtast.fancybot.*
|
||||
import cn.rtast.fancybot.util.Http
|
||||
import cn.rtast.rob.BotInstance
|
||||
import cn.rtast.rob.ROneBotFactory
|
||||
import cn.rtast.rob.util.ob.OneBotAction
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
import java.io.File
|
||||
import kotlin.random.Random
|
||||
@@ -20,8 +21,8 @@ fun randomBooleanWithProbability(probability: Double): Boolean {
|
||||
return randomValue <= (probability * 100)
|
||||
}
|
||||
|
||||
suspend fun OneBotListener.getUserName(groupId: Long, userId: Long): String {
|
||||
val info = instance.action.getGroupMemberInfo(groupId, userId)
|
||||
suspend fun OneBotListener.getUserName(action: OneBotAction, groupId: Long, userId: Long): String {
|
||||
val info = action.getGroupMemberInfo(groupId, userId)
|
||||
return info.card ?: info.nickname
|
||||
}
|
||||
|
||||
@@ -48,5 +49,9 @@ fun initItems() {
|
||||
}
|
||||
|
||||
fun initBackgroundTasks(instance: BotInstance) {
|
||||
tasks.forEach { instance.scheduler.scheduleTask(it.value, 1000L, it.key) }
|
||||
instance.scheduler.scheduleTask({ instance ->
|
||||
configManager.admins.forEach {
|
||||
instance.action.sendLike(it, 1)
|
||||
}
|
||||
}, 1000L, 10000000L)
|
||||
}
|
||||
Reference in New Issue
Block a user