I am trying to make a discord bot that has a help command which sends an embed with fields, each one corresponding to a command. I want to automatically set the values of these fields to the correct command file description. This is an example of the command file:
module.exports = {
name: 'kick',
description: "Kicks the mentioned user. Administrator permissions required",
execute(message, args) {
// command code
}
I am trying to set the field values to the module exports description. If this is possible, how would I achieve this?
You can use
Client#commands#get
to get the object of the command, then simply use.description
to get that command’s description.For this example I will use
Client
as the Client object, however if yours is Bot or anything else, adjust the code accordingly.Example Module:
How to get the description:
If you’re inside the command you want to get the description of, simply use
this
to reference the current commandreddit propecia – propecia maker post finasteride syndrome