Hi i'm making a command for my bot which lists all "orders" from a orders.json file the orders.json file has these "orders" stored like this
{
"ysh": {
"orderID": "ysh",
"userID": "734532125021307001",
"guildID": "745621984192364574",
"guild": "Cybers Taco Stand Server",
"channelID": "745621984192364578",
"order": "taco",
"customer": "ultradeadmeme#7674",
"status": "Ready",
"ticketChannelMessageID": "not set",
"chef": "597167860200243212",
"chefmention": "ultradeadmeme#7674"
},
"lhb": {
"orderID": "lhb",
"userID": "734532125021307001",
"guildID": "745409671430668389",
"guild": "Cybers Taco Stand Server",
"channelID": "746423099871985755",
"order": "a",
"customer": "Aro#1221",
"status": "Unclaimed",
"ticketChannelMessageID": "not set"
}
}
and now i want the command to lists all the orders in that file
the command code:
const fsn = require("fs-nextra");
const Discord = require('discord.js');
module.exports = {
name: 'list',
description: 'List of all orders',
aliases: ['allorders'],
execute(message) {
fsn.readJSON("./orders.json").then((orderDB) => {
let orderString;
for(let x in orderDB) {
orderString = "`" + x + "`: " + orderDB[x].status + "
";
// add newline character at the end to display each "order" on a separate line
}
const exampleEmbed = new Discord.MessageEmbed()
.setTitle('Here's a list of the current orders and their status.')
.setDescription(orderString)
.setTimestamp()
.setFooter(message.member.user.tag, message.author.avatarURL());
message.channel.send(exampleEmbed);
});
}
}
the problem is it only lists one order but i want it to view all the orders any way to fix this?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…