goat
command
anya
šŗšššŗ šæšššš¾š ššš
0
views
0
likes
0
installs
raw source
const axios = require("axios");
const fs = require("fs-extra");
const path = require("path");
module.exports = {
config: {
name: "anya",
author: "JABED",
version: "3.0",
countDown: 5,
role: 0,
shortDescription: { en: "šŗšššŗ šæšššš¾š ššš" },
longDescription: { en: "š¼šššš¾šš šš¾šš šš ššš¾š¾š¼š ššššš šŗšššŗ šæšššš¾š'š šššš¼š¾" },
category: "ai",
guide: { en: "ć {pn} [šš¾šš] ć" }
},
onStart: async function ({ api, event, args }) {
const { messageID, threadID, senderID } = event;
try {
if (!args[0]) {
return api.sendMessage(
`āāā į²š¼ š¹ šŗšššŗ ššš š¹ į²š¼ āāā®\n\n įÆā
šš
š¾šŗšš¾ šššššš½š¾ šš¾šš .į\n ā ššš¾: {pn} ššŗšš ššŗšš\n\nā°āā įÆā
Ėš·ĖŻ Ėį²š¼āš¹.į āāāÆ`,
threadID, messageID
);
}
const text = args.join(" ");
api.setMessageReaction("š„µ", messageID, () => {}, true);
const apiUrl = `https://api.tts.quest/v3/voicevox/synthesis?text=${encodeURIComponent(text)}&speaker=3`;
const response = await axios.get(apiUrl);
if (!response.data.success) {
throw new Error("šŗšš šæšŗšš
š¾š½");
}
const audioUrl = response.data.mp3StreamingUrl;
const cachePath = path.resolve(__dirname, 'cache');
if (!fs.existsSync(cachePath)) fs.mkdirSync(cachePath, { recursive: true });
const filePath = path.join(cachePath, `anya_${senderID}_${Date.now()}.mp3`);
const getAudio = await axios.get(audioUrl, { responseType: "arraybuffer" });
fs.writeFileSync(filePath, Buffer.from(getAudio.data));
const successMsg = `āāā į²š¼ š¹ šŗšššŗ šššš¼š¾ š¹ į²š¼ āāā®\n\n įÆā
šš¾šššŗšš¾: "${text}"\n ā šš¾ššš¾š½ š»š šš£šæš į²š¼\n\nā°āā įÆā
Ėš·ĖŻ Ėį²š¼āš¹.į āāāÆ`;
return api.sendMessage({
body: successMsg,
attachment: fs.createReadStream(filePath)
}, threadID, () => {
if (fs.existsSync(filePath)) fs.unlinkSync(filePath);
api.setMessageReaction("š", messageID, () => {}, true);
}, messageID);
} catch (error) {
console.error(error);
api.setMessageReaction("ā", messageID, () => {}, true);
return api.sendMessage(
`āāā į²š¼ š¹ š¾šššš š¹ į²š¼ āāā®\n\n įÆā
ššššš¾š šæšŗšš
ššš¾ .į\n\nā°āā įÆā
Ėš·ĖŻ Ėį²š¼āš¹.į āāāÆ`,
threadID, messageID
);
}
}
};