I want to adjust the API request frequency, the number

of my bot users is too large.
My bot is @SOSO
Are there any official technicians here?

8 ответов

15 просмотров

something like that? async function sendMessageToChannel(message) { const apiUrl = `https://api.telegram.org/bot${process.env.BOT_TOKEN}/sendMessage`; const data = { chat_id: process.env.CHANNEL_ID, text: message, parse_mode: "HTML", disable_web_page_preview: true, }; try { await axios.post(apiUrl, data); } catch (error) { if (error.response.data.parameters.retry_after) { const timeOut = error.response.data.parameters.retry_after; await sleep(timeOut * 1000); await axios.post(apiUrl, data); } } }

航海集团 🌊(永远不会主动私信)
I use pyrogram, all messages are async

In the last hour, I have added tens of thousands of users, and there are probably hundreds of thousands of messages....

航海集团 🌊(永远不会主动私信)
In the last hour, I have added tens of thousands o...

Look at your backend logic, I think bottle neck could be in the way you proccess messages and issuing replies. Then again im not an expert or have any pyrogram or python experience. Someone else mb can have a better idea on here.

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

Карта сайта