mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-15 08:22:37 +02:00
Lisa Presentation Command
This commit is contained in:
@@ -45,7 +45,7 @@ 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 (340)
|
## Commands (341)
|
||||||
### Utility:
|
### Utility:
|
||||||
|
|
||||||
* **eval:** Executes JavaScript code.
|
* **eval:** Executes JavaScript code.
|
||||||
@@ -293,6 +293,7 @@ Xiao is a Discord bot coded in JavaScript with
|
|||||||
* **illegal:** Makes President Trump make your text illegal.
|
* **illegal:** Makes President Trump make your text illegal.
|
||||||
* **invert:** Draws an image or a user's avatar but inverted.
|
* **invert:** Draws an image or a user's avatar but inverted.
|
||||||
* **kyon-gun:** Draws an image or a user's avatar behind Kyon shooting a gun.
|
* **kyon-gun:** Draws an image or a user's avatar behind Kyon shooting a gun.
|
||||||
|
* **lisa-presentation:** Sends a "Lisa Presentation" meme with the presentation of your choice.
|
||||||
* **meme-gen:** Sends a meme with the text and background of your choice.
|
* **meme-gen:** Sends a meme with the text and background of your choice.
|
||||||
* **minecraft-skin:** Sends the Minecraft skin for a user.
|
* **minecraft-skin:** Sends the Minecraft skin for a user.
|
||||||
* **needs-more-jpeg:** Draws an image or a user's avatar as a low quality JPEG.
|
* **needs-more-jpeg:** Draws an image or a user's avatar as a low quality JPEG.
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 172 KiB |
@@ -0,0 +1,47 @@
|
|||||||
|
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 LisaPresentationCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'lisa-presentation',
|
||||||
|
aliases: ['lisa'],
|
||||||
|
group: 'image-edit',
|
||||||
|
memberName: 'lisa-presentation',
|
||||||
|
description: 'Sends a "Lisa Presentation" meme with the presentation of your choice.',
|
||||||
|
throttling: {
|
||||||
|
usages: 1,
|
||||||
|
duration: 10
|
||||||
|
},
|
||||||
|
clientPermissions: ['ATTACH_FILES'],
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'text',
|
||||||
|
prompt: 'What should the text of the presentation be?',
|
||||||
|
type: 'string',
|
||||||
|
max: 280
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, { text }) {
|
||||||
|
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'lisa-presentation.png'));
|
||||||
|
const canvas = createCanvas(base.width, base.height);
|
||||||
|
const ctx = canvas.getContext('2d');
|
||||||
|
ctx.drawImage(base, 0, 0);
|
||||||
|
ctx.font = '24px Noto';
|
||||||
|
ctx.textAlign = 'center';
|
||||||
|
const lines = await wrapText(ctx, text, 330);
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
const textHeight = 95 + (i * 24) + (i * 10);
|
||||||
|
ctx.fillText(lines[i], base.width / 2, textHeight);
|
||||||
|
}
|
||||||
|
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'lisa-presentation.png' }] });
|
||||||
|
}
|
||||||
|
};
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "102.2.0",
|
"version": "102.3.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