Example #1
0
async def gita_hindi(event):
    """To get a specific verse from a specific chapter in Hindi."""
    if CLIENT_ID is None or CLIENT_SECRET is None:
        await event.edit(
            "`Please add required GITA_CLIENT_SECRET and GITA_CLIENT_ID env var`",
        )
        return
    pygita.auth(CLIENT_ID, CLIENT_SECRET)
    chapter_number = int(event.pattern_match.group(1))
    verse_number = int(event.pattern_match.group(2))
    verse = pygita.get_verse(chapter_number, verse_number, language="hi")
    await event.edit(f"**{verse.text}** {verse.meaning}")
Example #2
0
async def gita(event):
    """To get a specific verse from a specific chapter in English."""
    if CLIENT_ID is None or CLIENT_SECRET is None:
        await event.edit(
            "`Please add required GITA_CLIENT_SECRET and GITA_CLIENT_ID env var`"
        )
        return
    pygita.auth(CLIENT_ID, CLIENT_SECRET)
    try:
        chapter_number = int(event.pattern_match.group(1))
        verse_number = int(event.pattern_match.group(2))
    except ValueError:
        return
    verse = pygita.get_verse(chapter_number, verse_number, language="en")
    await event.edit(f"**{verse.text}** {verse.meaning}")