mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Jeopardy Question Command
This commit is contained in:
@@ -132,7 +132,7 @@ in the appropriate channel's topic to use it.
|
||||
|
||||
## Commands
|
||||
|
||||
Total: 397
|
||||
Total: 398
|
||||
|
||||
### Utility:
|
||||
|
||||
@@ -427,6 +427,7 @@ Total: 397
|
||||
* **hollywood-star:** Sends a Hollywood Walk of Fame star with the name of your choice.
|
||||
* **ifunny:** Draws an image with the iFunny logo.
|
||||
* **invert:** Draws an image or a user's avatar but inverted.
|
||||
* **jeopardy-question:** Sends a Jeopardy Question with the text of your choice.
|
||||
* **minecraft-skin:** Sends the Minecraft skin for a user.
|
||||
* **mirror:** Draws an image or a user's avatar but mirrored on the X/Y axis (or both).
|
||||
* **needs-more-jpeg:** Draws an image or a user's avatar as a low quality JPEG.
|
||||
@@ -851,6 +852,8 @@ here.
|
||||
* neko-atsume-password ([API URL](https://github.com/jasmaa/nekoatsume-password-learner/blob/master/neko_pswd.py#L4))
|
||||
- [JellyNeo Item Database](https://items.jellyneo.net/)
|
||||
* neopets-item (Item Data)
|
||||
- [Jeopardy](https://www.jeopardy.com/)
|
||||
* jeopardy-question (Original Show)
|
||||
- [Jessica Knable](https://picsart.com/u/jessicaknable)
|
||||
* hearts ([Image](https://picsart.com/i/sticker-hearts-heart-borders-frames-round-frame-border-love-263412201018212))
|
||||
- [Jisho](https://jisho.org/)
|
||||
@@ -971,6 +974,8 @@ here.
|
||||
* quiz-duel ([API](https://opentdb.com/api_config.php))
|
||||
- [OpenWeatherMap](https://openweathermap.org/)
|
||||
* weather ([API](https://openweathermap.org/api))
|
||||
- [OPTIFONT](http://opti.netii.net/)
|
||||
* jeopardy-question ([Korinna Agency Font](https://fontmeme.com/fonts/korinna-agency-font/))
|
||||
- [osu!](https://osu.ppy.sh/home)
|
||||
* osu ([API](https://github.com/ppy/osu-api/wiki))
|
||||
- [PAC-MAN Party](http://pacman.com/en/pac-man-games/pac-man-party)
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,60 @@
|
||||
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', 'OPTIKorinna-Agency.otf'), { family: 'Korinna' });
|
||||
|
||||
module.exports = class JeopardyQuestionCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'jeopardy-question',
|
||||
aliases: ['jeopardy', 'clue-card', 'jeopardy-clue-card', 'jeopardy-clue'],
|
||||
group: 'edit-image',
|
||||
memberName: 'jeopardy-question',
|
||||
description: 'Sends a Jeopardy Question with the text of your choice.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Jeopardy',
|
||||
url: 'https://www.jeopardy.com/',
|
||||
reason: 'Original Show'
|
||||
},
|
||||
{
|
||||
name: 'OPTIFONT',
|
||||
url: 'http://opti.netii.net/',
|
||||
reason: 'Korinna Agency Font',
|
||||
reasonURL: 'https://fontmeme.com/fonts/korinna-agency-font/'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What should the text of the question be?',
|
||||
type: 'string',
|
||||
max: 500
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { text }) {
|
||||
const canvas = createCanvas(1280, 720);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.fillStyle = '#030e78';
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
ctx.textAlign = 'center';
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.font = '62px Korinna';
|
||||
const lines = await wrapText(ctx, text, 813);
|
||||
const topMost = (canvas.height / 2) - (((62 * lines.length) / 2) + ((36 * (lines.length - 1)) / 2));
|
||||
ctx.fillText(lines.join('\n'), canvas.width / 2, topMost);
|
||||
ctx.fillStyle = 'black';
|
||||
ctx.fillText(lines.join('\n'), (canvas.width / 2) + 8, topMost + 8);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'jeopardy-question.png' }] });
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "113.11.0",
|
||||
"version": "113.12.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user