Last active
August 1, 2024 14:02
-
-
Save Tarkiin/71a2b9f06f4323544c1d17d99e179b6c 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 } = require('../lib'); | |
bot( | |
{ | |
pattern: 'ima', | |
fromMe: true, | |
desc: 'Send a specific image as media', | |
type: 'misc', | |
}, | |
async (message, match) => { | |
// URL de la imagen a enviar | |
const imageUrl = 'https://cdn.pixabay.com/photo/2024/07/11/14/29/bee-8888442_1280.jpg'; | |
try { | |
// Enviar un mensaje informativo | |
await message.send('Aquí está la imagen que solicitaste:'); | |
// Verificar si el método sendFromUrl está disponible y funcional | |
if (typeof message.sendFromUrl === 'function') { | |
// Intentar enviar la imagen como media | |
await message.sendFromUrl(imageUrl); | |
} else { | |
throw new Error('Método sendFromUrl no disponible'); | |
} | |
} catch (error) { | |
// Proporcionar detalles específicos del error | |
console.error('Error al enviar la imagen:', error); | |
await message.send('Error al enviar la imagen: ' + error.message); | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment