Package Exports
- @sodiumlabs/plume-api
Readme
About
@sodiumlabs/plume-api is a module that allows you to easily use Plume API.
Installation
npm install @sodiumlabs/plume-apiLinks
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] });References
PlumeAPI class methods.
You can find the types definitions on the API documentation.
eightBall(locale?: Locale): Promise<HeightBallData>;
emojiMix(left: string, right: string): Promise<EmojiMixData>;
funFact(locale?: Locale): Promise<FunFactData>;
issImage(circle?: boolean): Promise<Buffer>;
iss(): Promise<ISSData>;
joke(locale?: Locale): Promise<JokeData>;
math(expr: string): Promise<MathData>;
meme(): Promise<MemeData>;
nasaAPOD(): Promise<NasaAPOD>;
npm(name: string): Promise<NPMData>;
quote(locale?: Locale): Promise<QuoteData>;
randomEmojiMix(): Promise<RandomEmojiMixData>;
upsideDown(): Promise<UpsideDownTextData>;
urban(word: string): Promise<UrbanData>;
color(hex: string): Promise<ColorData>;
colorImage(hex: string): Promise<Buffer>;
randomColor(): Promise<ColorData>;
decode(type: DecodeType, text: string): Promise<DecodeData>;
encode(type: EncodeType, text: string): Promise<EncodeData>;
githubRepository(name: string): Promise<GitHubRepository>;
githubUser(name: string): Promise<GitHubUser>;
captcha(): Promise<{
code: string;
image: Buffer;
}>;
crypto(name: string, currency: "usd" | "eur"): Promise<CryptoData>;
definition(locale: Locale, word: string): Promise<DefinitionData>;
exec(language: ExecLanguage, code: string): Promise<ExecData>;
freeGames(locale?: Locale): Promise<FreeGamesData>;
ipInfo(ip: string): Promise<IPInfoData>;
qrcode(text: string): Promise<Buffer>;
reverseText(text: string): Promise<ReverseTextData>;
screenshot(url: string): Promise<Buffer>;
translate(text: string, to: string): Promise<TranslateData>;
weather(city: string): Promise<WeatherData>;
wikipedia(page: string, locale?: Locale): Promise<WikipediaData>;
interaction(type: InteractionType): Promise<InteractionData>;
achievement(text: string): Promise<Buffer>;
alert(text: string): Promise<Buffer>;
caution(text: string): Promise<Buffer>;
challenge(text: string): Promise<Buffer>;
jail(avatar: string): Promise<Buffer>;
nokia(url: string): Promise<Buffer>;
tweet(avatar: string, name: string, username: string, text: string, retweets?: number, quote_tweets?: number, likes?: number): Promise<Buffer>;
wanted(avatar: string): Promise<Buffer>;
blur(url: string): Promise<Buffer>;
colorify(url: string, color: string): Promise<Buffer>;
grayscale(url: string): Promise<Buffer>;
invert(url: string): Promise<Buffer>;
rotate(url: string, deg: number): Promise<Buffer>;
changeMyMind(text: string): Promise<Buffer>;
didYouMean(search: string, correction: string): Promise<Buffer>;
drake(top: string, bottom: string): Promise<Buffer>;
duolingo(text: string): Promise<Buffer>;
facts(text: string): Promise<Buffer>;
fuze3(text: string): Promise<Buffer>;
hugo(text: string): Promise<Buffer>;
nothing(text: string): Promise<Buffer>;
oogway(text: string): Promise<Buffer>;
pepeHug(avatar: string): Promise<Buffer>;
sadcat(top: string, bottom: string): Promise<Buffer>;
stonks(avatar: string, stonks?: boolean): Promise<Buffer>;
tableFlip(avatar: string): Promise<Buffer>;
water(text: string): Promise<Buffer>;
woosh(avatar: string): Promise<Buffer>;
boost(avatar: string, username: string, text?: string): Promise<Buffer>;
couple(avatar1: string, avatar2: string, percentage?: number, primary_color?: string): Promise<Buffer>;
rank(avatar: string, global_name: string, username: string, level: number, xp: number, max_xp: number, rank?: number, bg_url?: string, bg_color?: string, blur?: boolean, color?: string): Promise<Buffer>;
welcome(avatar: string, text1: string, text2?: string, text3?: string, bg_url?: string, bg_color?: string, font_color?: string, blur?: boolean): Promise<Buffer>;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.