stoat-uploader
v1.0.0
Published
A utility script to allow easy uploads of files to stoat.
Readme
Stoat Uploader
Note: This project requires Bun as its runtime.
stoat.js doesn't offer the ability to upload attachments, so here is a utility package to allow easy file uploads.
Installation
npm install stoat-uploader
Usage
First, import the uploader library:
const uploader = require("stoat-uploader");You need to have a bot (client) object initialized and logged in. Then you can use the uploader methods to upload files.
Uploading a file from disk
const id = await uploader.file({ file: "/path/to/file.txt" }, bot);
message.channel.sendMessage({
content: "Here is your file!",
attachments: [id]
});Uploading a file from a URL
const id = await uploader.url({ url: "https://example.com/image.png" }, bot);
message.channel.sendMessage({
content: "Here is your image!",
attachments: [id]
});Uploading raw data
const buffer = Buffer.from("hello world");
const id = await uploader.raw({ file: buffer, name: "hello.txt", type: "text/plain" }, bot);
message.channel.sendMessage({
content: "Here is your text file!",
attachments: [id]
});You can also specify a different tag for your upload (default is attachments). Available tags:
attachmentsavatarsbackgroundsiconsbannersemojis
All of these have different configurations and limits. See this file for the exact specifications.
