Проблема с командой для бота на Discord

В общем я создал команду которая будет показывать карточку ранга. Получается всё хорошо работает, ну, написал всё правильно, но когда я пишу в чат команду я столкнулся с интересной ошибкой.

(node:13412) UnhandledPromiseRejectionWarning: TypeError: ctx.drawIamge is not a function
    at Object.run (C:\Users\ASUS\Documents\Bots for Discord\AliceBotLocal\commands\fun\rankEn.js:69:21)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:13412) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:13412) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

ctx.draImage не является функцией. Я самостоятельно не смог найти причину. Вот как выглядит полностью команда:

const { createCanvas, loadImage } = require("canvas");
const { MessageAttachment, MessageEmbed } = require("discord.js");
const { join } = require("path");
const mongoose = require("mongoose");
const Rank = require('../../models/rank');
const config = require('../../node.json');
module.exports = {
    name: "rank",
    aliases: [],
    run: async (bot, message, args) => {
        const embed = new MessageEmbed();
        embed.setAuthor(`Request by ${message.author.tag}`, message.author.displayAvatarURL({size: 2048}));
        mongoose.connect(config.dataURL, {
            useNewUrlParser: true,
            useUnifiedTopology: true
        });
        if (bot.users.cache.find(user => user.tag === `${args[0]}`)) {
            return;
        } else if (bot.users.cache.find(user => user.id === `${args[0]}`)) {
            return;
        } else if (message.mentions.users.first()) {
            return;
        } else {
            const Data = Rank.findOne({
                UserID: message.author.id,
                GuildID: message.guild.id
            });
            if (!Data) {
                embed.setDescription(`You have no rank card because you have not sent messages yet!`);
                embed.setColor(0xff69b4);
                embed.setTimestamp();
                message.channel.send(embed);
            } else {
                const canvas = createCanvas(1000, 333);
                const ctx = canvas.getContext("2d");
                const background = await loadImage(join(__dirname, "..", "..", "backgrounds", "background.png"));
                ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
                ctx.beginPath();
                ctx.lineWidth = 4;
                ctx.strokeStyle = "#ffffff";
                ctx.globalAlpha = 0.2;
                ctx.fillStyle = "#000000";
                ctx.fillRect(180, 216, 770, 65);
                ctx.fill();
                ctx.globalAlpha = 1;
                ctx.strokeRect(180, 216, 770, 65);
                ctx.stroke();
                ctx.fillStyle = "#e67e22";
                ctx.globalAlpha = 0.6;
                ctx.fillRect(180, 216, ((100 / (Data.Level * 40)) * Data.XP) * 7.7, 65);
                ctx.fill();
                ctx.globalAlpha = 1;
                ctx.font = "30px Arial";
                ctx.textAlign = "center";
                ctx.fillStyle = "#ffffff";
                ctx.fillText(`${Data.XP} / ${Data.Level * 40} XP`, 600, 260);
                ctx.textAlign = "left";
                ctx.fillText(message.author.tag, 300, 120);
                ctx.font = "50px Arial";
                ctx.fillText("Level:", 300, 180);
                ctx.fillText(Data.Level, 470, 180);
                ctx.arc(170, 160, 120, 0, Math.PI * 2, true);
                ctx.lineWidth = 6;
                ctx.strokeStyle = "#ffffff";
                ctx.stroke();
                ctx.closePath();
                ctx.clip();
                const avatar = await loadImage(message.author.displayAvatarURL({format: 'png', size: 2048, dynamic: false}));
                ctx.drawIamge(avatar, 40, 20, 250, 250);
                const attachment = new MessageAttachment(canvas.toBuffer(), "rank.png");
                message.channel.send(attachment);
            }
        }
    }
}

Буду очень рад любой помощи. Заранее спасибо.


Ответы (0 шт):