by Lazy Sloth
Emoji Financial News Bot
import logging
import requests
from telegram import Update, Bot
from telegram.ext import (
Updater,
CommandHandler,
MessageHandler,
filters,
CallbackContext,
)
from abilities import apply_llm_prompt_to_every_item
from bs4 import BeautifulSoup
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
TELEGRAM_API_TOKEN = None
RSS_FEED_URL = "https://news.google.com/rss/search?q=when:24h+allinurl:bloomberg.com&hl=en-US&gl=US&ceid=US:en"
def fetch_financial_news_titles() -> list[str]:
logger.info("Fetching financial news titles")
response = requests.get(RSS_FEED_URL)
soup = BeautifulSoup(response.content, "lxml-xml")
Emoji Financial News Bot
Created: | Last Updated:
Introduction to the Emoji Financial News Bot Template
Welcome to the Emoji Financial News Bot template! This template allows you to create a Telegram bot that fetches the latest financial news from Bloomberg's RSS feed, analyzes the news titles using a language model, and presents them to users in the form of emoji representations. This bot is a fun and engaging way to keep up with financial news. To get started, simply click "Start with this Template" on the Lazy platform.
Setting Up Your Telegram API Token
Before you can use this template, you'll need to set up a Telegram bot and obtain an API token. Here's how to do it:
- Go to the Telegram app and search for the "BotFather" bot.
- Start a chat with BotFather and use the command
/newbot
to create a new bot. - Follow the instructions to set up your bot. You will be given an API token.
- Keep this token secure, as you will need to enter it when prompted by the Lazy CLI.
Using the Test Button
Once you have your Telegram API token, you're ready to deploy your bot. Click the "Test" button on the Lazy platform. This will launch the Lazy CLI, and you will be prompted to enter your Telegram API token. Enter the token when prompted to complete the deployment process.
After the deployment, your bot will be live on Telegram. You can start interacting with it by sending the /start
command to get a welcome message, and then /news
to receive the latest financial news in emojis.
Interacting with Your Telegram Bot
To use your new Telegram bot, follow these steps:
- Open the Telegram app and search for the name you gave your bot during the setup with BotFather.
- Start a conversation with your bot.
- Send the
/start
command to receive a welcome message from the bot. - Send the
/news
command to get the latest financial news represented in emojis.
Enjoy your Emoji Financial News Bot, and stay updated with the latest financial headlines in a fun and unique way!
If you encounter any issues or have questions, please refer to the documentation provided by Lazy or reach out to their customer support for assistance.