Skip to content

Commit

Permalink
[New] Added commandsReadMe function to generate table markdown of all…
Browse files Browse the repository at this point in the history
… commands!
  • Loading branch information
naseif committed Sep 3, 2021
1 parent 69cfb44 commit 5f726fb
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 0 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,44 @@ The bot is still in the development phase You can check the release page for the
- Moderation Commands 🔨
- and more ⌛️


## Commands

| Name | Description |
|:--------------------|:----------------------------------------------------------------:|
| **/addrole** | adds a role for a user |
| **/ban** | Bans a user from the server |
| **/deletemessages** | deletes x number of messages |
| **/kick** | kicks a user from the server |
| **/region** | changes the region of the voice channel the user is connected to |
| **/regionbyid** | changes a voice channel region by channel id |
| **/removerole** | removes a role for a user |
| **/unban** | unbans a user with id |
| **/8ball** | ask the magic ball a question! |
| **/insult** | insult your fav user <3 |
| **/joke** | gets a random joke! |
| **/useravatar** | Sends the user's avatar |
| **/help** | Shows all available commands for this bot! |
| **/nickname** | Changes your own nickname or other user's |
| **/perms** | Shows the permission for another member or your own |
| **/ping** | ping the bot connection to the server |
| **/serverstats** | Shows some stats about the server |
| **/summon** | ping the bot connection to the server |
| **/back** | plays previous track from the queue |
| **/clear** | clears the music queue |
| **/disconnect** | disconnects from the channel |
| **/lyrics** | gets the lyrics of the current song |
| **/nowplaying** | shows the current music name |
| **/pause** | pauses the song |
| **/play** | plays music from Youtube |
| **/listqueue** | Shows the current queue |
| **/loop** | repeats the current song |
| **/resume** | resumes the song |
| **/seek** | seeks the current song to the given position |
| **/shuffle** | shuffles the music queue |
| **/skip** | skips a song from the queue |
| **/stop** | stops the current song playing |

## Requirements

- Node.js (v16.6 or higher)
Expand Down
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const client = new Client({
],
restRequestTimeout: 30000,
});
const { commandsReadMe } = require("./modules/commandsReadMe");
const { findAndRequire } = require("./modules/loopAndRequireCommands");
const { Player } = require("discord-player");
const player = new Player(client);
Expand All @@ -20,6 +21,8 @@ const admin = (client.commands.admin = new Collection());
const fun = (client.commands.fun = new Collection());
const music = (client.commands.music = new Collection());
const misc = (client.commands.misc = new Collection());


// Admin Commands
findAndRequire("commands/admin", ".js", admin);

Expand Down
22 changes: 22 additions & 0 deletions modules/commandsReadMe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const mdtable = require("mdtable");
const { writeFileSync } = require("fs");
module.exports.commandsReadMe = (commands) => {

const tableData = {
header: ["Name", "Description"],
alignment: ["L", "C"],
rows: [],
};
const tableSettings = {
borders: true,
padding: 1,
};

commands.map(command => {
tableData.rows.push([`**/${command.data.name}**`, command.data.description])
})

const commandsTable = mdtable(tableData, tableSettings)

writeFileSync("./Commands.md", commandsTable, "utf-8");
};
33 changes: 33 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,8 @@
"node-fetch": "^2.6.1",
"utf-8-validate": "^5.0.5",
"zlib-sync": "^0.1.7"
},
"devDependencies": {
"mdtable": "^0.3.1"
}
}

0 comments on commit 5f726fb

Please sign in to comment.