Basic One-message Dice Roller?
This is the same discord bot I've asked about in the last question I posted here, and I want to add a simple dice rolling function that doesn't take up multiple messages so I don't
Solution 1:
I think you are essentially asking how to concatenate strings together. That is done with the plus sign operator. If any of the operands are strings, it treats all the variables as strings:
if (message.content.toLowerCase().includes("rei!d100")) {
var response = [Math.floor(Math.random() * ((100 - 1) + 1) + 1)];
message.channel.send("You got... " + response + "!").then().catch(console.error); // "You got... 96!"
}
Alternatively, you can use template params like so (those are backticks, not quotes):
message.channel.send(`You got... ${response}!`);
Post a Comment for "Basic One-message Dice Roller?"