30 lines
792 B
TypeScript
30 lines
792 B
TypeScript
|
|
import { SoundboardMeta } from './types';
|
||
|
|
|
||
|
|
/** Parallels custom-emoji/PackMetaReader (no usage tiers for soundboard). */
|
||
|
|
export class SoundboardMetaReader {
|
||
|
|
private readonly meta: SoundboardMeta;
|
||
|
|
|
||
|
|
constructor(meta: SoundboardMeta) {
|
||
|
|
this.meta = meta;
|
||
|
|
}
|
||
|
|
|
||
|
|
get name(): string | undefined {
|
||
|
|
const displayName = this.meta.display_name;
|
||
|
|
return typeof displayName === 'string' ? displayName : undefined;
|
||
|
|
}
|
||
|
|
|
||
|
|
get avatar(): string | undefined {
|
||
|
|
const avatarURL = this.meta.avatar_url;
|
||
|
|
return typeof avatarURL === 'string' ? avatarURL : undefined;
|
||
|
|
}
|
||
|
|
|
||
|
|
get attribution(): string | undefined {
|
||
|
|
const { attribution } = this.meta;
|
||
|
|
return typeof attribution === 'string' ? attribution : undefined;
|
||
|
|
}
|
||
|
|
|
||
|
|
get content(): SoundboardMeta {
|
||
|
|
return this.meta;
|
||
|
|
}
|
||
|
|
}
|