Last active
August 16, 2025 16:51
-
-
Save icy-r/0e33d30975fefc3b2d9ae2b6a71ee5b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const {bot, sleep} = require('../lib'); | |
| bot( | |
| { | |
| pattern: 'mean ?(.*)', | |
| fromMe: true, | |
| desc: 'get meaning of a word', | |
| type: 'all', | |
| }, | |
| async (message, match) => { | |
| if (!match) | |
| return await message.send('it is necessary to send a word!') | |
| const response = await fetch(`https://api.urbandictionary.com/v0/define?term=${match}`) | |
| const json = await response.json() | |
| if (!json.list.length) | |
| return await message.send('oops!!, no results found!') | |
| return await message.send(json.list[0].definition) | |
| } | |
| ) | |
| bot( | |
| { | |
| pattern: 'dict ?(.*)', | |
| fromMe: true, | |
| desc: 'get meaning of a word', | |
| type: 'all', | |
| }, | |
| async (message, match) => { | |
| if (!match) | |
| return await message.send('it is necessary to send a word!'); | |
| const response = await fetch(`https://api.dictionaryapi.dev/api/v2/entries/en/${match}`); | |
| const json = await response.json(); | |
| //random number | |
| let number = Math.floor(Math.random() * 100); | |
| if (number % 7 == 0) | |
| message.send('There is another command called "mean" which gives funny meanings of words. Try it out!'); | |
| if (!json.length) | |
| return await message.send('oops!!, no results found!') | |
| let msg = ''; | |
| msg += `*${json[0].word}*\n`; | |
| msg += 'Meanings:\n'; | |
| for (let i = 0; i < json[0].meanings.length; i++) { | |
| msg += '*part of speech:* ' + `${json[0].meanings[i].partOfSpeech}\n`; | |
| for (let j = 0; j < json[0].meanings[i].definitions.length; j++) { | |
| msg += '*definition:* ' + `${json[0].meanings[i].definitions[j].definition}\n`; | |
| if (json[0].meanings[i].definitions[j].example != undefined) | |
| msg += `*Example: ${json[0].meanings[i].definitions[j].example}*\n`; | |
| if (json[0].meanings[i].definitions[j].synonyms != '') | |
| msg += `*Synonyms: ${json[0].meanings[i].definitions[j].synonyms}*\n`; | |
| if (json[0].meanings[i].definitions[j].antonyms != '') | |
| msg += `*Antonyms: ${json[0].meanings[i].definitions[j].antonyms}*\n`; | |
| } | |
| msg += '=============================\n'; | |
| } | |
| msg += '=============================\n'; | |
| return await message.send(msg); | |
| }) |
Je n'ai rien compris qui peut m'aider
J'ai envie d'apprendre qui peut m'aider ?
Je n'ai rien compris qui peut m'aider
Moi aussi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/icy-r/0e33d30975fefc3b2d9ae2b6a71ee5b4