import { ClientEvents } from "discord.js" ; import { useClientContext } from "./context" ; type EventProps < Key extends keyof ClientEvents > = { event : Key ; handler ( ... args ) : void ; } ; export function Event < Key extends keyof ClientEvents > ( props ) { const context = useClientContext ( ) ; context . client . on ( props . event , ( ... args ) => props . handler ( ... args ) ) ; return null ; }