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

Regex error when parsing USERNOTICE #55

Open
PythooonUser opened this issue Apr 22, 2018 · 1 comment
Open

Regex error when parsing USERNOTICE #55

PythooonUser opened this issue Apr 22, 2018 · 1 comment
Labels

Comments

@PythooonUser
Copy link
Collaborator

Summary

The USERNOTICE event raises an exception under certain circumstances. Maybe it uses a specification not accounted for in the current regex implementation.

The error message/event details reads:

D:\Projects\pythooonchatbot\env\lib\site-packages\twitchobserver\twitchobserver.py:514: RuntimeWarning: Failed to process USERNOTICE message: @badges=subscriber/12,bits/100000;color=#FFCB13;display-name=Colabuechse90;emotes=;id=eb67b448-0a8d-4703-8d6e-aa7d95de3ec3;login=colabuechse90;mod=0;msg-id=subgift;msg-param-months=8;msg-param-recipient-display-name=ChiLLouTLeR;msg-param-recipient-id=141503055;msg-param-recipient-user-name=chilloutler;msg-param-sender-count=16;msg-param-sub-plan-name=Teammitglied;msg-param-sub-plan=1000;room-id=60305470;subscriber=1;system-msg=Colabuechse90\sgifted\sa\sTier\s1\ssub\sto\sChiLLouTLeR!\sThey\shave\sgiven\s16\sGift\sSubs\sin\sthe\schannel!;tmi-sent-ts=1524416686288;turbo=0;user-id=80475276;user-type= :tmi.twitch.tv USERNOTICE #honorius
  warnings.warn(RuntimeWarning('Failed to process {} message: {}'.format(cmd, message)))
@PythooonUser PythooonUser self-assigned this Apr 22, 2018
@PythooonUser PythooonUser removed their assignment Jul 10, 2018
@ashnasbot
Copy link

ashnasbot commented Jun 4, 2019

I think the PRIVMSG regex is trying to pull a message when there isn't one, seen on the Subscription USERNOTICE.

I've kludged the regex on L72 to:
_privmsg_params_re = re.compile('#(\w+)( :)*([\s\S]*)')
And then just ignored the extra group on L534:
params_match = _privmsg_params_re.match(params)

I'm sure theres a way to drop the unused group but it works at least.

HTH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants