Skip to content

Commit f4449e9

Browse files
committed
Merge branch 'master' of https://github.com/TwitchIO/TwitchIO
2 parents 218b487 + 986e0fa commit f4449e9

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

twitchio/abcs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ async def send(self, content: str):
121121
except AttributeError:
122122
name = entity.name
123123

124-
if not entity.__messageable_channel__:
125-
await ws.send(f"PRIVMSG #jtv :/w {name} {content}\r\n")
126-
else:
124+
if entity.__messageable_channel__:
127125
await ws.send(f"PRIVMSG #{name} :{content}\r\n")
126+
else:
127+
await ws.send(f"PRIVMSG #jtv :/w {entity.name} {content}\r\n")
128128

129129
async def reply(self, content: str):
130130
"""|coro|

twitchio/parse.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,19 @@
3030
if typing.TYPE_CHECKING:
3131
from .websocket import WSConnection
3232

33-
ACTIONS = ("JOIN", "PART", "PING", "PRIVMSG", "PRIVMSG(ECHO)", "USERSTATE", "MODE", "RECONNECT", "WHISPER")
34-
ACTIONS2 = ("USERSTATE", "ROOMSTATE", "PRIVMSG", "WHISPER")
33+
ACTIONS = (
34+
"JOIN",
35+
"PART",
36+
"PING",
37+
"PRIVMSG",
38+
"PRIVMSG(ECHO)",
39+
"USERSTATE",
40+
"MODE",
41+
"RECONNECT",
42+
"WHISPER",
43+
"USERNOTICE",
44+
)
45+
ACTIONS2 = ("USERSTATE", "ROOMSTATE", "PRIVMSG", "USERNOTICE", "WHISPER")
3546
USER_SUB = re.compile(r":(?P<user>.*)!")
3647
TMI = "tmi.twitch.tv"
3748

twitchio/websocket.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ async def _privmsg(self, parsed): # TODO(Update Cache properly)
385385

386386
self.dispatch("message", message)
387387

388-
async def _privmsg_echo(self, parsed): # TODO
388+
async def _privmsg_echo(self, parsed):
389389
log.debug(f'ACTION: PRIVMSG(ECHO):: {parsed["channel"]}')
390390

391391
channel = Channel(name=parsed["channel"], websocket=self)
@@ -395,7 +395,7 @@ async def _privmsg_echo(self, parsed): # TODO
395395

396396
self.dispatch("message", message)
397397

398-
async def _userstate(self, parsed): # TODO
398+
async def _userstate(self, parsed):
399399
log.debug(f'ACTION: USERSTATE:: {parsed["channel"]}')
400400
self._cache_add(parsed)
401401

@@ -405,9 +405,15 @@ async def _userstate(self, parsed): # TODO
405405

406406
self.dispatch("userstate", user)
407407

408-
async def _usernotice(self, parsed): # TODO
408+
async def _usernotice(self, parsed):
409409
log.debug(f'ACTION: USERNOTICE:: {parsed["channel"]}')
410410

411+
channel = Channel(name=parsed["channel"], websocket=self)
412+
rawData = parsed["groups"][0]
413+
tags = dict(x.split("=") for x in rawData.split(";"))
414+
415+
self.dispatch("raw_usernotice", channel, tags)
416+
411417
async def _join(self, parsed):
412418
log.debug(f'ACTION: JOIN:: {parsed["channel"]}')
413419
channel = parsed["channel"]

0 commit comments

Comments
 (0)