minecraft-server-banner-generator
v1.0.6
Published
Module to generate images of Minecraft-like banners with information about a server.
Downloads
23
Readme
🌍 minecraft-server-banner-generator
Module to generate images of Minecraft-like banners with information about a server.
Usage
First, import the module:
// Using CommonJS const { generate } = require("minecraft-server-banner-generator"); // Using TypeScript or ESM import { generate } from "minecraft-server-banner-generator";
Then, call the
generate
function by passing the information for the banner:// Using HyCraft information const options = { name: "HyCraft", players: { online: 721, max: 5000 }, motd: "§a§lHYCRAFT §f§lNETWORK §8» §7[1.7 1.19]\n§f§lSpeed SkyWars §8▸ §6¡Nuevo modo de SkyWars!§r", favicon: Buffer.from( "iVBORw0KGgoAAAANSUhEUg...", "base64" ) } // Using promises generate(options).then(image => { writeFileSync(path.join(__dirname, "banner.png"), image); }); // Using async/await const image = await generate(options); writeFileSync(path.join(__dirname, "banner.png"), image);
Generated:
API
generate(options: BannerGeneratorOptions) => Promise<Buffer>
Generate a banner of a Minecraft server. Returns a Promise
with the banner as a Buffer
, or throws an error if something happened while generating the image.
- options.name (
string
): Name that's going to appear at the top of the banner as the server name. - options.players (optional,
{ max?: number, online?: number }
): Amount of players that's going to appear at the top right corner of the banner. Defaults to{ max: 0, online: 0 }
. - options.motd (optional,
string
): MOTD (Message of the day) of the server. Appears under the server name. Defaults to:§7A Minecraft Server
. - options.favicon (optional,
Buffer
): Favicon of the server as a buffer. Appears at the left of the banner. Defaults to the default Minecraft server favicon. - options.mimeType (optional,
image/png
orimage/jpeg
): Favicon of the server as a buffer. Appears at the left of the banner Defaults toimage/png
.