forked from mahmud-aura/HINATA
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsing.js
More file actions
58 lines (46 loc) · 1.7 KB
/
Copy pathsing.js
File metadata and controls
58 lines (46 loc) · 1.7 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const axios = require("axios");
const baseApiUrl = async () => {
const base = await axios.get("https://raw.githubusercontent.com/mahmudx7/exe/main/baseApiUrl.json");
return base.data.sing;
};
module.exports = {
config: {
name: "sing",
version: "1.7",
author: "MahMUD",
countDown: 10,
role: 0,
category: "music",
guide: "{p}sing mood"
},
onStart: async function ({ api, event, args, message }) {
if (args.length === 0) {
return message.reply("❌ | Please provide a sing name janu.");
}
try {
const query = encodeURIComponent(args.join(" "));
const apiUrl = `${await baseApiUrl()}/sing?query=${query}`;
message.reply("𝐖𝐚𝐢𝐭 𝐤𝐨𝐫𝐨 𝐣𝐚𝐧 <😘");
const response = await axios.get(apiUrl, {
responseType: "stream",
headers: { "author": module.exports.config.author }
});
console.log("Response:", response);
if (response.data.error) {
return message.reply(`❌ Error: ${response.data.error}`);
}
message.reply({
body: `✅ Here's your song: ${args.join(" ")}`,
attachment: response.data
});
} catch (error) {
console.error("Error:", error.message);
if (error.response) {
console.error("Response error data:", error.response.data);
console.error("Response status:", error.response.status);
return message.reply(`❌ Error: ${error.response.data.error || error.message}`);
}
message.reply("error🥺");
}
}
};