to send Bot API method? Or there's another way better.
BotMethod('123456789:abcdEFGhimySElfQ', 'sendMessage', {
'chat_id' : '@PublicChannelUsername',
'text' : 'Hello World'
});
function BotMethod(botToken, method, data) {
var xmlHttp = new XMLHttpRequest();
const apiUrl = 'https://api.telegram.org/bot' + botToken + '/' + method;
xmlHttp.open("POST", apiUrl, true);
xmlHttp.send(data);
return xmlHttp.responseText;
}
P.S. I don't want to use any library, Because I'll use this in Browser.
use fetch and asyncio. https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
Thank you very much, It helped me a lot 😃
Обсуждают сегодня