Hi, I have a custom API about weather information but whenever i type the command it nightbot replies: [ Response must be less than 400 characters ]. So, I am wondering if its possible to set the amount of characters i want. for an example, I want nightbot to respond the first 200 characters of reply and how do i do that?
That’s the command i am using:
!addcom !deneme123 $(urlfetch [http://www.7timer.info/bin/astro.php?lon=113.17&lat=23.09&ac=0&lang=en&unit=metric&output=internal&tzshift=0 )]
Emily
January 31, 2024, 12:06pm
2
Hey @oldbutdolphin !
Do you expect the API to respond with text or JSON? Because when I go to the link I get an image.
$(urlfetch)
is only to be used for API that respond with text or JSON, it can’t deal with images.
If you just want to link to the image, you don’t need the $(urlfetch)
, just put the raw link in the command’s message:
!addcom !deneme123 https://www.7timer.info/bin/astro.php?lon=113.17&lat=23.09&ac=0&lang=en&unit=metric&output=internal&tzshift=0
Even though it doesn’t apply here, here’s how you limit the length of a response from an API to 400 characters:
!addcom !commandName $(eval `$(urlfetch API_LINK)`.slice(0, 400);)
2 Likes
system
Closed
February 14, 2024, 12:06pm
3
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.