0% found this document useful (0 votes)
20 views3 pages

Discord Bot Exchange Command Setup

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

Discord Bot Exchange Command Setup

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

cjosisgay = require("dotenv").

config()
cjosexchange = require("[Link]")

clientlol = new [Link]({


intents: [[Link]]
})

restblah = new [Link]({ version:


"10" }).setToken([Link])

;(async () => {
await [Link](
[Link]([Link]),
{ body: [{ name: "exchangebutton", description: "send exchange embed" }] }
)
})()

numbersWeTyped = {}

[Link]("ready", () => {
[Link](`__ _____ ____ ____ ____ ____ ___ ____ _____ _____
\ \ / / _ \| _ \/ ___| / ___| _ \|_ _| _ \_ _|__ /
\ \ / / | | | |_) \___ \| | | |_) || || |_) || | / /
\ V /| |_| | _ < ___) | |___| _ < | || __/ | | / /_
\_/ \___/|_| \_\____/ \____|_| \_\___|_| |_| /____|`)
})

[Link]("interactionCreate", async i => {

if ([Link]() && [Link] === "exchangebutton") {

emb = new [Link]()


.setTitle("Exchange")
.setDescription("Click the button below to enter a price")

row = new [Link]()


.addComponents(
new [Link]()
.setCustomId("open_numpad")
.setLabel("Exchange Numpad")
.setStyle([Link])
)

return [Link]({ embeds: [emb], components: [row] })


}

if ([Link]()) {

if ([Link] === "open_numpad") {


numbersWeTyped[[Link]] = ""

r1 = new [Link]().addComponents(
new
[Link]().setCustomId("n_1").setLabel("1").setStyle(cjosexchange
.[Link]),
new
[Link]().setCustomId("n_2").setLabel("2").setStyle(cjosexchange
.[Link]),
new
[Link]().setCustomId("n_3").setLabel("3").setStyle(cjosexchange
.[Link])
)
r2 = new [Link]().addComponents(
new
[Link]().setCustomId("n_4").setLabel("4").setStyle(cjosexchange
.[Link]),
new
[Link]().setCustomId("n_5").setLabel("5").setStyle(cjosexchange
.[Link]),
new
[Link]().setCustomId("n_6").setLabel("6").setStyle(cjosexchange
.[Link])
)
r3 = new [Link]().addComponents(
new
[Link]().setCustomId("n_7").setLabel("7").setStyle(cjosexchange
.[Link]),
new
[Link]().setCustomId("n_8").setLabel("8").setStyle(cjosexchange
.[Link]),
new
[Link]().setCustomId("n_9").setLabel("9").setStyle(cjosexchange
.[Link])
)
r4 = new [Link]().addComponents(
new
[Link]().setCustomId("n_dot").setLabel(".").setStyle(cjosexchan
[Link]),
new
[Link]().setCustomId("n_0").setLabel("0").setStyle(cjosexchange
.[Link]),
new
[Link]().setCustomId("n_back").setLabel("←").setStyle(cjosexcha
[Link])
)
r5 = new [Link]().addComponents(
new [Link]()
.setCustomId("n_confirm")
.setLabel("✅ Confirm")
.setStyle([Link])
)

return [Link]({
content: "Current: ` `",
components: [r1, r2, r3, r4, r5],
ephemeral: false
})
}

if ([Link]("n_")) {
let n = numbersWeTyped[[Link]] || ""
const v = [Link]("n_", "")

if (v === "back") {
n = [Link](0, -1)
} else if (v === "dot") {
if (![Link](".")) n += "."
} else if (v === "confirm") {
if (n === "" || n === ".") return [Link]({ content: "❌ Invalid
number.", ephemeral: false })
} else {
// Limit to 2 decimal places if there's a dot
if (![Link](".") || [Link](".")[1].length < 2) {
n += v
}
}

// Save the new value


numbersWeTyped[[Link]] = n

if (v === "confirm") {
await [Link]({ content: `✅ You entered **${n}**`, ephemeral: false
})
} else {
await [Link]({ content: `Current: \`${n || " "}\`` })
}
}

})

[Link]([Link])

You might also like