How to use telegram-bot to just read the message from channel? - telegram

Yes, I know I can add my bot to channel as admin and then the bot can work brilliantly.
But what I want to do is to add my bot to other channels to parse the data and do some analysis. How could this be achieved provided that I don't own those channels? Any other possible non-bot methods are welcomed to share.
I am currently using 'twx.botapi' from Python to do bot automation.

Related

Best solution for a small Discord bot and external file/db

I made a Discord bot. Its only function is if a DC member writes a keyword, the bot will send the:
link to an image
Link to a post
So, for each keyword, I have 2 URLs. Currently, this data is written in code. I wish to store this data in an external file or a database.
Now the problem is what is the best solution to host a bot and a file or database. I need a small free hosting service. Bot and data are very small really, so I don't need anything complex.
I thought about a few options now, although I don't know would it work:
to store the Discord bot at Heroku and to create a Database at the Firebase. Can the bot and db communicate this way?
to store both db/file and bot in Google Cloud micro instance (if it's for free). Although it sounds too complex for such a small task.
I've heard about the "Zapier" but I don't understand how it works, is it a good solution for my case?
In short, I need to host both a bot and a source of data, and those two should communicate. The bot should read the data.

Is it possible to send premium-only custom emojis with a Telegram Client?

Recently, Telegram released a new feature - Custom Emojis. They instantly became available to users, but there are no instructions on how to send them using a Telegram bot. Is it even possible within the API? And specifically on Telegraf?
This update describes methods that may be useful to you. I haven't tested them myself yet, but I think this is what is needed. I will write about the results as soon as I test it myself.

Hot to get callback data from telegram bot message

I'm developing a Telegram Bot via PHP and I want users to answer bot question.
For Example:
Bot: What is your name?
User: (Reply)
But I don't know how to process user reply for specific question from bot.
If I receive user reply via webhook, it doesn't contain last bot message, and I don't know what question this reply is.
Webhook has parameter callback_query, but it works only for messages that contains inline keyboard.
Can you help please?
This process is called conversation. There are various ways to implement this.
The best and common way is to implement a Finite State Machine which will save the current state and accordingly, have a conversation with a user. Famous libraries like python-telegram-bot already implement it, which can give you a general idea on how to do this. Other ways can be storing last message in a database, etc; which is not recommended.

Telegram client to listen for channel updates

I need a way to automate processing of messages/files sent in a Telegram channel. I've been told that is can't be done with a telegram bot since they can't join channels, nor am I the owner of the channel, so I would need to set up a client or to use regular Telegram API to be able to do that. I'm looking for guidance, suggestions, anything that could help me. The script/client will have to run on Windows (so I can't use the cli linux version).
You can try UNOFFICIAL PWRTelegram API, it can be login in use a user account, and have HTTP API like bots.
You can click here to see usages.

can Telegram CLI mimick Telegram bots?

I saw on internet that there is some programs that can use Telegram CLI.
I want to choose between them
for Telegram bot API there is much more documents explaining its functionality, but for CLI there isn't much that explains its features
it seems the only way to know about is to experiment with it.
unfortunately i don't have a linux distro installed on my pc so experimenting isn't an option right know.
so I thought to ask from people who already used it
I know about Telegram bot api, its powers and its limitations
here is my questions:
what can I do using Telegram CLI that I can't do with with bot api, and vice versa?
Telegram bot API:
do not require to register new Telegram account, so you don't need to have another phone number;
bot cannot write to user first, only after user sends a first message to bot;
already has the commands interface (/command);
can do stuff by simple HTTP POST (by sending request via cURL, for example). So you can hook to this tons of stuff (notifications about new articles at the website or so);
you can rather easily create lots of them;
you can write you own implementation in almost any programming language;
you have a list of bots you have created (thanks to #BotFather). If you have lost somehow control of your bot - just revoke the token via #BotFather and it's yours again;
pretty simple to use.
Telegram client application (in this case - CLI):
requires new Telegram account registration with phone number;
acts like any other actual Telegram user (can write to other users first, without invitation). Well, that's a good thing;
not really good cross-platform abilities for now (some lack of CLI-realisations);
not really easy to install and use;
you have to implement the commands handling part;
if you have lost your phone number - pretty much you lose this account, because it's not like you would make some precautions for CLI client account. So you will have to register a new one and repeat the setting procedure for client.
In conclusion, bots actually got rid of CLI clients, in my opinion. I had CLI account right to the moment the bots appeared. After that I deleted it and created a bot. And not just one :)
So, bots are for the "robot" stuff, and real accounts are for the real people.
The Telegram CLI library interacts directly with their MTproto protocol, which means it's like their desktop/mobile app...but for the console. You can send messages from one phone number to another. This means that when authenticating with the CLI application, you use your real number as if you were logging into the mobile application.
I wouldn't suggest using it for bot behavior as you have to write an application that wraps the Telegram CLI and parses the log file as it is displayed...since it doesn't implement all the MTproto methods and the outputs for the log file are custom...it can be quite annoying and different than what you would expect.
With Telegram CLI you can send a number to another Telegram user without having them initiate the conversation first (since it functions just like a normal Telegram client) where the Bot API requires the user to add the Bot and start interaction before the Bot knows you are there.
previous answers are almost correct. Two different interfaces for different purposes:
Telegram Bot API allows to develop a Telegram Bot.
Telegram CLI (as this one, as an implementation example: https://github.com/vysheng/tg) are telegram client implementations, running from command line, based on MTproto protocol, as Chris Brand said.
As a bot developer, I'm interested to have a TG CLI interface (2) to automatize dialogs tests, with bash scripts, with a bot made with (1).

Resources