@gary50613/discord.js-command-handler
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -5,2 +5,5 @@ const Interaction = require("../Base/Interaction") | ||
class InteractionManager extends EventEmitter { | ||
EPHEMERAL_FLAG_ID = 64 | ||
constructor(bot, options) { | ||
@@ -19,9 +22,20 @@ super() | ||
bot.ws.on("INTERACTION_CREATE", async (interaction) => { | ||
interaction.reply = (content) => bot.api.interactions(interaction.id, interaction.token).callback.post({ | ||
data: { | ||
type: 4, | ||
data: typeof content === "string" ? { content } : content | ||
let firstReply = true | ||
interaction.reply = (content, publicVisible = false) => { | ||
let data = { | ||
data: { | ||
type: 4, | ||
data: typeof content === "string" ? { content } : content, | ||
flags: publicVisible ? this.EPHEMERAL_FLAG_ID : null | ||
} | ||
} | ||
}) | ||
let reply = firstReply ? | ||
bot.api.interactions(interaction?.id, interaction?.token)?.callback?.post(data) : | ||
bot.api.webhooks(bot?.user?.id, interaction?.token)?.post(data) | ||
firstReply = true | ||
return reply.then(r => r?.id ?? "@original") | ||
} | ||
this.interactions.get(interaction?.data?.name)?.execute(bot, interaction, interaction?.data?.options, interaction.member) | ||
@@ -28,0 +42,0 @@ }) |
{ | ||
"name": "@gary50613/discord.js-command-handler", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "simple discord.js command handler", | ||
@@ -5,0 +5,0 @@ "main": "CommandHandler.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15279
275