refactor: remove cryptr prefix

This commit is contained in:
Isaac
2022-10-24 17:44:07 +01:00
parent 15df841774
commit ecd23a150a
5 changed files with 21 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
const { Autocompleter } = require('@eartharoid/dbf');
const emoji = require('node-emoji');
const Cryptr = require('cryptr');
const cryptr = new Cryptr(process.env.ENCRYPTION_KEY);
const { decrypt } = new Cryptr(process.env.ENCRYPTION_KEY);
module.exports = class ReferencesCompleter extends Autocompleter {
constructor(client, options) {
@@ -45,7 +45,7 @@ module.exports = class ReferencesCompleter extends Autocompleter {
.slice(0, 25)
.map(t => {
const date = new Date(t.createdAt).toLocaleString(settings.locale, { dateStyle: 'short' });
const topic = t.topic ? '| ' + cryptr.decrypt(t.topic).substring(0, 50) : '';
const topic = t.topic ? '| ' + decrypt(t.topic).substring(0, 50) : '';
const category = emoji.hasEmoji(t.category.emoji) ? emoji.get(t.category.emoji) + ' ' + t.category.name : t.category.name;
return {
name: `${category} #${t.number} - ${date} ${topic}`,

View File

@@ -1,7 +1,7 @@
const { Autocompleter } = require('@eartharoid/dbf');
const emoji = require('node-emoji');
const Cryptr = require('cryptr');
const cryptr = new Cryptr(process.env.ENCRYPTION_KEY);
const { decrypt } = new Cryptr(process.env.ENCRYPTION_KEY);
module.exports = class TicketCompleter extends Autocompleter {
constructor(client, options) {
@@ -45,7 +45,7 @@ module.exports = class TicketCompleter extends Autocompleter {
.slice(0, 25)
.map(t => {
const date = new Date(t.createdAt).toLocaleString(settings.locale, { dateStyle: 'short' });
const topic = t.topic ? '| ' + cryptr.decrypt(t.topic).substring(0, 50) : '';
const topic = t.topic ? '| ' + decrypt(t.topic).substring(0, 50) : '';
const category = emoji.hasEmoji(t.category.emoji) ? emoji.get(t.category.emoji) + ' ' + t.category.name : t.category.name;
return {
name: `${category} #${t.number} - ${date} ${topic}`,