mcb-dev / mCodingBot

The Discord bot for the mCoding Discord server.
https://mcoding.io/discord
MIT License
12 stars 4 forks source link

`xkcd` command #104

Open Enderchief opened 1 year ago

Enderchief commented 1 year ago

should fetch the xkcd by number

Enderchief commented 1 year ago

The easiest way is with the xkcd api. This is the endpoint where {x} is the number: https://xkcd.com/{x}/info.0.json

Here is a sample response from the api

{
  "month": "1",
  "num": 37,
  "link": "",
  "year": "2006",
  "news": "",
  "safe_title": "Hyphen",
  "transcript": "{{Headline: My hobby: whenever calls something an [adjective]-ass [noun], I mentally move the hyphen one word to the right.}}\n[[One man is talking to another about a car that resembles a Volkswagen Beetle]]\nMan: Man, that's a sweet ass-car.\n{{Title text: I do this constantly}}",
  "alt": "I do this constantly",
  "img": "https://imgs.xkcd.com/comics/hyphen.jpg",
  "title": "Hyphen",
  "day": "1"
}