3
3
package com.diyigemt.arona.custom.menu
4
4
5
5
import com.diyigemt.arona.command.AbstractCommand
6
+ import com.diyigemt.arona.command.BaseConfig
7
+ import com.diyigemt.arona.command.BuildInCommandOwner
6
8
import com.diyigemt.arona.communication.command.UserCommandSender
9
+ import com.diyigemt.arona.communication.command.UserCommandSender.Companion.readUserPluginConfigOrDefault
7
10
import com.diyigemt.arona.communication.command.UserCommandSender.Companion.readUserPluginConfigOrNull
8
11
import com.diyigemt.arona.communication.message.*
9
12
import com.diyigemt.arona.plugins.AronaPlugin
@@ -105,14 +108,24 @@ object CustomMenuCommand : AbstractCommand(
105
108
PluginMain , " 菜单" , description = " 提供快捷菜单, 或者默认菜单"
106
109
) {
107
110
suspend fun UserCommandSender.menu () {
111
+ val mdConfig = readUserPluginConfigOrDefault(BuildInCommandOwner , default = BaseConfig ()).markdown
112
+ if (! mdConfig.enable) {
113
+ sendMessage(MessageChainBuilder ()
114
+ .append(" 请先在webui开启markdown支持" )
115
+ .append(" 需要NTQQ或QQ8.9.85以上版本才能显示" )
116
+ .append(" 文档: https://doc.arona.diyigemt.com/v2/manual/webui" )
117
+ .append(" webui仅支持桌面端,未对移动端适配" )
118
+ .build()
119
+ )
120
+ return
121
+ }
108
122
val menu = readUserPluginConfigOrNull<CustomMenuConfig >(PluginMain )
109
123
val md = TencentTemplateMarkdown (" 102057194_1708227032" ) {
110
124
append(" title" , if (menu == null ) " 默认菜单" else " 快捷菜单" )
111
125
append(" content" , " " )
112
126
append(" footer" , " " )
113
127
}
114
- val kb = TencentTempleKeyboard (" 102057194_1708226882" )
115
- // val kb = (menu ?: CustomMenuConfig.DefaultMenu).toCustomKeyboard()
128
+ val kb = (menu ? : CustomMenuConfig .DefaultMenu ).toCustomKeyboard()
116
129
sendMessage(MessageChainBuilder ().append(md).append(kb).build())
117
130
}
118
131
}
0 commit comments