diff --git a/sdk-main/src/main/kotlin/cn/hoyobot/sdk/event/proxy/ProxySendMessageEvent.kt b/sdk-main/src/main/kotlin/cn/hoyobot/sdk/event/proxy/ProxySendMessageEvent.kt new file mode 100644 index 0000000..d8474c5 --- /dev/null +++ b/sdk-main/src/main/kotlin/cn/hoyobot/sdk/event/proxy/ProxySendMessageEvent.kt @@ -0,0 +1,13 @@ +package cn.hoyobot.sdk.event.proxy + +import cn.hoyobot.sdk.event.CancellableEvent +import cn.hoyobot.sdk.event.types.ProxyEvent +import cn.hoyobot.sdk.network.BotEntry +import cn.hoyobot.sdk.network.protocol.mihoyo.Message + +class ProxySendMessageEvent(val sender: BotEntry, val message: Message) : ProxyEvent(), CancellableEvent { + + var roomID = 0 + var villaID = "" + +} \ No newline at end of file diff --git a/sdk-main/src/main/kotlin/cn/hoyobot/sdk/network/BotEntry.kt b/sdk-main/src/main/kotlin/cn/hoyobot/sdk/network/BotEntry.kt index 62b5b42..c4f749a 100644 --- a/sdk-main/src/main/kotlin/cn/hoyobot/sdk/network/BotEntry.kt +++ b/sdk-main/src/main/kotlin/cn/hoyobot/sdk/network/BotEntry.kt @@ -1,5 +1,7 @@ package cn.hoyobot.sdk.network +import cn.hoyobot.sdk.HoyoBot +import cn.hoyobot.sdk.event.proxy.ProxySendMessageEvent import cn.hoyobot.sdk.event.villa.VillaSendMessageEvent import cn.hoyobot.sdk.network.protocol.mihoyo.* import cn.hoyobot.sdk.network.protocol.type.TextType @@ -103,6 +105,11 @@ class BotEntry { } fun sendMessage(room: Int, message: Message, type: TextType) { + val event = ProxySendMessageEvent(this, message) + event.roomID = room + event.villaID = this.villaID + HoyoBot.instance.getEventManager().callEvent(event) + if (event.isCancelled()) return when (type) { TextType.MESSAGE -> { if (message is MsgContentInfo) { @@ -159,6 +166,7 @@ class BotEntry { fun recallMessage(event: VillaSendMessageEvent) { this.recallMessage(event.getMsgID(), event.getRoomID(), event.getSendAt()) } + fun transferImage(originalLink: String): String { val params = JSONObject() params["url"] = originalLink;