[TASK] Add support for numeric classes.
This commit is contained in:
parent
1c99d74f02
commit
c9b93b82c5
|
@ -63,7 +63,10 @@ class Message(object):
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_string(cls, string):
|
def from_string(cls, string):
|
||||||
data = parse(string)
|
data = parse(string)
|
||||||
instance = cls._command_map.get(data["command"].upper(), cls)(data=data)
|
command = data["command"].upper()
|
||||||
|
if command.isdigit():
|
||||||
|
command = "Numeric{}".format(command).upper()
|
||||||
|
instance = cls._command_map.get(command, cls)(data=data)
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
@ -300,3 +303,10 @@ class Quit(Message, metaclass=register_derivative):
|
||||||
def parse(self):
|
def parse(self):
|
||||||
self.nick = self.get("nick")
|
self.nick = self.get("nick")
|
||||||
self.message = self.get("trailing")
|
self.message = self.get("trailing")
|
||||||
|
|
||||||
|
class Numeric005(Message, metaclass=register_derivative):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
def parse(self):
|
||||||
|
pass
|
Loading…
Reference in New Issue