@sodiumlabs/plume-api - v1.6.0
    Preparing search index...

    @sodiumlabs/plume-api - v1.6.0


    Plume API.js


    Discord server npm version npm downloads Last commit

    About

    @sodiumlabs/plume-api is a module that allows you to easily use Plume API.

    Installation

    npm install @sodiumlabs/plume-api
    

    Links

    Examples

    If you are developing a Discord bot using discord.js, here is how to use Plume API:

    const { Client } = require("discord.js");
    const { PlumeAPI } = require("@sodiumlabs/plume-api");

    // Your discord.js client
    const client = new Client({
    /* ... */
    });

    // Attach PlumeAPI to your client
    client.plumeAPI = new PlumeAPI();

    You can now use Plume API anywhere in your bot.
    For example, in a slash command:

    const joke = await client.plumeAPI.joke();

    await interaction.reply(`Question: ${joke.question}` + `\nAnswer: ||${joke.answer}||`);

    To send an image received from the API, you can use the AttachmentBuilder class from discord.js:

    const { AttachmentBuilder } = require("discord.js");

    // Since downloading the image can take some time
    // depending on your connection speed, you should defer.
    await interaction.deferReply();

    const buffer = await client.plumeAPI.facts("PlumeAPI is the best API");
    const attachment = new AttachmentBuilder(buffer, { name: "image.png" });

    await interaction.editReply({ files: [attachment] });

    Documentation

    Plume API provides two main resources for documentation:

    • API Reference:
      Plume API Documentation
      This documentation covers all available endpoints, types, and detailed comments for the API.

    • Module Reference:
      Module Documentation
      This documentation explains how to use the @sodiumlabs/plume-api npm package, with all available methods and types.

    For most use cases, you'll want to refer to the PlumeAPI class page, which lists all available methods for interacting with the API through this module.

    Help

    If you don't understand something in the documentation, are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to join our official Discord Server.