UNPKG

@aidarkezio/main-func

Version:
30 lines (28 loc) 1.26 kB
/* ═══════════════════════════════════════════════════════ // => If you want to recode, reupload, => or copy the codes/script, => pls give credit, => no credit? i will take action immediately. ==> Copyright (C) 2022 Dark_Ezio. ==> Licensed under the MIT License; ===> you may not use this file except in compliance with the License. => Thank you to Lord Buddha, Family and Myself. => Whats Bot - Dark_Ezio. // ════════════════════════════ */ import axios from "axios"; import * as cheerio from "cheerio"; export function styletext(text: string): Promise<{ name: string; result: string }[]> { return new Promise((resolve, reject) => { axios.get(`http://qaz.wtf/u/convert.cgi?text=${encodeURI(text)}`).then(({ data }) => { let $ = cheerio.load(data); let ezio: { name: string; result: string }[] = []; $("table > tbody > tr").each(function (a, b) { ezio.push({ name: $(b).find("td:nth-child(1) > span").text(), result: $(b).find("td:nth-child(2)").text().trim(), }); }); resolve(ezio); }).catch(e => reject(e)); }); }