Skip to content

Commit

Permalink
Changed shardtimes to list names horizontally, and alphabetically
Browse files Browse the repository at this point in the history
  • Loading branch information
jmiln committed Nov 26, 2018
1 parent 100ecf3 commit 73a1b4c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions commands/faction.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class Faction extends Command {
async run(client, message, args) {
const charList = client.characters;
let allyCode = null;
if (!args[0]) {
return message.channel.send(message.language.get("COMMAND_FACTION_INVALID_CHAR", message.guildSettings.prefix));
}
if (args[0].toLowerCase() === "me" || client.isAllyCode(args[0]) || client.isUserID(args[0])) {
allyCode = args.splice(0, 1);
allyCode = await client.getAllyCode(message, allyCode);
Expand Down
13 changes: 9 additions & 4 deletions commands/shardtimes.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ class Shardtimes extends Command {
const fields = [];
sortedShardTimes.forEach(time => {
const times = [];
console.log("Time: " + time);
console.log(shardOut[time]);
shardOut[time].forEach(user => {
let userFlag = client.emojis.get(shardTimes[user].flag);
if (!userFlag) {
Expand All @@ -175,12 +177,15 @@ class Shardtimes extends Command {
const userName = user;
uName = userName.length > maxLen ? userName.substring(0, maxLen) : userName;
}
times.push(`${shardTimes[user].flag != "" ? userFlag : ""}${uName}`);
times.push({
flag: shardTimes[user].flag != "" ? userFlag : "",
name: uName
});
});
const sortedTimes = times.sort((a, b) => a.name.toLowerCase() > b.name.toLowerCase() ? 1 : 0).map(t => `${t.flag}${t.name}`);
fields.push({
"name": time,
value: times.join("\n"),
"inline": true
name: time,
value: sortedTimes.join(" - ")
});
});
return message.channel.send({
Expand Down

0 comments on commit 73a1b4c

Please sign in to comment.