mirror of
https://github.com/Myxelium/RandomMemerBot.git
synced 2026-04-13 18:40:36 +00:00
Larger refactoring and added avoidlist
This commit is contained in:
18
client/handlers/getSoundFiles.ts
Normal file
18
client/handlers/getSoundFiles.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import express from 'express';
|
||||
import path from 'path';
|
||||
import * as fileSystem from 'fs';
|
||||
import { LoggerColors } from '../../helpers/logger-colors';
|
||||
|
||||
/**
|
||||
* Returns a list of all sound files in the sounds directory.
|
||||
* @returns string[] - An array of all sound files in the sounds directory.
|
||||
*/
|
||||
export function GetSoundFiles(response: express.Response) {
|
||||
const directoryPath = path.join(__dirname, '../../sounds');
|
||||
fileSystem.readdir(directoryPath, function (error: any, files: any[]) {
|
||||
if (error) {
|
||||
return console.log(LoggerColors.Red, 'Unable to scan directory: ' + error);
|
||||
}
|
||||
response.send(files);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user