Skip to content

Commit

Permalink
send raw websocket message support
Browse files Browse the repository at this point in the history
  • Loading branch information
MrXiaoM committed Jun 26, 2024
1 parent fb62ec4 commit a0c6602
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ interface RemoteBot {
@JvmBlockingBridge
suspend fun executeAction(actionPath: String, params: String?): String

/**
* 发送自定义 WebSocket 消息
* @param message 消息内容
*/
fun sendRawWebSocketMessage(message: String)

/**
* 发送自定义 WebSocket 消息
* @param message 消息内容
*/
fun sendRawWebSocketMessage(message: ByteArray)

/**
* 通过消息id获取消息,并反序列化为 mirai 格式消息
* @param messageId 消息id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ internal class BotWrapper private constructor(
return impl.customRequest(actionPath, params).toString()
}

override fun sendRawWebSocketMessage(message: String) {
implBot.channel.send(message)
}

override fun sendRawWebSocketMessage(message: ByteArray) {
implBot.channel.send(message)
}

override fun toString(): String = "Bot($id)"

companion object {
Expand Down

0 comments on commit a0c6602

Please sign in to comment.