From c9b93b82c53326a801ca96b49ab43cd0ceecd78f Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Sun, 25 Oct 2015 21:41:41 +0100 Subject: [PATCH] [TASK] Add support for numeric classes. --- piebot/irc.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/piebot/irc.py b/piebot/irc.py index 8f78ece..c8ae878 100644 --- a/piebot/irc.py +++ b/piebot/irc.py @@ -63,7 +63,10 @@ class Message(object): @classmethod def from_string(cls, 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 def __repr__(self): @@ -300,3 +303,10 @@ class Quit(Message, metaclass=register_derivative): def parse(self): self.nick = self.get("nick") self.message = self.get("trailing") + +class Numeric005(Message, metaclass=register_derivative): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + def parse(self): + pass \ No newline at end of file