Похожие чаты

Guys, hello! I have a question: Using the python REQUESTS library, you

can make it so that by means of a POST telegram request the bot will send a message to a specific user
The code for this action looks something like this:

import request

id_user = '1234567890'
message = ‘Hello!’
url = “https://api.telegram.org/botTOKEN_MY_BOT/sendMessage”

payload = {
'chat_id': id_user,
'text': message
}

requests.post(url, data=payload)

——————

Do you know if it is also possible, using the REQUESTS library, to perform requests through which a telegram bot running on TELETHON will send a message to a specific user?
Interested in sending via REQUESTS

13 ответов

20 просмотров

Yeah it's possible but it's like you go through a 1000 km way instead on going through a 10 km way which is shorter and better. Telegram bot frameworks have been made to ease working with bot api

123- Автор вопроса
CɪᴘʜᴇʀX ₂₃ . ₁₆
Yeah it's possible but it's like you go through a ...

Yes, thank you, but still, if you know, please give me a code example) Something like (pseudo code): import request import Telethon.session as TS id_user = '1234567890' message = ‘Hello!’ url = “https://api.telegram.org/botTS/sendMessage” payload = { 'api_id': api_id, 'api_hash', api_hash, 'chat_id': id_user, 'text': message } requests.post(url, data=payload)

123
Yes, thank you, but still, if you know, please giv...

There is none. if you want one, you have to make your own API for it

123- Автор вопроса
⎞ .·. ⎝ ⎝
There is none. if you want one, you have to make y...

Does this mean that I can ONLY send messages from the executable file in which TELETHON is running? Or are there other ways?

yes. unless you make your own api for it

123- Автор вопроса
123- Автор вопроса
⎞ .·. ⎝ ⎝
yes. unless you make your own api for it

The question is in continuation of the topic of my own api. For example, I launched Flask with endpoint, which accepts the request and after processing it, how should the method of sending a message on behalf of the TELETHON bot be called? I don't understand it, because a file with Flask is one file, and a file with TELEPHONE is another file. It is likely that you need to import some methods from the running TELETHON file into the Flask file. Am I right?

123
The question is in continuation of the topic of my...

The flask api needs the telethon to run with it in the same place. then you call your own api with "requests" aka the Flask, your api needs to call telethon' client instance to conduct the action also telethon is async, using Flask will be harder, use Quart instead

123- Автор вопроса
123- Автор вопроса
⎞ .·. ⎝ ⎝
The flask api needs the telethon to run with it in...

For an async approach, instead of Flask, I should use QUART or AioHTTP, right?)

⎞ .·. ⎝ ⎝
yes. unless you make your own api for it

Hello dear sir , i have one question, currently I am steaming to another platform using item_download , so is there any limitations, that 1000 or 10k can viewer can watch a video at once ? 😄 I am asking this question to avoid in trouble in future Currently i have 30 50 viewer

John
Hello dear sir , i have one question, currently I ...

you have to test it on your own. Telegram downloads have limits for active processes at once. unless you cache them locally and download once

Похожие вопросы

Обсуждают сегодня

Добрый день. Хочу сделать отрисовку по команде на панели. Почему-то рисуется только при втором вызове. С чем может быть связано, не подскажете? procedure TForm1.FormDblClick(...
Kirill Filippenok
20
а зачем этот вопрос для удаления из чата?
Mёdkinson Medvezhkin
63
А почему в си некоторые вещи работают с двойными кавычками некоторые с одинарными? Нельзя было все сделать с одними или чтоб работало с разными? например чтоб выводить строки ...
.
15
using next image component with s3 image: "url" parameter is valid but upstream response is invalid code: <Image fill src={s...
Fasil
3
Всем привет! Нужен совет от опытных. Переношу свой проект с Делфи 10.2 Токио на Лазарус 3.2 установленный через инсталлятор fpcupdeluxe-x86_64-win64. При импортировании проект...
Дмитрий Завгородний
7
Всем привет! procedure TForm1.FormCreate(Sender: TObject); type TStartEnd = record S: Byte; E: Byte; end; var a, b: TStartEnd; begin {1} a.S := 1; {2} a.E := 2; ...
Руслан Михайлович
10
Всем привет!) я тут новенький и пытаюсь освоить evolution методом тыка. У меня при переходе между папками файлов выскакивают вот такие уведомления Можете подсказать как их от...
Диман Samoed
10
Эх кто-то пришел и весь праздник испортил :( You need complex FBX scene importing setup to change things on import? good luck with that. You need navigation and pathfinding? g...
Serg Gini
5
Friends, how can I find my Wazirx wallet address?
Silm Silm
31
Всем привет! Подскажите. Я написал приложение на Delphi 10.2 Tokyo под Windows 10. И передо мной стал вопрос о том чтобы сделать это приложение кроссплатформенным (под Linux и...
Дмитрий Завгородний
24
Карта сайта