Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { promisify } from 'tsubaki';
import { IConfig } from '../interfaces/Config';
import Command, { Trigger } from '../structures/Command';
import HandlesClient from './Client';
import fs = require('fs');
import path = require('path');
const readdir: (dir: string) => Promise = promisify(fs.readdir);
const stat: (path: string) => Promise = promisify(fs.stat);
/**
* Manage command loading.
*/
export default class CommandRegistry extends Map {
/**
* Get all the file paths recursively in a directory.
* @param dir The directory to start at.
*/
private static async _loadDir(dir: string): Promise {
const files = await readdir(dir);
const list: string[] = [];
await Promise.all(files.map(async (f) => {
import { promisify } from 'tsubaki';
import { IConfig } from '../interfaces/Config';
import Command, { Trigger } from '../structures/Command';
import HandlesClient from './Client';
import fs = require('fs');
import path = require('path');
const readdir: (dir: string) => Promise = promisify(fs.readdir);
const stat: (path: string) => Promise = promisify(fs.stat);
/**
* Manage command loading.
*/
export default class CommandRegistry extends Map {
/**
* Get all the file paths recursively in a directory.
* @param dir The directory to start at.
*/
private static async _loadDir(dir: string): Promise {
const files = await readdir(dir);
const list: string[] = [];
await Promise.all(files.map(async (f) => {
const currentPath = path.join(dir, f);