88from typing import Callable
99
1010# Custom Library
11+ from AthenaColor import ForeNest
1112
1213# Custom Packages
1314from AthenaTwitchBot .models .twitch_message import TwitchMessage
@@ -113,7 +114,8 @@ def data_parser(self, data: bytearray):
113114 for d in data .decode ("utf_8" ).split ("\r \n " ):
114115 # catch some patterns early to be either ignored or parsed
115116 match d_split := d .split (" " ):
116- case PING (), * ping_response :
117+ case _ping , * ping_response \
118+ if _ping == PING :
117119 # CATCHES the following pattern:
118120 # PING
119121 # :tmi.twitch.tv
@@ -124,7 +126,8 @@ def data_parser(self, data: bytearray):
124126 )
125127 continue # go to next piece of data
126128
127- case TMI_TWITCH_TV (), str (int_id ), self .bot .nickname , str (text ):
129+ case _tmi_twitch_tv , str (int_id ), self .bot .nickname , * text \
130+ if _tmi_twitch_tv == TMI_TWITCH_TV :
128131 # CATCHES the following pattern:
129132 # :tmi.twitch.tv
130133 # 001
@@ -138,7 +141,8 @@ def data_parser(self, data: bytearray):
138141 )
139142
140143
141- case str (info ), str (user_name ), PRIVMSG (), str (channel ), str (text ):
144+ case str (info ), str (user_name ), _privmsg , str (channel ), * text \
145+ if _privmsg == PRIVMSG :
142146 # CATCHES the following pattern:
143147 # @badge-info=;badges=;client-nonce=4ac36d90556713038f596be25cc698a2;color=#1E90FF;display-name=badcop_;emotes=;first-msg=0;flags=;id=8b506bf0-517d-4ae7-9dcb-bce5c2145412;mod=0;room-id=600187263;subscriber=0;tmi-sent-ts=1655367514927;turbo=0;user-id=56931496;user-type=
144148 # :badcop_!badcop_@badcop_.tmi.twitch.tv
@@ -152,8 +156,9 @@ def data_parser(self, data: bytearray):
152156 text = " " .join (d_split )
153157 )
154158
155- case str (bot_name_long ), JOIN (), str (channel ) \
156- if bot_name_long == f":{ self .bot .nickname } !{ self .bot .nickname } @{ self .bot .nickname } .tmi.twitch.tv" :
159+ case str (bot_name_long ), _join , str (channel ) \
160+ if _join == JOIN \
161+ and bot_name_long == f":{ self .bot .nickname } !{ self .bot .nickname } @{ self .bot .nickname } .tmi.twitch.tv" :
157162 # CATCHES the following pattern:
158163 # :eva_athenabot!eva_athenabot@eva_athenabot.tmi.twitch.tv
159164 # JOIN
@@ -165,7 +170,7 @@ def data_parser(self, data: bytearray):
165170 text = " " .join (d_split )
166171 )
167172
168- case TMI_TWITCH_TV () , CAP () , ASTERISK () , ACK () , TWITCH_TAGS () :
173+ case _list if _list == [ TMI_TWITCH_TV , CAP , ASTERISK , ACK , TWITCH_TAGS ] :
169174 # CATCHES the following pattern:
170175 # :tmi.twitch.tv
171176 # CAP
@@ -179,8 +184,10 @@ def data_parser(self, data: bytearray):
179184 text = " " .join (d_split )
180185 )
181186
182- case str (bot_name_long ), str (int_id ), self .bot .nickname , EQUALS (), str (channel ), str (bot_name_short ) \
183- if bot_name_long == f":{ self .bot .nickname } .tmi.twitch.tv" and bot_name_short == f":{ self .bot .nickname } " :
187+ case str (bot_name_long ), str (int_id ), self .bot .nickname , _equals , str (channel ), str (bot_name_short ) \
188+ if _equals == EQUALS \
189+ and bot_name_long == f":{ self .bot .nickname } .tmi.twitch.tv" \
190+ and bot_name_short == f":{ self .bot .nickname } " :
184191 # CATCHES the following pattern:
185192 # :eva_athenabot.tmi.twitch.tv
186193 # 353
@@ -195,3 +202,27 @@ def data_parser(self, data: bytearray):
195202 text = " " .join (d_split )
196203 )
197204
205+ case str (bot_name_long ), str (int_id ), self .bot .nickname , str (channel ), * text \
206+ if bot_name_long == f":{ self .bot .nickname } .tmi.twitch.tv" :
207+ # CATCHES the following pattern:
208+ # :eva_athenabot.tmi.twitch.tv
209+ # 353
210+ # eva_athenabot
211+ # =
212+ # #directiveathena
213+ # :eva_athenabot
214+ pass # todo functionality
215+ self .output_handler (
216+ callback = output_undefined ,
217+ # below this point is all **kwargs
218+ text = " " .join (d_split )
219+ )
220+
221+ case _:
222+ self .output_handler (
223+ callback = output_undefined ,
224+ # below this point is all **kwargs
225+ text = ForeNest .Maroon ("UNDEFINED : '" ,ForeNest .SlateGray (" " .join (d_split )), "'" , sep = "" )
226+ )
227+
228+
0 commit comments