Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send custom tags with PRIVMSG #3

Closed
LosFarmosCTL opened this issue Mar 26, 2023 · 6 comments · Fixed by #4
Closed

Send custom tags with PRIVMSG #3

LosFarmosCTL opened this issue Mar 26, 2023 · 6 comments · Fixed by #4

Comments

@LosFarmosCTL
Copy link

Is it possible to add custom tags to outgoing PRIVMSGs? There is the messageIdToReply argument, but I'd specifically want to send a custom client-nonce to verify messages being sent successfully.

I can't see an option to add any additional tags, afaik client-once is the only one that even affects anything when sent to TMI, but it would be nice to have either a way of sending that specifically or an option for completely custom tags (IncomingMessage already contains the client-nonce tag).

@MahdiBM
Copy link
Owner

MahdiBM commented Mar 26, 2023

Twitch documentation doesn't mention sending any client-nonces through PRIVMSGs: https://dev.twitch.tv/docs/irc/tags/#privmsg-tags
I'm not sure if that'll be valid. Have you seen this somewhere so I can refer to it, or were you just wondering?!

@MahdiBM
Copy link
Owner

MahdiBM commented Mar 27, 2023

Someone in Twitch Dev Discord server did say you can send a client nonce... i can't confirm or deny since i'm on holiday for a week or two.

https://discord.com/channels/504015559252377601/523676013494796288/1089671374932561941

@LosFarmosCTL
Copy link
Author

LosFarmosCTL commented Mar 27, 2023

Yeah, Twitch does not have anything about it in their docs, but you can definitely send them, i.e. this is what the default webchat will send:

image

No idea what Twitch uses it for, since they are not doing anything with the received tag client-side, but considering that i.e. the Twitch recap for whatever reason only counts emotes sent over webchat for their stats, they might do something with it on the backend.

But you can also send completely custom client-nonce tags and Twitch will pass them along, which in theory i.e. by including a UUID etc. makes it possible to confirm that your message actually got sent and wasn't silently dropped by Twitch (which is something that the webchat does not show, i.e. if you are shadowbanned or they are just not letting all messages through in very fast chats):

image

The nonce-tag will even be present on the resulting USERSTATE you receive back from Twitch:

image

There is also a sent-ts tag, I wasn't on Twitch when that was a thing they used for 1st party products and it does not seem to have any practical use case anymore, but it's also passed along to any message receiver:

image
(I did not know about the sent-ts tag originally, source is mm's honestly amazing attempt at documenting some of Twitch's 3rd party garbage)

@MahdiBM
Copy link
Owner

MahdiBM commented Apr 4, 2023

@LosFarmosCTL Does the new PR solve this? The changes are available in the outgoing-prvmsg-client-nonce branch.
I haven't tested it in real world but i'm confident it should be good enough 🤔

@LosFarmosCTL
Copy link
Author

Does the new PR solve this?

LGTM on first sight, I can go ahead and test it properly in a few hours, but as long as the test is successful that looks like the correct IRC message.

@MahdiBM MahdiBM closed this as completed in #4 Apr 6, 2023
@LosFarmosCTL
Copy link
Author

Sorry, I had absolutely no time, i guess it's merged now anyways but I can confirm that everything works correctly.

LosFarmosCTL added a commit to LosFarmosCTL/swift-twitch-client that referenced this issue Apr 13, 2023
LosFarmosCTL added a commit to LosFarmosCTL/swift-twitch-client that referenced this issue Jan 23, 2024
* feat: add initial IRC implementation

* fix: re-add accidentally deleted file

* fix: finish message queue on disconnect

* feat: specify what kind of messages should be received on which connection

* fix: read connection doesn't need to pass NOTICEs

There are only 2 cases where a NOTICE can be received on the read connection.
Both of them are received on an unsuccessful JOIN and can be handled there.

* style: only apple swiftlint rule disabling for the next occurence

* chore: remove TODO

* build: update TwitchIRC dependency

* fix: add clientNonce into the PRIVMSG directly, see MahdiBM/TwitchIRC#3

* chore: revert unrelated change

* build: update TwitchIRC dependency

* chore: add TODO comment

* build: add websocket-kit as a dependency for linux

* refactor: rewrite the continuation system

* chore: handle potential unknown types of websocket messages

* fix: clean up channel names before sending them over IRC

* fix: remove completed continuations from the connections list

* various changes, too lazy for separate commits

* feat: implement timeouts for IRC requests

* build: update runner to macOS 13

* build: update platform requirements to macOS 13, iOS/iPadOS 16, watchOS 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants