aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main.js b/src/main.js
index f1df54b..5d0f95e 100644
--- a/src/main.js
+++ b/src/main.js
@@ -195,16 +195,20 @@ async function getCodMLoadOut(message, args) {
view: "Grid view",
filterByFormula: `({cod_username} = '${args[0]}')`
}).eachPage(function page(records, fetchNextPage) {
- records.forEach((record) => {
- const loadOutMessage = new MessageEmbed()
+ if (records && records.length > 0) {
+ records.forEach((record) => {
+ const loadOutMessage = new MessageEmbed()
.setTitle(`Loadout of ${codUserName} : ${record.get('cod_match_type')}`)
.addField('Weapon Name', record.get('cod_weapon_name'),true)
.addField('Weapon Type', record.get('cod_weapon_type'),true)
.addField('Attachments', record.get('cod_weapon_attachments'),true)
.setColor("RANDOM");
- message.channel.send(loadOutMessage);
- });
- fetchNextPage();
+ message.channel.send(loadOutMessage);
+ });
+ fetchNextPage();
+ } else {
+ message.channel.send(`No Loadout found for ***${codUserName}***`);
+ }
}, function done(err) {
if (err) { console.error(err); return; }