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.lookup
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.configManager
|
||||
import cn.rtast.fancybot.entity.gpt.ChatCompletionsPayload
|
||||
import cn.rtast.fancybot.entity.gpt.ChatCompletionsResponse
|
||||
@@ -20,8 +21,9 @@ import cn.rtast.rob.util.ob.MessageChain
|
||||
import cn.rtast.rob.util.ob.NodeMessageChain
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
|
||||
@CommandDescription("问AI(GPT)")
|
||||
class AICommand : BaseCommand() {
|
||||
override val commandNames = listOf("/ai", "问AI")
|
||||
override val commandNames = listOf("/ai")
|
||||
|
||||
private val openAIModel = configManager.openAIModel
|
||||
|
||||
@@ -71,6 +73,7 @@ class AICommand : BaseCommand() {
|
||||
}
|
||||
}
|
||||
|
||||
@CommandDescription("问AI(LLAMA)")
|
||||
class LlamaCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/llama")
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.lookup
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.entity.cigarette.Cigarette
|
||||
import cn.rtast.fancybot.util.Http
|
||||
import cn.rtast.fancybot.util.str.encodeToBase64
|
||||
@@ -17,8 +18,9 @@ import cn.rtast.rob.util.ob.NodeMessageChain
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
import java.net.URI
|
||||
|
||||
@CommandDescription("查询香烟价格")
|
||||
class CigaretteCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/香烟", "/tobacco", "/cigarette")
|
||||
override val commandNames = listOf("/tobacco")
|
||||
|
||||
private val apiUrl = "https://www.yanyue.cn/api/rc/product/yanlist"
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.lookup
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.entity.bgm.BGMSearch
|
||||
import cn.rtast.fancybot.util.Http
|
||||
import cn.rtast.fancybot.util.str.encodeToBase64
|
||||
@@ -18,8 +19,9 @@ import cn.rtast.rob.util.ob.OneBotListener
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
|
||||
@CommandDescription("搜索动漫")
|
||||
class DMSearchCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/dm", "动漫", "dm")
|
||||
override val commandNames = listOf("/dm", "动漫")
|
||||
|
||||
private val client = OkHttpClient()
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.lookup
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.entity.domain.PricePayload
|
||||
import cn.rtast.fancybot.entity.domain.PriceResponse
|
||||
import cn.rtast.fancybot.util.Http
|
||||
@@ -21,6 +22,7 @@ import java.awt.Color
|
||||
import java.awt.Font
|
||||
import java.awt.image.BufferedImage
|
||||
|
||||
@CommandDescription("查询域名价格")
|
||||
class DomainPriceCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/domain")
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.lookup
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.configManager
|
||||
import cn.rtast.fancybot.entity.github.UserInfo
|
||||
import cn.rtast.fancybot.util.Http
|
||||
@@ -24,8 +25,9 @@ import java.awt.Font
|
||||
import java.awt.image.BufferedImage
|
||||
import java.net.URI
|
||||
|
||||
@CommandDescription("获取Github用户信息")
|
||||
class GithubUserCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/gh", "/github", "gh")
|
||||
override val commandNames = listOf("/gh")
|
||||
|
||||
private val userInfoUrl = "https://api.github.com/users"
|
||||
private val backgroundColor = Color(255, 255, 240)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.lookup
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.motdpinger.BedrockPing
|
||||
import cn.rtast.motdpinger.JavaPing
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
@@ -15,8 +16,9 @@ import cn.rtast.rob.util.ob.MessageChain
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
import java.net.SocketException
|
||||
|
||||
@CommandDescription("PingMC服务器")
|
||||
class MCPingCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/mcping", "/mcPing")
|
||||
override val commandNames = listOf("/mcping")
|
||||
|
||||
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
|
||||
if (args.isEmpty()) {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.lookup
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.configManager
|
||||
import cn.rtast.fancybot.entity.music.Search
|
||||
import cn.rtast.fancybot.entity.music.SearchedResult
|
||||
@@ -27,8 +28,9 @@ import java.io.FileNotFoundException
|
||||
import java.net.URI
|
||||
import java.time.Instant
|
||||
|
||||
@CommandDescription("网易云音乐点歌")
|
||||
class MusicCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/music", "/点歌", "点歌")
|
||||
override val commandNames = listOf("点歌")
|
||||
|
||||
private val searchedResult = mutableMapOf<Long, List<SearchedResult>>()
|
||||
|
||||
@@ -137,8 +139,9 @@ class MusicCommand : BaseCommand() {
|
||||
}
|
||||
}
|
||||
|
||||
@CommandDescription("获取网易云音乐链接")
|
||||
class MusicPlayUrlCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/lj", "lj", "song", "/song")
|
||||
override val commandNames = listOf("lj")
|
||||
|
||||
private fun getPlayUrl(id: String): String {
|
||||
return Http.get<SongUrl>("${configManager.ncmAPI}/song/url", mapOf("id" to id)).data.first().url
|
||||
@@ -161,8 +164,9 @@ class MusicPlayUrlCommand : BaseCommand() {
|
||||
}
|
||||
}
|
||||
|
||||
@CommandDescription("QQ音乐点歌")
|
||||
class QQMusicCommand : BaseCommand() {
|
||||
override val commandNames = listOf("qm", "/qqm", "qqm", "/qm", "q点歌")
|
||||
override val commandNames = listOf("qm", "/qm")
|
||||
|
||||
private val qqMusicApiUrl = configManager.qqMusicApiUrl
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.lookup
|
||||
|
||||
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
|
||||
@@ -16,8 +17,9 @@ import kotlinx.coroutines.withContext
|
||||
import java.net.InetAddress
|
||||
import java.net.UnknownHostException
|
||||
|
||||
@CommandDescription("解析域名获取IP地址")
|
||||
class NslookupCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/nslookup", "/ns")
|
||||
override val commandNames = listOf("/ns")
|
||||
|
||||
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
|
||||
val host = args.joinToString(" ")
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.lookup
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.entity.pixiv.Ranking
|
||||
import cn.rtast.fancybot.util.Http
|
||||
import cn.rtast.fancybot.util.str.encodeToBase64
|
||||
@@ -16,8 +17,9 @@ import cn.rtast.rob.util.ob.MessageChain
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
import java.net.URI
|
||||
|
||||
@CommandDescription("获取Pixiv上的图片")
|
||||
class PixivCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/pixiv", "/p")
|
||||
override val commandNames = listOf("/p")
|
||||
|
||||
private val pixivRankingURL = "https://proxy.rtast.cn/https/www.pixiv.net/ranking.php?format=json&mode=daily&p=1"
|
||||
private val imageProxyURL = "https://pixiv.re"
|
||||
|
||||
@@ -7,13 +7,15 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.lookup
|
||||
|
||||
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 QRCodeCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/qrcode", "/qr", "/二维码")
|
||||
override val commandNames = listOf("/qr")
|
||||
|
||||
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
|
||||
val content = args.joinToString(" ")
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.lookup
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
import cn.rtast.rob.enums.ArrayMessageType
|
||||
import cn.rtast.rob.util.BaseCommand
|
||||
@@ -24,6 +25,7 @@ private fun generateNodeMessage(targetId: String, times: Int = 10): NodeMessageC
|
||||
return nodeMsg.build()
|
||||
}
|
||||
|
||||
@CommandDescription("骂自己(好爽)")
|
||||
class ShotSelfCommand : BaseCommand() {
|
||||
override val commandNames = listOf("骂我")
|
||||
|
||||
@@ -32,6 +34,7 @@ class ShotSelfCommand : BaseCommand() {
|
||||
}
|
||||
}
|
||||
|
||||
@CommandDescription("骂别人(更爽了")
|
||||
class ShotOtherCommand : BaseCommand() {
|
||||
override val commandNames = listOf("骂")
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.lookup
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.configManager
|
||||
import cn.rtast.fancybot.entity.weather.Geo
|
||||
import cn.rtast.fancybot.entity.weather.Weather
|
||||
@@ -25,8 +26,9 @@ import java.awt.Color
|
||||
import java.awt.Font
|
||||
import java.awt.image.BufferedImage
|
||||
|
||||
@CommandDescription("查询天气")
|
||||
class WeatherCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/weather", "/天气", "天气")
|
||||
override val commandNames = listOf("天气")
|
||||
|
||||
private val canvasWidth = 800
|
||||
private val canvasHeight = 600
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.commands.lookup
|
||||
|
||||
import cn.rtast.fancybot.annotations.CommandDescription
|
||||
import cn.rtast.fancybot.entity.wiki.PageInfoResponse
|
||||
import cn.rtast.fancybot.entity.wiki.WikipediaResponse
|
||||
import cn.rtast.fancybot.util.Http
|
||||
@@ -16,6 +17,7 @@ import cn.rtast.rob.util.ob.MessageChain
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
import org.jsoup.Jsoup
|
||||
|
||||
@CommandDescription("查询wiki百科")
|
||||
class WikipediaCommand : BaseCommand() {
|
||||
override val commandNames = listOf("/wiki", "/wk")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user