0
votes

I want that the username of the user, who requested the command gets displayed in the footer. I have tried many things, but I dont know how I am supposed to do it. My code is here:

const exampleEmbed = new Discord.MessageEmbed()

.setColor('#000033')
.setTitle('```Help```')
.setDescription('For more help, type .help (command)')
.addFields(
    { name: '.list', value: 'Opens list of all the achievements' },
    { name: '.profile', value: 'Opens achievement statistics from a member', },
    { name: '.leaderbord', value: 'Opens a leaderbord of the members with most achievements', },
    { name: '.bot', value: 'Opens bot links and information about the bot', },
    { name: '.setup', value: 'Starts the setup of the bot (only for administrators)', }
)
.setTimestamp()
.setFooter("here should the name stand")

    client.on("message", (message) => {
        if (message.content == ".help") {
            message.channel.send(exampleEmbed)
            console.log(message.member.user.tag +' executed command .HELP')
        }
    })
1

1 Answers

0
votes

You are looking for .setFooter(message.author.username)

Full Code:

    client.on("message", (message) => {
        if (message.content == ".help") {
             const exampleEmbed = new Discord.MessageEmbed()
               .setColor('#000033')
               .setTitle('```Help```')
               .setDescription('For more help, type .help (command)')
               .addFields(
                  { name: '.list', value: 'Opens list of all the achievements' },
                  { name: '.profile', value: 'Opens achievement statistics from a member', },
                  { name: '.leaderbord', value: 'Opens a leaderbord of the members with most achievements', },
                  { name: '.bot', value: 'Opens bot links and information about the bot', },
                  { name: '.setup', value: 'Starts the setup of the bot (only for administrators)', }
               )
               .setTimestamp()
               .setFooter(message.author.username);

            message.channel.send(exampleEmbed)
            console.log(message.member.user.tag +' executed command .HELP')
        }
    })

as mentioned below, you need to put your embed inside the message event listener