Skip to content

Commit

Permalink
Database encryption
Browse files Browse the repository at this point in the history
Security ™️
  • Loading branch information
eartharoid committed Apr 6, 2021
1 parent ba8c506 commit 1bc2e73
Show file tree
Hide file tree
Showing 16 changed files with 361 additions and 354 deletions.
1 change: 1 addition & 0 deletions example.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
DISCORD_TOKEN=
DB_ENCRYPTION_KEY=
DB_TYPE=sqlite
DB_HOST=
DB_PORT=
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
"dependencies": {
"@eartharoid/i18n": "^0.0.1",
"boxen": "^5.0.0",
"cryptr": "^6.0.2",
"discord.js": "^12.5.1",
"dotenv": "^8.2.0",
"fs-extra": "^9.1.0",
"leeks.js": "^0.0.9",
"leekslazylogger-fastify": "^0.1.0",
"node-fetch": "^2.6.1",
Expand Down
39 changes: 6 additions & 33 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 15 additions & 5 deletions src/commands/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { MessageEmbed } = require('discord.js');
const Command = require('../modules/commands/command');
const { footer } = require('../utils/discord');
const { letters } = require('../utils/emoji');
const { wait } = require('../utils');

module.exports = class NewCommand extends Command {
constructor(client) {
Expand Down Expand Up @@ -87,8 +88,12 @@ module.exports = class NewCommand extends Command {
}

setTimeout(async () => {
await response.delete();
await message.delete();
await response
.delete()
.catch(() => this.client.log.warn('Failed to delete response message'));
await message
.delete()
.catch(() => this.client.log.warn('Failed to delete original message'));
}, 15000);
};

Expand Down Expand Up @@ -122,7 +127,8 @@ module.exports = class NewCommand extends Command {
);

for (let i in categories.rows) {
await collector_message.react(letters_array[i]); // add the correct number of letter reactions
collector_message.react(letters_array[i]); // add the correct number of letter reactions
await wait(1000); // 1 reaction per second rate-limit
}

const collector_filter = (reaction, user) => {
Expand Down Expand Up @@ -153,8 +159,12 @@ module.exports = class NewCommand extends Command {
.setFooter(footer(settings.footer, i18n('message_will_be_deleted_in', 15)), message.guild.iconURL())
);
setTimeout(async () => {
await collector_message.delete();
await message.delete();
await collector_message
.delete()
.catch(() => this.client.log.warn('Failed to delete response (collector) message'));
await message
.delete()
.catch(() => this.client.log.warn('Failed to delete original message'));
}, 15000);
}
});
Expand Down
Loading

0 comments on commit 1bc2e73

Please sign in to comment.