diff --git a/src/database/index.js b/src/database/index.js index 8d26de0..0528770 100644 --- a/src/database/index.js +++ b/src/database/index.js @@ -270,7 +270,7 @@ module.exports = async (log) => { }, }, name: DataTypes.STRING, - colour: DataTypes.INTEGER, + colour: DataTypes.CHAR(6), }, { tableName: DB_TABLE_PREFIX + 'role_entities' }); diff --git a/src/modules/tickets/archives.js b/src/modules/tickets/archives.js index 2574285..35967fc 100644 --- a/src/modules/tickets/archives.js +++ b/src/modules/tickets/archives.js @@ -1,3 +1,5 @@ +const { int2hex } = require('../../utils'); + /** Manages ticket archiving */ module.exports = class TicketArchives { /** @@ -103,7 +105,7 @@ module.exports = class TicketArchives { username: message.author.username, discriminator: message.author.discriminator, display_name: message.member.displayName, - colour: message.member.displayColor === 0 ? null : message.member.displayColor, + colour: message.member.displayColor === 0 ? null : int2hex(message.member.displayColor), bot: message.author.bot }); @@ -117,12 +119,13 @@ module.exports = class TicketArchives { where: m_model_data, defaults: m_model_data }); + await m_row.update({ avatar: member.user.displayAvatarURL(), username: member.user.username, discriminator: member.user.discriminator, display_name: member.displayName, - colour: member.displayColor === 0 ? null : member.displayColor, + colour: member.displayColor === 0 ? null : int2hex(member.displayColor), bot: member.user.bot }); }); @@ -154,7 +157,7 @@ module.exports = class TicketArchives { }); await r_row.update({ name: role.name, - colour: role.color === 0 ? 7506394 : role.color + colour: role.color === 0 ? '7289DA' : int2hex(role.color) // 7289DA = 7506394 }); }); } diff --git a/src/utils/index.js b/src/utils/index.js new file mode 100644 index 0000000..d75562b --- /dev/null +++ b/src/utils/index.js @@ -0,0 +1,3 @@ +module.exports = { + int2hex: (int) => int.toString(16).toUpperCase(), +}; \ No newline at end of file