diff --git a/src/structure/client/wrappers/InteractionWrapper.js b/src/structure/client/wrappers/InteractionWrapper.js index 50790b2..90860ca 100644 --- a/src/structure/client/wrappers/InteractionWrapper.js +++ b/src/structure/client/wrappers/InteractionWrapper.js @@ -84,36 +84,6 @@ class InteractionWrapper { }); } - async promptMessage(str, opts = {}) { - - if (typeof str === 'string') { - if (opts.emoji) str = `${Emojis[opts.emoji]} ${str}`; - if (opts.reply) str = `<@!${this.author.id}> ${str}`; - } - - const data = { - content: str, - files: opts.files, - embeds: opts.embed ? [opts.embed] : [], - disableMentions: opts.disableMentions - }; - - if (opts.editInteraction) await this.editReply(data); - else await this.channel.send(data).then((msg) => { - if (opts.delete) msg.delete(); - }); - - return this.channel.awaitMessages({ - filter: (m) => m.author.id === this.user.id, max: 1, time: opts.time * 1000 || 30_000, errors: ['time'] - }) - .then((collected) => { - return collected.first(); - }) - .catch((error) => { //eslint-disable-line no-unused-vars, handle-callback-err - return null; - }); - } - replyEmbed(embed) { if (!embed.color) embed.color = 619452; return this.reply({ embeds: [embed] }); diff --git a/src/structure/client/wrappers/InvokerWrapper.js b/src/structure/client/wrappers/InvokerWrapper.js index 89d1713..5594dd4 100644 --- a/src/structure/client/wrappers/InvokerWrapper.js +++ b/src/structure/client/wrappers/InvokerWrapper.js @@ -80,6 +80,36 @@ class InvokerWrapper { return this.target.deferReply(options); } + async promptMessage(str, opts = {}) { + + if (typeof str === 'string') { + if (opts.emoji) str = `${Emojis[opts.emoji]} ${str}`; + if (opts.reply) str = `<@!${this.author.id}> ${str}`; + } + + const data = { + content: str, + files: opts.files, + embeds: opts.embed ? [opts.embed] : [], + disableMentions: opts.disableMentions + }; + + if (opts.editReply) await this.editReply(data); + else await this.channel.send(data).then((msg) => { + if (opts.delete) msg.delete(); + }); + + return this.channel.awaitMessages({ + filter: (m) => m.author.id === this.user.id, max: 1, time: opts.time * 1000 || 30_000, errors: ['time'] + }) + .then((collected) => { + return collected.first(); + }) + .catch((error) => { //eslint-disable-line no-unused-vars, handle-callback-err + return null; + }); + } + async reply(options = {}) { if (typeof options === 'string') options = { content: options }; diff --git a/src/structure/components/commands/administration/Import.js b/src/structure/components/commands/administration/Import.js index 38c8904..6818d1a 100644 --- a/src/structure/components/commands/administration/Import.js +++ b/src/structure/components/commands/administration/Import.js @@ -43,7 +43,7 @@ class ImportCommand extends SlashCommand { // TODO split into settings and modlogs const { MONGODB_HOST, MONGODB_USERNAME, MONGODB_PASSWORD } = process.env; - const migrator = new SettingsMigrator(guild, { + const migrator = new SettingsMigrator(this.client, guild, { host: MONGODB_HOST, username: MONGODB_USERNAME, password: MONGODB_PASSWORD, diff --git a/src/structure/components/settings/moderation/WordFilter.js b/src/structure/components/settings/moderation/WordFilter.js index 328a5a8..c42ce6a 100644 --- a/src/structure/components/settings/moderation/WordFilter.js +++ b/src/structure/components/settings/moderation/WordFilter.js @@ -143,7 +143,7 @@ class WordFilterSetting extends FilterSetting { const response = await interaction.promptMessage( interaction.format('SETTING_WORDFILTER_ACTION_ADD_TRIGGERS'), - { time: 60 * 1000, editInteraction: true } + { time: 60 * 1000, editReply: true } ); if (!response) { if (actions.find((ac) => ac.trigger === 'generic')) return { diff --git a/src/structure/interfaces/Setting.js b/src/structure/interfaces/Setting.js index 6434df0..bb68ebb 100644 --- a/src/structure/interfaces/Setting.js +++ b/src/structure/interfaces/Setting.js @@ -176,7 +176,7 @@ class Setting extends Component { if (!message.length && !index && !embed) throw new Error('Must declare either message, index or embeds'); const response = await interaction.promptMessage( index ? interaction.format(index, params) : message, - { time, editInteraction: true, embed } + { time, editReply: true, embed } ); if (!response) return { error: true, message: interaction.format('ERR_TIMEOUT') };