New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

bananapi

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bananapi

API wrapper for https://bananapi.ml

latest
Source
npmnpm
Version
1.3.0
Version published
Maintainers
1
Created
Source

BananAPI.js

install size npm

A wrapper to use the https://bananapi.ml API which has some fun endpoints

Install

npm install bananapi

API Key

You need a key to use this API to get one, we use discordapp to manage users and give out api keys so to apply you need to join our discord server using the link https://discord.gg/3Nxb7yZ and once your in run b.apply command by sending it in chat

Usage

const BananAPI = require("bananapi");
const fs = require("fs").promises;
const api = new BananAPI.Client({ token: "Your Token Goes here" });

(async() => {

  // Ping API for reponse time
  const ping = await api.ping();
  console.log(`Pong! ${ping} ms`);

  const reversed = await api.reverse("Hello, World!");
  console.log(reversed);
  const eball = await api.eightball("Some question?");
  console.log(`8ball: ${eball.response}, positive: ${eball.isPositive}`);

  // Image endpoints
  const image = await api.trumptweet("Hello");
  await fs.writeFile("./image.png", image);
});

Discord.js example, sending attachments

// Note we required both but you need just one depending on your version
// v11.x.x stable is Attachment
// v12.0.0 dev is MessageAttachment
const { Attachment, MessageAttachment } = require("discord.js");

const image = await api.disabled("something");
message.channel.send(new MessageAttachment(image, "file.png"));

TypeScript

TypeScript typings gets installed by default, you can use it straight with TypeScript and even if you are not the typings gives a nice intellisense code suggestion on editors like Visual Studio Code

Here is an example using TypeScript

import { Client } from "bananapi";

const client: Client = new Client({ token: "my token" });

client.reverse("TypeScript")
  .then((reversed: string) => {
    console.log(reversed); // => tpircSepyT
  });

License

MIT

Keywords

bananapi

FAQs

Package last updated on 03 Nov 2018

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