chore(release): version

This commit is contained in:
March 7th
2022-06-13 23:53:43 +07:00
parent bdc1c70758
commit dd2912fb8d
14 changed files with 245 additions and 31 deletions

View File

@@ -1,7 +1,17 @@
'use strict';
const { Events } = require('../../../util/Constants');
/**
* @typedef {Object} InteractionResponseBody
* @property {Snowflake} id maybe id of this event (???) (documentation needed)
* @property {Snowflake} nonce nonce in POST /interactions
*/
module.exports = (client, packet) => {
if (client.user.bot) client.actions.InteractionCreate.handle(packet.d);
else client.emit(Events.INTERACTION_CREATE, packet.d);
/**
* Emitted whenever client user send interaction
* @event Client#interactionSuccess
* @param {InteractionResponseBody} data InteractionResponseBody
*/ else client.emit(Events.INTERACTION_CREATE, packet.d);
};

View File

@@ -2,5 +2,10 @@
const { Events } = require('../../../util/Constants');
module.exports = (client, { d: data }) => {
/**
* Emitted whenever client user send interaction and error
* @event Client#interactionFailed
* @param {InteractionResponseBody} data data
*/
client.emit(Events.INTERACTION_FAILED, data);
};

View File

@@ -0,0 +1,11 @@
'use strict';
const Modal = require('../../../structures/Modal');
const { Events } = require('../../../util/Constants');
module.exports = (client, { d: data }) => {
/**
* Emitted whenever client user receive interaction.showModal()
* @event Client#interactionModalCreate
* @param {Modal} modal The modal (extended)
*/
client.emit(Events.INTERACTION_MODAL_CREATE, new Modal(data, client));
};

View File

@@ -8,25 +8,31 @@ const Discord = require('../../../index');
const { Events, Opcodes } = require('../../../util/Constants');
const { Networking } = require('../../../util/Voice');
/**
* Emitted whenever clientOptions.checkUpdate = true
* @event Client#update
* @param {string} data Log data :)) ehe
*/
async function checkUpdate(client) {
const res_ = await axios
.get(`https://registry.npmjs.com/${encodeURIComponent('discord.js-selfbot-v13')}`)
.catch(() => {});
if (!res_) {
return client.emit(Events.DEBUG, `${chalk.redBright('[Fail]')} Check Update error`);
return client.emit('update', `${chalk.redBright('[Fail]')} Check Update error`);
}
const lastest_tag = res_.data['dist-tags'].latest;
// Checking if the package is outdated
// Stable version
if (lastest_tag !== Discord.version && Discord.version.includes('-') == false) {
return client.emit(
Events.DEBUG,
'update',
`${chalk.yellowBright('[WARNING]')} New Discord.js-selfbot-v13 version.
Old Version: ${chalk.redBright(Discord.version)} => New Version: ${chalk.greenBright(lastest_tag)}`,
);
}
client.emit(
Events.DEBUG,
'update',
`${chalk.greenBright('[OK]')} Discord.js-selfbot-v13 is up to date. Version: ${chalk.blueBright(Discord.version)}`,
);
return null;

View File

@@ -55,6 +55,7 @@ const handlers = Object.fromEntries([
['WEBHOOKS_UPDATE', require('./WEBHOOKS_UPDATE')],
['INTERACTION_CREATE', require('./INTERACTION_CREATE')],
['INTERACTION_SUCCESS', require('./INTERACTION_SUCCESS')],
['INTERACTION_MODAL_CREATE', require('./INTERACTION_MODAL_CREATE')],
['INTERACTION_FAILED', require('./INTERACTION_FAILED')],
['STAGE_INSTANCE_CREATE', require('./STAGE_INSTANCE_CREATE')],
['STAGE_INSTANCE_UPDATE', require('./STAGE_INSTANCE_UPDATE')],