qol changes for Util.ts
parent
77e50b61c5
commit
276467519f
|
@ -2,18 +2,18 @@
|
|||
/* eslint-disable no-await-in-loop */
|
||||
/* eslint-disable no-param-reassign */
|
||||
import axios from 'axios';
|
||||
import { randomBytes } from 'crypto';
|
||||
import {randomBytes} from 'crypto';
|
||||
import childProcess from 'child_process';
|
||||
import nodemailer from 'nodemailer';
|
||||
import { Message, DMChannel, User, MessageEmbed, ColorResolvable, TextChannel } from 'discord.js';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import {ColorResolvable, DMChannel, Message, MessageEmbed, TextChannel, User} from 'discord.js';
|
||||
import {v4 as uuid} from 'uuid';
|
||||
import moment from 'moment';
|
||||
import fs from 'fs';
|
||||
import hastebin from 'hastebin-gen';
|
||||
import { getUserByUid } from '../functions';
|
||||
import { AccountUtil, Client, Command, PaginationEmbed } from '.';
|
||||
import { ModerationInterface, AccountInterface } from '../models';
|
||||
import { Certificate } from '../../types/x509';
|
||||
import {getUserByUid} from '../functions';
|
||||
import {AccountUtil, Client, Command, PaginationEmbed} from '.';
|
||||
import {AccountInterface, ModerationInterface} from '../models';
|
||||
import {Certificate} from '../../types/x509';
|
||||
|
||||
export default class Util {
|
||||
public client: Client;
|
||||
|
@ -46,7 +46,7 @@ export default class Util {
|
|||
cmd.stdout.on('data', writeFunction);
|
||||
cmd.stderr.on('data', writeFunction);
|
||||
cmd.on('error', writeFunction);
|
||||
cmd.once('close', (code, signal) => {
|
||||
cmd.once('close', (code) => {
|
||||
cmd.stdout.off('data', writeFunction);
|
||||
cmd.stderr.off('data', writeFunction);
|
||||
cmd.off('error', writeFunction);
|
||||
|
@ -184,16 +184,14 @@ export default class Util {
|
|||
}
|
||||
|
||||
public async createHash(password: string): Promise<string> {
|
||||
const hashed = await this.exec(`mkpasswd -m sha-512 "${password}"`);
|
||||
return hashed;
|
||||
return this.exec(`mkpasswd -m sha-512 "${password}"`);
|
||||
}
|
||||
|
||||
public isValidEmail(email: string): boolean {
|
||||
const checkAt = email.indexOf('@');
|
||||
if (checkAt < 1) return false;
|
||||
const checkDomain = email.indexOf('.', checkAt + 2);
|
||||
if (checkDomain < checkAt) return false;
|
||||
return true;
|
||||
return checkDomain >= checkAt;
|
||||
}
|
||||
|
||||
public randomPassword(): string {
|
||||
|
|
Loading…
Reference in New Issue