Spaces:
Paused
Paused
File size: 2,674 Bytes
8d8d92b |
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 59 60 61 |
/*╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺
⭐PROJECT NAME:
SUBZERO WHATSAPP MD BOT
⭐DEVELOPER
MR FRANK
⭐ MY TEAM
XERO CODERS
⭐ OUR WEBSITE
https://github.com/ZwSyntax/SUBZERO-MD
© TRY DECRYPTING IF YOU CAN⚠
╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺*/
const axios = require('axios');
const {cmd , commands} = require('../command');
cmd({
pattern: "define",
desc: "📚 Get the definition of a word",
react: "🔍",
category: "Auther",
filename: __filename
},
async (conn, mek, m, { from, q, reply }) => {
try {
if (!q) return reply("❗ Please provide a word to define. Usage: .define [word]");
const word = q;
const url = `https://api.dictionaryapi.dev/api/v2/entries/en/${word}`;
const response = await axios.get(url);
const definitionData = response.data[0];
const definition = definitionData.meanings[0].definitions[0].definition;
const example = definitionData.meanings[0].definitions[0].example || 'No example available';
const synonyms = definitionData.meanings[0].definitions[0].synonyms.join(', ') || 'No synonyms available';
const wordInfo = `
📚 *Word*: ${definitionData.word}
🔍 *Definition*: ${definition}
📝 *Example*: ${example}
🔗 *Synonyms*: ${synonyms}
*MADE WITH ♥ KERM_MD-V4*`;
return reply(wordInfo);
} catch (e) {
console.log(e);
if (e.response && e.response.status === 404) {
return reply("🚫 Word not found. Please check the spelling and try again.");
}
return reply("⚠️ An error occurred while fetching the definition. Please try again later.");
}
});
|