mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Phoebe Teaching Joey Command
This commit is contained in:
@@ -618,6 +618,7 @@ Total: 452
|
||||
* **meme-gen-modern:** Sends a meme with the text and image of your choice.
|
||||
* **new-password:** Sends a "Weak Password/Strong Password" meme with the passwords of your choice.
|
||||
* **nike-ad:** Sends a "Believe in Something" Nike Ad meme with the text of your choice.
|
||||
* **phoebe-teaching-joey:** Sends a "Phoebe Teaching Joey" meme with text of your choice.
|
||||
* **plankton-plan:** Sends a Plankton's Plan meme with steps of your choice.
|
||||
* **scroll-of-truth:** Sends a "Scroll of Truth" meme with the text of your choice.
|
||||
* **skyrim-skill:** Sends a "Skyrim Skill" meme with the skill and image of your choice.
|
||||
@@ -968,6 +969,7 @@ here.
|
||||
* new-password ([Noto Font](https://www.google.com/get/noto/))
|
||||
* nike-ad ([Noto Font](https://www.google.com/get/noto/))
|
||||
* periodic-table ([Noto Font](https://www.google.com/get/noto/))
|
||||
* phoebe-teaching-joey ([Noto Font](https://www.google.com/get/noto/))
|
||||
* plankton-plan ([Noto Font](https://www.google.com/get/noto/))
|
||||
* scroll-of-truth ([Noto Font](https://www.google.com/get/noto/))
|
||||
* sos ([Noto Font](https://www.google.com/get/noto/))
|
||||
@@ -1410,6 +1412,8 @@ here.
|
||||
* this-for-that ([API](http://itsthisforthat.com/api.php))
|
||||
- [WAIT: What Anime Is This?](https://trace.moe/)
|
||||
* what-anime ([API](https://soruly.github.io/trace.moe/#/))
|
||||
- [Warner Bros.](https://www.warnerbros.com/)
|
||||
* phoebe-teaching-joey ([Images, Original "Friends" TV Series](https://www.warnerbros.com/tv/friends/))
|
||||
- [Wattpad](https://www.wattpad.com/)
|
||||
* wattpad ([API](https://www.wattpad.com/developer/docs/api))
|
||||
- [wikiHow](https://www.wikihow.com/Main-Page)
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 571 KiB |
@@ -0,0 +1,100 @@
|
||||
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 = [
|
||||
[[107, 135], [439, 135]],
|
||||
[[105, 328], [443, 328]],
|
||||
[[120, 497], [445, 497]],
|
||||
[[116, 712], [420, 712]]
|
||||
];
|
||||
|
||||
module.exports = class PhoebeTeachingJoeyCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'phoebe-teaching-joey',
|
||||
aliases: ['phoebe', 'phoebe-teach', 'joey', 'phoebe-teach-joey'],
|
||||
group: 'edit-meme',
|
||||
memberName: 'phoebe-teaching-joey',
|
||||
description: 'Sends a "Phoebe Teaching Joey" meme with text of your choice.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Warner Bros.',
|
||||
url: 'https://www.warnerbros.com/',
|
||||
reason: 'Images, Original "Friends" TV Series',
|
||||
reasonURL: 'https://www.warnerbros.com/tv/friends/'
|
||||
},
|
||||
{
|
||||
name: 'Google',
|
||||
url: 'https://www.google.com/',
|
||||
reason: 'Noto Font',
|
||||
reasonURL: 'https://www.google.com/get/noto/'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'correct',
|
||||
prompt: 'What should Phoebe try to teach Joey?',
|
||||
type: 'string',
|
||||
validate: correct => {
|
||||
if (correct.split(' ') < 3) return 'Please provide at least three words.';
|
||||
if (correct.length > 50) return 'Please keep the text below or exactly 50 characters.';
|
||||
return true;
|
||||
},
|
||||
parse: correct => {
|
||||
const words = correct.split(' ');
|
||||
const divided = Math.ceil(words.length / 3);
|
||||
const first = words.slice(0, divided).join(' ');
|
||||
const second = words.slice(divided, divided * 2).join(' ');
|
||||
const third = words.slice(divided * 2, words.length).join(' ');
|
||||
return [first, second, third];
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'incorrect',
|
||||
prompt: 'What should Joey repeat back?',
|
||||
type: 'string',
|
||||
max: 50
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { correct, incorrect }) {
|
||||
const steps = [...correct, incorrect];
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'phoebe-teaching-joey.png'));
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.fillStyle = '#e3e35f';
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.textAlign = 'center';
|
||||
let i = 0;
|
||||
for (const coords of coord) {
|
||||
let j = 0;
|
||||
for (const [x, y] of coords) {
|
||||
ctx.font = '15px Noto';
|
||||
let step = steps[i];
|
||||
if (step === incorrect && j === 0) step = correct.join(' ');
|
||||
let fontSize = 15;
|
||||
while (ctx.measureText(step).width > 390) {
|
||||
fontSize -= 1;
|
||||
ctx.font = `${fontSize}px Noto`;
|
||||
}
|
||||
const lines = await wrapText(ctx, step, 260);
|
||||
ctx.fillText(lines.join('\n'), x, y);
|
||||
j++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'phoebe-teaching-joey.png' }] });
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "115.2.2",
|
||||
"version": "115.3.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user