feat: awaitModal
This commit is contained in:
@@ -204,6 +204,8 @@ class Client extends BaseClient {
|
||||
this.token = null;
|
||||
}
|
||||
|
||||
this._interactionCache = new Collection();
|
||||
|
||||
/**
|
||||
* User that the client is logged in as
|
||||
* @type {?ClientUser}
|
||||
@@ -340,7 +342,7 @@ class Client extends BaseClient {
|
||||
this.emit(Events.DEBUG, `Added Fingerprint: ${res.data.fingerprint}`);
|
||||
})
|
||||
.catch(err => {
|
||||
this.emit(Events.DEBUG, `Finding Cookie and Fingerprint failed: ${err.message}`);
|
||||
this.emit(Events.DEBUG, `Update Cookie and Fingerprint failed: ${err.message}`);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -12,4 +12,6 @@ module.exports = (client, { d: data }) => {
|
||||
status: false,
|
||||
metadata: data,
|
||||
});
|
||||
// Delete cache
|
||||
client._interactionCache.delete(data.nonce);
|
||||
};
|
||||
|
@@ -8,8 +8,21 @@ module.exports = (client, { d: data }) => {
|
||||
* @param {InteractionResponseBody} data data
|
||||
*/
|
||||
client.emit(Events.INTERACTION_SUCCESS, data);
|
||||
// Get channel data
|
||||
const cache = client._interactionCache.get(data.nonce);
|
||||
const channel = cache.guildId
|
||||
? client.guilds.cache.get(cache.guildId)?.channels.cache.get(cache.channelId)
|
||||
: client.channels.cache.get(cache.channelId);
|
||||
// Set data
|
||||
const interaction = {
|
||||
...cache,
|
||||
...data,
|
||||
};
|
||||
const data_ = channel.interactions._add(interaction);
|
||||
client.emit('interactionResponse', {
|
||||
status: true,
|
||||
metadata: data,
|
||||
metadata: data_,
|
||||
});
|
||||
// Delete cache
|
||||
// client._interactionCache.delete(data.nonce);
|
||||
};
|
||||
|
Reference in New Issue
Block a user