v1.4.5 with bug fix and word functions
This commit is contained in:
parent
d9d2875560
commit
05100b1169
10 changed files with 70 additions and 13 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
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cath",
|
||||
"version": "1.4.3",
|
||||
"version": "1.4.5",
|
||||
"description": "A powerful package that can interact with Cath API",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export class CathError extends Error {
|
||||
constructor(public err: string) {
|
||||
constructor(err: string) {
|
||||
super(err);
|
||||
console.log(`Cath Error: ${err}`);
|
||||
}
|
||||
|
|
|
@ -28,15 +28,15 @@ export async function DiscordActivity(options: DiscordActivityOptions) {
|
|||
spellcast: "852509694341283871",
|
||||
};
|
||||
if (!all[options.application]) {
|
||||
return new CathError(
|
||||
throw new CathError(
|
||||
"Application ID is not valid, if you want to see the list of applications, check the docs at https://cath.js.org/interfaces/Applications.html"
|
||||
);
|
||||
}
|
||||
if (!options.token) {
|
||||
return new CathError("Missing 'token'");
|
||||
throw new CathError("Missing 'token'");
|
||||
}
|
||||
if (!options.channel_id) {
|
||||
return new CathError("Missing 'Channel ID'");
|
||||
throw new CathError("Missing 'Channel ID'");
|
||||
}
|
||||
const data = await axios
|
||||
.post(
|
||||
|
|
16
src/functions/doublestruck.ts
Normal file
16
src/functions/doublestruck.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import axios from "axios";
|
||||
import { CathError } from "../Error/CathError";
|
||||
import config from "../utils/config.json";
|
||||
/**
|
||||
* Sends a 8ball response
|
||||
*/
|
||||
export async function doublestruck(word: string): Promise<string> {
|
||||
if (!word) {
|
||||
throw new CathError("Missing 'word'");
|
||||
}
|
||||
const data = await axios
|
||||
.get(`${config.api}/api/v1/fun/doublestruck?text=${word}`)
|
||||
.then(res => res.data);
|
||||
console.log(data);
|
||||
return data.text;
|
||||
}
|
16
src/functions/fractur.ts
Normal file
16
src/functions/fractur.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import axios from "axios";
|
||||
import { CathError } from "../Error/CathError";
|
||||
import config from "../utils/config.json";
|
||||
/**
|
||||
* Sends a 8ball response
|
||||
*/
|
||||
export async function fractur(word: string): Promise<string> {
|
||||
if (!word) {
|
||||
throw new CathError("Missing 'word'");
|
||||
}
|
||||
const data = await axios
|
||||
.get(`${config.api}/api/v1/fun/fractur?text=${word}`)
|
||||
.then(res => res.data);
|
||||
console.log(data);
|
||||
return data.text;
|
||||
}
|
16
src/functions/superscript.ts
Normal file
16
src/functions/superscript.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import axios from "axios";
|
||||
import { CathError } from "../Error/CathError";
|
||||
import config from "../utils/config.json";
|
||||
/**
|
||||
* Sends a superscript-ed word
|
||||
*/
|
||||
export async function superscript(word: string): Promise<string> {
|
||||
if (!word) {
|
||||
throw new CathError("Missing 'word'");
|
||||
}
|
||||
const data = await axios
|
||||
.get(`${config.api}/api/v1/fun/superscript?text=${word}`)
|
||||
.then(res => res.data);
|
||||
console.log(data);
|
||||
return data.text;
|
||||
}
|
|
@ -35,3 +35,6 @@ export { cleanText } from "./functions/cleanText";
|
|||
export { daysAgo } from "./functions/daysAgo";
|
||||
export { sleep } from "./functions/sleep";
|
||||
export { trimArray } from "./functions/trimArray";
|
||||
export { superscript } from "./functions/superscript";
|
||||
export { doublestruck } from "./functions/doublestruck";
|
||||
export { fractur } from "./functions/fractur";
|
||||
|
|
Loading…
Reference in a new issue