mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
Spongebob Burn Command
This commit is contained in:
@@ -59,7 +59,7 @@ Xiao is a Discord bot coded in JavaScript with
|
||||
* [Storyteller](https://github.com/dragonfire535/storyteller) is a Mafia bot made for Discord's 2019 Hack Week, whose features were originally built into Xiao.
|
||||
* [Meme Poster](https://github.com/dragonfire535/meme-poster) is a meme-posting webhook, inspired by an idea that started as part of Xiao.
|
||||
|
||||
## Commands (346)
|
||||
## Commands (347)
|
||||
### Utility:
|
||||
|
||||
* **eval:** Executes JavaScript code.
|
||||
@@ -327,6 +327,7 @@ Xiao is a Discord bot coded in JavaScript with
|
||||
* **shields-io-badge:** Creates a badge from shields.io.
|
||||
* **silhouette:** Draws a silhouette of an image or a user's avatar.
|
||||
* **sora-selfie:** Draws an image or a user's avatar behind Sora taking a selfie.
|
||||
* **spongebob-burn:** Sends a "Spongebob Throwing Something into a Fire" meme with words of your choice.
|
||||
* **square:** Draws an image or a user's avatar as a square.
|
||||
* **thug-life:** Draws "Thug Life" over an image or a user's avatar.
|
||||
* **tint:** Draws an image or a user's avatar but tinted a specific color.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 548 KiB |
@@ -0,0 +1,72 @@
|
||||
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 SpongebobBurnCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'spongebob-burn',
|
||||
aliases: ['sponge-burn', 'spongebob-fire', 'sponge-fire'],
|
||||
group: 'image-edit',
|
||||
memberName: 'spongebob-burn',
|
||||
description: 'Sends a "Spongebob Throwing Something into a Fire" meme with words of your choice.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Spongebob',
|
||||
url: 'https://www.nick.com/shows/spongebob-squarepants'
|
||||
},
|
||||
{
|
||||
name: 'Google Noto Fonts',
|
||||
url: 'https://www.google.com/get/noto/'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'burn',
|
||||
label: 'thing to burn',
|
||||
prompt: 'What should Spongebob burn?',
|
||||
type: 'string',
|
||||
max: 150
|
||||
},
|
||||
{
|
||||
key: 'person',
|
||||
prompt: 'What should Spongebob be labelled as?',
|
||||
type: 'string',
|
||||
max: 15
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { burn, person }) {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'spongebob-burn.png'));
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.fillStyle = 'black';
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.font = '35px Noto';
|
||||
let fontSize = 35;
|
||||
while (ctx.measureText(burn).width > 360) {
|
||||
fontSize -= 1;
|
||||
ctx.font = `${fontSize}px Noto`;
|
||||
}
|
||||
const lines = await wrapText(ctx, burn, 180);
|
||||
ctx.fillText(lines.join('\n'), 50, 83);
|
||||
ctx.font = '25px Noto';
|
||||
ctx.fillText(person, 382, 26);
|
||||
ctx.font = '20px Noto';
|
||||
ctx.fillText(person, 114, 405);
|
||||
ctx.fillText(person, 434, 434);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'spongebob-burn.png' }] });
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "107.5.0",
|
||||
"version": "107.6.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user