MitchellHarrison / stream-environment

Python. Postgres. Docker. | Microservices in pursuit of a better, more interactive live stream. https://twitch.tv/mitchsworkshop
https://twitch.tv/mitchsworkshop
MIT License
20 stars 12 forks source link

BUG: Non-RegEx parser does not correctly handle messages where the content contains "PRIVMSG" #64

Closed nyxkrage closed 2 years ago

nyxkrage commented 2 years ago

Line 35: chat-input-handler/src/message.py This splits on "PRIVMSG" and takes the 2nd element in the resulting array, however if the message contents contains "PRIVMSG" this will only return the contents between the IRC command, and the sent PRIVMSG

Example of failing message: @badge-info=;badges=broadcaster/1,overwatch-league-insider_1/1;client-nonce=34c6d3b8a857f8127cc41d71dbd104bc;color=#18181A;display-name=NyxKrage;emotes=;first-msg=0;flags=;id=c9116e02-2bb6-4882-b7d0-9d065f4963b7;mod=0;room-id=57632769;subscriber=0;tmi-sent-ts=1640635298614;turbo=0;user-id=57632769;user-type= :nyxkrage!nyxkrage@nyxkrage.tmi.twitch.tv PRIVMSG #nyxkrage :something PRIVMSG something more When put through the parse method, will result in a dict { message: "something" ... } even though it should contain the full { message: "something PRIVMSG something more" ... }

To fix this, change .split("PRIVMSG") to .split("PRIVMSG", maxsplits=1)