Update SlashCommand.md
This commit is contained in:
@@ -99,14 +99,27 @@ channel
|
|||||||
.sendSlash('289066747443675143', 'osu', 'Accolibed')
|
.sendSlash('289066747443675143', 'osu', 'Accolibed')
|
||||||
.then(async (message) => {
|
.then(async (message) => {
|
||||||
if (message.flags.has('LOADING')) { // owo is thinking...
|
if (message.flags.has('LOADING')) { // owo is thinking...
|
||||||
return new Promise((r, rej) => {
|
return new Promise((resolve, reject) => {
|
||||||
let t = setTimeout(() => rej('timeout'), 15 * 60 * 1000); // 15m (DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE)
|
let done = false;
|
||||||
message.client.on('messageUpdate', (_, m) => {
|
const timeout = setTimeout(() => {
|
||||||
if (_.id == message.id) {
|
if (!done) {
|
||||||
clearTimeout(t);
|
done = true;
|
||||||
r(m);
|
client.off('messageUpdate', onUpdate);
|
||||||
|
reject('timeout');
|
||||||
}
|
}
|
||||||
});
|
}, 15 * 60 * 1000); // 15m (DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE)
|
||||||
|
|
||||||
|
function onUpdate(_, m) {
|
||||||
|
if (_.id === message.id) {
|
||||||
|
if (!done) {
|
||||||
|
done = true;
|
||||||
|
clearTimeout(timeout);
|
||||||
|
client.off('messageUpdate', onUpdate);
|
||||||
|
resolve(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
client.on('messageUpdate', onUpdate);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return Promise.resolve(message);
|
return Promise.resolve(message);
|
||||||
|
|||||||
Reference in New Issue
Block a user