You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Natsuki/util/ask.js

13 lines
659 B

module.exports = async (message, toAsk, time, nofilter, timeoutResponse) => {
let msg = await message.channel.send(toAsk);
let filter = nofilter ? () => true : m => m.author.id === message.author.id;
try {
3 years ago
let collected = await msg.channel.awaitMessages({filter: filter, max: 1, errors: ['time'], time: time});
if (collected.first().attachments.size > 0) {collected = collected.first().attachments.first().url;}
else {collected = collected.first().content;}
return collected;
} catch {
if (timeoutResponse) {message.reply("This question has timed out! Please try again.");}
return null;
}
};