mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
LEGO Icon Command
This commit is contained in:
@@ -253,7 +253,7 @@ in the appropriate channel's topic to use it.
|
|||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
Total: 535
|
Total: 536
|
||||||
|
|
||||||
### Utility:
|
### Utility:
|
||||||
|
|
||||||
@@ -626,6 +626,7 @@ Total: 535
|
|||||||
* **implode:** Draws an image or a user's avatar but imploded.
|
* **implode:** Draws an image or a user's avatar but imploded.
|
||||||
* **invert:** Draws an image or a user's avatar but inverted.
|
* **invert:** Draws an image or a user's avatar but inverted.
|
||||||
* **jeopardy-question:** Sends a Jeopardy Question with the text of your choice.
|
* **jeopardy-question:** Sends a Jeopardy Question with the text of your choice.
|
||||||
|
* **lego-icon:** Edits an image or avatar onto a character icon from LEGO Star Wars.
|
||||||
* **liquid-rescale:** Draws an image or a user's avatar but with liquid rescale from ImageMagick.
|
* **liquid-rescale:** Draws an image or a user's avatar but with liquid rescale from ImageMagick.
|
||||||
* **minecraft-skin:** Sends the Minecraft skin for a user.
|
* **minecraft-skin:** Sends the Minecraft skin for a user.
|
||||||
* **mirror:** Draws an image or a user's avatar but mirrored on the X/Y axis (or both).
|
* **mirror:** Draws an image or a user's avatar but mirrored on the X/Y axis (or both).
|
||||||
@@ -1284,6 +1285,8 @@ here.
|
|||||||
* hat (Megumin Hat Original Anime)
|
* hat (Megumin Hat Original Anime)
|
||||||
- [Latlmes](https://www.latlmes.com/)
|
- [Latlmes](https://www.latlmes.com/)
|
||||||
* latlmes (API)
|
* latlmes (API)
|
||||||
|
- [LEGO](https://www.lego.com/en-us)
|
||||||
|
* lego-icon ([Original Design](https://store.steampowered.com/app/32440/LEGO_Star_Wars__The_Complete_Saga/))
|
||||||
- [LMGTFY](https://lmgtfy.com/)
|
- [LMGTFY](https://lmgtfy.com/)
|
||||||
* google (API)
|
* google (API)
|
||||||
* lmgtfy (API)
|
* lmgtfy (API)
|
||||||
@@ -1662,6 +1665,8 @@ here.
|
|||||||
* nitro ([Image](https://www.reddit.com/r/discordapp/comments/a9fr7x/troll_your_friends_with_this/))
|
* nitro ([Image](https://www.reddit.com/r/discordapp/comments/a9fr7x/troll_your_friends_with_this/))
|
||||||
- [u/N1ffler](https://www.reddit.com/user/N1ffler/)
|
- [u/N1ffler](https://www.reddit.com/user/N1ffler/)
|
||||||
* sorting-hat ([Sorting Hat Quiz Analysis Data](https://www.reddit.com/r/Pottermore/comments/44os14/pottermore_sorting_hat_quiz_analysis/))
|
* sorting-hat ([Sorting Hat Quiz Analysis Data](https://www.reddit.com/r/Pottermore/comments/44os14/pottermore_sorting_hat_quiz_analysis/))
|
||||||
|
- [u/PowderedShmegma](https://www.reddit.com/user/PowderedShmegma/)
|
||||||
|
* lego-icon ([Image](https://www.reddit.com/r/legostarwars/comments/eheb76/lego_sw_character_icon_template/))
|
||||||
- [u/SupremeMemesXD](https://www.reddit.com/user/SupremeMemesXD/)
|
- [u/SupremeMemesXD](https://www.reddit.com/user/SupremeMemesXD/)
|
||||||
* girl-worth-fighting-for ([Image](https://www.reddit.com/r/MemeTemplatesOfficial/comments/8h39vi/girl_worth_fighting_for_template/))
|
* girl-worth-fighting-for ([Image](https://www.reddit.com/r/MemeTemplatesOfficial/comments/8h39vi/girl_worth_fighting_for_template/))
|
||||||
- [u/THANOS_COPTER](https://www.reddit.com/user/THANOS_COPTER/)
|
- [u/THANOS_COPTER](https://www.reddit.com/user/THANOS_COPTER/)
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 263 KiB |
@@ -0,0 +1,63 @@
|
|||||||
|
const Command = require('../../structures/Command');
|
||||||
|
const { createCanvas, loadImage } = require('canvas');
|
||||||
|
const request = require('node-superfetch');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
module.exports = class LegoIconCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'lego-icon',
|
||||||
|
aliases: ['icon-lego', 'lego-star-wars', 'lego-sw'],
|
||||||
|
group: 'edit-image',
|
||||||
|
memberName: 'lego-icon',
|
||||||
|
description: 'Edits an image or avatar onto a character icon from LEGO Star Wars.',
|
||||||
|
throttling: {
|
||||||
|
usages: 1,
|
||||||
|
duration: 10
|
||||||
|
},
|
||||||
|
clientPermissions: ['ATTACH_FILES'],
|
||||||
|
credit: [
|
||||||
|
{
|
||||||
|
name: 'LEGO',
|
||||||
|
url: 'https://www.lego.com/en-us',
|
||||||
|
reason: 'Original Design',
|
||||||
|
reasonURL: 'https://store.steampowered.com/app/32440/LEGO_Star_Wars__The_Complete_Saga/'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'u/PowderedShmegma',
|
||||||
|
url: 'https://www.reddit.com/user/PowderedShmegma/',
|
||||||
|
reason: 'Image',
|
||||||
|
reasonURL: 'https://www.reddit.com/r/legostarwars/comments/eheb76/lego_sw_character_icon_template/'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'image',
|
||||||
|
prompt: 'What image would you like to edit?',
|
||||||
|
type: 'image',
|
||||||
|
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, { image }) {
|
||||||
|
try {
|
||||||
|
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'lego-icon.png'));
|
||||||
|
const { body } = await request.get(image);
|
||||||
|
const data = await loadImage(body);
|
||||||
|
const canvas = createCanvas(base.width, base.height);
|
||||||
|
const ctx = canvas.getContext('2d');
|
||||||
|
ctx.drawImage(base, 0, 0);
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.arc(base.width / 2, base.height / 2, 764 / 2, 0, Math.PI * 2);
|
||||||
|
ctx.closePath();
|
||||||
|
ctx.clip();
|
||||||
|
const height = 764 / data.width;
|
||||||
|
ctx.drawImage(data, (base.width / 2) - (764 / 2), (base.height / 2) - (764 / 2), 764, data.height * height);
|
||||||
|
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'lego-icon.png' }] });
|
||||||
|
} catch (err) {
|
||||||
|
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "119.18.3",
|
"version": "119.19.0",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user