From e858425238747837662f46b5152db4ff8c362765 Mon Sep 17 00:00:00 2001 From: flameface Date: Sun, 12 Nov 2023 14:48:25 +0530 Subject: [PATCH] Name change --- README.md | 63 +++++++++++++++++++++++---------- build/structures/welcomeCard.js | 4 +-- example/index.js | 18 ++++++---- package.json | 25 ++++++++----- 4 files changed, 74 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index d42f565..e192a8a 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,21 @@ -
- -
-
-
- # **About** -Pixelord is a powerful canvas project with high-quality design that has awesome canvas like welcomeCard and more in the future. - -- Fully Customizable -- High Quality Assets -- Dreamlike designs +**Greetify** is futuristic welcome card canvas library # **Installation** ``` -npm i pixelord +npm i greetify ``` # **Example Usage** +This example code will create a welcome card and save it as a png. ```js (async () => { - const { welcomeCard } = require("pixelord"); + // Importing modules + const { welcomeCard } = require("greetify"); const fs = require("fs") - const welcard = new welcomeCard() + // Card details here + const card = new welcomeCard() .setName("FlameFace") .setAvatar("https://s6.imgcdn.dev/ZFQlq.png") .setMessage("YOU ARE 688 MEMBER") @@ -30,18 +23,50 @@ npm i pixelord .setColor("00FF38") // without # .setTitle("Welcome") - const output = await welcard.build(); + // Building process + const output = await card.build(); + // Save as image fs.writeFileSync("card.png", output); console.log("Done"); })() ``` +This example is of **Discord Bot** using discord.js +```js +// Importing modules +const { welcomeCard } = require("greetify"); +const { AttachmentBuilder } = require("discord.js") + +// Make sure to define client +client.on('guildMemberAdd', async (member) => { + // Card details here + const card = new welcomeCard() + .setName("FlameFace") + .setAvatar("https://s6.imgcdn.dev/ZFQlq.png") + .setMessage("YOU ARE 688 MEMBER") + .setBackground("https://s6.imgcdn.dev/ZqH2S.png") + .setColor("00FF38") // without # + .setTitle("Welcome") + + // Building process + const output = await card.build() + + // Fetch channel from members guild using ID + const channel = member.guild.channels.cache.get("0000000000000000000"); + + // Sends card to the "channel" + await channel.send({ + files: [{ + attachment: output, + name: `${member.id}.png` + }] + }) +}) +``` + ### **Output** ![welcome-preview](https://s6.imgcdn.dev/ZFifB.png) # **Help** -If you need help or want some features to be added, join our official **[A3PIRE](https://discord.gg/qDysF95NWh)** community. - - -**A3PIRE Project 2023** \ No newline at end of file +If you need help or want some features to be added, join our official **[A3PIRE](https://discord.gg/qDysF95NWh)** community. \ No newline at end of file diff --git a/build/structures/welcomeCard.js b/build/structures/welcomeCard.js index 1bb1d1d..bc5874b 100644 --- a/build/structures/welcomeCard.js +++ b/build/structures/welcomeCard.js @@ -3,8 +3,8 @@ const { createCanvas, loadImage, GlobalFonts } = require("@napi-rs/canvas"); // GlobalFonts.registerFromPath("build/structures/font/Montserrat-Black.ttf", "montserrat-black") // GlobalFonts.registerFromPath("build/structures/font/Montserrat-ExtraLight.ttf", "montserrat-extra-light") -GlobalFonts.registerFromPath("node_modules/pixelord/build/structures/font/Montserrat-Black.ttf", "montserrat-black") -GlobalFonts.registerFromPath("node_modules/pixelord/build/structures/font/Montserrat-ExtraLight.ttf", "montserrat-extra-light") +GlobalFonts.registerFromPath("node_modules/greetify/build/structures/font/Montserrat-Black.ttf", "montserrat-black") +GlobalFonts.registerFromPath("node_modules/greetify/build/structures/font/Montserrat-ExtraLight.ttf", "montserrat-extra-light") const defaultAssets = { background: "https://s6.imgcdn.dev/ZqH2S.png", diff --git a/example/index.js b/example/index.js index dfbd931..7fc7258 100644 --- a/example/index.js +++ b/example/index.js @@ -1,17 +1,21 @@ (async () => { - const { welcomeCard } = require("../build/index"); + // Importing modules + const { welcomeCard } = require("greetify"); const fs = require("fs") - const welcard = new welcomeCard() + // Card details here + const card = new welcomeCard() .setName("FlameFace") - .setAvatar("https://images-ext-1.discordapp.net/external/nkz8HXtBh-7fSjsFGeAltG_THjuap1tmbd4pVcOsx9I/https/cdn.discordapp.com/avatars/786504767358238720/4d21f3a661f2f41eefe09e7aeb093fc0.webp") - .setMessage("YOU ARE 340th MEMBER") + .setAvatar("https://s6.imgcdn.dev/ZFQlq.png") + .setMessage("YOU ARE 688 MEMBER") .setBackground("https://s6.imgcdn.dev/ZqH2S.png") .setColor("00FF38") // without # .setTitle("Welcome") - const output = await welcard.build(); + // Building process + const output = await card.build(); - fs.writeFileSync(`card.png`, output); - console.log("Done!"); + // Save as image + fs.writeFileSync("card.png", output); + console.log("Done"); })() \ No newline at end of file diff --git a/package.json b/package.json index 2352343..6e62b83 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "pixelord", - "description": "Pixelord is a powerful canvas project with high-quality assets & designs", + "name": "greetify", + "description": "Greetify is futuristic welcome card canvas library", "version": "1.0.0", "main": "build/index.js", "types": "build/index.d.ts", @@ -14,20 +14,29 @@ "welcome-card", "welcome-canvas", "canvas", - "pixelord", - "rank-card", - "discord-canvas" + "greetify", + "greeting", + "discord-canvas", + "discord.js" ], "dependencies": { "@napi-rs/canvas": "^0.1.44" }, - "license": "MIT", + "devDependencies": { + "@types/node": "^20.4.5", + "typescript": "^5.1.6" + }, + "license": "GPL-3.0", "author": "FlameFace", "repository": { "type": "git", - "url": "https://github.com/A3PIRE/pixelord.git" + "url": "https://github.com/A3PIRE/greetify.git" }, "bugs": { - "url": "https://github.com/A3PIRE/pixelord/issues" + "url": "https://github.com/A3PIRE/greetify/issues" + }, + "funding": { + "type": "githubsponser", + "url": "https://github.com/sponsors/flameface" } } \ No newline at end of file