Skip to content

Commit

Permalink
fix: handle avatar hashes (closes #442)
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiTenno committed Feb 12, 2021
1 parent 11cb3c5 commit 5a4a98b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/settings/Database.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const fs = require('fs');
const { assetBase, platforms } = require('../CommonFunctions');
const logger = require('../Logger');

const avatarPrefix = `https://cnd.discordapp.com/avatars/${process.env.BOT_USER_ID}`;

const props = (obj) => {
const p = [];
for (; obj != null; obj = Object.getPrototypeOf(obj)) { // eslint-disable-line no-param-reassign
Expand Down Expand Up @@ -254,6 +256,10 @@ class Database {
setting: row.setting,
value: row.val,
})).forEach((row) => {
if (row.setting === 'webhookAvatar' && !row.value.startsWith('http')) {
// handle sending hashes
row.value = `${avatarPrefix}/${row.value}.png`;
}
if (row.setting.indexOf('webhook') === -1) {
context[`${row.setting}`] = row.value;
} else {
Expand Down

0 comments on commit 5a4a98b

Please sign in to comment.