diff --git a/assets/images/jeopardy.png b/assets/images/jeopardy.png new file mode 100644 index 00000000..a864e763 Binary files /dev/null and b/assets/images/jeopardy.png differ diff --git a/commands/edit-image-text/jeopardy-question.js b/commands/edit-image-text/jeopardy-question.js index 341a0db1..b6c907c7 100644 --- a/commands/edit-image-text/jeopardy-question.js +++ b/commands/edit-image-text/jeopardy-question.js @@ -25,6 +25,12 @@ module.exports = class JeopardyQuestionCommand extends Command { url: 'http://opti.netii.net/', reason: 'Korinna Agency Font', reasonURL: 'https://fontmeme.com/fonts/korinna-agency-font/' + }, + { + name: 'DrewManDew', + url: 'https://www.deviantart.com/drewmandew/gallery', + reason: 'Blank Background Image', + reasonURL: 'https://www.deviantart.com/drewmandew/art/Blank-Jeopardy-Screen-780893853' } ], args: [ @@ -37,8 +43,8 @@ module.exports = class JeopardyQuestionCommand extends Command { }); } - run(msg, { text }) { - const attachment = this.client.registry.commands.get('jeopardy').generateClueCard(text); + async run(msg, { text }) { + const attachment = await this.client.registry.commands.get('jeopardy').generateClueCard(text); return msg.say({ files: [{ attachment, name: 'jeopardy-question.png' }] }); } }; diff --git a/commands/games-sp/jeopardy.js b/commands/games-sp/jeopardy.js index e50a7ed1..5eab2c0e 100644 --- a/commands/games-sp/jeopardy.js +++ b/commands/games-sp/jeopardy.js @@ -1,6 +1,6 @@ const Command = require('../../framework/Command'); const request = require('node-superfetch'); -const { createCanvas } = require('@napi-rs/canvas'); +const { createCanvas, loadImage } = require('@napi-rs/canvas'); const path = require('path'); const { reactIfAble } = require('../../util/Util'); const { wrapText } = require('../../util/Canvas'); @@ -33,6 +33,12 @@ module.exports = class JeopardyCommand extends Command { url: 'http://opti.netii.net/', reason: 'Korinna Agency Font', reasonURL: 'https://fontmeme.com/fonts/korinna-agency-font/' + }, + { + name: 'DrewManDew', + url: 'https://www.deviantart.com/drewmandew/gallery', + reason: 'Blank Background Image', + reasonURL: 'https://www.deviantart.com/drewmandew/art/Blank-Jeopardy-Screen-780893853' } ] }); @@ -40,7 +46,7 @@ module.exports = class JeopardyCommand extends Command { async run(msg) { const question = await this.fetchQuestion(); - const clueCard = this.generateClueCard(question.question.replace(/<\/?i>/gi, '')); + const clueCard = await this.generateClueCard(question.question.replace(/<\/?i>/gi, '')); const connection = msg.guild ? this.client.dispatchers.get(msg.guild.id) : null; let playing = false; if (msg.guild && connection && connection.canPlay) { @@ -70,11 +76,11 @@ module.exports = class JeopardyCommand extends Command { return body; } - generateClueCard(question) { + async generateClueCard(question) { + const bg = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'jeopardy.png')); const canvas = createCanvas(1280, 720); const ctx = canvas.getContext('2d'); - ctx.fillStyle = '#030e78'; - ctx.fillRect(0, 0, canvas.width, canvas.height); + ctx.drawImage(bg, 0, 0); ctx.textAlign = 'center'; ctx.textBaseline = 'top'; ctx.fillStyle = 'white';