def parse_unknown_command(cls, data: dict) -> dataclasses.SystemMessage: """Converts an "unknown command" message into a SystemMessage.""" message = data['params'].split(' ', 2)[-1] return dataclasses.SystemMessage( enums.SysMessageTypes.GENERIC, 'tmi.twitch.tv', message[1:], enums.IrcResponses.UNKNOWN_COMMAND )
def parse_motd_end(cls, data: dict) -> dataclasses.SystemMessage: """Converts a "message of the day end" message into a SystemMessage.""" end = data['params'].split(' ', 1)[-1] return dataclasses.SystemMessage( enums.SysMessageTypes.GENERIC, 'tmi.twitch.tv', end[1:], enums.IrcResponses.MOTD_END )
def parse_name_end(cls, data: dict) -> dataclasses.SystemMessage: """Converts a "name end" message into a SystemMessage.""" us, channel, message = data['params'].split(' ', 2) return dataclasses.SystemMessage( enums.SysMessageTypes.GENERIC, channel[1:], message[1:], enums.IrcResponses.NAME_END )
def parse_motd_start(cls, data: dict) -> dataclasses.SystemMessage: """Converts a "motd start" message into a SystemMessage.""" message = data['params'].split(' ', 1)[-1] return dataclasses.SystemMessage( enums.SysMessageTypes.GENERIC, 'tmi.twitch.tv', message[1:], enums.IrcResponses.MOTD_START )
def parse_my_info(cls, data: dict) -> dataclasses.SystemMessage: """Converts a "my info" message into a SystemMessage.""" user, message = data['params'].split(' ', 1) return dataclasses.SystemMessage( enums.SysMessageTypes.GENERIC, user, '', enums.IrcResponses.MY_INFO )
def parse_created(cls, data: dict) -> dataclasses.SystemMessage: """Converts a "created" message into a SystemMessage.""" message = data['params'].split(' ', 1)[-1] return dataclasses.SystemMessage( enums.SysMessageTypes.GENERIC, 'tmi.twitch.tv', message[1:], enums.IrcResponses.CREATED )
def parse_your_host(cls, data: dict) -> dataclasses.SystemMessage: """Converts a "your host" message into a SystemMessage.""" message = data['params'].split(' ', 1)[-1] return dataclasses.SystemMessage( enums.SysMessageTypes.GENERIC, 'tmi.twitch.tv', message[1:], enums.IrcResponses.YOUR_HOST )
def parse_welcome(cls, data: dict) -> dataclasses.SystemMessage: """Converts a "welcome" message into a SystemMessage.""" message = data['params'].split(' ', 1)[-1] return dataclasses.SystemMessage( enums.SysMessageTypes.GENERIC, data['prefix'], message[1:], enums.IrcResponses.WELCOME )
def parse_cap(cls, data: dict) -> dataclasses.SystemMessage: """Converts a "cap" message into a SystemMessage.""" return dataclasses.SystemMessage(enums.SysMessageTypes.CAP, data['prefix'], data['params'][2:])