mirror of
https://github.com/keanuplayz/TravBot-v3.git
synced 2024-08-15 02:33:12 +00:00
don't use networking in the owoify command
This commit is contained in:
parent
e86abbef3e
commit
31c68a5d09
1 changed files with 11 additions and 5 deletions
|
@ -1,15 +1,21 @@
|
|||
import {NamedCommand, RestCommand} from "onion-lasers";
|
||||
import {getContent} from "../../lib";
|
||||
import {URL} from "url";
|
||||
import {random} from "../../lib";
|
||||
|
||||
export default new NamedCommand({
|
||||
description: "OwO-ifies the input.",
|
||||
run: "You need to specify some text to owoify.",
|
||||
any: new RestCommand({
|
||||
async run({send, combined}) {
|
||||
let url = new URL(`https://nekos.life/api/v2/owoify?text=${combined}`);
|
||||
const content = (await getContent(url.toString())) as any; // Apparently, the object in question is {owo: string}.
|
||||
send(content.owo);
|
||||
// Copied from <https://github.com/Nekos-life/neko-website/blob/78b2532de2d91375d6de45e4446fc766ba169472/app.py#L78-L87>.
|
||||
const faces = ["owo", "UwU", ">w<", "^w^"];
|
||||
const owoified = combined
|
||||
.replace(/[rl]/g, "w")
|
||||
.replace(/[RL]/g, "W")
|
||||
.replace(/ove/g, "uv")
|
||||
.replace(/n/g, "ny")
|
||||
.replace(/N/g, "NY")
|
||||
.replace(/\!/g, ` ${random(faces)} `);
|
||||
send(owoified);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue