summaryrefslogtreecommitdiff
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/vainsocial/guild_add.js14
-rw-r--r--commands/vainsocial/guild_update.js2
2 files changed, 11 insertions, 5 deletions
diff --git a/commands/vainsocial/guild_add.js b/commands/vainsocial/guild_add.js
index 8fe952c..75eb5f3 100644
--- a/commands/vainsocial/guild_add.js
+++ b/commands/vainsocial/guild_add.js
@@ -30,17 +30,23 @@ Register IGNs to your Guild.
const playersWaiters = args.map((name) => api.subscribeUpdates(name)),
guildAddView = new GuildAddView(msg, playersData);
// create waiter dict & data dict
- await Promise.map(playersWaiters, async (waiter, idx) => {
+ await Promise.each(playersWaiters, async (waiter, idx) => {
await api.upsearchPlayer(args[idx]);
let success = false;
- while (["stats_update", undefined].indexOf(await waiter.next())) {
- playersData[args[idx]] = await api.getPlayer(args[idx]);
+ while (["stats_update", "matches_update", undefined].indexOf(
+ await waiter.next())) {
+ try {
+ playersData[args[idx]] = await api.getPlayer(args[idx]);
+ success = true;
+ } catch (err) {
+ playersData[args[idx]] = undefined;
+ }
await guildAddView.respond();
- success = true;
}
if (success) {
await api.addToGuild(msg.author.id, args[idx]);
}
});
+ await guildAddView.respond("Your Guild members were added.");
}
};
diff --git a/commands/vainsocial/guild_update.js b/commands/vainsocial/guild_update.js
index 7d36b0e..f0360ea 100644
--- a/commands/vainsocial/guild_update.js
+++ b/commands/vainsocial/guild_update.js
@@ -42,7 +42,7 @@ Update the match history for all your Guild members.
// update all the IGNs
const playersWaiters = names.map((name) => api.subscribeUpdates(name));
// create waiter dict & data dict
- await Promise.map(playersWaiters, async (waiter, idx) => {
+ await Promise.each(playersWaiters, async (waiter, idx) => {
await api.updatePlayer(names[idx]);
let success = false;
while (["stats_update", undefined].indexOf(await waiter.next())) {