mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 06:42:50 +02:00
Spiderman Pointing Command
This commit is contained in:
@@ -231,7 +231,7 @@ in the appropriate channel's topic to use it.
|
|||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
Total: 513
|
Total: 514
|
||||||
|
|
||||||
### Utility:
|
### Utility:
|
||||||
|
|
||||||
@@ -690,6 +690,7 @@ Total: 513
|
|||||||
* **sonic-says:** Sends a "Sonic Says" meme with the quote of your choice.
|
* **sonic-says:** Sends a "Sonic Says" meme with the quote of your choice.
|
||||||
* **sora-selfie:** Draws an image or a user's avatar behind Sora taking a selfie.
|
* **sora-selfie:** Draws an image or a user's avatar behind Sora taking a selfie.
|
||||||
* **sos:** Sends a "Esther Verkest's Help Sign" comic with the text of your choice.
|
* **sos:** Sends a "Esther Verkest's Help Sign" comic with the text of your choice.
|
||||||
|
* **spiderman-pointing:** Sends a "Spiderman Pointing at Spiderman" meme with the text of your choice.
|
||||||
* **spongebob-burn:** Sends a "Spongebob Throwing Something into a Fire" meme with words of your choice.
|
* **spongebob-burn:** Sends a "Spongebob Throwing Something into a Fire" meme with words of your choice.
|
||||||
* **this-guy:** Draws an image or a user's avatar over the "Get a load of this guy" meme.
|
* **this-guy:** Draws an image or a user's avatar over the "Get a load of this guy" meme.
|
||||||
* **thug-life:** Draws "Thug Life" over an image or a user's avatar.
|
* **thug-life:** Draws "Thug Life" over an image or a user's avatar.
|
||||||
@@ -1080,6 +1081,7 @@ here.
|
|||||||
* scroll-of-truth ([Noto Font](https://www.google.com/get/noto/))
|
* scroll-of-truth ([Noto Font](https://www.google.com/get/noto/))
|
||||||
* sonic-says ([Noto Font](https://www.google.com/get/noto/))
|
* sonic-says ([Noto Font](https://www.google.com/get/noto/))
|
||||||
* sos ([Noto Font](https://www.google.com/get/noto/))
|
* sos ([Noto Font](https://www.google.com/get/noto/))
|
||||||
|
* spiderman-pointing ([Noto Font](https://www.google.com/get/noto/))
|
||||||
* spongebob-burn ([Noto Font](https://www.google.com/get/noto/))
|
* spongebob-burn ([Noto Font](https://www.google.com/get/noto/))
|
||||||
* steam-card ([Noto Font](https://www.google.com/get/noto/))
|
* steam-card ([Noto Font](https://www.google.com/get/noto/))
|
||||||
* steam-now-playing ([Noto Font](https://www.google.com/get/noto/))
|
* steam-now-playing ([Noto Font](https://www.google.com/get/noto/))
|
||||||
@@ -1245,6 +1247,8 @@ here.
|
|||||||
* box-choosing ([Original Translation](https://store.steampowered.com/app/526490/Higurashi_When_They_Cry_Hou__Ch4_Himatsubushi/))
|
* box-choosing ([Original Translation](https://store.steampowered.com/app/526490/Higurashi_When_They_Cry_Hou__Ch4_Himatsubushi/))
|
||||||
- [Martin Handford](https://www.candlewick.com/authill.asp?b=Author&m=bio&id=1497&pix=y)
|
- [Martin Handford](https://www.candlewick.com/authill.asp?b=Author&m=bio&id=1497&pix=y)
|
||||||
* waldo (Original "Where's Wally?" Book Series)
|
* waldo (Original "Where's Wally?" Book Series)
|
||||||
|
- [Marvel](https://www.marvel.com/)
|
||||||
|
* spiderman-pointing ([Image, Original "Spiderman" Comic](https://spiderman.marvelhq.com/))
|
||||||
- [Marvelous](http://www.marv.jp/)
|
- [Marvelous](http://www.marv.jp/)
|
||||||
* give-flower ([Original "Rune Factory 4" Game](http://www.runefactory4.com/index1.html))
|
* give-flower ([Original "Rune Factory 4" Game](http://www.runefactory4.com/index1.html))
|
||||||
* xiao ([Images, Original "Rune Factory 4" Game](http://www.runefactory4.com/index1.html))
|
* xiao ([Images, Original "Rune Factory 4" Game](http://www.runefactory4.com/index1.html))
|
||||||
@@ -1356,6 +1360,7 @@ here.
|
|||||||
* simp (Concept)
|
* simp (Concept)
|
||||||
* sonic-says (Concept)
|
* sonic-says (Concept)
|
||||||
* speed-limit (Concept)
|
* speed-limit (Concept)
|
||||||
|
* spiderman-pointing (Concept)
|
||||||
* thicc (Concept)
|
* thicc (Concept)
|
||||||
* undertale (Concept)
|
* undertale (Concept)
|
||||||
* wild-pokemon (Concept)
|
* wild-pokemon (Concept)
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 347 KiB |
@@ -0,0 +1,98 @@
|
|||||||
|
const Command = require('../../structures/Command');
|
||||||
|
const { createCanvas, loadImage, registerFont } = require('canvas');
|
||||||
|
const path = require('path');
|
||||||
|
const { wrapText } = require('../../util/Canvas');
|
||||||
|
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
|
||||||
|
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
|
||||||
|
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
|
||||||
|
|
||||||
|
module.exports = class SpidermanPointingCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'spiderman-pointing',
|
||||||
|
aliases: ['spiderman-pointing-at-spiderman', 'spiderman', 'spiderman-point'],
|
||||||
|
group: 'edit-meme',
|
||||||
|
memberName: 'spiderman-pointing',
|
||||||
|
description: 'Sends a "Spiderman Pointing at Spiderman" meme with the text of your choice.',
|
||||||
|
throttling: {
|
||||||
|
usages: 1,
|
||||||
|
duration: 10
|
||||||
|
},
|
||||||
|
clientPermissions: ['ATTACH_FILES'],
|
||||||
|
credit: [
|
||||||
|
{
|
||||||
|
name: 'Marvel',
|
||||||
|
url: 'https://www.marvel.com/',
|
||||||
|
reason: 'Image, Original "Spiderman" Comic',
|
||||||
|
reasonURL: 'https://spiderman.marvelhq.com/'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Overtime2005',
|
||||||
|
url: 'https://github.com/Overtime2005',
|
||||||
|
reason: 'Concept'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Google',
|
||||||
|
url: 'https://www.google.com/',
|
||||||
|
reason: 'Noto Font',
|
||||||
|
reasonURL: 'https://www.google.com/get/noto/'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'first',
|
||||||
|
prompt: 'What should the first spiderman be?',
|
||||||
|
type: 'string',
|
||||||
|
max: 500
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'second',
|
||||||
|
prompt: 'What should the second spiderman be?',
|
||||||
|
type: 'string',
|
||||||
|
max: 500
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, { first, second }) {
|
||||||
|
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'spiderman-pointing.png'));
|
||||||
|
const canvas = createCanvas(base.width, base.height);
|
||||||
|
const ctx = canvas.getContext('2d');
|
||||||
|
ctx.drawImage(base, 0, 0);
|
||||||
|
ctx.textAlign = 'center';
|
||||||
|
ctx.textBaseline = 'top';
|
||||||
|
ctx.font = '50px Noto';
|
||||||
|
ctx.fillStyle = 'white';
|
||||||
|
let fontSize = 50;
|
||||||
|
while (ctx.measureText(first).width > 725) {
|
||||||
|
fontSize--;
|
||||||
|
ctx.font = `${fontSize}px Noto`;
|
||||||
|
}
|
||||||
|
const lines = await wrapText(ctx, first, 290);
|
||||||
|
const topMost = 189 - (((fontSize * lines.length) / 2) + ((10 * (lines.length - 1)) / 2));
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
ctx.strokeStyle = 'black';
|
||||||
|
ctx.lineWidth = 5;
|
||||||
|
const height = topMost + ((fontSize + 10) * i);
|
||||||
|
ctx.strokeText(lines[i], 222, height);
|
||||||
|
ctx.fillText(lines[i], 222, height);
|
||||||
|
}
|
||||||
|
ctx.font = '50px Noto';
|
||||||
|
fontSize = 50;
|
||||||
|
while (ctx.measureText(second).width > 725) {
|
||||||
|
fontSize--;
|
||||||
|
ctx.font = `${fontSize}px Noto`;
|
||||||
|
}
|
||||||
|
const lines = await wrapText(ctx, second, 290);
|
||||||
|
const topMost = 190 - (((fontSize * lines.length) / 2) + ((10 * (lines.length - 1)) / 2));
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
ctx.strokeStyle = 'black';
|
||||||
|
ctx.lineWidth = 5;
|
||||||
|
const height = topMost + ((fontSize + 10) * i);
|
||||||
|
ctx.strokeText(lines[i], 596, height);
|
||||||
|
ctx.fillText(lines[i], 596, height);
|
||||||
|
}
|
||||||
|
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'spiderman-pointing.png' }] });
|
||||||
|
}
|
||||||
|
};
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "117.9.1",
|
"version": "117.10.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