Skip to content

Commit a315db9

Browse files
committed
Better USERNOTICE handling
Improved handling of USERNOTICE messages and their tags
1 parent d543f27 commit a315db9

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

docs/changelog.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Master
1717
- Fix whispers that were not able to be parsed
1818
- Fix USERSTATE parsing incorrect user
1919
- Fix errors when event loop is started using `run_until_complete` to call methods prior to :func:`~twitchio.Client.run`
20+
- Improved handling of USERNOTICE messages and the tags created for :func:`~twitchio.Client.event_raw_usernotice`
2021

2122
- ext.routines
2223
- Additions
@@ -32,8 +33,6 @@ Master
3233
- Bug fixes
3334
- Unsubscribing from Pubsubevents works again
3435

35-
36-
3736
- ext.sound
3837
- Bug fixes
3938
- Make system calls to ffmpeg are more robust (works on windows and linux)

docs/twitchio.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Client
1919
:exclude-members: event_ready, event_raw_data, event_message,
2020
event_join, event_part, event_mode, event_userstate,
2121
event_raw_usernotice, event_usernotice_subscription, event_error,
22-
event_channel_join_failure
22+
event_channel_join_failure, event_reconnect
2323

2424
Event Reference
2525
-----------------

twitchio/websocket.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ async def _usernotice(self, parsed):
443443

444444
channel = Channel(name=parsed["channel"], websocket=self)
445445
rawData = parsed["groups"][0]
446-
tags = dict(x.split("=") for x in rawData.split(";"))
446+
tags = dict(x.split("=", 1) for x in rawData.split(";"))
447+
tags["user-type"] = tags["user-type"].split(":tmi.twitch.tv")[0].strip()
447448

448449
self.dispatch("raw_usernotice", channel, tags)
449450

0 commit comments

Comments
 (0)