Examples
An example page to use options

Disabling the resultEmbed option

1
const blackjack = require("discord-blackjack")
2
const Discord = require("discord.js")
3
4
module.exports = {
5
name: "blackjack",
6
async execute(message, args, client) => {
7
8
let game = await blackjack(message, Discord, {resultEmbed: false})
9
10
switch (game.result) {
11
12
case "Win":
13
message.channel.send(
14
new Discord.MessageEmbed()
15
.setTitle("You won!")
16
.setDescription(`You have a total of ${game.yvalue} points!`)
17
)
18
break;
19
case "Lose":
20
message.channel.send("You're a disgrace to us...")
21
22
}
23
24
}
25
}
Copied!
Basically, resultEmbed will disable the bot from sending it's own default result embed and will let the user make their own win/lose embed.

Disabling the buttons option

1
const blackjack = require("discord-blackjack")
2
const Discord = require("discord.js")
3
4
module.exports = {
5
name: "blackjack",
6
async execute(message, args, client) => {
7
8
let game = await blackjack(message, Discord, { buttons: false }) // it will use messages instead of buttons now.
9
10
switch (game.result) {
11
12
case "Win":
13
message.channel.send(
14
new Discord.MessageEmbed()
15
.setTitle("You won!")
16
.setDescription(`You have a total of ${game.yvalue} points!`)
17
)
18
break;
19
case "Lose":
20
message.channel.send("You're a disgrace to us...")
21
22
}
23
24
}
25
}
Copied!

Disabling the normalEmbed option

1
const blackjack = require("discord-blackjack")
2
const Discord = require("discord.js")
3
4
module.exports = {
5
name: "blackjack",
6
async execute(message, args, client) => {
7
8
let embed = new Discord.MessageEmbed()
9
.setTitle("A very pro blackjack game")
10
.setColor("RANDOM")
11
.addFields(
12
{name: `${message.author.username}'s hand`, value: `Cards: {yourcontent}\nTotal: {yvalue}`},
13
{name: `Dealer's Hand`, value: `Cards: {dcontent}\nTotal: {dvalue}`}
14
)
15
.setFooter("Type E to end the game. This bot is so pro so go support us...")
16
17
let game = await blackjack(message, Discord, {normalEmbed: false, normalEmbedContent: embed})
18
19
switch (game.result) {
20
21
case "Win":
22
// do win stuff
23
break;
24
case "Lose":
25
// do lose stuff
26
break;
27
// rest of the case stuff
28
29
}
30
31
}
32
}
33
Copied!
So to make your own embed, the bot will need you to put {yourcontent} somewhere in your embed. It will replace {yourcontent} and replace it with the card ranks.
Here's a list of what you'd need to put for the bot to change the content
Placeholder
Description
{yourcontent}
The emoji and card to be placed in the player's section
{dcontent}
The emoji and card to be placed in the dealer's section
{yvalue}
The total value of the player's cards.
{dvalue}
Displays ?
Last modified 1mo ago