| 59 | |
| 60 | @dataclass |
| 61 | class IRCMessage: |
| 62 | ts: float |
| 63 | direction: str # 'c2s' (client->server) or 's2c' |
| 64 | prefix: str |
| 65 | command: str |
| 66 | params: List[str] |
| 67 | raw: str |
| 68 | |
| 69 | def to_dict(self) -> Dict[str, Any]: |
| 70 | return { |
| 71 | 'ts': datetime.fromtimestamp(self.ts).isoformat(), |
| 72 | 'direction': self.direction, |
| 73 | 'prefix': self.prefix, |
| 74 | 'command': self.command, |
| 75 | 'params': self.params, |
| 76 | 'raw': self.raw[:500], |
| 77 | } |
| 78 | |
| 79 | |
| 80 | @dataclass |