Skip to content

Commit

Permalink
fix: add fix the capture for default role
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobiah committed May 1, 2020
1 parent eca16af commit df743c6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/commands/DefaultRoles/AddDefaultRole.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ class AddDefaultRole extends Command {
this.usages = [
{ description: 'Add a new default role for persons joining the server.', parameters: ['role id'] },
];
this.regex = new RegExp(`^${this.call}\\s?${captures.roles}?$`, 'i');
this.regex = new RegExp(`^${this.call}\\s?${captures.role}?$`, 'i');
this.requiresAuth = true;
this.allowDM = false;
}

async run(message) {
async run(message, ctx) {
const roleId = message.strippedContent.match(this.regex)[1];
if (roleId && message.guild.roles.cache.has(roleId.trim())) {
const roles = JSON.parse(await this.settings.getGuildSetting(message.guild, 'defaultRoles') || '[]');
Expand Down
2 changes: 1 addition & 1 deletion src/commands/DefaultRoles/DeleteDefaultRole.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class DeleteDefaultRole extends Command {
this.usages = [
{ description: 'Delete a default role for persons joining the server.', parameters: ['role mention'] },
];
this.regex = new RegExp(`^${this.call}\\s?${captures.roles}?$`, 'i');
this.regex = new RegExp(`^${this.call}\\s?${captures.role}?$`, 'i');
this.requiresAuth = true;
this.allowDM = false;
}
Expand Down
3 changes: 2 additions & 1 deletion src/eventHandlers/Ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ class OnReadyHandle extends Handler {
cetusState.isDay = !cetusState.isDay;
}

const ousRemaining = (((new Date(outpost.expiry).getTime() - Date.now()) / 1000) % 60).toFixed(0);
const vs = vallisState ? `${timeDeltaToMinutesString(vsFromNow) || '0m'}: ${vallisState.isWarm ? '❄' : '🔥'} • ` : '';
const cs = cetusState ? `${timeDeltaToMinutesString(csFromNow) || '0m'}: ${cetusState.isDay ? '🌙' : '☀'} • ` : '';
const ous = outpost.active ? `${outpost.mission.node.split('(')[0]} • ` : '';
const ous = outpost.active ? `${outpost.mission.node.split('(')[0]}: ${ousRemaining}m • ` : '';
return `${ous}${vs}${cs}${base}`;
}
return base;
Expand Down

0 comments on commit df743c6

Please sign in to comment.