mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Mario Bros Views Command
This commit is contained in:
@@ -243,7 +243,7 @@ in the appropriate channel's topic to use it.
|
||||
|
||||
## Commands
|
||||
|
||||
Total: 523
|
||||
Total: 524
|
||||
|
||||
### Utility:
|
||||
|
||||
@@ -696,6 +696,7 @@ Total: 523
|
||||
* **like:** Sends an "Everyone Liked That" meme with the image of your choice.
|
||||
* **lisa-presentation:** Sends a "Lisa Presentation" meme with the presentation of your choice.
|
||||
* **look-at-this-photograph:** Draws an image or a user's avatar over Nickelback's photograph.
|
||||
* **mario-bros-views:** Sends a "Mario Bros. Views" meme with the text of your choice.
|
||||
* **meme-gen-classic:** Sends a meme with the text and background of your choice.
|
||||
* **meme-gen-modern:** Sends a meme with the text and image of your choice.
|
||||
* **my-collection-grows:** Sends a "My collection grows richer" Nekopara meme with the text of your choice.
|
||||
@@ -1088,6 +1089,7 @@ here.
|
||||
* illegal ([Noto Font](https://www.google.com/get/noto/))
|
||||
* lisa-presentation ([Noto Font](https://www.google.com/get/noto/))
|
||||
* map ([Maps Static API](https://developers.google.com/maps/documentation/maps-static/intro))
|
||||
* mario-bros-views ([Noto Font](https://www.google.com/get/noto/))
|
||||
* meme-gen-modern ([Noto Font](https://www.google.com/get/noto/))
|
||||
* new-password ([Noto Font](https://www.google.com/get/noto/))
|
||||
* nike-ad ([Noto Font](https://www.google.com/get/noto/))
|
||||
@@ -1347,6 +1349,7 @@ here.
|
||||
* nike-ad (Logo, Concept)
|
||||
- [Nintendo](https://www.nintendo.com/)
|
||||
* challenger ([Original "Super Smash Bros." Game](https://www.smashbros.com/en_US/index.html))
|
||||
* mario-bros-views ([Original "Super Mario Bros." Game](https://mario.nintendo.com/))
|
||||
* smw-level ([Original "Super Mario World" Game](https://www.nintendo.co.jp/n02/shvc/mw/index.html))
|
||||
- [NotAWeebDev](https://github.com/NotAWeebDev/)
|
||||
* triggered ([Image](https://github.com/NotAWeebDev/Misaki/blob/2e44f9efb467028dcbae5a2c9f836d2e99860b85/assets/images/plate_triggered.png))
|
||||
@@ -1380,6 +1383,7 @@ here.
|
||||
* i-fear-no-man (Concept)
|
||||
* if-those-kids-could-read (Concept)
|
||||
* like (Concept)
|
||||
* mario-bros-views (Concept)
|
||||
* pills (Concept)
|
||||
* pogchamp (Concept)
|
||||
* porn (Original Subreddit List)
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
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 MarioBrosViewsCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'mario-bros-views',
|
||||
aliases: ['mario-views', 'luigi-views', 'mario-luigi-views', 'mario-says', 'luigi-says'],
|
||||
group: 'edit-meme',
|
||||
memberName: 'mario-bros-views',
|
||||
description: 'Sends a "Mario Bros. Views" meme with the text of your choice.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Nintendo',
|
||||
url: 'https://www.nintendo.com/',
|
||||
reason: 'Original "Super Mario Bros." Game',
|
||||
reasonURL: 'https://mario.nintendo.com/'
|
||||
},
|
||||
{
|
||||
name: 'Google',
|
||||
url: 'https://www.google.com/',
|
||||
reason: 'Noto Font',
|
||||
reasonURL: 'https://www.google.com/get/noto/'
|
||||
},
|
||||
{
|
||||
name: 'Overtime2005',
|
||||
url: 'https://github.com/Overtime2005',
|
||||
reason: 'Concept'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'thing',
|
||||
prompt: 'What do you want the Mario Bros. to tell their views on?',
|
||||
type: 'string',
|
||||
max: 20
|
||||
},
|
||||
{
|
||||
key: 'mario',
|
||||
prompt: 'What should Mario\'s views be?',
|
||||
type: 'string',
|
||||
max: 280
|
||||
},
|
||||
{
|
||||
key: 'luigi',
|
||||
prompt: 'What should Luigi\'s views be?',
|
||||
type: 'string',
|
||||
max: 280
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { thing, mario, luigi }) {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'mario-bros-views.png'));
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.font = '47px Noto';
|
||||
ctx.fillText(thing, 420, 108, 180);
|
||||
ctx.textAlign = 'start';
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.font = '36px Noto';
|
||||
let fontSize = 36;
|
||||
while (ctx.measureText(mario).width > 765) {
|
||||
fontSize--;
|
||||
ctx.font = `${fontSize}px Noto`;
|
||||
}
|
||||
const marioLines = await wrapText(ctx, text, 381);
|
||||
const marioTopMost = 450 - (((fontSize * marioLines.length) / 2) + ((20 * (marioLines.length - 1)) / 2));
|
||||
for (let i = 0; i < marioLines.length; i++) {
|
||||
ctx.strokeStyle = 'black';
|
||||
ctx.lineWidth = 5;
|
||||
const height = marioTopMost + ((fontSize + 20) * i);
|
||||
ctx.strokeText(marioLines[i], 235, height);
|
||||
ctx.fillText(marioLines[i], 235, height);
|
||||
}
|
||||
ctx.font = '36px Noto';
|
||||
fontSize = 36;
|
||||
while (ctx.measureText(luigi).width > 765) {
|
||||
fontSize--;
|
||||
ctx.font = `${fontSize}px Noto`;
|
||||
}
|
||||
const luigiLines = await wrapText(ctx, text, 381);
|
||||
const luigiTopMost = 450 - (((fontSize * luigiLines.length) / 2) + ((20 * (luigiLines.length - 1)) / 2));
|
||||
for (let i = 0; i < luigiLines.length; i++) {
|
||||
ctx.strokeStyle = 'black';
|
||||
ctx.lineWidth = 5;
|
||||
const height = luigiTopMost + ((fontSize + 20) * i);
|
||||
ctx.strokeText(luigiLines[i], 420, height);
|
||||
ctx.fillText(luigiLines[i], 420, height);
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'mario-bros-views.png' }] });
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "119.5.1",
|
||||
"version": "119.6.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user