Package Exports
- gospel_catholic
 - gospel_catholic/index.js
 
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gospel_catholic) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
gospel_catholic
An NPM package to fetch daily Catholic gospel readings from Vatican News with translation support. Useful for WhatsApp bots, Discord bots, Telegram bots, and more.
Installation
npm install gospel_catholicUsage
Basic Usage
const GospelCatholic = require('gospel_catholic');
// Create a new instance with default settings (English)
const gospel = new GospelCatholic();
// Get today's gospel
gospel.getGospel()
  .then(result => {
    console.log('Gospel Title:', result.original.title);
    console.log('Date:', result.original.date);
    console.log('Scripture:', result.original.scripture);
    console.log('Gospel Text:', result.original.text);
  })
  .catch(error => {
    console.error('Error:', error);
  });With Translation
// Create a new instance with Spanish translation
const gospel = new GospelCatholic({ language: 'es' });
// Get today's gospel translated to Spanish
gospel.getGospel()
  .then(result => {
    console.log('Original Title:', result.original.title);
    console.log('Translated Title:', result.translated.title);
    console.log('Translated Scripture:', result.translated.scripture);
    console.log('Translated Gospel Text:', result.translated.text);
  })
  .catch(error => {
    console.error('Error:', error);
  });Supported Languages
The package supports all languages available in Google Translate, including:
en- English (default)es- Spanishfr- Frenchit- Italiande- Germanpt- Portugueseru- Russianzh- Chineseja- Japaneseko- Koreanar- Arabichi- Hindibn- Bengalisi- Sinhala (supported with Google Translate)- And many more ISO language codes
 
The package uses Google Translate's API which supports over 100 languages including those with less common support like Sinhala, Amharic, Kurdish, etc.
Integration Examples
WhatsApp Bot (using whatsapp-web.js)
const { Client } = require('whatsapp-web.js');
const GospelCatholic = require('gospel_catholic');
const client = new Client();
client.on('message', async msg => {
  if (msg.body === '!gospel') {
    const gospel = new GospelCatholic();
    const result = await gospel.getGospel();
    
    msg.reply(`*${result.original.title}*\n${result.original.date}\n\n${result.original.scripture}\n\n${result.original.text}`);
  }
  
  if (msg.body === '!evangelio') {
    const gospel = new GospelCatholic({ language: 'es' });
    const result = await gospel.getGospel();
    
    msg.reply(`*${result.translated.title}*\n${result.original.date}\n\n${result.translated.scripture}\n\n${result.translated.text}`);
  }
});
client.initialize();Discord Bot (using discord.js)
const { Client, GatewayIntentBits } = require('discord.js');
const GospelCatholic = require('gospel_catholic');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] });
client.on('messageCreate', async message => {
  if (message.content === '!gospel') {
    const gospel = new GospelCatholic();
    const result = await gospel.getGospel();
    
    message.channel.send(`**${result.original.title}**\n${result.original.date}\n\n${result.original.scripture}\n\n${result.original.text}`);
  }
});
client.login('YOUR_DISCORD_BOT_TOKEN');Telegram Bot (using node-telegram-bot-api)
const TelegramBot = require('node-telegram-bot-api');
const GospelCatholic = require('gospel_catholic');
const bot = new TelegramBot('YOUR_TELEGRAM_BOT_TOKEN', { polling: true });
bot.onText(/\/gospel/, async (msg) => {
  const chatId = msg.chat.id;
  
  const gospel = new GospelCatholic();
  const result = await gospel.getGospel();
  
  bot.sendMessage(chatId, `*${result.original.title}*\n${result.original.date}\n\n${result.original.scripture}\n\n${result.original.text}`, { parse_mode: 'Markdown' });
});
bot.onText(/\/gospel_([a-z]{2})/, async (msg, match) => {
  const chatId = msg.chat.id;
  const language = match[1]; // Language code from the command
  
  const gospel = new GospelCatholic({ language });
  const result = await gospel.getGospel();
  
  bot.sendMessage(chatId, `*${result.translated.title}*\n${result.original.date}\n\n${result.translated.scripture}\n\n${result.translated.text}`, { parse_mode: 'Markdown' });
});License
MIT