forked from mahmud-aura/HINATA
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfont.js
More file actions
43 lines (37 loc) · 1.41 KB
/
Copy pathfont.js
File metadata and controls
43 lines (37 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const axios = require("axios");
const baseApiUrl = async () => {
const base = await axios.get("https://raw.githubusercontent.com/mahmudx7/exe/main/baseApiUrl.json");
return base.data.mahmud
};
module.exports.config = {
name: "style",
aliases: ["font"],
version: "1.7",
role: 0,
countDowns: 5,
author: "MahMUD",
category: "general",
guide: { en: "[number] [text] or list" }
};
module.exports.onStart = async function ({ message, args }) {
const apiUrl = await baseApiUrl();
if (args[0] === "list") {
try {
const fontList = (await axios.get(`${apiUrl}/api/font/list`)).data.replace("Available Font Styles:", "").trim();
return fontList ? message.reply(`Available Font Styles:\n${fontList}`) : message.reply("No font styles found.");
} catch {
return message.reply("Error fetching font styles.");
}
}
const [number, ...textParts] = args;
const text = textParts.join(" ");
if (!text || isNaN(number)) return message.reply("Invalid usage. Format: style <number> <text>");
try {
const { data: { data: fontData } } = await axios.post(`${apiUrl}/api/font`, { number, text });
const fontStyle = fontData[number];
const convertedText = text.split("").map(char => fontStyle[char] || char).join("");
return convertedText ? message.reply(convertedText) : message.reply("Error converting text.");
} catch {
return message.reply("Error processing your request.");
}
};