1.0.8 • Published 7 months ago

fancystudio-cards v1.0.8

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

FancyStudio Cards

A framework made with canvas to create fancy and easy cards for Discord bots

Version Downloads Support

Installation

npm install fancystudio-cards

Basic example (Welcome Card)

const { Welcome } = require("fancystudio-cards");
const Discord = require("discord.js");

client.on("messageCreate", async (message) => {
  if (message.content === "!welcome") {
    // The constructor must include an await

    const welcome = await new Welcome().load({
      background: "https://i.ibb.co/RBbddtb/Card.png",
      avatar: "https://i.ibb.co/7z1Wgxh/Avatar.png",
      title: {
        content: "Welcome",
        color: "#ffffff",
        font: "JosefinSans",
      },
      username: {
        content: "User#0000",
        color: "#ffffff",
        font: "JosefinSans",
      },
      subtitle: {
        content: "Remember to read the rules",
        color: "#ffffff",
        font: "JosefinSans",
      },
    });

    const file = new Discord.AttachmentBuilder(welcome, {
      name: "welcome.png", // Image name with PNG format
    });

    message.reply({
      files: [file],
    });
  }
});

Response:

Documentation

Welcome

await new Welcome(); // Must include an await

Properties / Methods

export class Welcome {
  public background: string;
  public avatar: string;
  public title: WelcomeTitle;
  public username: WelcomeUsername;
  public subtitle: WelcomeSubtitle;
  public load(options: LoadOptions): Buffer;
}

Welcome Title

export interface WelcomeTitle {
  content: string;
  color: string;
  font: keyof Fonts;
}

Welcome Username

export interface WelcomeUsername {
  content: string;
  color: string;
  font: keyof Fonts;
}

Welcome Username

export interface WelcomeSubtitle {
  content: string;
  color: string;
  font: keyof Fonts;
}

Methods

.load()

.load({ ...LoadOptions })

Load the properties and create the card

Load Options

export interface LoadOptions {
  background: string;
  avatar: string;
  title: WelcomeTitle;
  username: WelcomeUsername;
  subtitle: WelcomeSubtitle;
}

Fonts

export interface Fonts {
  JosefinSans: "Josefin Sans";
  Poppins: "Poppins";
  SofiaPro: "Sofia Pro";
  Whitney: "Whitney";
}
1.0.8

7 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

1 year ago