How to make bot say a random line of text? #5358
-
How can i make it so that when someone types in the command, the bot gives a random answer from a list? This is what i have so far, i want to make it so that i wont have to completely change this code.
any help is appreciated |
Beta Was this translation helpful? Give feedback.
Answered by
Androz2091
Feb 28, 2021
Replies: 1 comment 2 replies
-
You can store your words in an array, then pick a random item. module.exports= {
name: 'insult',
description: "insults someone",
execute(message, args){
const words = [ 'noob', 'another-adjective', 'etc..' ];
const item = words[Math.floor(Math.random() * words.length)];
message.channel.send(`hey ${message.mentions.users.first()}, ur a ${item} :regional_indicator_l: :regional_indicator_l: :regional_indicator_l: :regional_indicator_l:`);
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
iCrawl
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can store your words in an array, then pick a random item.