Skip to content

sodium-labs/plume-url.js

Repository files navigation


Plume URL.js


Discord server npm version npm downloads Last commit

About

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

Installation

npm install @sodiumlabs/plume-url

Links

Examples

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

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

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

// Attach PlumeURL to your client
client.plumeURL = new PlumeURL({ apiKey: "YOUR-API-KEY" });

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

const userId = "619838036846575617";

// Create a new URL
const data = await client.plumeURL.createURL({
    url: "https://google.com",
    customId: userId, // The custom ID allows your users to retrieve their URLs later
});
console.log(data);

// Search for the URLs you created
// You can filter by custom ID if needed
const urls = await client.plumeURL.search({ limit: 5, customId: userId });
console.log(urls);

References

PlumeURL class methods.
You can find the types definitions on the API documentation.

createURL(options: CreateURLOptions): Promise<URLData>;
search({ customId, limit, page, expired }: SearchURLOptions): Promise<SearchURLResults>;
getURL(id: string): Promise<URLData>;
editURL(id: string, options: EditURLOptions): Promise<void>;
deleteURL(id: string): Promise<void>;

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.