Add arrow-parens eslint rule & fix inconsistencies

This commit is contained in:
Crawl
2017-03-13 15:56:00 +01:00
parent cee0d58fb8
commit 4ef0ec491c
5 changed files with 41 additions and 38 deletions

View File

@@ -278,7 +278,7 @@ class Message {
get cleanContent() {
return this.content
.replace(/@(everyone|here)/g, '@\u200b$1')
.replace(/<@!?[0-9]+>/g, (input) => {
.replace(/<@!?[0-9]+>/g, input => {
const id = input.replace(/<|!|>|@/g, '');
if (this.channel.type === 'dm' || this.channel.type === 'group') {
return this.client.users.has(id) ? `@${this.client.users.get(id).username}` : input;
@@ -294,12 +294,12 @@ class Message {
return input;
}
})
.replace(/<#[0-9]+>/g, (input) => {
.replace(/<#[0-9]+>/g, input => {
const channel = this.client.channels.get(input.replace(/<|#|>/g, ''));
if (channel) return `#${channel.name}`;
return input;
})
.replace(/<@&[0-9]+>/g, (input) => {
.replace(/<@&[0-9]+>/g, input => {
if (this.channel.type === 'dm' || this.channel.type === 'group') return input;
const role = this.guild.roles.get(input.replace(/<|@|>|&/g, ''));
if (role) return `@${role.name}`;