harmony/src/structures/base.ts

25 lines
494 B
TypeScript
Raw Normal View History

import { Client } from '../models/client.ts'
import { Snowflake } from '../utils/snowflake.ts'
2020-10-24 18:11:27 +00:00
export class Base {
client: Client
2020-12-02 12:29:52 +00:00
constructor(client: Client, _data?: any) {
this.client = client
}
}
export class SnowflakeBase extends Base {
id!: string
/** Get Snowflake Object */
get snowflake(): Snowflake {
return new Snowflake(this.id)
}
/** Timestamp of when resource was created */
get timestamp(): Date {
return new Date(this.snowflake.timestamp)
}
}