ts-discord-wrapper
Version:
A wrapper for the Discord API written in TypeScript
73 lines (60 loc) • 1.55 kB
text/typescript
export declare interface EmbedVideo {
/**
* The url of the video
*/
url ?: string;
/**
* The proxy url of the video
*/
proxyUrl ?: string;
/**
* The height of the video
*/
height ?: number;
/**
* The width of the video
*/
width ?: number;
/**
* Converts this video to json
*/
toJson(): any;
}
export class EmbedVideo {
url ?: string;
proxyUrl ?: string;
height ?: number;
width ?: number;
constructor(url ?: string, proxyUrl ?: string, height ?: number, width ?: number) {
this.url = url;
this.proxyUrl = proxyUrl;
this.height = height;
this.width = width;
}
public getUrl() : string | undefined {
return this.url;
}
public getProxyUrl() : string | undefined {
return this.proxyUrl;
}
public getHeight() : number | undefined {
return this.height;
}
public getWidth() : number | undefined {
return this.width;
}
public static fromJson(data : any) : EmbedVideo {
return new EmbedVideo(data.url,
data.proxy_url ? data.proxy_url : undefined,
data.height ? data.height : undefined,
data.width ? data.width : undefined);
}
public toJson() : any {
return {
url: this.url,
proxy_url: this.proxyUrl,
height: this.height,
width: this.width
};
}
}