mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 06:42:50 +02:00
Plankton Plan Command, Related Bots in README
This commit is contained in:
@@ -53,7 +53,13 @@ Xiao is a Discord bot coded in JavaScript with
|
|||||||
6. Run `npm i -g pm2` to install PM2.
|
6. Run `npm i -g pm2` to install PM2.
|
||||||
7. Run `pm2 start Xiao.js --name xiao` to run the bot.
|
7. Run `pm2 start Xiao.js --name xiao` to run the bot.
|
||||||
|
|
||||||
## Commands (345)
|
## Related Bots
|
||||||
|
|
||||||
|
* [Rando Cardrissian](https://github.com/dragonfire535/rando-cardrissian) is a Cards Against Humanity bot, who's features were originally built into Xiao.
|
||||||
|
* [Storyteller](https://github.com/dragonfire535/storyteller) is a Mafia bot made for Discord's 2019 Hack Week, who's 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)
|
||||||
### Utility:
|
### Utility:
|
||||||
|
|
||||||
* **eval:** Executes JavaScript code.
|
* **eval:** Executes JavaScript code.
|
||||||
@@ -312,6 +318,7 @@ Xiao is a Discord bot coded in JavaScript with
|
|||||||
* **nike-ad:** Sends a "Believe in Something" Nike Ad meme with the text of your choice.
|
* **nike-ad:** Sends a "Believe in Something" Nike Ad meme with the text of your choice.
|
||||||
* **osu-signature:** Creates a card based on an osu! user's stats.
|
* **osu-signature:** Creates a card based on an osu! user's stats.
|
||||||
* **pixelize:** Draws an image or a user's avatar pixelized.
|
* **pixelize:** Draws an image or a user's avatar pixelized.
|
||||||
|
* **plankton-plan:** Sends a Plankton's Plan meme with steps of your choice.
|
||||||
* **pokemon-fusion:** Fuses two Generation I Pokémon together.
|
* **pokemon-fusion:** Fuses two Generation I Pokémon together.
|
||||||
* **rainbow:** Draws a rainbow over an image or a user's avatar.
|
* **rainbow:** Draws a rainbow over an image or a user's avatar.
|
||||||
* **rejected:** Draws a "rejected" stamp over an image or a user's avatar.
|
* **rejected:** Draws a "rejected" stamp over an image or a user's avatar.
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 402 KiB |
@@ -0,0 +1,82 @@
|
|||||||
|
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' });
|
||||||
|
const coord = [[240, 63], [689, 63], [705, 380], [220, 380]];
|
||||||
|
|
||||||
|
module.exports = class PlanktonPlanCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'plankton-plan',
|
||||||
|
aliases: ['planktons-plan', 'plankton'],
|
||||||
|
group: 'image-edit',
|
||||||
|
memberName: 'plankton-plan',
|
||||||
|
description: 'Sends a Plankton\'s Plan meme with steps 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: 'step1',
|
||||||
|
label: 'step 1',
|
||||||
|
prompt: 'What should the first step of Plankton\'s plan be?',
|
||||||
|
type: 'string',
|
||||||
|
max: 150
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'step2',
|
||||||
|
label: 'step 2',
|
||||||
|
prompt: 'What should the second step of Plankton\'s plan be?',
|
||||||
|
type: 'string',
|
||||||
|
max: 150
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'step3',
|
||||||
|
label: 'step 3',
|
||||||
|
prompt: 'What should the third step of Plankton\'s plan be?',
|
||||||
|
type: 'string',
|
||||||
|
max: 150
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, { step1, step2, step3 }) {
|
||||||
|
const steps = [step1, step2, step3, step3];
|
||||||
|
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'plankton-plan.png'));
|
||||||
|
const canvas = createCanvas(base.width, base.height);
|
||||||
|
const ctx = canvas.getContext('2d');
|
||||||
|
ctx.drawImage(base, 0, 0);
|
||||||
|
ctx.fillStyle = 'black';
|
||||||
|
ctx.textBaseline = 'top';
|
||||||
|
let i = 0;
|
||||||
|
for (const [x, y] of coord) {
|
||||||
|
ctx.font = '35px Noto';
|
||||||
|
const step = steps[i];
|
||||||
|
let fontSize = 35;
|
||||||
|
while (ctx.measureText(step).width > 720) {
|
||||||
|
fontSize -= 1;
|
||||||
|
ctx.font = `${fontSize}px Noto`;
|
||||||
|
}
|
||||||
|
const lines = await wrapText(ctx, step, 252);
|
||||||
|
ctx.fillText(lines.join('\n'), x, y);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'plankton-plan.png' }] });
|
||||||
|
}
|
||||||
|
};
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "107.4.1",
|
"version": "107.5.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