Giter VIP home page Giter VIP logo

Comments (11)

yagop avatar yagop commented on May 22, 2024

Hi, which URL are you sending?
There was a change on the Telegram API, maybe for a while wasn’t working.
Test are passing now, could you please check again? Thanks

from node-telegram-bot-api.

m90 avatar m90 commented on May 22, 2024

Hi & thanks for getting back to me so quick.

It's still failing, the URL that is used is:

https://api.telegram.org/<token>/sendPhoto

A little unrelated (but maybe related again), I was looking at your tests as well but I'm not too sure if they work at all (that's probably another issue):

When doing with a plain A+ promise:

it('does stuff', function(done){
  thingy().then(function(result){
   assert(false);
   done();
  });
});

the test will still pass as the promise will swallow the thrown exception. So I usually use it like this:

it('does stuff', function(){
  return thingy().then(function(result){
   assert(false);
  });
});

I never use Bluebird though, so I don't know if it handles this smarter (I'm asking in hope for a yes, so I can get rid of that.....).

from node-telegram-bot-api.

yagop avatar yagop commented on May 22, 2024

I mean the request URL (someUrl) on client.sendPhoto(config.group_chat_id, request(someUrl));

You can run the test with:

DEBUG='node-telegram-bot-api' \
TEST_TELEGRAM_TOKEN=<YOUR_TOKEN> \
TEST_USER_ID=<YOUR_USER> ./node_modules/.bin/mocha test/index.js

If promise fails, it will throw an Unhandled rejection Error: 400 {"ok":false,"error_code":400,"description":"Error: AUDIO_EXT_INVALID"}

from node-telegram-bot-api.

m90 avatar m90 commented on May 22, 2024

I'm using random image URLs from flickr.

I can save them to disk and do whatever with them so that should not be the
problem I guess.

Can you run the demo in `/examples? ? I'm getting the same error for any kind
of upload here.

Thanks!

from node-telegram-bot-api.

SerjoPepper avatar SerjoPepper commented on May 22, 2024

Maybe it because of the lib make only GET requests, not POST. So large queries can be cut.

from node-telegram-bot-api.

m90 avatar m90 commented on May 22, 2024

@SerjoPepper I actually tried hacking on the lib to make it a POST as I was thinking the same thing as you, but it did not make a difference. I ended up "manually" (i.e. no lib) uploading the files which worked fine.

from node-telegram-bot-api.

yagop avatar yagop commented on May 22, 2024

In order to send form data, it sends a POST request. Could you please provide me the URL which you are testing? It works fine with URL with file format extension because Telegram needs an extension.

from node-telegram-bot-api.

m90 avatar m90 commented on May 22, 2024

I was using full image URLs like: https://farm1.staticflickr.com/323/19723079154_f405855a4c.jpg

But as I have already written above I also could not run the example bot in /examples/polling.js as it would fail with the exact same error.

from node-telegram-bot-api.

yagop avatar yagop commented on May 22, 2024

Did you try the test and passed them out? Clone the repository, get inside the folder and then:

DEBUG='node-telegram-bot-api' \
TEST_TELEGRAM_TOKEN=<YOUR_TOKEN> \
TEST_USER_ID=<YOUR_USER> ./node_modules/.bin/mocha test/index.js

from node-telegram-bot-api.

m90 avatar m90 commented on May 22, 2024

Ok so this is super weird and seems to be an issue with Telegram. I created a new bot where the token works perfectly fine, whereas when I use the "old" token it will still return the 400.

I'll try to use the two tokens with my own wrapper once I find the time to do so, so we can find out if this is a Telegram issue or not (sounds a lot like it).

from node-telegram-bot-api.

m90 avatar m90 commented on May 22, 2024

So this really is an issue with the token I am using. My own lib, test suites and everything fails when using that one single token. Everything else works. Going to contact Telegram regarding that.

Thanks for your input and sorry for all that noise.

from node-telegram-bot-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.