I'm trying to code a warning system for a discord bot using Discord.JS and Sequelize. Saving the warns works, but fetching doesn't work.
async function warnGet() {
let msgArgs = message.content.split(" ");
var ReportID = Math.floor(1000 + Math.random() * 9000);
let messageReason = msgArgs[2]
? message.content.substring(
msgArgs.slice(0, 3).join(" ").length + 1
)
: "No reason provided";
(async () => {
try {
let userTag = member.user.tag;
let warningYes = JSON.stringify(
await moderationLogging.findAll({
where: {
Member: userTag,
},
}),
{ raw: true }
);
warningYes = JSON.parse(warningYes);
const faqembed = new MessageEmbed()
.setColor("#ff9100")
.addField(
`Reason: ${warningYes.Reason}`,
`Report ID: ${warningYes.ReprtID}`
)
.setAuthor(
member.user.username,
member.user.displayAvatarURL({
format: "jpg",
dynamic: "true",
})
);
warningYes.forEach((e) => {
faqembed.addField(
`Reason: ${warningYes.Reason}`,
`Report ID: ${warningYes.ReprtID}`
);
});
message.channel.send(faqembed);
} catch (error) {
message.channel.send(
`Aw maaaaan. I couldn't do the thing I needed to do. <@388813100964642816> should prob know about this. The technical stuff\` \`\`\`xl\n${clean(
error
)}\n\`\`\``
);
console.log(error);
}
})();
}
this code when ran returns this This leads to the result.
I'm not sure why. Any help would be appreciated. These are the entries it's trying to get Image