const blackjack = require("discord-blackjack")
const Discord = require("discord.js")
module.exports = {
name: "blackjack",
async execute(message, args, client) => {
let game = await blackjack(message, {resultEmbed: false})
switch (game.result) {
case "WIN":
message.channel.send(
new Discord.MessageEmbed()
.setTitle("You won!")
.setDescription(`You have a total of ${game.yvalue} points!`)
)
break;
case "LOSE":
message.channel.send("You're a disgrace to us...")
}
}
}
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
const blackjack = require("discord-blackjack")
const Discord = require("discord.js")
module.exports = {
name: "blackjack",
async execute(message, args, client) => {
let game = await blackjack(message, { buttons: false }) // it will use messages instead of buttons now.
switch (game.result) {
case "Win":
message.channel.send(
new Discord.MessageEmbed()
.setTitle("You won!")
.setDescription(`You have a total of ${game.yvalue} points!`)
)
break;
case "Lose":
message.channel.send("You're a disgrace to us...")
}
}
}
Disabling the normalEmbed option
const blackjack = require("discord-blackjack")
const Discord = require("discord.js")
module.exports = {
name: "blackjack",
async execute(message, args, client) => {
let embed = {
title: "A very pro blackjack game",
color: "RANDOM"
fields: [
{name: `${message.author.username}'s hand`, value: "" },
{name: `Dealer's Hand`, value: "" }
],
footer: { text: "Type E to end the game. This bot is so pro so go support us..." }
let game = await blackjack(message, {normalEmbed: false, normalEmbedContent: embed})
switch (game.result) {
case "WIN":
// do win stuff
break;
case "LOSE":
// do lose stuff
break;
// rest of the case stuff
}
}
}
So to make your own embed, the bot will need you empty out the value. Don't worry as it will replace it when sending messages.