From d2d3a5c335806df150c636547044fe63bdd93efa Mon Sep 17 00:00:00 2001 From: Matthew R Date: Fri, 17 Apr 2020 23:05:10 -0400 Subject: [PATCH] remove uuid from log id, use randomBytes(2).toString('hex') instead --- src/class/Moderation.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/class/Moderation.ts b/src/class/Moderation.ts index 71fcb22..e7d3975 100644 --- a/src/class/Moderation.ts +++ b/src/class/Moderation.ts @@ -1,6 +1,6 @@ /* eslint-disable no-bitwise */ import { Member, User } from 'eris'; -import { v4 as uuid } from 'uuid'; +import { randomBytes } from 'crypto'; import moment, { unitOfTime } from 'moment'; import { Client, RichEmbed } from '.'; import { Moderation as ModerationModel, ModerationInterface } from '../models'; @@ -43,7 +43,7 @@ export default class Moderation { public async ban(user: User, moderator: Member, duration: number, reason?: string): Promise { if (reason && reason.length > 512) throw new Error('Ban reason cannot be longer than 512 characters'); await this.client.guilds.get(this.client.config.guildID).banMember(user.id, 7, reason); - const logID = uuid(); + const logID = randomBytes(2).toString('hex'); const mod = new ModerationModel({ userID: user.id, logID, @@ -85,7 +85,7 @@ export default class Moderation { this.client.unbanGuildMember(this.client.config.guildID, userID, reason); const user = await this.client.getRESTUser(userID); if (!user) throw new Error('Cannot get user.'); - const logID = uuid(); + const logID = randomBytes(2).toString('hex'); const mod = new ModerationModel({ userID, logID,