Trying to add a !me command

Im trying to create a command that just says random things about the user but it keeps saying “User is not defined.”

@inveeus

Are you perhaps using an $(eval) variable? You have to create a variable called ‘user’ (JavaScript is the scripting language used in $(eval). In the context of JS this is a string variable, not the $(user) variable for Nightbot) and store the command user’s name in it. For example:

$(eval user = `$(user)`; user + ` is feeling a bit under the weather today.`)

Or just directly stick the $(user) variable in the output message:

$(eval `$(user) is feeling a bit under the weather today.`)

How would I go about creating a bunch of random responses?

Create an array of responses then pick one response at random:

$(eval responses = [`response 1`,`response 2`,`response 3`,`etc`]; responses[Math.floor(Math.random()*responses.length)])

You can add more responses. Just make sure each response is separated by commas and bounded by backticks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.