L
L
LeoCh23402020-10-11 17:48:28
Python
LeoCh2340, 2020-10-11 17:48:28

How to automate a bot in Telegram?

I am writing a bot in Python using the pyTelegramBotApi library.
The bot sends information about securities, for example, if the user writes: apple, then he will display its price.
I get information using a library that takes api google finance and api yahoo finance.
In order to get information about apple you need to write:

@bot.message_handler(content_types=['text'])

def handle_text_messages(message):
    if message.text.lower() == "apple":     
        bot.send_message(message.from_user.id, f"Привет, акции Apple - {AAPL.price}$")

But what about other securities? Don't write everything by hand. How to automate this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
no_yank, 2020-10-12
@no_yank

Try to receive an array of tickers and write not just some nonsense, but a ticker to a bot.
In general, if it's for yourself, then why? Isn't there already such a free bot? Do you love bicycles?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question