Telegram Bot API
abtahizadeh opened this issue · 2 comments
abtahizadeh commented
Hi rainner
I think the Telegram Bot API section is not working
Does it need to update the code?
OmarMai commented
Its and old repo, don't expect a update any time soon. Im trying to run the project and try to use a discord bot api instead
abtahizadeh commented
Its and old repo, don't expect a update any time soon. Im trying to run the project and try to use a discord bot api instead
Thanks
This part of the code is related to Telegram
binance-watch/src/modules/messenger.js
Line 140 in b1f1cff
/**
* Send queue messages using Telegram API
*/
_telegramSend() {
let { enabled, botkey, userid } = this._options.telegram;
if ( !enabled || !botkey || !userid || !this._ajax ) return;
let content = '';
this._queue.forEach( q => {
let { title, message } = q;
content += `<b>${ title }</b> \n`;
content += `${ message } \n`;
content += `\n`;
});
const fdata = new FormData();
fdata.append( 'chat_id', userid );
fdata.append( 'text', String( content ).trim() );
fdata.append( 'parse_mode', 'html' );
this._ajax.post( 'https://api.telegram.org/bot'+ botkey +'/sendMessage', {
type: 'json',
data: fdata,
done: ( xhr, status, response ) => {
if ( !response || !response.ok ) return console.warn( 'Telegram-API', status, response );
this.emit( 'sent', 'Telegram notifications sent to ('+ userid +').' );
},
});