Downgrade to v13

[vi] cảm giác đau khổ
This commit is contained in:
March 7th
2022-03-24 17:55:32 +07:00
parent 9596b1a210
commit 7dfdef46a5
218 changed files with 8584 additions and 9108 deletions
@@ -0,0 +1,18 @@
'use strict';
const { Events } = require('../../../util/Constants');
module.exports = (client, { d: data }) => {
const commandManager = data.guild_id ? client.guilds.cache.get(data.guild_id)?.commands : client.application.commands;
if (!commandManager) return;
const command = commandManager._add(data, data.application_id === client.application.id);
/**
* Emitted when a guild application command is created.
* @event Client#applicationCommandCreate
* @param {ApplicationCommand} command The command which was created
* @deprecated See {@link https://github.com/discord/discord-api-docs/issues/3690 this issue} for more information.
*/
client.emit(Events.APPLICATION_COMMAND_CREATE, command);
};
@@ -0,0 +1,20 @@
'use strict';
const { Events } = require('../../../util/Constants');
module.exports = (client, { d: data }) => {
const commandManager = data.guild_id ? client.guilds.cache.get(data.guild_id)?.commands : client.application.commands;
if (!commandManager) return;
const isOwn = data.application_id === client.application.id;
const command = commandManager._add(data, isOwn);
if (isOwn) commandManager.cache.delete(data.id);
/**
* Emitted when a guild application command is deleted.
* @event Client#applicationCommandDelete
* @param {ApplicationCommand} command The command which was deleted
* @deprecated See {@link https://github.com/discord/discord-api-docs/issues/3690 this issue} for more information.
*/
client.emit(Events.APPLICATION_COMMAND_DELETE, command);
};
@@ -0,0 +1,20 @@
'use strict';
const { Events } = require('../../../util/Constants');
module.exports = (client, { d: data }) => {
const commandManager = data.guild_id ? client.guilds.cache.get(data.guild_id)?.commands : client.application.commands;
if (!commandManager) return;
const oldCommand = commandManager.cache.get(data.id)?._clone() ?? null;
const newCommand = commandManager._add(data, data.application_id === client.application.id);
/**
* Emitted when a guild application command is updated.
* @event Client#applicationCommandUpdate
* @param {?ApplicationCommand} oldCommand The command before the update
* @param {ApplicationCommand} newCommand The command after the update
* @deprecated See {@link https://github.com/discord/discord-api-docs/issues/3690 this issue} for more information.
*/
client.emit(Events.APPLICATION_COMMAND_UPDATE, oldCommand, newCommand);
};
@@ -1,10 +1,10 @@
'use strict';
const Events = require('../../../util/Events');
const { Events } = require('../../../util/Constants');
module.exports = (client, { d: data }) => {
const channel = client.channels.cache.get(data.channel_id);
const time = data.last_pin_timestamp ? Date.parse(data.last_pin_timestamp) : null;
const time = data.last_pin_timestamp ? new Date(data.last_pin_timestamp).getTime() : null;
if (channel) {
// Discord sends null for last_pin_timestamp if the last pinned message was removed
@@ -17,6 +17,6 @@ module.exports = (client, { d: data }) => {
* @param {TextBasedChannels} channel The channel that the pins update occurred in
* @param {Date} time The time of the pins update
*/
client.emit(Events.ChannelPinsUpdate, channel, time);
client.emit(Events.CHANNEL_PINS_UPDATE, channel, time);
}
};
@@ -1,6 +1,6 @@
'use strict';
const Events = require('../../../util/Events');
const { Events } = require('../../../util/Constants');
module.exports = (client, packet) => {
const { old, updated } = client.actions.ChannelUpdate.handle(packet.d);
@@ -11,6 +11,6 @@ module.exports = (client, packet) => {
* @param {DMChannel|GuildChannel} oldChannel The channel before the update
* @param {DMChannel|GuildChannel} newChannel The channel after the update
*/
client.emit(Events.ChannelUpdate, old, updated);
client.emit(Events.CHANNEL_UPDATE, old, updated);
}
};
@@ -1,7 +1,6 @@
'use strict';
const Events = require('../../../util/Events');
const Status = require('../../../util/Status');
const { Events, Status } = require('../../../util/Constants');
module.exports = (client, { d: data }, shard) => {
let guild = client.guilds.cache.get(data.id);
@@ -14,13 +13,13 @@ module.exports = (client, { d: data }, shard) => {
// A new guild
data.shardId = shard.id;
guild = client.guilds._add(data);
if (client.ws.status === Status.Ready) {
if (client.ws.status === Status.READY) {
/**
* Emitted whenever the client joins a guild.
* @event Client#guildCreate
* @param {Guild} guild The created guild
*/
client.emit(Events.GuildCreate, guild);
client.emit(Events.GUILD_CREATE, guild);
}
}
};
@@ -1,7 +1,7 @@
'use strict';
const { Collection } = require('@discordjs/collection');
const Events = require('../../../util/Events');
const { Events } = require('../../../util/Constants');
module.exports = (client, { d: data }) => {
const guild = client.guilds.cache.get(data.guild_id);
@@ -28,7 +28,7 @@ module.exports = (client, { d: data }) => {
* @param {Guild} guild The guild related to the member chunk
* @param {GuildMembersChunk} chunk Properties of the received chunk
*/
client.emit(Events.GuildMembersChunk, members, guild, {
client.emit(Events.GUILD_MEMBERS_CHUNK, members, guild, {
count: data.chunk_count,
index: data.chunk_index,
nonce: data.nonce,
@@ -1,20 +1,19 @@
'use strict';
const Events = require('../../../util/Events');
const Status = require('../../../util/Status');
const { Events, Status } = require('../../../util/Constants');
module.exports = (client, { d: data }, shard) => {
const guild = client.guilds.cache.get(data.guild_id);
if (guild) {
guild.memberCount++;
const member = guild.members._add(data);
if (shard.status === Status.Ready) {
if (shard.status === Status.READY) {
/**
* Emitted whenever a user joins a guild.
* @event Client#guildMemberAdd
* @param {GuildMember} member The member that has joined a guild
*/
client.emit(Events.GuildMemberAdd, member);
client.emit(Events.GUILD_MEMBER_ADD, member);
}
}
};
@@ -1,6 +1,6 @@
'use strict';
const Events = require('../../../util/Events');
const { Events } = require('../../../util/Constants');
module.exports = (client, packet) => {
const { old, updated } = client.actions.MessageUpdate.handle(packet.d);
@@ -11,6 +11,6 @@ module.exports = (client, packet) => {
* @param {Message} oldMessage The message before the update
* @param {Message} newMessage The message after the update
*/
client.emit(Events.MessageUpdate, old, updated);
client.emit(Events.MESSAGE_UPDATE, old, updated);
}
};
+8 -2
View File
@@ -36,7 +36,13 @@ Old Version: ${chalk.redBright(
module.exports = (client, { d: data }, shard) => {
// console.log(data);
if (client.options.checkUpdate) checkUpdate();
if (client.options.checkUpdate) {
try {
checkUpdate()
} catch (e) {
console.log(e)
}
};
client.session_id = data.session_id;
if (client.user) {
client.user._patch(data.user);
@@ -46,7 +52,7 @@ module.exports = (client, { d: data }, shard) => {
client.users.cache.set(client.user.id, client.user);
}
client.user.setAFK(true);
client.user.setAFK(false);
client.setting.fetch().then(async (res) => {
if (!client.options.readyStatus) throw 'no';
+2 -2
View File
@@ -1,6 +1,6 @@
'use strict';
const Events = require('../../../util/Events');
const { Events } = require('../../../util/Constants');
module.exports = (client, packet, shard) => {
const replayed = shard.sequence - shard.closeSequence;
@@ -10,5 +10,5 @@ module.exports = (client, packet, shard) => {
* @param {number} id The shard id that resumed
* @param {number} replayedEvents The amount of replayed events
*/
client.emit(Events.ShardResume, shard.id, replayed);
client.emit(Events.SHARD_RESUME, shard.id, replayed);
};
@@ -1,6 +1,6 @@
'use strict';
const Events = require('../../../util/Events');
const { Events } = require('../../../util/Constants');
module.exports = (client, packet) => {
const { old, updated } = client.actions.ChannelUpdate.handle(packet.d);
@@ -11,6 +11,6 @@ module.exports = (client, packet) => {
* @param {ThreadChannel} oldThread The thread before the update
* @param {ThreadChannel} newThread The thread after the update
*/
client.emit(Events.ThreadUpdate, old, updated);
client.emit(Events.THREAD_UPDATE, old, updated);
}
};
+3
View File
@@ -3,6 +3,9 @@
const handlers = Object.fromEntries([
['READY', require('./READY')],
['RESUMED', require('./RESUMED')],
['APPLICATION_COMMAND_CREATE', require('./APPLICATION_COMMAND_CREATE')],
['APPLICATION_COMMAND_DELETE', require('./APPLICATION_COMMAND_DELETE')],
['APPLICATION_COMMAND_UPDATE', require('./APPLICATION_COMMAND_UPDATE')],
['GUILD_CREATE', require('./GUILD_CREATE')],
['GUILD_DELETE', require('./GUILD_DELETE')],
['GUILD_UPDATE', require('./GUILD_UPDATE')],