fixed error with buildHelper

This commit is contained in:
Xetera
2019-07-29 04:12:09 -04:00
committed by Jean-Philippe Sirois
parent 71b6078e40
commit 2fd129acc2
+3 -5
View File
@@ -11,16 +11,14 @@ module.exports = {
const hash = identifier.slice(hashLocation + 1) const hash = identifier.slice(hashLocation + 1)
return [name, hash] return [name, hash]
}, },
getDefaultAvatar(name) { getDefaultAvatar(hash) {
const [_, hash] = this.splitHash(hashLocation) const avatar = hash % DEFAULT_AVATAR_MODULO
const avatar = Number(hash) % DEFAULT_AVATAR_MODULO
return `https://cdn.discordapp.com/embed/avatars/${avatar}.png` return `https://cdn.discordapp.com/embed/avatars/${avatar}.png`
}, },
resolveAuthor(users, author) { resolveAuthor(users, author) {
const target = users.find(user => user.identifier === author) const target = users.find(user => user.identifier === author)
const [name, hash] = this.splitHash(author) const [name, hash] = this.splitHash(author)
const avatar = target ? target.avatar : this.getDefaultAvatar(author) const avatar = target ? target.avatar : this.getDefaultAvatar(hash)
return { return {
name, name,