Skip to content

Commit

Permalink
fix reply with helix
Browse files Browse the repository at this point in the history
(cherry picked from commit 67338ed)
  • Loading branch information
crackededed committed Dec 15, 2024
1 parent e01050c commit ab27565
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1038,11 +1038,12 @@ class ApiRepository @Inject constructor(
}
}

suspend fun sendMessage(helixHeaders: Map<String, String>, userId: String?, channelId: String?, message: String?): String? = withContext(Dispatchers.IO) {
suspend fun sendMessage(helixHeaders: Map<String, String>, userId: String?, channelId: String?, message: String?, replyId: String?): String? = withContext(Dispatchers.IO) {
val json = buildJsonObject {
put("broadcaster_id", channelId)
put("sender_id", userId)
put("message", message)
replyId?.let { put("reply_parent_message_id", it) }
}
val response = helix.sendMessage(helixHeaders, json)
if (response.isSuccessful) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ class ChatViewModel @Inject constructor(
private fun sendMessage(message: CharSequence, replyId: String? = null) {
if (useApiChatMessages && !helixHeaders[C.HEADER_TOKEN].isNullOrBlank()) {
viewModelScope.launch {
repository.sendMessage(helixHeaders, account.id, channelId, message.toString())?.let {
repository.sendMessage(helixHeaders, account.id, channelId, message.toString(), replyId)?.let {
onMessage(ChatMessage(systemMsg = it))
}
}
Expand Down

0 comments on commit ab27565

Please sign in to comment.