quick.db 出现错误
我试图制作一个 view-case 命令来查看用户惩罚的详细信息等等。但我得到一个错误说warnInfo is not iterable
有人可以帮助我
const Discord = require("discord.js");
const database = require("quick.db");
const config = require('../config.json');
module.exports = {
name: "view-case",
description: "View details of a user's punishment / warnings.",
async execute(message, args) {
const warnInfo = database.get(`info.${message.author.id}.${message.guild.id}`)
if(!args.length) {
// invalid usage returns
};
for(let warnings of warnInfo){
let mod = warnings.moderator
let reason = warnings.reason
let date = warnings.date
let cases = warnings.cases
let numbercase = warnings.numbercase
let dur = warnings.duration
if(args[0] === numbercase) {
let embed = new Discord.MessageEmbed()
.setAuthor(message.author.tag, message.author.displayAvatarURL({ dynamic: true }))
.setTitle(`Case #${numbercase}`)
.setDescription(`**Case**: ${cases} \n**Moderator**: ${mod} \n**Reason**: ${reason} \n**Date**: ${date} \n**Mute Duration**: ${dur}`)
.setColor("RANDOM")
.setTimestamp();
return message.channel.send(embed)
}
}
}
}
错误日志
(node:3308) UnhandledPromiseRejectionWarning: TypeError: warnInfo is not iterable
at Object.execute (C:\Users\DS9\Documents\GitHub\sarah\commands\view-case.js:29:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3308) 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:3308) [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..```