mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Scroll of Truth Command
This commit is contained in:
@@ -224,7 +224,7 @@ in the appropriate channel's topic to use it.
|
|||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
Total: 447
|
Total: 448
|
||||||
|
|
||||||
### Utility:
|
### Utility:
|
||||||
|
|
||||||
@@ -615,6 +615,7 @@ Total: 447
|
|||||||
* **new-password:** Sends a "Weak Password/Strong Password" meme with the passwords 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.
|
* **nike-ad:** Sends a "Believe in Something" Nike Ad meme with the text of your choice.
|
||||||
* **plankton-plan:** Sends a Plankton's Plan meme with steps 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.
|
* **skyrim-skill:** Sends a "Skyrim Skill" meme with the skill and image of your choice.
|
||||||
* **sora-selfie:** Draws an image or a user's avatar behind Sora taking a selfie.
|
* **sora-selfie:** Draws an image or a user's avatar behind Sora taking a selfie.
|
||||||
* **sos:** Sends a "Esther Verkest's Help Sign" comic with the text of your choice.
|
* **sos:** Sends a "Esther Verkest's Help Sign" comic with the text of your choice.
|
||||||
@@ -963,6 +964,7 @@ here.
|
|||||||
* nike-ad ([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/))
|
* periodic-table ([Noto Font](https://www.google.com/get/noto/))
|
||||||
* plankton-plan ([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/))
|
* sos ([Noto Font](https://www.google.com/get/noto/))
|
||||||
* spongebob-burn ([Noto Font](https://www.google.com/get/noto/))
|
* spongebob-burn ([Noto Font](https://www.google.com/get/noto/))
|
||||||
* steam-card ([Noto Font](https://www.google.com/get/noto/))
|
* steam-card ([Noto Font](https://www.google.com/get/noto/))
|
||||||
@@ -1283,6 +1285,8 @@ here.
|
|||||||
* league-of-legends ([API](https://developer.riotgames.com/))
|
* league-of-legends ([API](https://developer.riotgames.com/))
|
||||||
- [RoboHash](https://robohash.org/)
|
- [RoboHash](https://robohash.org/)
|
||||||
* robohash (API)
|
* robohash (API)
|
||||||
|
- [Robotatertot](https://robotatertot.tumblr.com/)
|
||||||
|
* scroll-of-truth ([Image](https://robotatertot.tumblr.com/post/156736308530/truth))
|
||||||
- [RogerHub Final Grade Calculator](https://rogerhub.com/final-grade-calculator/)
|
- [RogerHub Final Grade Calculator](https://rogerhub.com/final-grade-calculator/)
|
||||||
* final-grade (Concept, Code)
|
* final-grade (Concept, Code)
|
||||||
- [Rotten Tomatoes](https://www.rottentomatoes.com/)
|
- [Rotten Tomatoes](https://www.rottentomatoes.com/)
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.7 MiB |
@@ -0,0 +1,68 @@
|
|||||||
|
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 ScrollOfTruthCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'scroll-of-truth',
|
||||||
|
aliases: ['truth', 'scroll', 'truth-scroll', 'scroll-truth'],
|
||||||
|
group: 'edit-meme',
|
||||||
|
memberName: 'scroll-of-truth',
|
||||||
|
description: 'Sends a "Scroll of Truth" meme with the text of your choice.',
|
||||||
|
throttling: {
|
||||||
|
usages: 1,
|
||||||
|
duration: 10
|
||||||
|
},
|
||||||
|
clientPermissions: ['ATTACH_FILES'],
|
||||||
|
credit: [
|
||||||
|
{
|
||||||
|
name: 'Robotatertot',
|
||||||
|
url: 'https://robotatertot.tumblr.com/',
|
||||||
|
reason: 'Image',
|
||||||
|
reasonURL: 'https://robotatertot.tumblr.com/post/156736308530/truth'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Google',
|
||||||
|
url: 'https://www.google.com/',
|
||||||
|
reason: 'Noto Font',
|
||||||
|
reasonURL: 'https://www.google.com/get/noto/'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'text',
|
||||||
|
prompt: 'What do you want the scroll of truth to say?',
|
||||||
|
type: 'string',
|
||||||
|
max: 500
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, { text }) {
|
||||||
|
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'scroll-of-truth.png'));
|
||||||
|
const canvas = createCanvas(base.width, base.height);
|
||||||
|
const ctx = canvas.getContext('2d');
|
||||||
|
ctx.drawImage(base, 0, 0);
|
||||||
|
ctx.textAlign = 'center';
|
||||||
|
ctx.textBaseline = 'top';
|
||||||
|
ctx.font = '60px Noto';
|
||||||
|
let fontSize = 60;
|
||||||
|
while (ctx.measureText(text).width > 678) {
|
||||||
|
fontSize -= 1;
|
||||||
|
ctx.font = `${fontSize}px Noto`;
|
||||||
|
}
|
||||||
|
const lines = await wrapText(ctx, text, 226);
|
||||||
|
const topMost = 724 - (((fontSize * lines.length) / 2) + ((20 * (lines.length - 1)) / 2));
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
const height = topMost + ((fontSize + 20) * i);
|
||||||
|
ctx.fillText(lines[i], 240, height);
|
||||||
|
}
|
||||||
|
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'scroll-of-truth.png' }] });
|
||||||
|
}
|
||||||
|
};
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "114.32.0",
|
"version": "114.33.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