forked from Galactic/galactic-bot
move prompt interaction to invokerwrapper
This commit is contained in:
parent
8b2c25085b
commit
a5d0479d4e
@ -69,24 +69,24 @@ class InteractionWrapper {
|
|||||||
return this.interaction.editReply(options);
|
return this.interaction.editReply(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
async promptInteraction(opts = {}, time = 30) {
|
// async promptInteraction(opts = {}, time = 30) {
|
||||||
if (!opts.components) throw new Error('Missing components. Use promptMessage');
|
// if (!opts.components) throw new Error('Missing components. Use promptMessage');
|
||||||
let message = null;
|
// let message = null;
|
||||||
if (this.replied || this.deferred) message = await this.editReply(opts);
|
// if (this.replied || this.deferred) message = await this.editReply(opts);
|
||||||
else message = await this.reply(opts);
|
// else message = await this.reply(opts);
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
// return new Promise((resolve) => {
|
||||||
message.createMessageComponentCollector({
|
// message.createMessageComponentCollector({
|
||||||
time: time*1000,
|
// time: time*1000,
|
||||||
componentType: opts.componentType || 'BUTTON',
|
// componentType: opts.componentType || 'BUTTON',
|
||||||
max: 1,
|
// max: 1,
|
||||||
filter: (i) => i.user.id === this.user.id
|
// filter: (i) => i.user.id === this.user.id
|
||||||
}).on('collect', resolve)
|
// }).on('collect', resolve)
|
||||||
.on('end', (collected) => {
|
// .on('end', (collected) => {
|
||||||
if (!collected.size) resolve(null);
|
// if (!collected.size) resolve(null);
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
replyEmbed(embed) {
|
replyEmbed(embed) {
|
||||||
if (!embed.color) embed.color = EmbedDefaultColor;
|
if (!embed.color) embed.color = EmbedDefaultColor;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const { EmbedBuilder } = require("@discordjs/builders");
|
const { EmbedBuilder } = require("@discordjs/builders");
|
||||||
|
const { ComponentType } = require("discord.js");
|
||||||
const { Emojis, Constants } = require("../../../constants");
|
const { Emojis, Constants } = require("../../../constants");
|
||||||
const MessageWrapper = require("./MessageWrapper");
|
const MessageWrapper = require("./MessageWrapper");
|
||||||
|
|
||||||
@ -135,6 +136,25 @@ class InvokerWrapper {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async promptInteraction(opts = {}, time = 30) {
|
||||||
|
if (!opts.components) throw new Error('Missing components. Use promptMessage');
|
||||||
|
let message = null;
|
||||||
|
if (this.replied || this.deferred) message = await this.editReply(opts);
|
||||||
|
else message = await this.reply(opts);
|
||||||
|
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
message.createMessageComponentCollector({
|
||||||
|
time: time * 1000,
|
||||||
|
componentType: opts.componentType || ComponentType.Button,
|
||||||
|
max: 1,
|
||||||
|
filter: (i) => i.user.id === this.user.id
|
||||||
|
}).on('collect', resolve)
|
||||||
|
.on('end', (collected) => {
|
||||||
|
if (!collected.size) resolve(null);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async reply(options = {}) {
|
async reply(options = {}) {
|
||||||
|
|
||||||
if (typeof options === 'string') options = { content: options };
|
if (typeof options === 'string') options = { content: options };
|
||||||
|
Loading…
Reference in New Issue
Block a user