mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-16 15:57:54 +02:00
Do Radians right
This commit is contained in:
@@ -41,9 +41,9 @@ module.exports = class BobRossCommand extends Command {
|
|||||||
const avatar = await loadImage(body);
|
const avatar = await loadImage(body);
|
||||||
ctx.fillStyle = 'white';
|
ctx.fillStyle = 'white';
|
||||||
ctx.fillRect(0, 0, 600, 775);
|
ctx.fillRect(0, 0, 600, 775);
|
||||||
ctx.rotate(3 * Math.PI / 180);
|
ctx.rotate(3 * (Math.PI / 180));
|
||||||
ctx.drawImage(avatar, 69, 102, 256, 256);
|
ctx.drawImage(avatar, 69, 102, 256, 256);
|
||||||
ctx.rotate(-3 * Math.PI / 180);
|
ctx.rotate(-3 * (Math.PI / 180));
|
||||||
ctx.drawImage(base, 0, 0);
|
ctx.drawImage(base, 0, 0);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'bob-ross.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'bob-ross.png' }] });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ module.exports = class DexterCommand extends Command {
|
|||||||
const { body } = await snekfetch.get(avatarURL);
|
const { body } = await snekfetch.get(avatarURL);
|
||||||
const avatar = await loadImage(body);
|
const avatar = await loadImage(body);
|
||||||
ctx.drawImage(base, 0, 0);
|
ctx.drawImage(base, 0, 0);
|
||||||
ctx.rotate(-11 * Math.PI / 180);
|
ctx.rotate(-11 * (Math.PI / 180));
|
||||||
ctx.drawImage(avatar, 234, 274, 225, 225);
|
ctx.drawImage(avatar, 234, 274, 225, 225);
|
||||||
ctx.rotate(11 * Math.PI / 180);
|
ctx.rotate(11 * (Math.PI / 180));
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'dexter.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'dexter.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!`);
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ module.exports = class SimbaCommand extends Command {
|
|||||||
const { body } = await snekfetch.get(avatarURL);
|
const { body } = await snekfetch.get(avatarURL);
|
||||||
const avatar = await loadImage(body);
|
const avatar = await loadImage(body);
|
||||||
ctx.drawImage(base, 0, 0);
|
ctx.drawImage(base, 0, 0);
|
||||||
ctx.rotate(-24 * Math.PI / 180);
|
ctx.rotate(-24 * (Math.PI / 180));
|
||||||
ctx.drawImage(avatar, 75, 160, 130, 150);
|
ctx.drawImage(avatar, 75, 160, 130, 150);
|
||||||
ctx.rotate(24 * Math.PI / 180);
|
ctx.rotate(24 * (Math.PI / 180));
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'simba.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'simba.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
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiaobot",
|
"name": "xiaobot",
|
||||||
"version": "34.0.4",
|
"version": "34.0.5",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Shard.js",
|
"main": "Shard.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
+2
-1
@@ -62,7 +62,8 @@ class Util {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static list(arr, conj = 'and') {
|
static list(arr, conj = 'and') {
|
||||||
return `${arr.slice(0, -1).join(', ')}${arr.length > 1 ? `${arr.length > 2 ? ',' : ''} ${conj} ` : ''}${arr.slice(-1)}`; // eslint-disable-line max-len
|
const { length } = arr;
|
||||||
|
return `${arr.slice(0, -1).join(', ')}${length > 1 ? `${length > 2 ? ',' : ''} ${conj} ` : ''}${arr.slice(-1)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
static shorten(text, maxLen = 2000) {
|
static shorten(text, maxLen = 2000) {
|
||||||
|
|||||||
Reference in New Issue
Block a user