Created
August 1, 2024 15:57
-
-
Save Tarkiin/75303034192686931535f50827cd6ab3 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/'); | |
const path = require('path'); | |
const fs = require('fs'); | |
// Directorio de imágenes | |
const imageDirectory = path.join(__dirname, 'images'); | |
// Nombre del archivo de imagen | |
const imageFileName = 'acolores.jpg'; | |
bot( | |
{ | |
pattern: 'ima', | |
fromMe: true, | |
desc: 'Sends the acolores image from the images directory', | |
type: 'misc', | |
}, | |
async (message, match) => { | |
// Construir la ruta del archivo de imagen | |
const imagePath = path.join(imageDirectory, imageFileName); | |
// Verificar si el archivo de imagen existe | |
if (fs.existsSync(imagePath)) { | |
// Enviar la imagen desde el archivo | |
await message.send({ file: imagePath, mimetype: 'image/jpeg' }); | |
} else { | |
// Enviar un mensaje de error si la imagen no existe | |
await message.send('Imagen no encontrada.'); | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment