mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
Ace Attorney Command
This commit is contained in:
@@ -132,7 +132,7 @@ in the appropriate channel's topic to use it.
|
||||
|
||||
## Commands
|
||||
|
||||
Total: 407
|
||||
Total: 408
|
||||
|
||||
### Utility:
|
||||
|
||||
@@ -409,6 +409,7 @@ Total: 407
|
||||
|
||||
### Image Manipulation:
|
||||
|
||||
* **ace-attorney:** Sends a text box from Ace Attorney with the quote and character of your choice.
|
||||
* **achievement:** Sends a Minecraft achievement with the text of your choice.
|
||||
* **adorable:** Creates an adorable avatar based on the text you provide.
|
||||
* **apple-engraving:** Engraves the text of your choice onto an Apple product.
|
||||
@@ -685,6 +686,7 @@ here.
|
||||
- [Bulletin of the Atomic Scientists](https://thebulletin.org/)
|
||||
* doomsday-clock ([Doomsday Clock Data](https://thebulletin.org/doomsday-clock/current-time/))
|
||||
- [Capcom](http://www.capcom.com/us/)
|
||||
* ace-attorney ([Images, Original "Ace Attorney" Game](http://www.ace-attorney.com/))
|
||||
* zero-dialogue ([Image, Original "Megaman Zero" Game](http://megaman.capcom.com/))
|
||||
- [cheesecakejedi](https://imgur.com/user/cheesecakejedi)
|
||||
* axis-cult-sign-up ([Image](https://imgur.com/gallery/quQTD))
|
||||
@@ -740,6 +742,8 @@ here.
|
||||
* hat ([Pirate Hat Image](http://dynamicpickaxe.com/pirate-hat-clipart.html))
|
||||
- [ebearskittychan](https://twitter.com/ebearskittychan)
|
||||
* temmie (English-to-Temmie Dictionary Data)
|
||||
- [Enkidulga](https://www.dafont.com/profile.php?user=736583)
|
||||
* ace-attorney ([Ace Attorney Font](https://www.dafont.com/ace-attorney.font))
|
||||
- [Esther Verkest](https://www.facebook.com/Esther-Verkest-49667161749/)
|
||||
* sos (Image)
|
||||
- [Evil Mojo Games](https://www.evilmojogames.com/)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
@@ -0,0 +1,87 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage, registerFont } = require('canvas');
|
||||
const path = require('path');
|
||||
const { list } = require('../../util/Util');
|
||||
const { wrapText } = require('../../util/Canvas');
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Ace-Attorney.ttf'), { family: 'Ace Attorney' });
|
||||
const characters = {
|
||||
phoenix: ['phoenix', 'wright', 'naruhodo', 'ryuuichi', 'ryu', 'nick'],
|
||||
edgeworth: ['miles', 'edgeworth', 'mitsurugi', 'reiji', 'edgey']
|
||||
};
|
||||
|
||||
module.exports = class AceAttorneyCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'ace-attorney',
|
||||
aliases: [
|
||||
'aa',
|
||||
'ace-attorney-dialogue',
|
||||
'aa-dialogue',
|
||||
'ace-attorney-dialog',
|
||||
'aa-dialog',
|
||||
'ace-attorney-quote',
|
||||
'aa-quote'
|
||||
],
|
||||
group: 'edit-image',
|
||||
memberName: 'ace-attorney',
|
||||
description: 'Sends a text box from Ace Attorney with the quote and character of your choice.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Capcom',
|
||||
url: 'http://www.capcom.com/us/',
|
||||
reason: 'Images, Original "Ace Attorney" Game',
|
||||
reasonURL: 'http://www.ace-attorney.com/'
|
||||
},
|
||||
{
|
||||
name: 'Enkidulga',
|
||||
url: 'https://www.dafont.com/profile.php?user=736583',
|
||||
reason: 'Ace Attorney Font',
|
||||
reasonURL: 'https://www.dafont.com/ace-attorney.font'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'character',
|
||||
prompt: `What character do you want to use? Either ${list(Object.keys(characters), 'or')}.`,
|
||||
type: 'string',
|
||||
oneOf: Object.values(characters).reduce((a, b) => a.concat(b)),
|
||||
parse: character => {
|
||||
for (const [id, arr] of Object.entries(characters)) {
|
||||
if (!arr.includes(character.toLowerCase())) continue;
|
||||
return id;
|
||||
}
|
||||
return character.toLowerCase();
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'quote',
|
||||
prompt: 'What should the character say?',
|
||||
type: 'string',
|
||||
max: 250
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { character, quote }) {
|
||||
const base = await loadImage(
|
||||
path.join(__dirname, '..', '..', 'assets', 'images', 'ace-attorney', `${character}.png`)
|
||||
);
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.font = '14px Ace Attorney';
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.fillText(character, 6, 178);
|
||||
let text = await wrapText(ctx, quote, 242);
|
||||
text = text.length > 5 ? `${text.slice(0, 5).join('\n')}...` : text.join('\n');
|
||||
ctx.fillText(text, 7, 199);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: `ace-attorney-${character}.png` }] });
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "113.21.0",
|
||||
"version": "113.22.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user