zyno-bot-addons
Advanced tools
Comparing version 1.1.10 to 1.1.11
{ | ||
"name": "zyno-bot-addons", | ||
"version": "1.1.10", | ||
"version": "1.1.11", | ||
"description": "Create easily addons for Zyno Bot", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -9,3 +9,3 @@ const GuildManager = require('../../managers/guildManager.js'); | ||
const FormBuilder = require('../../builders/formBuilder.js'); | ||
const { ModalBuilder, ActionRowBuilder, TextInputBuilder } = require('discord.js'); | ||
const { ModalBuilder, InteractionResponse, ActionRowBuilder, TextInputBuilder } = require('discord.js'); | ||
@@ -61,4 +61,4 @@ class ButtonInteraction{ | ||
let _content = getMessageContent(content); | ||
if(!data.replied && !data.deferred) data.reply({..._content, fetchReply: true}).then(msg => resolve(structureHandler.createStructure('Message', [msg, addon]))).catch(reject); | ||
else data.editReply({..._content, fetchReply: true}).then(msg => resolve(structureHandler.createStructure('Message', [msg, addon]))).catch(reject); | ||
if(!data.replied && !data.deferred) data.reply(_content).then(msg => resolve(structureHandler.createStructure('Message', [msg, addon]))).catch(reject); | ||
else data.editReply(_content).then(i => resolve(structureHandler.createStructure('Message', [i instanceof InteractionResponse ? i.interaction.message : i, addon]))).catch(reject); | ||
}); | ||
@@ -70,3 +70,3 @@ }; | ||
let _content = getMessageContent(content); | ||
data.followUp({..._content, fetchReply: true}).then(msg => resolve(structureHandler.createStructure('Message', [msg, addon]))).catch(reject); | ||
data.followUp(_content).then(i => resolve(structureHandler.createStructure('Message', [i instanceof InteractionResponse ? i.interaction.message : i, addon]))).catch(reject); | ||
}); | ||
@@ -78,3 +78,3 @@ }; | ||
let _content = getMessageContent(content); | ||
data.update({..._content, fetchReply: true}).then(msg => resolve(structureHandler.createStructure('Message', [msg, addon]))).catch(reject); | ||
data.update(_content).then(i => resolve(structureHandler.createStructure('Message', [i instanceof InteractionResponse ? i.interaction.message : i, addon]))).catch(reject); | ||
}); | ||
@@ -81,0 +81,0 @@ }; |
@@ -8,3 +8,3 @@ const GuildManager = require('../../managers/guildManager.js'); | ||
const Save = require('../../save.js'); | ||
const { ComponentType } = require('discord.js'); | ||
const { InteractionResponse, ComponentType } = require('discord.js'); | ||
@@ -65,3 +65,3 @@ class FormInteraction{ | ||
if(!data.replied && !data.deferred) data.reply(_content).then(msg => resolve(structureHandler.createStructure('Message', [msg, addon]))).catch(reject); | ||
else data.editReply(_content).then(msg => resolve(structureHandler.createStructure('Message', [msg, addon]))).catch(reject); | ||
else data.editReply(_content).then(i => resolve(structureHandler.createStructure('Message', [i instanceof InteractionResponse ? i.interaction.message : i, addon]))).catch(reject); | ||
}); | ||
@@ -73,3 +73,3 @@ }; | ||
let _content = getMessageContent(content); | ||
data.followUp(_content).then(msg => resolve(structureHandler.createStructure('Message', [msg, addon]))).catch(reject); | ||
data.followUp(_content).then(i => resolve(structureHandler.createStructure('Message', [i instanceof InteractionResponse ? i.interaction.message : i, addon]))).catch(reject); | ||
}); | ||
@@ -81,3 +81,3 @@ }; | ||
let _content = getMessageContent(content); | ||
data.update(_content).then(msg => resolve(structureHandler.createStructure('Message', [msg, addon]))).catch(reject); | ||
data.update(_content).then(i => resolve(structureHandler.createStructure('Message', [i instanceof InteractionResponse ? i.interaction.message : i, addon]))).catch(reject); | ||
}); | ||
@@ -84,0 +84,0 @@ }; |
@@ -9,3 +9,3 @@ const GuildManager = require('../../managers/guildManager.js'); | ||
const FormBuilder = require('../../builders/formBuilder.js'); | ||
const { ModalBuilder } = require('discord.js'); | ||
const { ModalBuilder, InteractionResponse, ActionRowBuilder, TextInputBuilder } = require('discord.js'); | ||
@@ -63,3 +63,3 @@ class MenuInteraction{ | ||
if(!data.replied && !data.deferred) data.reply(_content).then(msg => resolve(structureHandler.createStructure('Message', [msg, addon]))).catch(reject); | ||
else data.editReply(_content).then(msg => resolve(structureHandler.createStructure('Message', [msg, addon]))).catch(reject); | ||
else data.editReply(_content).then(i => resolve(structureHandler.createStructure('Message', [i instanceof InteractionResponse ? i.interaction.message : i, addon]))).catch(reject); | ||
}); | ||
@@ -71,3 +71,3 @@ }; | ||
let _content = getMessageContent(content); | ||
data.followUp(_content).then(msg => resolve(structureHandler.createStructure('Message', [msg, addon]))).catch(reject); | ||
data.followUp(_content).then(i => resolve(structureHandler.createStructure('Message', [i instanceof InteractionResponse ? i.interaction.message : i, addon]))).catch(reject); | ||
}); | ||
@@ -79,3 +79,3 @@ }; | ||
let _content = getMessageContent(content); | ||
data.update(_content).then(msg => resolve(structureHandler.createStructure('Message', [msg, addon]))).catch(reject); | ||
data.update(_content).then(i => resolve(structureHandler.createStructure('Message', [i instanceof InteractionResponse ? i.interaction.message : i, addon]))).catch(reject); | ||
}); | ||
@@ -82,0 +82,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
const { validatePermission, getAddonPermission, getClientParser } = require('../../utils/functions.js'); | ||
const { validatePermission, getAddonPermission, getClientParser, getClient } = require('../../utils/functions.js'); | ||
const { getMessageContent } = require('../../utils/messageFunctions.js'); | ||
@@ -14,4 +14,15 @@ const scopes = require('../../bitfields/scopes.js'); | ||
let client = null; | ||
class Message{ | ||
constructor(data, addon, structureHandler){ | ||
if(!client){ | ||
client = getClient(); | ||
} | ||
if(!data.channel){ | ||
data.channel = client.channels.cache.get(data.channelId); | ||
} | ||
if(!data.guild){ | ||
data.guild = client.guilds.cache.get(data.guildId); | ||
} | ||
if(!data.channel.isDMBased()){ | ||
@@ -38,3 +49,3 @@ const addonMemberManager = MemberManager.get(addon.name) || new Save(); | ||
const guildChannelManager = addonChannelManager.get(data.channel.isDMBased() ? undefined : data.guild.id) || new Save(); | ||
this.channel = data.channel.isDMBased() ? structureHandler.createStructure('DMChannel', [data.channel, addon]) : (guildChannelManager.get(data.id) ?? null); | ||
this.channel = data.channel.isDMBased() ? structureHandler.createStructure('DMChannel', [data.channel, addon]) : (guildChannelManager.get(data.channel.id) ?? null); | ||
this.deletable = data.deletable; | ||
@@ -41,0 +52,0 @@ this.mentions = structureHandler.createStructure('Mentions', [data, addon, this.guild]); |
Sorry, the diff of this file is too big to display
470797
9696
80