Skip to content

Commit

Permalink
fix: add clientNonce into the PRIVMSG directly, see MahdiBM/TwitchIRC#3
Browse files Browse the repository at this point in the history
  • Loading branch information
LosFarmosCTL committed Apr 13, 2023
1 parent 32085d3 commit 800e251
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions Sources/Twitch/Chat/IRC/TwitchIRCConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,11 @@ internal class TwitchIRCConnection {
to channel: String, message: String,
replyingTo replyMessageId: String? = nil, nonce: String? = nil
) async throws {
// manually add client-nonce tag, see MahdiBM/TwitchIRC#3
let prefix =
nonce.map { "@client-nonce=\($0)" + (replyMessageId != nil ? " " : "") }
?? ""

try await websocket.send(
prefix
+ OutgoingMessage.privateMessage(
to: channel, message: message, messageIdToReply: replyMessageId
).serialize())
OutgoingMessage.privateMessage(
to: channel, message: message, messageIdToReply: replyMessageId,
clientNonce: nonce
).serialize())
}

private var joinContinuations: [String: CheckedContinuation<Void, Error>]
Expand Down

0 comments on commit 800e251

Please sign in to comment.