Coder Social home page Coder Social logo

twitchypy-irc's People

Contributors

eloonstra avatar

Stargazers

 avatar

Watchers

 avatar

twitchypy-irc's Issues

Index error when parsing message from some user.

During testing, I found this error.

Here are a few details.

image

I was able to get the message string from a previous error from the same type as message as the one in the screenshot above.

"@badge-info=founder/102;badges=moderator/1,founder/0;color=#8A2BE2;display-name=SheepFarmer;emotes=;first-msg=0;flags=;id=f9912e9d-474a-4cba-8897-0eb7bb9391e7;mod=1;reply-parent-display-name=hughmyron17;reply-parent-msg-body=!giveaway;reply-parent-msg-id=500ea2a8-f58f-407c-97a4-4c0e3274f374;reply-parent-user-id=133248066;reply-parent-user-login=hughmyron17;reply-thread-parent-msg-id=500ea2a8-f58f-407c-97a4-4c0e3274f374;reply-thread-parent-user-login=hughmyron17;returning-chatter=0;room-id=56649026;subscriber=1;tmi-sent-ts=1696780419533;turbo=0;user-id=69861108;user-type=mod :[email protected] PRIVMSG #quin69 :@hughmyron17 For Quins $1,000 giveaway & more, enter here: http://bit.ly/quin69giveaway"

testable example:

>>> message = "@badge-info=founder/102;badges=moderator/1,founder/0;color=#8A2BE2;display-name=SheepFarmer;emotes=;firs
... t-msg=0;flags=;id=f9912e9d-474a-4cba-8897-0eb7bb9391e7;mod=1;reply-parent-display-name=hughmyron17;reply-parent-msg
... -body=!giveaway;reply-parent-msg-id=500ea2a8-f58f-407c-97a4-4c0e3274f374;reply-parent-user-id=133248066;reply-paren
... t-user-login=hughmyron17;reply-thread-parent-msg-id=500ea2a8-f58f-407c-97a4-4c0e3274f374;reply-thread-parent-user-l
... ogin=hughmyron17;returning-chatter=0;room-id=56649026;subscriber=1;tmi-sent-ts=1696780419533;turbo=0;user-id=698611
... 08;user-type=mod :sheepfarmer!sheepfarmer@sheepfarmer.tmi.twitch.tv PRIVMSG #quin69 :@hughmyron17 For Quins $1,000
... giveaway & more, enter here: http://bit.ly/quin69giveaway"
>>>
>>> name = message.split("PRIVMSG")[0].split("!")[0].split(":")[1]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: list index out of range

>>>

I don't know enough to talk about a solution, maybe indexing and splitting is not the right tool when the data is not predictable.
and many selecting negative indexes would work. name = message.split("PRIVMSG")[0].split("!")[-2].split(":")[1] as an example for discussion.

Since the results are unclear, regex may be the right tool for this.

eivl

UnicodeDecodeError: 'utf-8' codec can't decode bytes in position x-y: unexpected end of data

  File "C:\Users\eivin\AppData\Local\pypoetry\Cache\virtualenvs\mychat-BEEt1f8j-py3.12\Lib\site-packages\twitch\twitch.py", line 165, in read
    for recv in self.__recv():
  File "C:\Users\eivin\AppData\Local\pypoetry\Cache\virtualenvs\mychat-BEEt1f8j-py3.12\Lib\site-packages\twitch\twitch.py", line 151, in __recv
    recv = self.sock.recv(1024).decode("utf-8")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 434-435: unexpected end of data

I have seen this a few times today, not sure what causes it. It would need to be some sort of corrupted data?

Im open for a discussion of how I could troubleshoot it if anyone knows.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.