feat: add annotation to add command description
This commit is contained in:
41 files changed
+135
-33
No files matched your search
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.misc
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.configManager
|
||||
import cn.rtast.rob.entity.ArrayMessage
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
@@ -14,6 +15,7 @@ import cn.rtast.rob.enums.ArrayMessageType
|
||||
import cn.rtast.rob.util.BaseCommand
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
|
||||
@CommandDescription("防撤回(获取消息)")
|
||||
class AntiRevokeCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/revoke", "/rv", "/防撤回")
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.misc
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.entity.compiler.GLOTPayload
|
||||
import cn.rtast.fancybot.entity.compiler.GLOTResponse
|
||||
import cn.rtast.fancybot.entity.compiler.KCSPayload
|
||||
@@ -18,6 +19,7 @@ import cn.rtast.rob.util.BaseCommand
|
||||
import cn.rtast.rob.util.ob.MessageChain
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
|
||||
@CommandDescription("执行不同语言的代码片段")
|
||||
class CompilerCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/compiler", "/exec")
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.misc
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.entity.FKXQS
|
||||
import cn.rtast.fancybot.util.Http
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
@@ -14,6 +15,7 @@ import cn.rtast.rob.util.BaseCommand
|
||||
import cn.rtast.rob.util.ob.MessageChain
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
|
||||
@CommandDescription("今天是疯狂星期四!")
|
||||
class FKXQSCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/fkxqs", "/fk", "/疯狂星期四")
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.misc
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.entity.Hitokoto
|
||||
import cn.rtast.fancybot.util.Http
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
@@ -14,8 +15,9 @@ import cn.rtast.rob.util.BaseCommand
|
||||
import cn.rtast.rob.util.ob.MessageChain
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
|
||||
@CommandDescription("一言")
|
||||
class HitokotoCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/hitokoto", "/1", "一言", "1")
|
||||
override val commandNames = listOf("/1")
|
||||
|
||||
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
|
||||
val response = Http.get<Hitokoto>("https://v1.hitokoto.cn/?c=b")
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright © 2024 RTAkland
|
||||
* Author: RTAkland
|
||||
* Date: 2024/8/27
|
||||
*/
|
||||
|
||||
|
||||
package cn.rtast.fancybot.commands.misc
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.util.file.JrrpManager
|
||||
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.OneBotListener
|
||||
|
||||
@CommandDescription("今日人品~")
|
||||
class JrrpCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/jrrp", "/今日人品")
|
||||
|
||||
private val jrrpManager = JrrpManager()
|
||||
|
||||
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
|
||||
if (jrrpManager.isJrrped(message.sender.userId)) {
|
||||
val msg = MessageChain.Builder()
|
||||
.addAt(message.sender.userId)
|
||||
.addText("你今天已经今日人品过啦, 明天再来吧~")
|
||||
.build()
|
||||
listener.sendGroupMessage(message.groupId, msg)
|
||||
return
|
||||
}
|
||||
val randomPoint = jrrpManager.jrrp(message.sender.userId)
|
||||
val scoreDesc = when (randomPoint) {
|
||||
in 0..10 -> "人品不太好呢"
|
||||
in 30..50 -> "人品一般般"
|
||||
in 70..90 -> "人品还不错哦"
|
||||
in 90..100 -> "人品超级好呢!"
|
||||
else -> "人品还行哦"
|
||||
}
|
||||
val msg = MessageChain.Builder()
|
||||
.addAt(message.sender.userId)
|
||||
.addText("$scoreDesc($randomPoint)")
|
||||
.build()
|
||||
listener.sendGroupMessage(message.groupId, msg)
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.misc
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.util.Resources
|
||||
import cn.rtast.fancybot.util.drawCircularImage
|
||||
import cn.rtast.fancybot.util.makeGif
|
||||
@@ -21,6 +22,7 @@ import com.madgag.gif.fmsware.GifDecoder
|
||||
import java.awt.image.BufferedImage
|
||||
import java.net.URI
|
||||
|
||||
@CommandDescription("撅撅你")
|
||||
class JueCommand : BaseCommand() {
|
||||
override val commandNames = listOf("撅")
|
||||
|
||||
|
||||
@@ -7,11 +7,13 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.misc
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
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.OneBotListener
|
||||
|
||||
@CommandDescription("资料卡点赞")
|
||||
class LikeMeCommand : BaseCommand() {
|
||||
override val commandNames = listOf("赞我")
|
||||
|
||||
|
||||
@@ -7,12 +7,14 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.misc
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
import cn.rtast.rob.enums.ArrayMessageType
|
||||
import cn.rtast.rob.util.BaseCommand
|
||||
import cn.rtast.rob.util.ob.MessageChain
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
|
||||
@CommandDescription("RUA!")
|
||||
class RUACommand : BaseCommand() {
|
||||
override val commandNames = listOf("/rua", "rua")
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.misc
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.entity.enums.CountryList
|
||||
import cn.rtast.fancybot.util.randomBooleanWithProbability
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
@@ -14,8 +15,9 @@ import cn.rtast.rob.util.BaseCommand
|
||||
import cn.rtast.rob.util.ob.MessageChain
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
|
||||
@CommandDescription("人生重开模拟器")
|
||||
class RemakeCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/remake", "/重开", "remake", "重开")
|
||||
override val commandNames = listOf("remake")
|
||||
|
||||
private val locations = listOf(
|
||||
"厕所", "首都", "农村", "市区",
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.misc
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.configManager
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
import cn.rtast.rob.util.BaseCommand
|
||||
@@ -16,6 +17,7 @@ import org.simplejavamail.api.mailer.config.TransportStrategy
|
||||
import org.simplejavamail.email.EmailBuilder
|
||||
import org.simplejavamail.mailer.MailerBuilder
|
||||
|
||||
@CommandDescription("发送邮件!")
|
||||
class SendMailCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/mail")
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright © 2024 RTAkland
|
||||
* Author: RTAkland
|
||||
* Date: 2024/9/22
|
||||
*/
|
||||
|
||||
|
||||
package cn.rtast.fancybot.commands.misc
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.entity.ShortLink
|
||||
import cn.rtast.fancybot.util.Http
|
||||
import cn.rtast.fancybot.util.str.encodeToBase64
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
import cn.rtast.rob.util.BaseCommand
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
|
||||
@CommandDescription("生成短链接")
|
||||
class ShortLinkCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/s", "/sl", "/shortlink", "/short")
|
||||
|
||||
private val shortLinkApi = "https://api.rtast.cn"
|
||||
|
||||
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
|
||||
if (args.isEmpty()) {
|
||||
message.reply("发送`/s <url>`来生成短链接`不要放入一些奇怪的链接哦~")
|
||||
return
|
||||
}
|
||||
val target = args.first().encodeToBase64()
|
||||
val shortLink = Http.post<ShortLink>(
|
||||
"$shortLinkApi/short_link",
|
||||
params = mapOf("target" to target)
|
||||
)
|
||||
message.reply("$shortLinkApi/s?rnd_id=${shortLink.id}")
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.misc
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.entity.Setu
|
||||
import cn.rtast.fancybot.util.Http
|
||||
import cn.rtast.fancybot.util.str.encodeToBase64
|
||||
@@ -18,6 +19,7 @@ import cn.rtast.rob.util.ob.NodeMessageChain
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
import java.net.URI
|
||||
|
||||
@CommandDescription("老板你好, 给我来十张色图")
|
||||
class TenSetuCommand : BaseCommand() {
|
||||
override val commandNames = listOf("十张色图")
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.misc
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
import cn.rtast.rob.entity.PrivateMessage
|
||||
import cn.rtast.rob.util.BaseCommand
|
||||
@@ -15,6 +16,7 @@ import cn.rtast.rob.util.ob.OneBotListener
|
||||
|
||||
val users = mutableMapOf<Long, Long>()
|
||||
|
||||
@CommandDescription("自闭去吧你")
|
||||
class ZiBiCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/自闭", "自闭")
|
||||
|
||||
@@ -40,6 +42,7 @@ class ZiBiCommand : BaseCommand() {
|
||||
}
|
||||
}
|
||||
|
||||
@CommandDescription("我好像突然想开了")
|
||||
class UnsetZiBiCommand : BaseCommand() {
|
||||
override val commandNames = listOf("我想开了")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user