Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

blague.xyz

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blague.xyz

Wrapper pour Blague.xyz (blagues aléatoires, blague du jour, etc...)

  • 2.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Blague.xyz

Blague.xyz is a package to get jokes and FML easily from the Blague.xyz API.

🇬🇧 Jokes/FML in english are supported 🇫🇷 Blagues/Vie de merde en français sont supportées

Installation

$ npm install --save blague.xyz

API Token

You need an API Key to send request to the Blague.xyz API. Click here to get one.

Usage example

Jokes/Blague

const { Client } = require("blague.xyz");
const joker = new Client("API token", {
    defaultLang: "fr" // The default language for jokes and fml
});

// Gets a random joke. As no language is specified, it will use the default language of the client, "fr" in our case. 
joker.randomJoke().then((joke) => {
    console.log(joke.question); // Que dit une feuille quand elle tombe dans l'eau ?
    console.log(joke.answer); // J'ai papier
    console.log(joke.toString()); // Que dit une feuille quand elle tombe dans l'eau ?\nJ'ai papier
    console.log(joke.toDiscordSpoils()); // Que dit une feuille quand elle tombe dans l'eau ?\n\n||J'ai papier||
    console.log(joke.id); // 71
});

// Gets an english joke. If you specify a language, it will use it instead of the default language.
joker.dailyJoke("en").then((joke) => {
    console.log(joke.question); // What is the only dog you can eat ?
    console.log(joke.answer); // A Hot Dog
});

// Gets a joke with its ID
joker.getJoke(10, "fr").then((joke) => {
    console.log(joke.question); // Que dit une fleur qui a eu zéro à un contrôle ?
    console.log(joke.answer); // Qu'elle s'est plantée
});

// Gets the joke list. [premium only]
joker.listJoke().then((list) => {
    console.log(list); // [ {joke}, {joke}, {joke} ]
});

FML/VDM

const Client = require("blague.xyz");
const joker = new Client("API token", {
    defaultLang: "fr" // The default language for jokes and fml
});

// Gets a random vdm. As no language is specified, it will use the default language of the client, "fr" in our case. 
joker.randomVDM().then((vdm) => {
    console.log(vdm.content); // Aujourd'hui, j'ai acheté une voiture d'occasion à un de mes amis. Après avoir ramené la voiture à la maison et l'avoir inspectée, j'ai trouvé l'une des boucles d'oreilles de ma femme sur le siège arrière.
});

// Gets a random vdm with type "hot".
joker.randomVDM("hot").then((vdm) => {
    console.log(vdm.content); // Censured. Use the package to get some hot vdm...
});

// Gets an english fml. If you specify a language, it will use it instead of the default language.
joker.getVDM("normal", "en").then((fml) => {
    console.log(fml.content); // Today, a little girl asked me how I could be so fat and still have small boobs.
});

// Gets a vdm with its ID
joker.listVDM().then((list) => {
    console.log(list); // [ {vdm}, {vdm}, {vdm} ]
});

Keywords

FAQs

Package last updated on 08 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc