Table of Contents
About
Discord bot projects usually maintain a lot of files due to every file being a separate command, event, handler or some data storing json files, so keeping the files organized in tree structure folders like "commands/moderation/admins-only/ban.js", yet keeping track of each file path in order to reference it anywhere inside your commands, for example: if you're making a test command to test the welcome event message rather than kicking and re-joining from another acount it'd be better to have a test command and be somewhere like "commands/tests/event-tests/welcome-test.js" and you want to require the event located at "events/guild/welcome.js" so you can call it from the tets command, you propably would write something like Key features of paths-manager:
Additional important infopaths-manager keeps the stored paths in variables, meaning they'll be lost once the project is stopped and you'll need to save the files every time you run it paths-manager will auto detect all main folders if non were specified in the save files function. paths-manager finding functions will require the extension of the file name. when having a file with the same name as an other file, paths-manager will return the first one it finds. |
Built With
- Node.js
- Javascript
Getting Started
Prerequisites
Install paths-manager by running the following command in your node.js project:
npm i paths-manager
or
npm install paths-manager
Usage
Require the paths-manager module like so
const pathsManager = require('paths-manager');
.Save all your main folders files at the beggining of your project.
When you want to get the full path of a file that you know it's name, require the package like before.
then use the function for getting a file path, give it the full file name with it's extension like so
'example.js'
.if you have more than one file with the same name then use the function for getting a file path with a folder name it's inside, provide the folder name along with the file name to get the exact one you want.
Contributing
First off, thanks for taking the time to contribute! Contributions are what makes the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are greatly appreciated.
Please try to create bug reports that are:
- Reproducible. Include steps to reproduce the problem.
- Specific. Include as much detail as possible: which version, what environment, etc.
- Unique. Do not duplicate existing opened issues.
- Scoped to a Single Bug. One bug per report.
Support
Try contacting one of the followings:
License
This project is licensed under the MIT license. Feel free to edit and distribute this template as you like. See LICENSE for more information.