DiscordAPIError: Invalid Form Body 3.options[1].type: This field is required

DiscordAPIError: Invalid Form Body 3.options[1].type: This field is required

所以我有这个锁定命令,但当我想启动机器人时,我收到以下错误

DiscordAPIError: Invalid Form Body
3.options[1].type: This field is required

我尝试修复它,但我不知道问题出在哪里。

它存在 4 个文件。

文件 1: GiveawaySys.js <-- 系统文件

const { GiveawaysManager } = require('discord-giveaways');
const giveawayModel = require("../Structures/Schemas/GiveawayDB");

module.exports = (client) => {
    const GiveawayManagerWithOwnDatabase = class extends GiveawaysManager {
        async getAllGiveaways() {
            return await giveawayModel.find().lean().exec();
        }
    
        async saveGiveaway(messageId, giveawayData) {
            await giveawayModel.create(giveawayData);
            return true;
        }
    
        async editGiveaway(messageId, giveawayData) {
            await giveawayModel.updateOne({ messageId }, giveawayData, { omitUndefined: true }).exec();
            return true;
        }
    
        async deleteGiveaway(messageId) {
            await giveawayModel.deleteOne({ messageId }).exec();
            return true;
        }
    };
    
    const manager = new GiveawayManagerWithOwnDatabase(client, {
        default: {
            botsCanWin: false,
            embedColor: '#FF0000',
            embedColorEnd: '#000000',
            reaction: ''
        }
    });
    client.giveawaysManager = manager;
}

文件 2:Lockdown.js <-- 架构

const { model, Schema } = require("mongoose");

module.exports = model("Lockdown", new Schema({
    GuildID: String,
    ChannelID: String,
    Time: String,
})
);

文件 3:lock.js <-- 锁定命令

const {
    CommandInteraction,
    MessageEmbed
} = require("discord.js");
const DB = require("../../Structures/Schemas/LockDown");
const ms = require("ms");

module.exports = {
    name: "lock",
    description: "Lockdown this channel",
    permission: "MANAGE_CHANNELS",
    options: [{
            name: "time",
            description: "Expire date for this lockdown (1m, 1h, 1d)",
            type: "STRING",
        },
        {
            name: "reason",
            description: "Provide a reason for this lockdown.",
            tyoe: "STRING",
        },
    ],
    /**
     * 
     * @param {CommandInteraction} interaction 
     */
    async execute(interaction) {
        const {
            guild,
            channel,
            options
        } = interaction;

        const Reason = options.getString("reason") || "no specified reason";

        const Embed = new MessageEmbed();

        if (!channel.permissionsFor(guild.id).has("SEND_MESSAGES"))
            return interaction.reply({
                embeds: [Embed.setColor("RED").
                    setDescription("⛔  | This channel is already locked."),
                ],
                ephemeral: true,
            });

        channel.permissionOverwrites.edit(guild.id, {
            SEND_MESSAGES: false,
        });
        interaction.reply({
            embeds: [Embed
                .setColor("RED")
                .setDescription(` | This channel is now under lockdown for: ${Reason}`
                ),
            ],
        });
        const Time = options.getString("time");
        if (Time) {
            const ExpireDate = Date.now() + ms(Time);
            DB.create({
                GuildID: guild.id,
                ChannelID: channel.id,
                Time: ExpireDate
            });

            setTimeout(async () => {
                channel.permissionOverwrites.edit(guild.id, {
                    SEND_MESSAGES: null,
                });
                interaction.editReply({
                        embeds: [Embed
                            .setDescription(" | The lockdown has been lifted")
                            .setColor("GREEN")
                        ],
                    })
                    .catch(() => {});
                await DB.deleteOne({
                    ChannelID: channel.id
                });
            }, ms(Time));
        }

    },
};

文件 4:unlock.js <-- 解锁命令

const {
    CommandInteraction,
    MessageEmbed
} = require("discord.js");
const DB = require("../../Structures/Schemas/LockDown");

module.exports = {
    name: "unlock",
    description: "Lift a lockdown from a channel",
    permission: "MANAGE_CHANNELS",
    /**
     * 
     * @param {CommandInteraction} interaction 
     */
    async execute(interaction) {
        const {
            guild,
            channel
        } = interaction;

        const Embed = new MessageEmbed();

        if (channel.permissionsFor(guild.id).has("SEND_MESSAGES"))
            return interaction.reply({
                embeds: [Embed
                    .setColor("RED")
                    .setDescription("⛔ | This channel is not locked"),
                ],
                ephemeral: true,
            });

        channel.permissionOverwrites.edit(guild.id, {
            SEND_MESSAGES: null,
        });

        await DB.deleteOne({
            ChannelID: channel.id
        });

        interaction.reply({
            embeds: [Embed
                .setColor("GREEN")
                .setDescription(" | Lockdown has been lifted."),
            ],
        });
    },
};

请帮我解决这个问题,我在这里找不到问题

您遇到的错误 (.options[1].type is required) 是一个非常重要的提示,说明问题是什么。搜索您的文件代码,我在 options[1]:

的第三个文件中看到了这个
{
    name: "reason",
    description: "Provide a reason for this lockdown.",
    tyoe: "STRING",
}

注意到问题了吗?这是一个错字。 "tyoe" 而不是 "type",导致 dj 抱怨需要 "type"