discord-buttons
Advanced tools
Comparing version 2.3.2 to 2.3.3
{ | ||
"name": "discord-buttons", | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"description": "Discord.js buttons", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -85,3 +85,3 @@ const { sendAPICallback } = require('./APIMessage'); | ||
data: info, | ||
type: [4, 5, 6, 7].includes(parseInt(options?.type)) ? parseInt(options.type) : 4, | ||
type: options.type ? ([4, 5, 6, 7].includes(parseInt(options.type)) ? parseInt(options.type) : 4) : 4, | ||
}, | ||
@@ -95,3 +95,3 @@ files | ||
const raw = await this.webhook.fetchMessage('@original'); | ||
return this.channel?.messages.add(raw) ?? raw; | ||
return this.channel ? this.channel.messages.add(raw) : undefined ?? raw; | ||
} | ||
@@ -102,3 +102,3 @@ | ||
const raw = await this.webhook.editMessage('@original', content, options); | ||
return this.channel?.messages.add(raw) ?? raw; | ||
return this.channel ? this.channel.messages.add(raw) : undefined ?? raw; | ||
} | ||
@@ -105,0 +105,0 @@ |
@@ -6,4 +6,3 @@ const { WebhookClient } = require('discord.js'); | ||
async editMessage(message, content, options = {}) { | ||
const { data, files } = await ( | ||
content.resolveData?.() ?? APIMessage.create(this, content, options).resolveData() | ||
const { data, files } = await (content instanceof APIMessage ? content : APIMessage.create(this, content, options).resolveData() | ||
).resolveFiles(); | ||
@@ -15,3 +14,3 @@ const d = await this.client.api | ||
const messageManager = this.client.channels?.cache.get(d.channel_id)?.messages; | ||
const messageManager = this.client.channels ? (this.channels.cache.get(d.channel_id) ? this.channels.cache.get(d.channel_id).messages : null) : null; | ||
if (!messageManager) return d; | ||
@@ -36,4 +35,4 @@ | ||
const data = await this.client.api.webhooks(this.id, this.token).messages(message).get(); | ||
return this.client.channels?.cache.get(data.channel_id)?.messages.add(data, cache) ?? data; | ||
return this.client.channels ? (this.client.channels.cache.get(data.channel_id) ? this.client.channels.cache.get(data.channel_id).messages.add(data, cache) : null) : undefined ?? data; | ||
} | ||
} |
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
27131
564