forked from mahmud-aura/HINATA
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathage.js
More file actions
40 lines (33 loc) · 1.08 KB
/
Copy pathage.js
File metadata and controls
40 lines (33 loc) · 1.08 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
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: "age",
version: "1.7",
author: "MahMUD",
category: "utility",
guide: {
en: "Usage: age <YYYY-MM-DD>"
}
},
onStart: async function ({ args, message }) {
if (args.length === 0) {
return message.reply("❗ Please provide your date of birth in the format `YYYY-MM-DD`.");
}
const inputDate = args[0];
try {
const apiUrl = await baseApiUrl();
const response = await axios.get(`${apiUrl}/api/age/font3?dob=${inputDate}`);
const data = response.data;
if (data.error) {
return message.reply(data.error);
}
return message.reply(data.message);
} catch (error) {
return message.reply("❌ Error connecting to the age calculator API.");
}
}
};