1.3.8-dev with imageclient

This commit is contained in:
night0721 2021-10-10 08:54:02 +08:00
parent 121dd8a499
commit fa90dcfb3d
9 changed files with 78 additions and 7 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{
"name": "cath",
"version": "1.3.7-dev",
"version": "1.3.8-dev",
"description": "A powerful package that can interact with Cath API",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",

67
src/ImageClient/image.ts Normal file
View file

@ -0,0 +1,67 @@
import config from "../utils/config.json";
/**
* @name ImageClient
* @kind constructor
*/
export class ImageClient {
constructor() {}
private endpoint(end: string, ava: string, ava1?: string, ava2?: string) {
if (ava && ava1 && !ava2)
return `${config.api}/api/v1/image/${end}?image=${ava}&image2=${ava1}`;
else if (ava && ava1 && ava2)
return `${config.api}/api/v1/image/${end}?image=${ava}&image2=${ava1}&image3=${ava2}`;
else return `${config.api}/api/v1/image/${end}?image=${ava}`;
}
public busted(AvatarURL: string) {
return this.endpoint("busted", AvatarURL);
}
public communism(AvatarURL: string) {
return this.endpoint("communism", AvatarURL);
}
public gun(AvatarURL: string) {
return this.endpoint("gun", AvatarURL);
}
public mask(AvatarURL: string) {
return this.endpoint("mask", AvatarURL);
}
public whodidthis(AvatarURL: string) {
return this.endpoint("whodidthis", AvatarURL);
}
public pray(AvatarURL: string) {
return this.endpoint("pray", AvatarURL);
}
public pressplay(AvatarURL: string) {
return this.endpoint("pressplay", AvatarURL);
}
public vr(AvatarURL: string) {
return this.endpoint("vr", AvatarURL);
}
public rifleshoot(AvatarURL: string) {
return this.endpoint("rifleshoot", AvatarURL);
}
public bestmeme(AvatarURL: string) {
return this.endpoint("bestmeme", AvatarURL);
}
public robert(AvatarURL: string) {
return this.endpoint("robert", AvatarURL);
}
public saveonlyone(
AvatarURL1: string,
AvatarURL2: string,
AvatarURL3: string
) {
return this.endpoint("saveonlyone", AvatarURL1, AvatarURL2, AvatarURL3);
}
public alone(AvatarURL: string) {
return this.endpoint("alone", AvatarURL);
}
public toilet(AvatarURL: string) {
return this.endpoint("toilet", AvatarURL);
}
public moment(AvatarURL: string) {
return this.endpoint("moment", AvatarURL);
}
public awesome(AvatarURL: string) {
return this.endpoint("awesome", AvatarURL);
}
}

1
src/ImageClient/index.ts Normal file
View file

@ -0,0 +1 @@
export { ImageClient } from "./image";

2
src/index.d.ts vendored
View file

@ -14,7 +14,7 @@ export {
GiveawaysClientOptions,
DefaultGiveawayMessages,
} from "./GiveawaysClient";
export { ImageClient } from "./ImageClient/index";
export { random8ball } from "./functions/8ball";
export { getreddit, RedditObject } from "./functions/reddit";
export { Pagination } from "./functions/pagination";

View file

@ -14,7 +14,7 @@ export {
GiveawaysClientOptions,
DefaultGiveawayMessages,
} from "./GiveawaysClient";
export { ImageClient } from "./ImageClient/index";
export { random8ball } from "./functions/8ball";
export { getreddit, RedditObject } from "./functions/reddit";
export { Pagination } from "./functions/pagination";