mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 14:19:11 +02:00
Tuxedo Pooh Command
This commit is contained in:
@@ -253,7 +253,7 @@ in the appropriate channel's topic to use it.
|
|||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
Total: 533
|
Total: 534
|
||||||
|
|
||||||
### Utility:
|
### Utility:
|
||||||
|
|
||||||
@@ -734,6 +734,7 @@ Total: 533
|
|||||||
* **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.
|
||||||
* **to-be-continued:** Draws an image with the "To Be Continued..." arrow.
|
* **to-be-continued:** Draws an image with the "To Be Continued..." arrow.
|
||||||
|
* **tuxedo-pooh:** Sends a "Tuxedo Winnie the Pooh" meme with the text of your choice.
|
||||||
* **two-buttons:** Sends a "Two Buttons" meme with the buttons of your choice.
|
* **two-buttons:** Sends a "Two Buttons" meme with the buttons of your choice.
|
||||||
* **ultimate-tattoo:** Draws an image or a user's avatar as "The Ultimate Tattoo".
|
* **ultimate-tattoo:** Draws an image or a user's avatar as "The Ultimate Tattoo".
|
||||||
* **vietnam-flashbacks:** Edits Vietnam flashbacks behind an image or a user's avatar.
|
* **vietnam-flashbacks:** Edits Vietnam flashbacks behind an image or a user's avatar.
|
||||||
@@ -1022,6 +1023,7 @@ here.
|
|||||||
* beautiful ([Original "Gravity Falls" Show](https://disneynow.com/shows/gravity-falls))
|
* beautiful ([Original "Gravity Falls" Show](https://disneynow.com/shows/gravity-falls))
|
||||||
* girl-worth-fighting-for ([Original "Mulan" Movie](https://movies.disney.com/mulan))
|
* girl-worth-fighting-for ([Original "Mulan" Movie](https://movies.disney.com/mulan))
|
||||||
* he-lives-in-you ([Image, Original "The Lion King" Movie](https://movies.disney.com/the-lion-king))
|
* he-lives-in-you ([Image, Original "The Lion King" Movie](https://movies.disney.com/the-lion-king))
|
||||||
|
* tuxedo-pooh ([Original "Winnie the Pooh" Movie](https://winniethepooh.disney.com/))
|
||||||
* worthless ([Original "Gravity Falls" Show](https://disneynow.com/shows/gravity-falls))
|
* worthless ([Original "Gravity Falls" Show](https://disneynow.com/shows/gravity-falls))
|
||||||
- [Dog CEO](https://dog.ceo/)
|
- [Dog CEO](https://dog.ceo/)
|
||||||
* dog ([Dog API](https://dog.ceo/dog-api/))
|
* dog ([Dog API](https://dog.ceo/dog-api/))
|
||||||
@@ -1131,6 +1133,7 @@ here.
|
|||||||
* steam-now-playing-classic ([Noto Font](https://www.google.com/get/noto/))
|
* steam-now-playing-classic ([Noto Font](https://www.google.com/get/noto/))
|
||||||
* subtitle ([Noto Font](https://www.google.com/get/noto/))
|
* subtitle ([Noto Font](https://www.google.com/get/noto/))
|
||||||
* translate ([Google Translate](https://translate.google.com/))
|
* translate ([Google Translate](https://translate.google.com/))
|
||||||
|
* tuxedo-pooh ([Noto Font](https://www.google.com/get/noto/))
|
||||||
* tweet ([Noto Font](https://www.google.com/get/noto/))
|
* tweet ([Noto Font](https://www.google.com/get/noto/))
|
||||||
* two-buttons ([Noto Font](https://www.google.com/get/noto/))
|
* two-buttons ([Noto Font](https://www.google.com/get/noto/))
|
||||||
* youtube ([YouTube Data API](https://developers.google.com/youtube/v3/))
|
* youtube ([YouTube Data API](https://developers.google.com/youtube/v3/))
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 282 KiB |
@@ -0,0 +1,90 @@
|
|||||||
|
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 TuxedoPoohCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'tuxedo-pooh',
|
||||||
|
aliases: ['tuxedo-winnie', 'tuxedo-winnie-the-pooh', 'tux-pooh', 'tux-winnie', 'tux-winnie-the-pooh'],
|
||||||
|
group: 'edit-meme',
|
||||||
|
memberName: 'tuxedo-pooh',
|
||||||
|
description: 'Sends a "Tuxedo Winnie the Pooh" meme with the text of your choice.',
|
||||||
|
throttling: {
|
||||||
|
usages: 1,
|
||||||
|
duration: 10
|
||||||
|
},
|
||||||
|
clientPermissions: ['ATTACH_FILES'],
|
||||||
|
credit: [
|
||||||
|
{
|
||||||
|
name: 'Disney',
|
||||||
|
url: 'https://www.disney.com/',
|
||||||
|
reason: 'Original "Winnie the Pooh" Movie',
|
||||||
|
reasonURL: 'https://winniethepooh.disney.com/'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Google',
|
||||||
|
url: 'https://www.google.com/',
|
||||||
|
reason: 'Noto Font',
|
||||||
|
reasonURL: 'https://www.google.com/get/noto/'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'normal',
|
||||||
|
prompt: 'What text should be the normal Pooh?',
|
||||||
|
type: 'string',
|
||||||
|
max: 500
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'tuxedo',
|
||||||
|
prompt: 'What text should be the tuxedo Pooh?',
|
||||||
|
type: 'string',
|
||||||
|
max: 500
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, { normal, tuxedo }) {
|
||||||
|
try {
|
||||||
|
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'tuxedo-pooh.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';
|
||||||
|
let fontSize = 50;
|
||||||
|
while (ctx.measureText(normal).width > 1320) {
|
||||||
|
fontSize--;
|
||||||
|
ctx.font = `${fontSize}px Noto`;
|
||||||
|
}
|
||||||
|
const normalLines = await wrapText(ctx, normal, 440);
|
||||||
|
const normalTopMost = 145 - (((fontSize * normalLines.length) / 2) + ((10 * (normalLines.length - 1)) / 2));
|
||||||
|
for (let i = 0; i < normalLines.length; i++) {
|
||||||
|
const height = normalTopMost + ((fontSize + 10) * i);
|
||||||
|
ctx.fillText(nahLinormalLinesnes[i], 560, height);
|
||||||
|
}
|
||||||
|
ctx.font = '50px Noto';
|
||||||
|
fontSize = 50;
|
||||||
|
while (ctx.measureText(tuxedo).width > 1320) {
|
||||||
|
fontSize--;
|
||||||
|
ctx.font = `${fontSize}px Noto`;
|
||||||
|
}
|
||||||
|
const tuxedoLines = await wrapText(ctx, tuxedo, 440);
|
||||||
|
const tuxedoTopMost = 436 - (((fontSize * tuxedoLines.length) / 2) + ((10 * (tuxedoLines.length - 1)) / 2));
|
||||||
|
for (let i = 0; i < tuxedoLines.length; i++) {
|
||||||
|
const height = tuxedoTopMost + ((fontSize + 10) * i);
|
||||||
|
ctx.fillText(tuxedoLines[i], 560, height);
|
||||||
|
}
|
||||||
|
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'tuxedo-pooh.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.14.1",
|
"version": "119.15.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