mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 14:19:56 +02:00
Changes
This commit is contained in:
@@ -2,6 +2,7 @@ const Command = require('../../structures/Command');
|
|||||||
const { createCanvas, loadImage, registerFont } = require('canvas');
|
const { createCanvas, loadImage, registerFont } = require('canvas');
|
||||||
const snekfetch = require('snekfetch');
|
const snekfetch = require('snekfetch');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const { shorten } = require('../../structures/Util');
|
||||||
|
|
||||||
module.exports = class SteamNowPlayingCommand extends Command {
|
module.exports = class SteamNowPlayingCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
@@ -21,11 +22,7 @@ module.exports = class SteamNowPlayingCommand extends Command {
|
|||||||
{
|
{
|
||||||
key: 'game',
|
key: 'game',
|
||||||
prompt: 'Which game would you like the user to be playing?',
|
prompt: 'Which game would you like the user to be playing?',
|
||||||
type: 'string',
|
type: 'string'
|
||||||
validate: game => {
|
|
||||||
if (game.length < 25) return true;
|
|
||||||
return 'Please keep the game under 25 characters.';
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'member',
|
key: 'member',
|
||||||
@@ -55,8 +52,8 @@ module.exports = class SteamNowPlayingCommand extends Command {
|
|||||||
ctx.drawImage(avatar, 21, 21, 32, 32);
|
ctx.drawImage(avatar, 21, 21, 32, 32);
|
||||||
ctx.fillStyle = '#90ba3c';
|
ctx.fillStyle = '#90ba3c';
|
||||||
ctx.font = '10px Roboto';
|
ctx.font = '10px Roboto';
|
||||||
ctx.fillText(member.displayName, 63, 28);
|
ctx.fillText(member.displayName, 63, 26);
|
||||||
ctx.fillText(game, 63, 54);
|
ctx.fillText(shorten(game, 20), 63, 54);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'steam-now-playing.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'steam-now-playing.png' }] });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
|
|||||||
Reference in New Issue
Block a user