The point of subclassing is to get type hints, everything else works as the default object
from typing import Dict from datetime import datetime from discord.ext.ipc.objects import ClientPayload class Timer(ClientPayload): def __init__(self, data: Dict) -> None: super().__init__(data) self.time = datetime.from_timestamp(self.timestamp)
from datetime import datetime from discord.ext.ipc import Server @Server.route() async def check_timer(self, data: Timer) -> str: if data.time <= datetime.now(): return "The timer has expired!" return "The timer is still going!"
Last updated 1 year ago