-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,203 additions
and
1,822 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
const Command = require('../../base/Command.js'); | ||
const { createCanvas, loadImage } = require('canvas'); | ||
const path = require('path'); | ||
|
||
class Delete extends Command { | ||
constructor(client) { | ||
super(client, { | ||
name: 'delete', | ||
description: "Displays you or the mentioned user's avatar with windows deletion menu.", | ||
category: 'Images', | ||
usage: 'delete [user]', | ||
}); | ||
} | ||
|
||
async run(msg, args) { | ||
let infoMem; // Will store the GuildMember or User object | ||
let fetchedUser; // Will store the User object | ||
|
||
// If text is provided, try to get the member from the guild | ||
if (args?.length > 0) { | ||
infoMem = await this.client.util.getMember(msg, args.join(' ').toLowerCase()); | ||
} | ||
|
||
if (!infoMem) { | ||
// If no member is found, try to fetch the user by ID | ||
const findId = args.join(' ').toLowerCase().replace(/<@|>/g, ''); | ||
|
||
try { | ||
// Fetch the user object using the ID | ||
fetchedUser = await this.client.users.fetch(findId, { force: true }); | ||
} catch (err) { | ||
// If the user cannot be fetched, default to the message author | ||
infoMem = msg.member; // Use the message author's member object | ||
fetchedUser = infoMem.user; // Get the User object from the member | ||
} | ||
} else { | ||
// If a member is found in the guild, fetch their user object | ||
fetchedUser = infoMem.user; | ||
} | ||
|
||
// Fetch the user's avatar as a PNG | ||
const avatarURL = fetchedUser.displayAvatarURL({ extension: 'png', size: 512, dynamic: false }); | ||
|
||
// Generate the image | ||
try { | ||
// Load the avatar and the background image | ||
const avatar = await loadImage(avatarURL); | ||
const backgroundPath = path.resolve(__dirname, '../../resources/images/DeleteMeme.jpg'); | ||
const background = await loadImage(backgroundPath); | ||
|
||
// Create a canvas with the dimensions of the background | ||
const canvas = createCanvas(background.width, background.height); | ||
const ctx = canvas.getContext('2d'); | ||
|
||
// Draw the background | ||
ctx.drawImage(background, 0, 0); | ||
|
||
// Resize and position the avatar | ||
const avatarWidth = 155; | ||
const avatarHeight = 155; | ||
const avatarX = 95; // X-coordinate | ||
const avatarY = 106; // Y-coordinate | ||
ctx.drawImage(avatar, avatarX, avatarY, avatarWidth, avatarHeight); | ||
|
||
// Send the result | ||
const attachment = canvas.toBuffer(); | ||
await msg.channel.send({ | ||
files: [{ attachment, name: 'custom_avatar.png' }], | ||
}); | ||
} catch (error) { | ||
this.client.logger.error(error.stack); | ||
msg.reply('There was an error processing the image.'); | ||
} | ||
} | ||
} | ||
|
||
module.exports = Delete; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
const Command = require('../../base/Command.js'); | ||
const { createCanvas, loadImage } = require('canvas'); | ||
const path = require('path'); | ||
|
||
class LGBT extends Command { | ||
constructor(client) { | ||
super(client, { | ||
name: 'lgbt', | ||
description: "Displays you or the mentioned user's avatar with the LGBT overlay.", | ||
category: 'Images', | ||
usage: 'lgbt [user]', | ||
}); | ||
} | ||
|
||
async run(msg, args) { | ||
let infoMem; // Will store the GuildMember or User object | ||
let fetchedUser; // Will store the User object | ||
|
||
// If text is provided, try to get the member from the guild | ||
if (args?.length > 0) { | ||
infoMem = await this.client.util.getMember(msg, args.join(' ').toLowerCase()); | ||
} else { | ||
infoMem = msg.member; | ||
} | ||
|
||
if (!infoMem) { | ||
// If no member is found, try to fetch the user by ID | ||
const findId = args.join(' ').toLowerCase().replace(/<@|>/g, ''); | ||
|
||
try { | ||
// Fetch the user object using the ID | ||
fetchedUser = await this.client.users.fetch(findId, { force: true }); | ||
} catch (err) { | ||
// If the user cannot be fetched, default to the message author | ||
infoMem = msg.member; // Use the message author's member object | ||
fetchedUser = infoMem.user; // Get the User object from the member | ||
} | ||
} else { | ||
// If a member is found in the guild, fetch their user object | ||
fetchedUser = infoMem.user; | ||
} | ||
|
||
// Fetch the user's avatar as a PNG | ||
const avatarURL = fetchedUser.displayAvatarURL({ extension: 'png', size: 512, dynamic: false }); | ||
|
||
// Generate the image | ||
try { | ||
const avatar = await loadImage(avatarURL); | ||
const canvas = createCanvas(400, 400); | ||
const ctx = canvas.getContext('2d'); | ||
|
||
// Draw the avatar | ||
ctx.drawImage(avatar, 0, 0, 400, 400); | ||
|
||
// Load and draw the "WASTED" banner | ||
const rainbowPath = path.resolve(__dirname, '../../resources/images/rainbow.png'); | ||
const rainbow = await loadImage(rainbowPath); | ||
ctx.drawImage(rainbow, 0, 0, 400, 400); | ||
|
||
// Send the result | ||
const attachment = canvas.toBuffer(); | ||
await msg.channel.send({ | ||
files: [{ attachment, name: 'lgbt.png' }], | ||
}); | ||
} catch (error) { | ||
this.client.logger.error(error.stack); | ||
msg.reply('There was an error processing the image.'); | ||
} | ||
} | ||
} | ||
|
||
module.exports = LGBT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
const Command = require('../../base/Command.js'); | ||
const { createCanvas, loadImage } = require('canvas'); | ||
const path = require('path'); | ||
|
||
class Shit extends Command { | ||
constructor(client) { | ||
super(client, { | ||
name: 'shit', | ||
description: "Displays you or the mentioned user's avatar as stepped in shit", | ||
category: 'Images', | ||
usage: 'shit [user]', | ||
}); | ||
} | ||
|
||
async run(msg, args) { | ||
let infoMem; // Will store the GuildMember or User object | ||
let fetchedUser; // Will store the User object | ||
|
||
// If text is provided, try to get the member from the guild | ||
if (args?.length > 0) { | ||
infoMem = await this.client.util.getMember(msg, args.join(' ').toLowerCase()); | ||
} else { | ||
infoMem = msg.member; | ||
} | ||
|
||
if (!infoMem) { | ||
// If no member is found, try to fetch the user by ID | ||
const findId = args.join(' ').toLowerCase().replace(/<@|>/g, ''); | ||
|
||
try { | ||
// Fetch the user object using the ID | ||
fetchedUser = await this.client.users.fetch(findId, { force: true }); | ||
} catch (err) { | ||
// If the user cannot be fetched, default to the message author | ||
infoMem = msg.member; // Use the message author's member object | ||
fetchedUser = infoMem.user; // Get the User object from the member | ||
} | ||
} else { | ||
// If a member is found in the guild, fetch their user object | ||
fetchedUser = infoMem.user; | ||
} | ||
|
||
// Fetch the user's avatar as a PNG | ||
const avatarURL = fetchedUser.displayAvatarURL({ extension: 'png', size: 512, dynamic: false }); | ||
|
||
// Generate the image | ||
try { | ||
const avatar = await loadImage(avatarURL); | ||
const canvas = createCanvas(600, 835); | ||
const ctx = canvas.getContext('2d'); | ||
|
||
// Load and draw the shit image | ||
const shitPath = path.resolve(__dirname, '../../resources/images/plate_shit.png'); | ||
const shit = await loadImage(shitPath); | ||
ctx.drawImage(shit, 0, 0, 600, 835); | ||
|
||
// Draw the avatar with rotation | ||
const avatarX = 220 + 75 / 2; // X-coordinate of the avatar's center | ||
const avatarY = 600 + 75 / 2; // Y-coordinate of the avatar's center | ||
const rotationAngle = (-40 * Math.PI) / 180; // Convert -30 degrees to radians (negative for counterclockwise) | ||
|
||
ctx.save(); // Save the current canvas state | ||
ctx.translate(avatarX, avatarY); // Move the canvas origin to the avatar's center | ||
ctx.rotate(rotationAngle); // Rotate the canvas counterclockwise | ||
ctx.drawImage(avatar, -75 / 2, -75 / 2, 75, 75); // Draw the avatar, offset by half its size | ||
ctx.restore(); // Restore the canvas state | ||
|
||
// Send the result | ||
const attachment = canvas.toBuffer(); | ||
await msg.channel.send({ | ||
files: [{ attachment, name: 'lgbt.png' }], | ||
}); | ||
} catch (error) { | ||
this.client.logger.error(error.stack); | ||
msg.reply('There was an error processing the image.'); | ||
} | ||
} | ||
} | ||
|
||
module.exports = Shit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
const Command = require('../../base/Command.js'); | ||
const { createCanvas, loadImage } = require('canvas'); | ||
const path = require('path'); | ||
|
||
class Wanted extends Command { | ||
constructor(client) { | ||
super(client, { | ||
name: 'wanted', | ||
description: "Displays you or the mentioned user's avatar with on a wanted poster", | ||
category: 'Images', | ||
usage: 'wanted [user]', | ||
}); | ||
} | ||
|
||
async run(msg, args) { | ||
let infoMem; // Will store the GuildMember or User object | ||
let fetchedUser; // Will store the User object | ||
|
||
// If text is provided, try to get the member from the guild | ||
if (args?.length > 0) { | ||
infoMem = await this.client.util.getMember(msg, args.join(' ').toLowerCase()); | ||
} | ||
|
||
if (!infoMem) { | ||
// If no member is found, try to fetch the user by ID | ||
const findId = args.join(' ').toLowerCase().replace(/<@|>/g, ''); | ||
|
||
try { | ||
// Fetch the user object using the ID | ||
fetchedUser = await this.client.users.fetch(findId, { force: true }); | ||
} catch (err) { | ||
// If the user cannot be fetched, default to the message author | ||
infoMem = msg.member; // Use the message author's member object | ||
fetchedUser = infoMem.user; // Get the User object from the member | ||
} | ||
} else { | ||
// If a member is found in the guild, fetch their user object | ||
fetchedUser = infoMem.user; | ||
} | ||
|
||
// Fetch the user's avatar as a PNG | ||
const avatarURL = fetchedUser.displayAvatarURL({ extension: 'png', size: 512, dynamic: false }); | ||
|
||
// Generate the image | ||
try { | ||
// Load the avatar and the background image | ||
const avatar = await loadImage(avatarURL); | ||
const backgroundPath = path.resolve(__dirname, '../../resources/images/wanted_poster.jpg'); | ||
const background = await loadImage(backgroundPath); | ||
|
||
// Create a canvas with the dimensions of the background | ||
const canvas = createCanvas(background.width, background.height); | ||
const ctx = canvas.getContext('2d'); | ||
|
||
// Draw the background | ||
ctx.drawImage(background, 0, 0); | ||
|
||
// Resize and position the avatar | ||
const avatarWidth = 400; | ||
const avatarHeight = 400; | ||
const avatarX = 170; // X-coordinate | ||
const avatarY = 305; // Y-coordinate | ||
ctx.drawImage(avatar, avatarX, avatarY, avatarWidth, avatarHeight); | ||
|
||
// Send the result | ||
const attachment = canvas.toBuffer(); | ||
await msg.channel.send({ | ||
files: [{ attachment, name: 'custom_avatar.png' }], | ||
}); | ||
} catch (error) { | ||
this.client.logger.error(error.stack); | ||
msg.reply('There was an error processing the image.'); | ||
} | ||
} | ||
} | ||
|
||
module.exports = Wanted; |
Oops, something went wrong.