remove uuid from log id, use randomBytes(2).toString('hex') instead
parent
99d7e6c433
commit
d2d3a5c335
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-disable no-bitwise */
|
/* eslint-disable no-bitwise */
|
||||||
import { Member, User } from 'eris';
|
import { Member, User } from 'eris';
|
||||||
import { v4 as uuid } from 'uuid';
|
import { randomBytes } from 'crypto';
|
||||||
import moment, { unitOfTime } from 'moment';
|
import moment, { unitOfTime } from 'moment';
|
||||||
import { Client, RichEmbed } from '.';
|
import { Client, RichEmbed } from '.';
|
||||||
import { Moderation as ModerationModel, ModerationInterface } from '../models';
|
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<ModerationInterface> {
|
public async ban(user: User, moderator: Member, duration: number, reason?: string): Promise<ModerationInterface> {
|
||||||
if (reason && reason.length > 512) throw new Error('Ban reason cannot be longer than 512 characters');
|
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);
|
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({
|
const mod = new ModerationModel({
|
||||||
userID: user.id,
|
userID: user.id,
|
||||||
logID,
|
logID,
|
||||||
|
@ -85,7 +85,7 @@ export default class Moderation {
|
||||||
this.client.unbanGuildMember(this.client.config.guildID, userID, reason);
|
this.client.unbanGuildMember(this.client.config.guildID, userID, reason);
|
||||||
const user = await this.client.getRESTUser(userID);
|
const user = await this.client.getRESTUser(userID);
|
||||||
if (!user) throw new Error('Cannot get user.');
|
if (!user) throw new Error('Cannot get user.');
|
||||||
const logID = uuid();
|
const logID = randomBytes(2).toString('hex');
|
||||||
const mod = new ModerationModel({
|
const mod = new ModerationModel({
|
||||||
userID,
|
userID,
|
||||||
logID,
|
logID,
|
||||||
|
|
Loading…
Reference in New Issue