This commit is contained in:
Daniel Odendahl Jr
2017-09-12 03:57:09 +00:00
parent 068feece01
commit 418e1b3f46
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -2,7 +2,6 @@ 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');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto.ttf'), { family: 'Noto' }); registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' }); registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' }); registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
@@ -38,7 +37,7 @@ module.exports = class SteamNowPlayingCommand extends Command {
} }
async run(msg, args) { async run(msg, args) {
const { game } = args; let { game } = args;
const member = args.member || msg.member; const member = args.member || msg.member;
const avatarURL = member.user.displayAvatarURL({ const avatarURL = member.user.displayAvatarURL({
format: 'png', format: 'png',
@@ -55,7 +54,8 @@ module.exports = class SteamNowPlayingCommand extends Command {
ctx.fillStyle = '#90ba3c'; ctx.fillStyle = '#90ba3c';
ctx.font = '10px Noto'; ctx.font = '10px Noto';
ctx.fillText(member.displayName, 63, 26); ctx.fillText(member.displayName, 63, 26);
ctx.fillText(shorten(game, 35), 63, 54); while (ctx.measureText(game).width > 160) game = game.substr(0, game.length - 1);
ctx.fillText(game, 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!`);
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "xiaobot", "name": "xiaobot",
"version": "38.4.2", "version": "38.4.3",
"description": "Your personal server companion.", "description": "Your personal server companion.",
"main": "Shard.js", "main": "Shard.js",
"scripts": { "scripts": {