diff options
Diffstat (limited to 'commands')
| -rw-r--r-- | commands/vainsocial/guild_add.js | 12 | ||||
| -rw-r--r-- | commands/vainsocial/guild_update.js | 15 |
2 files changed, 8 insertions, 19 deletions
diff --git a/commands/vainsocial/guild_add.js b/commands/vainsocial/guild_add.js index e3a0008..bf8f8f6 100644 --- a/commands/vainsocial/guild_add.js +++ b/commands/vainsocial/guild_add.js @@ -31,18 +31,12 @@ Register IGNs to your Guild. guildAddView = new GuildAddView(msg, playersStatus); // create waiter dict & data dict await Promise.each(playersWaiters, async (waiter, idx) => { - await api.upsearchPlayer(args[idx]); let success = false; try { playersStatus[args[idx]] = "Loading…"; - do { - try { - await api.getPlayer(args[idx]); - success = true; - } catch (err) { } - await guildAddView.respond(); - } while (["stats_update", "matches_update", undefined] - .indexOf(await waiter.next())); + await guildAddView.respond(); + await api.upsearchPlayerSync(args[idx]); + success = true; } catch (err) { console.error(err); playersStatus[args[idx]] = err.error.err; diff --git a/commands/vainsocial/guild_update.js b/commands/vainsocial/guild_update.js index c3163be..a61647f 100644 --- a/commands/vainsocial/guild_update.js +++ b/commands/vainsocial/guild_update.js @@ -42,16 +42,11 @@ Update the match history for all your Guild members. const playersWaiters = names.map((name) => api.subscribeUpdates(name)); // create waiter dict & data dict await Promise.each(playersWaiters, async (waiter, idx) => { - await api.updatePlayer(names[idx]); - while (["stats_update", undefined].indexOf(await waiter.next())) { - try { - await api.getPlayer(names[idx]); - playersStatus[names[idx]] = "Loaded."; - } catch (err) { - playersStatus[names[idx]] = "Loading…"; - } - await guildUpdateView.respond(); - } + playersStatus[names[idx]] = "Loading…"; + await guildUpdateView.respond(); + await api.upsearchPlayerSync(names[idx]); + playersStatus[names[idx]] = "Loaded."; + await guildUpdateView.respond(); }); await guildUpdateView.respond("Your Guild's fame is being updated…"); try { |
