Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telegram Bot API #44

Open
abtahizadeh opened this issue Sep 24, 2023 · 2 comments
Open

Telegram Bot API #44

abtahizadeh opened this issue Sep 24, 2023 · 2 comments

Comments

@abtahizadeh
Copy link

Hi rainner

I think the Telegram Bot API section is not working
Does it need to update the code?

@OmarMai
Copy link

OmarMai commented Sep 27, 2023

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
Copy link
Author

abtahizadeh commented Sep 29, 2023

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


  /**
   * 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 +').' );
      },
    });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants