You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 24, 2024. It is now read-only.
I have the following code to display incoming Twitch whispers:
functionwhisperIn_cb(words){// words example: [':pcgdan!pcgdan@pcgdan.tmi.twitch.tv', 'WHISPER', 'danpcg', ':test', 'message']// should print "pcgdan > danpcg: test message"varnick=words[0].replace(/^:(.+)!.+$/,'$1');varmsg=words.slice(3);msg[0]=msg[0].slice(1);// remove leading ":" (':test')print(nick+' > '+words[2]+': '+msg.join(' '));returnEAT_ALL;}hook_server('WHISPER',whisperIn_cb);
It works fine unless the whispered message has more than 27 words. If the message has 28 words or more, the length of the array words is over 30, which probably causes the crash. The code in whisperIn_cb() is not important, as HexChat still crashes if the function is empty.
I have noticed, that if you pass an array that has over 30 elements to a hook_command callback function (e.g. a long outgoing whisper message), the array gets truncated to the length of 30. Is it possible to have arrays that are longer than 30 words? If not, can they at least be truncated for hook_server callback functions, to prevent the crash?
P.S. I have written the same function using the Python interface and it works without any issues (tested with a 100-word whisper).
The text was updated successfully, but these errors were encountered:
I have noticed, that if you pass an array that has over 30 elements to a hook_command callback function (e.g. a long outgoing whisper message), the array gets truncated to the length of 30. Is it possible to have arrays that are longer than 30 words?
It seems to work with the Python interface, so I thought the issue was because of the JS interface.
Just a guess here but can you test changing this line [...]
Sorry, I've never made anything with C++ before. I tried, but couldn't get Visual Studio to compile. (I'm still using the old javascript-0.3_x64.dll which is provided with the 0.3 release.)
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have the following code to display incoming Twitch whispers:
It works fine unless the whispered message has more than 27 words. If the message has 28 words or more, the length of the array
words
is over 30, which probably causes the crash. The code inwhisperIn_cb()
is not important, as HexChat still crashes if the function is empty.I have noticed, that if you pass an array that has over 30 elements to a
hook_command
callback function (e.g. a long outgoing whisper message), the array gets truncated to the length of 30. Is it possible to have arrays that are longer than 30 words? If not, can they at least be truncated forhook_server
callback functions, to prevent the crash?P.S. I have written the same function using the Python interface and it works without any issues (tested with a 100-word whisper).
The text was updated successfully, but these errors were encountered: