package plugins.hello
import plus.yumeyuka.yumebot.plugin.Plugin
import plus.yumeyuka.yumebot.plugin.annotations.OnGroupMessage
import plus.yumeyuka.yumebot.plugin.annotations.GroupKeyword
import plus.yumeyuka.yumebot.plugin.annotations.Priority
import plus.yumeyuka.yumebot.protocol.message.OB11GroupMessage
import plus.yumeyuka.yumebot.api.message.message
class HelloPlugin : Plugin() {
override val id = "com.example.hello"
override val name = "问候插件"
override val version = "1.0.0"
override val author = "YumeBot"
override val description = "简单的问候插件示例"
override suspend fun onEnable() {
logger.info("问候插件已启动")
}
@OnGroupMessage
@GroupKeyword("你好", "hello")
@Priority(100)
suspend fun onHello(event: OB11GroupMessage) {
val reply = message {
at(event.sender.userId)
text(" 你好!很高兴见到你")
}.build()
messageApi?.sendGroupMessage(event.groupId, reply, name)
}
}