mirror of
https://github.com/Eyre-S/Coeur-Morny-Cono.git
synced 2024-11-22 11:14:55 +08:00
change ISimpleCommand.aliases type to List from Array
This commit is contained in:
parent
20f2a05ee0
commit
58cf4cc74b
@ -55,6 +55,7 @@ lazy val root = (project in file("."))
|
|||||||
"-source", "17",
|
"-source", "17",
|
||||||
"-target", "17"
|
"-target", "17"
|
||||||
),
|
),
|
||||||
|
autoAPIMappings := true,
|
||||||
|
|
||||||
assemblyMergeStrategy := {
|
assemblyMergeStrategy := {
|
||||||
case module if module endsWith "module-info.class" => MergeStrategy.concat
|
case module if module endsWith "module-info.class" => MergeStrategy.concat
|
||||||
|
@ -8,7 +8,7 @@ object MornyConfiguration {
|
|||||||
val MORNY_CODE_STORE = "https://github.com/Eyre-S/Coeur-Morny-Cono"
|
val MORNY_CODE_STORE = "https://github.com/Eyre-S/Coeur-Morny-Cono"
|
||||||
val MORNY_COMMIT_PATH = "https://github.com/Eyre-S/Coeur-Morny-Cono/commit/%s"
|
val MORNY_COMMIT_PATH = "https://github.com/Eyre-S/Coeur-Morny-Cono/commit/%s"
|
||||||
|
|
||||||
val VERSION = "2.0.0-alpha1.1"
|
val VERSION = "2.0.0-alpha2"
|
||||||
val VERSION_DELTA: Option[String] = None
|
val VERSION_DELTA: Option[String] = None
|
||||||
val CODENAME = "guanggu"
|
val CODENAME = "guanggu"
|
||||||
|
|
||||||
@ -42,6 +42,9 @@ object MornyConfiguration {
|
|||||||
|
|
||||||
"org.scalatest" %% "scalatest" % "3.2.17" % Test,
|
"org.scalatest" %% "scalatest" % "3.2.17" % Test,
|
||||||
"org.scalatest" %% "scalatest-freespec" % "3.2.17" % Test,
|
"org.scalatest" %% "scalatest-freespec" % "3.2.17" % Test,
|
||||||
|
// for test report
|
||||||
|
"com.vladsch.flexmark" % "flexmark" % "0.64.0" % Test,
|
||||||
|
"com.vladsch.flexmark" % "flexmark-profile-pegdown" % "0.64.0" % Test
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import scala.language.postfixOps
|
|||||||
class DirectMsgClear (using coeur: MornyCoeur) extends ISimpleCommand {
|
class DirectMsgClear (using coeur: MornyCoeur) extends ISimpleCommand {
|
||||||
|
|
||||||
override val name: String = "r"
|
override val name: String = "r"
|
||||||
override val aliases: Array[ICommandAlias] | Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
|
|
||||||
override def execute (using command: InputCommand, event: Update): Unit = {
|
override def execute (using command: InputCommand, event: Update): Unit = {
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import scala.language.postfixOps
|
|||||||
class Encryptor (using coeur: MornyCoeur) extends ITelegramCommand {
|
class Encryptor (using coeur: MornyCoeur) extends ITelegramCommand {
|
||||||
|
|
||||||
override val name: String = "encrypt"
|
override val name: String = "encrypt"
|
||||||
override val aliases: Array[ICommandAlias] | Null = Array(ListedAlias("enc"))
|
override val aliases: List[ICommandAlias] = ListedAlias("enc") :: Nil
|
||||||
override val paramRule: String = "[algorithm|(l)] [(uppercase)]"
|
override val paramRule: String = "[algorithm|(l)] [(uppercase)]"
|
||||||
override val description: String = "通过指定算法加密回复的内容 (目前只支持文本)"
|
override val description: String = "通过指定算法加密回复的内容 (目前只支持文本)"
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import scala.language.postfixOps
|
|||||||
class EventHack (using coeur: MornyCoeur) extends ITelegramCommand {
|
class EventHack (using coeur: MornyCoeur) extends ITelegramCommand {
|
||||||
|
|
||||||
override val name: String = "event_hack"
|
override val name: String = "event_hack"
|
||||||
override val aliases: Array[ICommandAlias] | Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
override val paramRule: String = "[(user|group|any)]"
|
override val paramRule: String = "[(user|group|any)]"
|
||||||
override val description: String = "输出 bot 下一个获取到的事件序列化数据"
|
override val description: String = "输出 bot 下一个获取到的事件序列化数据"
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import com.pengrad.telegrambot.request.SendSticker
|
|||||||
class GetSocial (using coeur: MornyCoeur) extends ITelegramCommand {
|
class GetSocial (using coeur: MornyCoeur) extends ITelegramCommand {
|
||||||
|
|
||||||
override val name: String = "get"
|
override val name: String = "get"
|
||||||
override val aliases: Array[ICommandAlias] | Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
override val paramRule: String = "<tweet-url|weibo-status-url>"
|
override val paramRule: String = "<tweet-url|weibo-status-url>"
|
||||||
override val description: String = "从社交媒体分享链接获取其内容"
|
override val description: String = "从社交媒体分享链接获取其内容"
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import scala.language.postfixOps
|
|||||||
class GetUsernameAndId (using coeur: MornyCoeur) extends ITelegramCommand {
|
class GetUsernameAndId (using coeur: MornyCoeur) extends ITelegramCommand {
|
||||||
|
|
||||||
override val name: String = "user"
|
override val name: String = "user"
|
||||||
override val aliases: Array[ICommandAlias] | Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
override val paramRule: String = "[userid]"
|
override val paramRule: String = "[userid]"
|
||||||
override val description: String = "获取指定或回复的用户相关信息"
|
override val description: String = "获取指定或回复的用户相关信息"
|
||||||
|
|
||||||
|
@ -18,13 +18,13 @@ class IP186Query (using coeur: MornyCoeur) {
|
|||||||
|
|
||||||
object IP extends ITelegramCommand:
|
object IP extends ITelegramCommand:
|
||||||
override val name: String = "ip"
|
override val name: String = "ip"
|
||||||
override val aliases: Array[ICommandAlias]|Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
override val paramRule: String = "[ip]"
|
override val paramRule: String = "[ip]"
|
||||||
override val description: String = "通过 https://ip.186526.xyz 查询 ip 资料"
|
override val description: String = "通过 https://ip.186526.xyz 查询 ip 资料"
|
||||||
override def execute (using command: InputCommand, event: Update): Unit = query
|
override def execute (using command: InputCommand, event: Update): Unit = query
|
||||||
object Whois extends ITelegramCommand:
|
object Whois extends ITelegramCommand:
|
||||||
override val name: String = "whois"
|
override val name: String = "whois"
|
||||||
override val aliases: Array[ICommandAlias]|Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
override val paramRule: String = "[domain]"
|
override val paramRule: String = "[domain]"
|
||||||
override val description: String = "通过 https://ip.186526.xyz 查询域名资料"
|
override val description: String = "通过 https://ip.186526.xyz 查询域名资料"
|
||||||
override def execute (using command: InputCommand, event: Update): Unit = query
|
override def execute (using command: InputCommand, event: Update): Unit = query
|
||||||
|
@ -25,9 +25,9 @@ trait ISimpleCommand {
|
|||||||
* the unique identifier, it uses the same namespace with [[name]], means
|
* the unique identifier, it uses the same namespace with [[name]], means
|
||||||
* it also cannot be duplicate with other [[name]] or [[aliases]].
|
* it also cannot be duplicate with other [[name]] or [[aliases]].
|
||||||
*
|
*
|
||||||
* It can be [[Null]], means no aliases.
|
* It should not be [[Null]], using [[Nil]] instead for no aliases.
|
||||||
*/
|
*/
|
||||||
val aliases: Array[ICommandAlias]|Null
|
val aliases: List[ICommandAlias]
|
||||||
|
|
||||||
/** The work code of this command.
|
/** The work code of this command.
|
||||||
*
|
*
|
||||||
|
@ -19,7 +19,7 @@ class MornyCommands (using coeur: MornyCoeur) {
|
|||||||
val stash = mutable.SeqMap.empty[String, ISimpleCommand]
|
val stash = mutable.SeqMap.empty[String, ISimpleCommand]
|
||||||
for (i <- commands)
|
for (i <- commands)
|
||||||
stash += (i.name -> i)
|
stash += (i.name -> i)
|
||||||
if (i.aliases ne null) for (alias <- i.aliases)
|
for (alias <- i.aliases)
|
||||||
stash += (alias.name -> i)
|
stash += (alias.name -> i)
|
||||||
stash
|
stash
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ class MornyCommands (using coeur: MornyCoeur) {
|
|||||||
BotCommand(name, if paramRule isBlank then intro else s"$paramRule - $intro")
|
BotCommand(name, if paramRule isBlank then intro else s"$paramRule - $intro")
|
||||||
val list = mutable.ArrayBuffer[BotCommand](
|
val list = mutable.ArrayBuffer[BotCommand](
|
||||||
buildOne(command.name, command.paramRule, command.description))
|
buildOne(command.name, command.paramRule, command.description))
|
||||||
if (command.aliases ne null) for (alias <- command.aliases)
|
for (alias <- command.aliases)
|
||||||
if (alias.listed) list += buildOne(alias.name, "", "↑")
|
if (alias.listed) list += buildOne(alias.name, "", "↑")
|
||||||
list toArray
|
list toArray
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ class MornyHellos (using coeur: MornyCoeur) {
|
|||||||
object On extends ITelegramCommand {
|
object On extends ITelegramCommand {
|
||||||
|
|
||||||
override val name: String = "on"
|
override val name: String = "on"
|
||||||
override val aliases: Array[ICommandAlias] | Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
override val paramRule: String = ""
|
override val paramRule: String = ""
|
||||||
override val description: String = "检查是否在线"
|
override val description: String = "检查是否在线"
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ class MornyHellos (using coeur: MornyCoeur) {
|
|||||||
object Hello extends ITelegramCommand {
|
object Hello extends ITelegramCommand {
|
||||||
|
|
||||||
override val name: String = "hello"
|
override val name: String = "hello"
|
||||||
override val aliases: Array[ICommandAlias] | Null = Array(ListedAlias("hi"))
|
override val aliases: List[ICommandAlias] = ListedAlias("hi") :: Nil
|
||||||
override val paramRule: String = ""
|
override val paramRule: String = ""
|
||||||
override val description: String = "打招呼"
|
override val description: String = "打招呼"
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import scala.language.postfixOps
|
|||||||
class MornyInfoOnStart (using coeur: MornyCoeur) extends ISimpleCommand {
|
class MornyInfoOnStart (using coeur: MornyCoeur) extends ISimpleCommand {
|
||||||
|
|
||||||
override val name: String = "start"
|
override val name: String = "start"
|
||||||
override val aliases: Array[ICommandAlias] | Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
|
|
||||||
override def execute (using command: InputCommand, event: Update): Unit = {
|
override def execute (using command: InputCommand, event: Update): Unit = {
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class MornyInformation (using coeur: MornyCoeur) extends ITelegramCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override val name: String = "info"
|
override val name: String = "info"
|
||||||
override val aliases: Array[ICommandAlias]|Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
override val paramRule: String = "[(version|runtime|stickers[.IDs]|tasks|event)]"
|
override val paramRule: String = "[(version|runtime|stickers[.IDs]|tasks|event)]"
|
||||||
override val description: String = "输出当前 Morny 的各种信息"
|
override val description: String = "输出当前 Morny 的各种信息"
|
||||||
|
|
||||||
|
@ -7,12 +7,12 @@ class MornyInformationOlds (using base: MornyInformation) {
|
|||||||
|
|
||||||
object Version extends ISimpleCommand:
|
object Version extends ISimpleCommand:
|
||||||
override val name: String = "version"
|
override val name: String = "version"
|
||||||
override val aliases: Array[ICommandAlias] | Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
override def execute (using command: InputCommand, event: Update): Unit = base.echoVersion
|
override def execute (using command: InputCommand, event: Update): Unit = base.echoVersion
|
||||||
|
|
||||||
object Runtime extends ISimpleCommand:
|
object Runtime extends ISimpleCommand:
|
||||||
override val name: String = "runtime"
|
override val name: String = "runtime"
|
||||||
override val aliases: Array[ICommandAlias] | Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
override def execute (using command: InputCommand, event: Update): Unit = base.echoRuntime
|
override def execute (using command: InputCommand, event: Update): Unit = base.echoRuntime
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ class MornyManagers (using coeur: MornyCoeur) {
|
|||||||
object Exit extends ITelegramCommand {
|
object Exit extends ITelegramCommand {
|
||||||
|
|
||||||
override val name: String = "exit"
|
override val name: String = "exit"
|
||||||
override val aliases: Array[ICommandAlias] | Null = Array(HiddenAlias("stop"), HiddenAlias("quit"))
|
override val aliases: List[ICommandAlias] = HiddenAlias("stop") :: HiddenAlias("quit") :: Nil
|
||||||
override val paramRule: String = "exit"
|
override val paramRule: String = "exit"
|
||||||
override val description: String = "关闭 Bot (仅可信成员)"
|
override val description: String = "关闭 Bot (仅可信成员)"
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ class MornyManagers (using coeur: MornyCoeur) {
|
|||||||
object SaveData extends ITelegramCommand {
|
object SaveData extends ITelegramCommand {
|
||||||
|
|
||||||
override val name: String = "save"
|
override val name: String = "save"
|
||||||
override val aliases: Array[ICommandAlias] | Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
override val paramRule: String = ""
|
override val paramRule: String = ""
|
||||||
override val description: String = "保存缓存数据到文件(仅可信成员)"
|
override val description: String = "保存缓存数据到文件(仅可信成员)"
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import com.pengrad.telegrambot.request.SendMessage
|
|||||||
class MornyOldJrrp (using coeur: MornyCoeur) extends ITelegramCommand {
|
class MornyOldJrrp (using coeur: MornyCoeur) extends ITelegramCommand {
|
||||||
|
|
||||||
override val name: String = "jrrp"
|
override val name: String = "jrrp"
|
||||||
override val aliases: Array[ICommandAlias] | Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
override val paramRule: String = ""
|
override val paramRule: String = ""
|
||||||
override val description: String = "获取 (假的) jrrp"
|
override val description: String = "获取 (假的) jrrp"
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class Nbnhhsh (using coeur: MornyCoeur) extends ITelegramCommand {
|
|||||||
"<a href=\"https://lab.magiconch.com/nbnhhsh/\">## Result of nbnhhsh query :</a>"
|
"<a href=\"https://lab.magiconch.com/nbnhhsh/\">## Result of nbnhhsh query :</a>"
|
||||||
|
|
||||||
override val name: String = "nbnhhsh"
|
override val name: String = "nbnhhsh"
|
||||||
override val aliases: Array[ICommandAlias]|Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
override val paramRule: String = "[text]"
|
override val paramRule: String = "[text]"
|
||||||
override val description: String = "检索文本内 nbnhhsh 词条"
|
override val description: String = "检索文本内 nbnhhsh 词条"
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import scala.language.postfixOps
|
|||||||
class Testing (using coeur: MornyCoeur) extends ISimpleCommand {
|
class Testing (using coeur: MornyCoeur) extends ISimpleCommand {
|
||||||
|
|
||||||
override val name: String = "test"
|
override val name: String = "test"
|
||||||
override val aliases: Array[ICommandAlias] | Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
|
|
||||||
override def execute (using command: InputCommand, event: Update): Unit = {
|
override def execute (using command: InputCommand, event: Update): Unit = {
|
||||||
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
package cc.sukazyo.cono.morny.bot.command
|
package cc.sukazyo.cono.morny.bot.command
|
||||||
|
|
||||||
import cc.sukazyo.cono.morny.MornyCoeur
|
import cc.sukazyo.cono.morny.MornyCoeur
|
||||||
import cc.sukazyo.cono.morny.data.TelegramStickers
|
|
||||||
import cc.sukazyo.cono.morny.util.tgapi.InputCommand
|
import cc.sukazyo.cono.morny.util.tgapi.InputCommand
|
||||||
import cc.sukazyo.cono.morny.util.tgapi.TelegramExtensions.Bot.*
|
import cc.sukazyo.cono.morny.util.tgapi.TelegramExtensions.Bot.*
|
||||||
import com.pengrad.telegrambot.model.{MessageEntity, Update}
|
import com.pengrad.telegrambot.model.{MessageEntity, Update}
|
||||||
import com.pengrad.telegrambot.request.{SendMessage, SendSticker}
|
import com.pengrad.telegrambot.request.SendMessage
|
||||||
|
|
||||||
//noinspection NonAsciiCharacters
|
//noinspection NonAsciiCharacters
|
||||||
class 创 (using coeur: MornyCoeur) {
|
class 创 (using coeur: MornyCoeur) {
|
||||||
@ -13,7 +12,7 @@ class 创 (using coeur: MornyCoeur) {
|
|||||||
object Chuang extends ISimpleCommand {
|
object Chuang extends ISimpleCommand {
|
||||||
|
|
||||||
override val name: String = "chuang"
|
override val name: String = "chuang"
|
||||||
override val aliases: Array[ICommandAlias] | Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
|
|
||||||
override def execute (using command: InputCommand, event: Update): Unit = {
|
override def execute (using command: InputCommand, event: Update): Unit = {
|
||||||
|
|
||||||
|
@ -17,35 +17,35 @@ class 喵呜 (using coeur: MornyCoeur) {
|
|||||||
|
|
||||||
object 抱抱 extends ISimpleCommand {
|
object 抱抱 extends ISimpleCommand {
|
||||||
override val name: String = "抱抱"
|
override val name: String = "抱抱"
|
||||||
override val aliases: Array[ICommandAlias]|Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
override def execute (using command: InputCommand, event: Update): Unit =
|
override def execute (using command: InputCommand, event: Update): Unit =
|
||||||
replyingSet("贴贴", "贴贴")
|
replyingSet("贴贴", "贴贴")
|
||||||
}
|
}
|
||||||
|
|
||||||
object 揉揉 extends ISimpleCommand {
|
object 揉揉 extends ISimpleCommand {
|
||||||
override val name: String = "揉揉"
|
override val name: String = "揉揉"
|
||||||
override val aliases: Array[ICommandAlias]|Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
override def execute (using command: InputCommand, event: Update): Unit =
|
override def execute (using command: InputCommand, event: Update): Unit =
|
||||||
replyingSet("蹭蹭", "摸摸")
|
replyingSet("蹭蹭", "摸摸")
|
||||||
}
|
}
|
||||||
|
|
||||||
object 蹭蹭 extends ISimpleCommand {
|
object 蹭蹭 extends ISimpleCommand {
|
||||||
override val name: String = "蹭蹭"
|
override val name: String = "蹭蹭"
|
||||||
override val aliases: Array[ICommandAlias]|Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
override def execute (using command: InputCommand, event: Update): Unit =
|
override def execute (using command: InputCommand, event: Update): Unit =
|
||||||
replyingSet("揉揉", "蹭蹭")
|
replyingSet("揉揉", "蹭蹭")
|
||||||
}
|
}
|
||||||
|
|
||||||
object 贴贴 extends ISimpleCommand {
|
object 贴贴 extends ISimpleCommand {
|
||||||
override val name: String = "贴贴"
|
override val name: String = "贴贴"
|
||||||
override val aliases: Array[ICommandAlias]|Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
override def execute (using command: InputCommand, event: Update): Unit =
|
override def execute (using command: InputCommand, event: Update): Unit =
|
||||||
replyingSet("贴贴", "贴贴")
|
replyingSet("贴贴", "贴贴")
|
||||||
}
|
}
|
||||||
|
|
||||||
object Progynova extends ITelegramCommand {
|
object Progynova extends ITelegramCommand {
|
||||||
override val name: String = "install"
|
override val name: String = "install"
|
||||||
override val aliases: Array[ICommandAlias]|Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
override val paramRule: String = ""
|
override val paramRule: String = ""
|
||||||
override val description: String = "抽取一个神秘盒子"
|
override val description: String = "抽取一个神秘盒子"
|
||||||
override def execute (using command: InputCommand, event: Update): Unit = {
|
override def execute (using command: InputCommand, event: Update): Unit = {
|
||||||
|
@ -12,7 +12,7 @@ import com.pengrad.telegrambot.request.SendMessage
|
|||||||
class 私わね (using coeur: MornyCoeur) extends ISimpleCommand {
|
class 私わね (using coeur: MornyCoeur) extends ISimpleCommand {
|
||||||
|
|
||||||
override val name: String = "me"
|
override val name: String = "me"
|
||||||
override val aliases: Array[ICommandAlias] | Null = null
|
override val aliases: List[ICommandAlias] = Nil
|
||||||
|
|
||||||
override def execute (using command: InputCommand, event: Update): Unit = {
|
override def execute (using command: InputCommand, event: Update): Unit = {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user