Travis C
Travis C

Reputation: 77

how do i store a user in a variable in discord.js

so, I am running a boy scout server and for it, I am making a bot. we have been struggling to get everyone's real name for better organization. the bot will ask for their name and they will type !name Travis_c. then I want it to store their discord username in a variable and send me a message saying trullycool => Travis_C. with that information, it would be super simple to change their nickname on the server. I am running into issues with getting the user who sent the previous message, into a variable. my code is


`

  1.    case 'name':
         name = args[1];
         const channel = message.guild.channels.cache.find(channel => channel.name === "names");
         user = message.author()
         if(!channel) return;
         message.channel.send(`${user} => ${name}`)
    

`


I am having issues on user = message.author() I know if I want to reply to something I do message.reply but that wouldn't work in my situation. thanks in advance!

Upvotes: 1

Views: 1266

Answers (1)

CedarBlocks
CedarBlocks

Reputation: 86

message.author is not a function so there is no need for () at the end of it.

Upvotes: 1

Related Questions