K
To be honest, it is not clear what a bot-development approach is needed, and rather a working solution cannot be created, but it is still possible to implement something like this, but not as much as you have planned.In fact, it's kind of a way to realize what you want to do as a crutch - to create a public band, to build a botus right, to get an identifier. supergroupand remove all the lasers from the group, then yes - in that case, you really don't need a single account in Telegram to send a message, but in fact, there's no client to interact with a bean, and the question is, why do you need a monologue? So the right and the only solution is to have at least one account, or more. chat_id (logine and password are not transferred or used, only tip identifiers).API Telegram, like everyone else, is a client-serious decision. So the client poisons the server, then the server delivers the results and then the information is given to the client. It can therefore be assumed that without a client, such a task is not possible in principle.Let's look at the official documentation as a simple method for sending simple messages. Based on this, at least one account in Telegram-e is needed to interact with the bot. If you need to be sent to the group/canal, negative identifiers are used, for example -10011234567890 NO! As you need to know, bott is controlled through API, that is, used json- objects. From this point of view, it is not necessary to use the ready-to-house libraries for the development of the bots, in fact, the cords over Telegram methods, all of which are built on the same principle that I described above - sending the data server to the client and getting it. As they say, we've all been done for us by making life simple: But if you're strong in the spirit, you're not afraid of the obstacles, and you want to go through a hard way, i.e. describe all the methods you want (that doesn't make any sense, because they've already been written for us) so we'll only have some of the follow-up methods.Bottoms can work in two different ways - one through getUpdatesand the second through webhook♪ You can go for a walk. long_polling and webhook For beans, because it's available on the first google reference, I'm not going to get into it, I'm gonna take it for a simplicity. getUpdates♪To send a message to the chat/group, you have to send it. POST- Telegram server. We're doing this through simple use. requestsSimple example of sending a message:import requests
token = 'ваш токен'
data = {'chat_id': 'Ваш id', 'text': 'Test message'}
r = requests.post(f'https://api.telegram.org/bot{token}/sendMessage?', data=data)
print(r.json())
и далее ваше взаимодействие с json-объектом
Simple example of a message sent by the botus user:import requests
token = 'ваш токен'
data_offset = {'offset': 1234567801}
r = requests.post(f'https://api.telegram.org/bot{token}/getUpdates') #, data=data_offset)
print(r.json())
data_offset You need to confirm on Telegram's server that you answered that message. But for the answer to be confirmed, we need to increment. offset One more, that's to send. data_offset = {'offset': 1234567802}It's two words, how it works. You'll need two days to make this happen.So the advice is to redesign the architecture of your task. I have everything: